(window.webpackJsonp=window.webpackJsonp||[]).push([[231,5,6,7,19],{"+NIl": /*!***************************************************!*\ !*** ./node_modules/codemirror/mode/stex/stex.js ***! \***************************************************/ /*! no static exports found */ /*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,i){!function(e){"use strict";e.defineMode("stex",(function(e,t){function i(e,t){e.cmdState.push(t)}function r(e){return e.cmdState.length>0?e.cmdState[e.cmdState.length-1]:null}function n(e,t,i){return function(){this.name=e,this.bracketNo=0,this.style=t,this.styles=i,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var s={};function o(e,t){e.f=t}function a(e,t){var n;if(e.match(/^\\[a-zA-Z@]+/)){var a=e.current().slice(1);return i(t,n=new(n=s.hasOwnProperty(a)?s[a]:s.DEFAULT)),o(t,c),n.style}if(e.match(/^\\[$&%#{}_]/))return"tag";if(e.match(/^\\[,;!\/\\]/))return"tag";if(e.match("\\["))return o(t,(function(e,t){return l(e,t,"\\]")})),"keyword";if(e.match("\\("))return o(t,(function(e,t){return l(e,t,"\\)")})),"keyword";if(e.match("$$"))return o(t,(function(e,t){return l(e,t,"$$")})),"keyword";if(e.match("$"))return o(t,(function(e,t){return l(e,t,"$")})),"keyword";var u=e.next();return"%"==u?(e.skipToEnd(),"comment"):"}"==u||"]"==u?(n=r(t))?(n.closeBracket(u),o(t,c),"bracket"):"error":"{"==u||"["==u?(i(t,n=new(n=s.DEFAULT)),"bracket"):/\d/.test(u)?(e.eatWhile(/[\w.%]/),"atom"):(e.eatWhile(/[\w\-_]/),"begin"==(n=function(e){for(var t=e.cmdState,i=t.length-1;i>=0;i--){var r=t[i];if("DEFAULT"!=r.name)return r}return{styleIdentifier:function(){return null}}}(t)).name&&(n.argument=e.current()),n.styleIdentifier())}function l(e,t,i){if(e.eatSpace())return null;if(i&&e.match(i))return o(t,a),"keyword";if(e.match(/^\\[a-zA-Z@]+/))return"tag";if(e.match(/^[a-zA-Z]+/))return"variable-2";if(e.match(/^\\[$&%#{}_]/))return"tag";if(e.match(/^\\[,;!\/]/))return"tag";if(e.match(/^[\^_&]/))return"tag";if(e.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(e.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var r=e.next();return"{"==r||"}"==r||"["==r||"]"==r||"("==r||")"==r?"bracket":"%"==r?(e.skipToEnd(),"comment"):"error"}function c(e,t){var i=e.peek();return"{"==i||"["==i?(r(t).openBracket(i),e.eat(i),o(t,a),"bracket"):/[ \t\r]/.test(i)?(e.eat(i),null):(o(t,a),function(e){var t=e.cmdState.pop();t&&t.closeBracket()}(t),a(e,t))}return s.importmodule=n("importmodule","tag",["string","builtin"]),s.documentclass=n("documentclass","tag",["","atom"]),s.usepackage=n("usepackage","tag",["atom"]),s.begin=n("begin","tag",["atom"]),s.end=n("end","tag",["atom"]),s.label=n("label","tag",["atom"]),s.ref=n("ref","tag",["atom"]),s.eqref=n("eqref","tag",["atom"]),s.cite=n("cite","tag",["atom"]),s.bibitem=n("bibitem","tag",["atom"]),s.Bibitem=n("Bibitem","tag",["atom"]),s.RBibitem=n("RBibitem","tag",["atom"]),s.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}},{startState:function(){return{cmdState:[],f:t.inMathMode?function(e,t){return l(e,t)}:a}},copyState:function(e){return{cmdState:e.cmdState.slice(),f:e.f}},token:function(e,t){return t.f(e,t)},blankLine:function(e){e.f=a,e.cmdState.length=0},lineComment:"%"}})),e.defineMIME("text/x-stex","stex"),e.defineMIME("text/x-latex","stex")}(i(/*! ../../lib/codemirror */"VrN/"))},"/POA": /*!*****************************************!*\ !*** ./node_modules/xterm/lib/xterm.js ***! \*****************************************/ /*! no static exports found */ /*! exports used: Terminal */ /*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,i){window,e.exports=function(e){var t={};function i(r){if(t[r])return t[r].exports;var n=t[r]={i:r,l:!1,exports:{}};return e[r].call(n.exports,n,n.exports,i),n.l=!0,n.exports}return i.m=e,i.c=t,i.d=function(e,t,r){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(i.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)i.d(r,n,function(t){return e[t]}.bind(null,n));return r},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=34)}([function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.forwardEvent=t.EventEmitter=void 0;var r=function(){function e(){this._listeners=[],this._disposed=!1}return Object.defineProperty(e.prototype,"event",{get:function(){var e=this;return this._event||(this._event=function(t){return e._listeners.push(t),{dispose:function(){if(!e._disposed)for(var i=0;i>22},t.prototype.getChars=function(){return 2097152&this.content?this.combinedData:2097151&this.content?s.stringFromCodePoint(2097151&this.content):""},t.prototype.getCode=function(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content},t.prototype.setFromCharData=function(e){this.fg=e[o.CHAR_DATA_ATTR_INDEX],this.bg=0;var t=!1;if(e[o.CHAR_DATA_CHAR_INDEX].length>2)t=!0;else if(2===e[o.CHAR_DATA_CHAR_INDEX].length){var i=e[o.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=i&&i<=56319){var r=e[o.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=r&&r<=57343?this.content=1024*(i-55296)+r-56320+65536|e[o.CHAR_DATA_WIDTH_INDEX]<<22:t=!0}else t=!0}else this.content=e[o.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|e[o.CHAR_DATA_WIDTH_INDEX]<<22;t&&(this.combinedData=e[o.CHAR_DATA_CHAR_INDEX],this.content=2097152|e[o.CHAR_DATA_WIDTH_INDEX]<<22)},t.prototype.getAsCharData=function(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]},t}(a.AttributeData);t.CellData=l},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ISoundService=t.ISelectionService=t.IRenderService=t.IMouseService=t.ICoreBrowserService=t.ICharSizeService=void 0;var r=i(14);t.ICharSizeService=r.createDecorator("CharSizeService"),t.ICoreBrowserService=r.createDecorator("CoreBrowserService"),t.IMouseService=r.createDecorator("MouseService"),t.IRenderService=r.createDecorator("RenderService"),t.ISelectionService=r.createDecorator("SelectionService"),t.ISoundService=r.createDecorator("SoundService")},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ExtendedAttrs=t.AttributeData=void 0;var r=function(){function e(){this.fg=0,this.bg=0,this.extended=new n}return e.toColorRGB=function(e){return[e>>>16&255,e>>>8&255,255&e]},e.fromColorRGB=function(e){return(255&e[0])<<16|(255&e[1])<<8|255&e[2]},e.prototype.clone=function(){var t=new e;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t},e.prototype.isInverse=function(){return 67108864&this.fg},e.prototype.isBold=function(){return 134217728&this.fg},e.prototype.isUnderline=function(){return 268435456&this.fg},e.prototype.isBlink=function(){return 536870912&this.fg},e.prototype.isInvisible=function(){return 1073741824&this.fg},e.prototype.isItalic=function(){return 67108864&this.bg},e.prototype.isDim=function(){return 134217728&this.bg},e.prototype.getFgColorMode=function(){return 50331648&this.fg},e.prototype.getBgColorMode=function(){return 50331648&this.bg},e.prototype.isFgRGB=function(){return 50331648==(50331648&this.fg)},e.prototype.isBgRGB=function(){return 50331648==(50331648&this.bg)},e.prototype.isFgPalette=function(){return 16777216==(50331648&this.fg)||33554432==(50331648&this.fg)},e.prototype.isBgPalette=function(){return 16777216==(50331648&this.bg)||33554432==(50331648&this.bg)},e.prototype.isFgDefault=function(){return 0==(50331648&this.fg)},e.prototype.isBgDefault=function(){return 0==(50331648&this.bg)},e.prototype.isAttributeDefault=function(){return 0===this.fg&&0===this.bg},e.prototype.getFgColor=function(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}},e.prototype.getBgColor=function(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}},e.prototype.hasExtendedAttrs=function(){return 268435456&this.bg},e.prototype.updateExtended=function(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456},e.prototype.getUnderlineColor=function(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()},e.prototype.getUnderlineColorMode=function(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()},e.prototype.isUnderlineColorRGB=function(){return 268435456&this.bg&&~this.extended.underlineColor?50331648==(50331648&this.extended.underlineColor):this.isFgRGB()},e.prototype.isUnderlineColorPalette=function(){return 268435456&this.bg&&~this.extended.underlineColor?16777216==(50331648&this.extended.underlineColor)||33554432==(50331648&this.extended.underlineColor):this.isFgPalette()},e.prototype.isUnderlineColorDefault=function(){return 268435456&this.bg&&~this.extended.underlineColor?0==(50331648&this.extended.underlineColor):this.isFgDefault()},e.prototype.getUnderlineStyle=function(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0},e}();t.AttributeData=r;var n=function(){function e(e,t){void 0===e&&(e=0),void 0===t&&(t=-1),this.underlineStyle=e,this.underlineColor=t}return e.prototype.clone=function(){return new e(this.underlineStyle,this.underlineColor)},e.prototype.isEmpty=function(){return 0===this.underlineStyle},e}();t.ExtendedAttrs=n},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.addDisposableDomListener=void 0,t.addDisposableDomListener=function(e,t,i,r){e.addEventListener(t,i,r);var n=!1;return{dispose:function(){n||(n=!0,e.removeEventListener(t,i,r))}}}},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Utf8ToUtf32=t.StringToUtf32=t.utf32ToString=t.stringFromCodePoint=void 0,t.stringFromCodePoint=function(e){return e>65535?(e-=65536,String.fromCharCode(55296+(e>>10))+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)},t.utf32ToString=function(e,t,i){void 0===t&&(t=0),void 0===i&&(i=e.length);for(var r="",n=t;n65535?(s-=65536,r+=String.fromCharCode(55296+(s>>10))+String.fromCharCode(s%1024+56320)):r+=String.fromCharCode(s)}return r};var r=function(){function e(){this._interim=0}return e.prototype.clear=function(){this._interim=0},e.prototype.decode=function(e,t){var i=e.length;if(!i)return 0;var r=0,n=0;this._interim&&(56320<=(a=e.charCodeAt(n++))&&a<=57343?t[r++]=1024*(this._interim-55296)+a-56320+65536:(t[r++]=this._interim,t[r++]=a),this._interim=0);for(var s=n;s=i)return this._interim=o,r;var a;56320<=(a=e.charCodeAt(s))&&a<=57343?t[r++]=1024*(o-55296)+a-56320+65536:(t[r++]=o,t[r++]=a)}else t[r++]=o}return r},e}();t.StringToUtf32=r;var n=function(){function e(){this.interim=new Uint8Array(3)}return e.prototype.clear=function(){this.interim.fill(0)},e.prototype.decode=function(e,t){var i=e.length;if(!i)return 0;var r,n,s,o,a=0,l=0,c=0;if(this.interim[0]){var u=!1,h=this.interim[0];h&=192==(224&h)?31:224==(240&h)?15:7;for(var d=0,f=void 0;(f=63&this.interim[++d])&&d<4;)h<<=6,h|=f;for(var p=192==(224&this.interim[0])?2:224==(240&this.interim[0])?3:4,g=p-d;c=i)return 0;if(128!=(192&(f=e[c++]))){c--,u=!0;break}this.interim[d++]=f,h<<=6,h|=63&f}u||(2===p?h<128?c--:t[a++]=h:3===p?h<2048||h>=55296&&h<=57343||(t[a++]=h):h<65536||h>1114111||(t[a++]=h)),this.interim.fill(0)}for(var v=i-4,m=c;m=i)return this.interim[0]=r,a;if(128!=(192&(n=e[m++]))){m--;continue}if((l=(31&r)<<6|63&n)<128){m--;continue}t[a++]=l}else if(224==(240&r)){if(m>=i)return this.interim[0]=r,a;if(128!=(192&(n=e[m++]))){m--;continue}if(m>=i)return this.interim[0]=r,this.interim[1]=n,a;if(128!=(192&(s=e[m++]))){m--;continue}if((l=(15&r)<<12|(63&n)<<6|63&s)<2048||l>=55296&&l<=57343)continue;t[a++]=l}else if(240==(248&r)){if(m>=i)return this.interim[0]=r,a;if(128!=(192&(n=e[m++]))){m--;continue}if(m>=i)return this.interim[0]=r,this.interim[1]=n,a;if(128!=(192&(s=e[m++]))){m--;continue}if(m>=i)return this.interim[0]=r,this.interim[1]=n,this.interim[2]=s,a;if(128!=(192&(o=e[m++]))){m--;continue}if((l=(7&r)<<18|(63&n)<<12|(63&s)<<6|63&o)<65536||l>1114111)continue;t[a++]=l}}return a},e}();t.Utf8ToUtf32=n},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CHAR_ATLAS_CELL_SPACING=t.DIM_OPACITY=t.INVERTED_DEFAULT_COLOR=void 0,t.INVERTED_DEFAULT_COLOR=257,t.DIM_OPACITY=.5,t.CHAR_ATLAS_CELL_SPACING=1},function(e,t,i){"use strict";var r,n,s,o;function a(e){var t=e.toString(16);return t.length<2?"0"+t:t}function l(e,t){return e>>0}}(r=t.channels||(t.channels={})),(n=t.color||(t.color={})).blend=function(e,t){var i=(255&t.rgba)/255;if(1===i)return{css:t.css,rgba:t.rgba};var n=t.rgba>>24&255,s=t.rgba>>16&255,o=t.rgba>>8&255,a=e.rgba>>24&255,l=e.rgba>>16&255,c=e.rgba>>8&255,u=a+Math.round((n-a)*i),h=l+Math.round((s-l)*i),d=c+Math.round((o-c)*i);return{css:r.toCss(u,h,d),rgba:r.toRgba(u,h,d)}},n.isOpaque=function(e){return 255==(255&e.rgba)},n.ensureContrastRatio=function(e,t,i){var r=o.ensureContrastRatio(e.rgba,t.rgba,i);if(r)return o.toColor(r>>24&255,r>>16&255,r>>8&255)},n.opaque=function(e){var t=(255|e.rgba)>>>0,i=o.toChannels(t),n=i[0],s=i[1],a=i[2];return{css:r.toCss(n,s,a),rgba:t}},n.opacity=function(e,t){var i=Math.round(255*t),n=o.toChannels(e.rgba),s=n[0],a=n[1],l=n[2];return{css:r.toCss(s,a,l,i),rgba:r.toRgba(s,a,l,i)}},(t.css||(t.css={})).toColor=function(e){switch(e.length){case 7:return{css:e,rgba:(parseInt(e.slice(1),16)<<8|255)>>>0};case 9:return{css:e,rgba:parseInt(e.slice(1),16)>>>0}}throw new Error("css.toColor: Unsupported css format")},function(e){function t(e,t,i){var r=e/255,n=t/255,s=i/255;return.2126*(r<=.03928?r/12.92:Math.pow((r+.055)/1.055,2.4))+.7152*(n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4))+.0722*(s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4))}e.relativeLuminance=function(e){return t(e>>16&255,e>>8&255,255&e)},e.relativeLuminance2=t}(s=t.rgb||(t.rgb={})),function(e){function t(e,t,i){for(var r=e>>24&255,n=e>>16&255,o=e>>8&255,a=t>>24&255,c=t>>16&255,u=t>>8&255,h=l(s.relativeLuminance2(a,u,c),s.relativeLuminance2(r,n,o));h0||c>0||u>0);)a-=Math.max(0,Math.ceil(.1*a)),c-=Math.max(0,Math.ceil(.1*c)),u-=Math.max(0,Math.ceil(.1*u)),h=l(s.relativeLuminance2(a,u,c),s.relativeLuminance2(r,n,o));return(a<<24|c<<16|u<<8|255)>>>0}function i(e,t,i){for(var r=e>>24&255,n=e>>16&255,o=e>>8&255,a=t>>24&255,c=t>>16&255,u=t>>8&255,h=l(s.relativeLuminance2(a,u,c),s.relativeLuminance2(r,n,o));h>>0}e.ensureContrastRatio=function(e,r,n){var o=s.relativeLuminance(e>>8),a=s.relativeLuminance(r>>8);if(l(o,a)>24&255,e>>16&255,e>>8&255,255&e]},e.toColor=function(e,t,i){return{css:r.toCss(e,t,i),rgba:r.toRgba(e,t,i)}}}(o=t.rgba||(t.rgba={})),t.toPaddedHex=a,t.contrastRatio=l},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isLinux=t.isWindows=t.isIphone=t.isIpad=t.isMac=t.isSafari=t.isFirefox=void 0;var r="undefined"==typeof navigator,n=r?"node":navigator.userAgent,s=r?"node":navigator.platform;function o(e,t){return e.indexOf(t)>=0}t.isFirefox=!!~n.indexOf("Firefox"),t.isSafari=/^((?!chrome|android).)*safari/i.test(n),t.isMac=o(["Macintosh","MacIntel","MacPPC","Mac68K"],s),t.isIpad="iPad"===s,t.isIphone="iPhone"===s,t.isWindows=o(["Windows","Win16","Win32","WinCE"],s),t.isLinux=s.indexOf("Linux")>=0},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.C1=t.C0=void 0,function(e){e.NUL="\0",e.SOH="",e.STX="",e.ETX="",e.EOT="",e.ENQ="",e.ACK="",e.BEL="",e.BS="\b",e.HT="\t",e.LF="\n",e.VT="\v",e.FF="\f",e.CR="\r",e.SO="",e.SI="",e.DLE="",e.DC1="",e.DC2="",e.DC3="",e.DC4="",e.NAK="",e.SYN="",e.ETB="",e.CAN="",e.EM="",e.SUB="",e.ESC="",e.FS="",e.GS="",e.RS="",e.US="",e.SP=" ",e.DEL=""}(t.C0||(t.C0={})),function(e){e.PAD="€",e.HOP="",e.BPH="‚",e.NBH="ƒ",e.IND="„",e.NEL="…",e.SSA="†",e.ESA="‡",e.HTS="ˆ",e.HTJ="‰",e.VTS="Š",e.PLD="‹",e.PLU="Œ",e.RI="",e.SS2="Ž",e.SS3="",e.DCS="",e.PU1="‘",e.PU2="’",e.STS="“",e.CCH="”",e.MW="•",e.SPA="–",e.EPA="—",e.SOS="˜",e.SGCI="™",e.SCI="š",e.CSI="›",e.ST="œ",e.OSC="",e.PM="ž",e.APC="Ÿ"}(t.C1||(t.C1={}))},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BaseRenderLayer=void 0;var r=i(3),n=i(9),s=i(25),o=i(6),a=i(28),l=i(10),c=i(17),u=function(){function e(e,t,i,r,n,s,o,a){this._container=e,this._alpha=r,this._colors=n,this._rendererId=s,this._bufferService=o,this._optionsService=a,this._scaledCharWidth=0,this._scaledCharHeight=0,this._scaledCellWidth=0,this._scaledCellHeight=0,this._scaledCharLeft=0,this._scaledCharTop=0,this._currentGlyphIdentifier={chars:"",code:0,bg:0,fg:0,bold:!1,dim:!1,italic:!1},this._canvas=document.createElement("canvas"),this._canvas.classList.add("xterm-"+t+"-layer"),this._canvas.style.zIndex=i.toString(),this._initCanvas(),this._container.appendChild(this._canvas)}return e.prototype.dispose=function(){var e;c.removeElementFromParent(this._canvas),null===(e=this._charAtlas)||void 0===e||e.dispose()},e.prototype._initCanvas=function(){this._ctx=a.throwIfFalsy(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()},e.prototype.onOptionsChanged=function(){},e.prototype.onBlur=function(){},e.prototype.onFocus=function(){},e.prototype.onCursorMove=function(){},e.prototype.onGridChanged=function(e,t){},e.prototype.onSelectionChanged=function(e,t,i){void 0===i&&(i=!1)},e.prototype.setColors=function(e){this._refreshCharAtlas(e)},e.prototype._setTransparency=function(e){if(e!==this._alpha){var t=this._canvas;this._alpha=e,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,t),this._refreshCharAtlas(this._colors),this.onGridChanged(0,this._bufferService.rows-1)}},e.prototype._refreshCharAtlas=function(e){this._scaledCharWidth<=0&&this._scaledCharHeight<=0||(this._charAtlas=s.acquireCharAtlas(this._optionsService.options,this._rendererId,e,this._scaledCharWidth,this._scaledCharHeight),this._charAtlas.warmUp())},e.prototype.resize=function(e){this._scaledCellWidth=e.scaledCellWidth,this._scaledCellHeight=e.scaledCellHeight,this._scaledCharWidth=e.scaledCharWidth,this._scaledCharHeight=e.scaledCharHeight,this._scaledCharLeft=e.scaledCharLeft,this._scaledCharTop=e.scaledCharTop,this._canvas.width=e.scaledCanvasWidth,this._canvas.height=e.scaledCanvasHeight,this._canvas.style.width=e.canvasWidth+"px",this._canvas.style.height=e.canvasHeight+"px",this._alpha||this._clearAll(),this._refreshCharAtlas(this._colors)},e.prototype._fillCells=function(e,t,i,r){this._ctx.fillRect(e*this._scaledCellWidth,t*this._scaledCellHeight,i*this._scaledCellWidth,r*this._scaledCellHeight)},e.prototype._fillBottomLineAtCells=function(e,t,i){void 0===i&&(i=1),this._ctx.fillRect(e*this._scaledCellWidth,(t+1)*this._scaledCellHeight-window.devicePixelRatio-1,i*this._scaledCellWidth,window.devicePixelRatio)},e.prototype._fillLeftLineAtCell=function(e,t,i){this._ctx.fillRect(e*this._scaledCellWidth,t*this._scaledCellHeight,window.devicePixelRatio*i,this._scaledCellHeight)},e.prototype._strokeRectAtCell=function(e,t,i,r){this._ctx.lineWidth=window.devicePixelRatio,this._ctx.strokeRect(e*this._scaledCellWidth+window.devicePixelRatio/2,t*this._scaledCellHeight+window.devicePixelRatio/2,i*this._scaledCellWidth-window.devicePixelRatio,r*this._scaledCellHeight-window.devicePixelRatio)},e.prototype._clearAll=function(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))},e.prototype._clearCells=function(e,t,i,r){this._alpha?this._ctx.clearRect(e*this._scaledCellWidth,t*this._scaledCellHeight,i*this._scaledCellWidth,r*this._scaledCellHeight):(this._ctx.fillStyle=this._colors.background.css,this._ctx.fillRect(e*this._scaledCellWidth,t*this._scaledCellHeight,i*this._scaledCellWidth,r*this._scaledCellHeight))},e.prototype._fillCharTrueColor=function(e,t,i){this._ctx.font=this._getFont(!1,!1),this._ctx.textBaseline="middle",this._clipRow(i),this._ctx.fillText(e.getChars(),t*this._scaledCellWidth+this._scaledCharLeft,i*this._scaledCellHeight+this._scaledCharTop+this._scaledCharHeight/2)},e.prototype._drawChars=function(e,t,i){var s,o,a=this._getContrastColor(e);a||e.isFgRGB()||e.isBgRGB()?this._drawUncachedChars(e,t,i,a):(e.isInverse()?(s=e.isBgDefault()?n.INVERTED_DEFAULT_COLOR:e.getBgColor(),o=e.isFgDefault()?n.INVERTED_DEFAULT_COLOR:e.getFgColor()):(o=e.isBgDefault()?r.DEFAULT_COLOR:e.getBgColor(),s=e.isFgDefault()?r.DEFAULT_COLOR:e.getFgColor()),s+=this._optionsService.options.drawBoldTextInBrightColors&&e.isBold()&&s<8?8:0,this._currentGlyphIdentifier.chars=e.getChars()||r.WHITESPACE_CELL_CHAR,this._currentGlyphIdentifier.code=e.getCode()||r.WHITESPACE_CELL_CODE,this._currentGlyphIdentifier.bg=o,this._currentGlyphIdentifier.fg=s,this._currentGlyphIdentifier.bold=!!e.isBold(),this._currentGlyphIdentifier.dim=!!e.isDim(),this._currentGlyphIdentifier.italic=!!e.isItalic(),this._charAtlas&&this._charAtlas.draw(this._ctx,this._currentGlyphIdentifier,t*this._scaledCellWidth+this._scaledCharLeft,i*this._scaledCellHeight+this._scaledCharTop)||this._drawUncachedChars(e,t,i))},e.prototype._drawUncachedChars=function(e,t,i,r){if(this._ctx.save(),this._ctx.font=this._getFont(!!e.isBold(),!!e.isItalic()),this._ctx.textBaseline="middle",e.isInverse())if(r)this._ctx.fillStyle=r.css;else if(e.isBgDefault())this._ctx.fillStyle=l.color.opaque(this._colors.background).css;else if(e.isBgRGB())this._ctx.fillStyle="rgb("+o.AttributeData.toColorRGB(e.getBgColor()).join(",")+")";else{var s=e.getBgColor();this._optionsService.options.drawBoldTextInBrightColors&&e.isBold()&&s<8&&(s+=8),this._ctx.fillStyle=this._colors.ansi[s].css}else if(r)this._ctx.fillStyle=r.css;else if(e.isFgDefault())this._ctx.fillStyle=this._colors.foreground.css;else if(e.isFgRGB())this._ctx.fillStyle="rgb("+o.AttributeData.toColorRGB(e.getFgColor()).join(",")+")";else{var a=e.getFgColor();this._optionsService.options.drawBoldTextInBrightColors&&e.isBold()&&a<8&&(a+=8),this._ctx.fillStyle=this._colors.ansi[a].css}this._clipRow(i),e.isDim()&&(this._ctx.globalAlpha=n.DIM_OPACITY),this._ctx.fillText(e.getChars(),t*this._scaledCellWidth+this._scaledCharLeft,i*this._scaledCellHeight+this._scaledCharTop+this._scaledCharHeight/2),this._ctx.restore()},e.prototype._clipRow=function(e){this._ctx.beginPath(),this._ctx.rect(0,e*this._scaledCellHeight,this._bufferService.cols*this._scaledCellWidth,this._scaledCellHeight),this._ctx.clip()},e.prototype._getFont=function(e,t){return(t?"italic":"")+" "+(e?this._optionsService.options.fontWeightBold:this._optionsService.options.fontWeight)+" "+this._optionsService.options.fontSize*window.devicePixelRatio+"px "+this._optionsService.options.fontFamily},e.prototype._getContrastColor=function(e){if(1!==this._optionsService.options.minimumContrastRatio){var t=this._colors.contrastCache.getColor(e.bg,e.fg);if(void 0!==t)return t||void 0;var i=e.getFgColor(),r=e.getFgColorMode(),n=e.getBgColor(),s=e.getBgColorMode(),o=!!e.isInverse(),a=!!e.isInverse();if(o){var c=i;i=n,n=c;var u=r;r=s,s=u}var h=this._resolveBackgroundRgba(s,n,o),d=this._resolveForegroundRgba(r,i,o,a),f=l.rgba.ensureContrastRatio(h,d,this._optionsService.options.minimumContrastRatio);if(f){var p={css:l.channels.toCss(f>>24&255,f>>16&255,f>>8&255),rgba:f};return this._colors.contrastCache.setColor(e.bg,e.fg,p),p}this._colors.contrastCache.setColor(e.bg,e.fg,null)}},e.prototype._resolveBackgroundRgba=function(e,t,i){switch(e){case 16777216:case 33554432:return this._colors.ansi[t].rgba;case 50331648:return t<<8;case 0:default:return i?this._colors.foreground.rgba:this._colors.background.rgba}},e.prototype._resolveForegroundRgba=function(e,t,i,r){switch(e){case 16777216:case 33554432:return this._optionsService.options.drawBoldTextInBrightColors&&r&&t<8&&(t+=8),this._colors.ansi[t].rgba;case 50331648:return t<<8;case 0:default:return i?this._colors.background.rgba:this._colors.foreground.rgba}},e}();t.BaseRenderLayer=u},function(e,t,i){"use strict";function r(e,t,i){t.di$target===t?t.di$dependencies.push({id:e,index:i}):(t.di$dependencies=[{id:e,index:i}],t.di$target=t)}Object.defineProperty(t,"__esModule",{value:!0}),t.createDecorator=t.getServiceDependencies=t.serviceRegistry=void 0,t.serviceRegistry=new Map,t.getServiceDependencies=function(e){return e.di$dependencies||[]},t.createDecorator=function(e){if(t.serviceRegistry.has(e))return t.serviceRegistry.get(e);var i=function(e,t,n){if(3!==arguments.length)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");r(i,e,n)};return i.toString=function(){return e},t.serviceRegistry.set(e,i),i}},function(e,t,i){"use strict";function r(e,t,i,r){if(void 0===i&&(i=0),void 0===r&&(r=e.length),i>=e.length)return e;i=(e.length+i)%e.length,r=r>=e.length?e.length:(e.length+r)%e.length;for(var n=i;n>22,2097152&t?this._combined[e].charCodeAt(this._combined[e].length-1):i]},e.prototype.set=function(e,t){this._data[3*e+1]=t[n.CHAR_DATA_ATTR_INDEX],t[n.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[e]=t[1],this._data[3*e+0]=2097152|e|t[n.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*e+0]=t[n.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|t[n.CHAR_DATA_WIDTH_INDEX]<<22},e.prototype.getWidth=function(e){return this._data[3*e+0]>>22},e.prototype.hasWidth=function(e){return 12582912&this._data[3*e+0]},e.prototype.getFg=function(e){return this._data[3*e+1]},e.prototype.getBg=function(e){return this._data[3*e+2]},e.prototype.hasContent=function(e){return 4194303&this._data[3*e+0]},e.prototype.getCodePoint=function(e){var t=this._data[3*e+0];return 2097152&t?this._combined[e].charCodeAt(this._combined[e].length-1):2097151&t},e.prototype.isCombined=function(e){return 2097152&this._data[3*e+0]},e.prototype.getString=function(e){var t=this._data[3*e+0];return 2097152&t?this._combined[e]:2097151&t?r.stringFromCodePoint(2097151&t):""},e.prototype.loadCell=function(e,t){var i=3*e;return t.content=this._data[i+0],t.fg=this._data[i+1],t.bg=this._data[i+2],2097152&t.content&&(t.combinedData=this._combined[e]),268435456&t.bg&&(t.extended=this._extendedAttrs[e]),t},e.prototype.setCell=function(e,t){2097152&t.content&&(this._combined[e]=t.combinedData),268435456&t.bg&&(this._extendedAttrs[e]=t.extended),this._data[3*e+0]=t.content,this._data[3*e+1]=t.fg,this._data[3*e+2]=t.bg},e.prototype.setCellFromCodePoint=function(e,t,i,r,n,s){268435456&n&&(this._extendedAttrs[e]=s),this._data[3*e+0]=t|i<<22,this._data[3*e+1]=r,this._data[3*e+2]=n},e.prototype.addCodepointToCell=function(e,t){var i=this._data[3*e+0];2097152&i?this._combined[e]+=r.stringFromCodePoint(t):(2097151&i?(this._combined[e]=r.stringFromCodePoint(2097151&i)+r.stringFromCodePoint(t),i&=-2097152,i|=2097152):i=t|1<<22,this._data[3*e+0]=i)},e.prototype.insertCells=function(e,t,i,r){if((e%=this.length)&&2===this.getWidth(e-1)&&this.setCellFromCodePoint(e-1,0,1,(null==r?void 0:r.fg)||0,(null==r?void 0:r.bg)||0,(null==r?void 0:r.extended)||new o.ExtendedAttrs),t=0;--a)this.setCell(e+t+a,this.loadCell(e+a,n));for(a=0;athis.length){var i=new Uint32Array(3*e);this.length&&(3*e=e&&delete this._combined[s]}}else this._data=new Uint32Array(0),this._combined={};this.length=e}},e.prototype.fill=function(e){this._combined={},this._extendedAttrs={};for(var t=0;t=0;--e)if(4194303&this._data[3*e+0])return e+(this._data[3*e+0]>>22);return 0},e.prototype.copyCellsFrom=function(e,t,i,r,n){var s=e._data;if(n)for(var o=r-1;o>=0;o--)for(var a=0;a<3;a++)this._data[3*(i+o)+a]=s[3*(t+o)+a];else for(o=0;o=t&&(this._combined[c-t+i]=e._combined[c])}},e.prototype.translateToString=function(e,t,i){void 0===e&&(e=!1),void 0===t&&(t=0),void 0===i&&(i=this.length),e&&(i=Math.min(i,this.getTrimmedLength()));for(var s="";t>22||1}return s},e}();t.BufferLine=a},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.removeElementFromParent=void 0,t.removeElementFromParent=function(){for(var e,t=[],i=0;i24)return t.setWinLines||!1;switch(e){case 1:return!!t.restoreWin;case 2:return!!t.minimizeWin;case 3:return!!t.setWinPosition;case 4:return!!t.setWinSizePixels;case 5:return!!t.raiseWin;case 6:return!!t.lowerWin;case 7:return!!t.refreshWin;case 8:return!!t.setWinSizeChars;case 9:return!!t.maximizeWin;case 10:return!!t.fullscreenWin;case 11:return!!t.getWinState;case 13:return!!t.getWinPosition;case 14:return!!t.getWinSizePixels;case 15:return!!t.getScreenSizePixels;case 16:return!!t.getCellSizePixels;case 18:return!!t.getWinSizeChars;case 19:return!!t.getScreenSizeChars;case 20:return!!t.getIconTitle;case 21:return!!t.getWinTitle;case 22:return!!t.pushTitle;case 23:return!!t.popTitle;case 24:return!!t.setWinLines}return!1}!function(e){e[e.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",e[e.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"}(s=t.WindowsOptionsReportType||(t.WindowsOptionsReportType={}));var S=function(){function e(e,t,i,r){this._bufferService=e,this._coreService=t,this._logService=i,this._optionsService=r,this._data=new Uint32Array(0)}return e.prototype.hook=function(e){this._data=new Uint32Array(0)},e.prototype.put=function(e,t,i){this._data=u.concat(this._data,e.subarray(t,i))},e.prototype.unhook=function(e){if(e){var t=h.utf32ToString(this._data);switch(this._data=new Uint32Array(0),t){case'"q':return this._coreService.triggerDataEvent(o.C0.ESC+'P1$r0"q'+o.C0.ESC+"\\");case'"p':return this._coreService.triggerDataEvent(o.C0.ESC+'P1$r61;1"p'+o.C0.ESC+"\\");case"r":var i=this._bufferService.buffer.scrollTop+1+";"+(this._bufferService.buffer.scrollBottom+1)+"r";return this._coreService.triggerDataEvent(o.C0.ESC+"P1$r"+i+o.C0.ESC+"\\");case"m":return this._coreService.triggerDataEvent(o.C0.ESC+"P1$r0m"+o.C0.ESC+"\\");case" q":var r={block:2,underline:4,bar:6}[this._optionsService.options.cursorStyle];return r-=this._optionsService.options.cursorBlink?1:0,this._coreService.triggerDataEvent(o.C0.ESC+"P1$r"+r+" q"+o.C0.ESC+"\\");default:this._logService.debug("Unknown DCS $q %s",t),this._coreService.triggerDataEvent(o.C0.ESC+"P0$r"+o.C0.ESC+"\\")}}else this._data=new Uint32Array(0)},e}(),C=function(e){function t(t,i,r,n,s,c,u,p,v){void 0===v&&(v=new l.EscapeSequenceParser);var y=e.call(this)||this;y._bufferService=t,y._charsetService=i,y._coreService=r,y._dirtyRowService=n,y._logService=s,y._optionsService=c,y._coreMouseService=u,y._unicodeService=p,y._parser=v,y._parseBuffer=new Uint32Array(4096),y._stringDecoder=new h.StringToUtf32,y._utf8Decoder=new h.Utf8ToUtf32,y._workCell=new g.CellData,y._windowTitle="",y._iconName="",y._windowTitleStack=[],y._iconNameStack=[],y._curAttrData=d.DEFAULT_ATTR_DATA.clone(),y._eraseAttrDataInternal=d.DEFAULT_ATTR_DATA.clone(),y._onRequestBell=new f.EventEmitter,y._onRequestRefreshRows=new f.EventEmitter,y._onRequestReset=new f.EventEmitter,y._onRequestScroll=new f.EventEmitter,y._onRequestSyncScrollBar=new f.EventEmitter,y._onRequestWindowsOptionsReport=new f.EventEmitter,y._onA11yChar=new f.EventEmitter,y._onA11yTab=new f.EventEmitter,y._onCursorMove=new f.EventEmitter,y._onLineFeed=new f.EventEmitter,y._onScroll=new f.EventEmitter,y._onTitleChange=new f.EventEmitter,y.register(y._parser),y._parser.setCsiHandlerFallback((function(e,t){y._logService.debug("Unknown CSI code: ",{identifier:y._parser.identToString(e),params:t.toArray()})})),y._parser.setEscHandlerFallback((function(e){y._logService.debug("Unknown ESC code: ",{identifier:y._parser.identToString(e)})})),y._parser.setExecuteHandlerFallback((function(e){y._logService.debug("Unknown EXECUTE code: ",{code:e})})),y._parser.setOscHandlerFallback((function(e,t,i){y._logService.debug("Unknown OSC code: ",{identifier:e,action:t,data:i})})),y._parser.setDcsHandlerFallback((function(e,t,i){"HOOK"===t&&(i=i.toArray()),y._logService.debug("Unknown DCS code: ",{identifier:y._parser.identToString(e),action:t,payload:i})})),y._parser.setPrintHandler((function(e,t,i){return y.print(e,t,i)})),y._parser.setCsiHandler({final:"@"},(function(e){return y.insertChars(e)})),y._parser.setCsiHandler({intermediates:" ",final:"@"},(function(e){return y.scrollLeft(e)})),y._parser.setCsiHandler({final:"A"},(function(e){return y.cursorUp(e)})),y._parser.setCsiHandler({intermediates:" ",final:"A"},(function(e){return y.scrollRight(e)})),y._parser.setCsiHandler({final:"B"},(function(e){return y.cursorDown(e)})),y._parser.setCsiHandler({final:"C"},(function(e){return y.cursorForward(e)})),y._parser.setCsiHandler({final:"D"},(function(e){return y.cursorBackward(e)})),y._parser.setCsiHandler({final:"E"},(function(e){return y.cursorNextLine(e)})),y._parser.setCsiHandler({final:"F"},(function(e){return y.cursorPrecedingLine(e)})),y._parser.setCsiHandler({final:"G"},(function(e){return y.cursorCharAbsolute(e)})),y._parser.setCsiHandler({final:"H"},(function(e){return y.cursorPosition(e)})),y._parser.setCsiHandler({final:"I"},(function(e){return y.cursorForwardTab(e)})),y._parser.setCsiHandler({final:"J"},(function(e){return y.eraseInDisplay(e)})),y._parser.setCsiHandler({prefix:"?",final:"J"},(function(e){return y.eraseInDisplay(e)})),y._parser.setCsiHandler({final:"K"},(function(e){return y.eraseInLine(e)})),y._parser.setCsiHandler({prefix:"?",final:"K"},(function(e){return y.eraseInLine(e)})),y._parser.setCsiHandler({final:"L"},(function(e){return y.insertLines(e)})),y._parser.setCsiHandler({final:"M"},(function(e){return y.deleteLines(e)})),y._parser.setCsiHandler({final:"P"},(function(e){return y.deleteChars(e)})),y._parser.setCsiHandler({final:"S"},(function(e){return y.scrollUp(e)})),y._parser.setCsiHandler({final:"T"},(function(e){return y.scrollDown(e)})),y._parser.setCsiHandler({final:"X"},(function(e){return y.eraseChars(e)})),y._parser.setCsiHandler({final:"Z"},(function(e){return y.cursorBackwardTab(e)})),y._parser.setCsiHandler({final:"`"},(function(e){return y.charPosAbsolute(e)})),y._parser.setCsiHandler({final:"a"},(function(e){return y.hPositionRelative(e)})),y._parser.setCsiHandler({final:"b"},(function(e){return y.repeatPrecedingCharacter(e)})),y._parser.setCsiHandler({final:"c"},(function(e){return y.sendDeviceAttributesPrimary(e)})),y._parser.setCsiHandler({prefix:">",final:"c"},(function(e){return y.sendDeviceAttributesSecondary(e)})),y._parser.setCsiHandler({final:"d"},(function(e){return y.linePosAbsolute(e)})),y._parser.setCsiHandler({final:"e"},(function(e){return y.vPositionRelative(e)})),y._parser.setCsiHandler({final:"f"},(function(e){return y.hVPosition(e)})),y._parser.setCsiHandler({final:"g"},(function(e){return y.tabClear(e)})),y._parser.setCsiHandler({final:"h"},(function(e){return y.setMode(e)})),y._parser.setCsiHandler({prefix:"?",final:"h"},(function(e){return y.setModePrivate(e)})),y._parser.setCsiHandler({final:"l"},(function(e){return y.resetMode(e)})),y._parser.setCsiHandler({prefix:"?",final:"l"},(function(e){return y.resetModePrivate(e)})),y._parser.setCsiHandler({final:"m"},(function(e){return y.charAttributes(e)})),y._parser.setCsiHandler({final:"n"},(function(e){return y.deviceStatus(e)})),y._parser.setCsiHandler({prefix:"?",final:"n"},(function(e){return y.deviceStatusPrivate(e)})),y._parser.setCsiHandler({intermediates:"!",final:"p"},(function(e){return y.softReset(e)})),y._parser.setCsiHandler({intermediates:" ",final:"q"},(function(e){return y.setCursorStyle(e)})),y._parser.setCsiHandler({final:"r"},(function(e){return y.setScrollRegion(e)})),y._parser.setCsiHandler({final:"s"},(function(e){return y.saveCursor(e)})),y._parser.setCsiHandler({final:"t"},(function(e){return y.windowOptions(e)})),y._parser.setCsiHandler({final:"u"},(function(e){return y.restoreCursor(e)})),y._parser.setCsiHandler({intermediates:"'",final:"}"},(function(e){return y.insertColumns(e)})),y._parser.setCsiHandler({intermediates:"'",final:"~"},(function(e){return y.deleteColumns(e)})),y._parser.setExecuteHandler(o.C0.BEL,(function(){return y.bell()})),y._parser.setExecuteHandler(o.C0.LF,(function(){return y.lineFeed()})),y._parser.setExecuteHandler(o.C0.VT,(function(){return y.lineFeed()})),y._parser.setExecuteHandler(o.C0.FF,(function(){return y.lineFeed()})),y._parser.setExecuteHandler(o.C0.CR,(function(){return y.carriageReturn()})),y._parser.setExecuteHandler(o.C0.BS,(function(){return y.backspace()})),y._parser.setExecuteHandler(o.C0.HT,(function(){return y.tab()})),y._parser.setExecuteHandler(o.C0.SO,(function(){return y.shiftOut()})),y._parser.setExecuteHandler(o.C0.SI,(function(){return y.shiftIn()})),y._parser.setExecuteHandler(o.C1.IND,(function(){return y.index()})),y._parser.setExecuteHandler(o.C1.NEL,(function(){return y.nextLine()})),y._parser.setExecuteHandler(o.C1.HTS,(function(){return y.tabSet()})),y._parser.setOscHandler(0,new m.OscHandler((function(e){y.setTitle(e),y.setIconName(e)}))),y._parser.setOscHandler(1,new m.OscHandler((function(e){return y.setIconName(e)}))),y._parser.setOscHandler(2,new m.OscHandler((function(e){return y.setTitle(e)}))),y._parser.setEscHandler({final:"7"},(function(){return y.saveCursor()})),y._parser.setEscHandler({final:"8"},(function(){return y.restoreCursor()})),y._parser.setEscHandler({final:"D"},(function(){return y.index()})),y._parser.setEscHandler({final:"E"},(function(){return y.nextLine()})),y._parser.setEscHandler({final:"H"},(function(){return y.tabSet()})),y._parser.setEscHandler({final:"M"},(function(){return y.reverseIndex()})),y._parser.setEscHandler({final:"="},(function(){return y.keypadApplicationMode()})),y._parser.setEscHandler({final:">"},(function(){return y.keypadNumericMode()})),y._parser.setEscHandler({final:"c"},(function(){return y.fullReset()})),y._parser.setEscHandler({final:"n"},(function(){return y.setgLevel(2)})),y._parser.setEscHandler({final:"o"},(function(){return y.setgLevel(3)})),y._parser.setEscHandler({final:"|"},(function(){return y.setgLevel(3)})),y._parser.setEscHandler({final:"}"},(function(){return y.setgLevel(2)})),y._parser.setEscHandler({final:"~"},(function(){return y.setgLevel(1)})),y._parser.setEscHandler({intermediates:"%",final:"@"},(function(){return y.selectDefaultCharset()})),y._parser.setEscHandler({intermediates:"%",final:"G"},(function(){return y.selectDefaultCharset()}));var _=function(e){b._parser.setEscHandler({intermediates:"(",final:e},(function(){return y.selectCharset("("+e)})),b._parser.setEscHandler({intermediates:")",final:e},(function(){return y.selectCharset(")"+e)})),b._parser.setEscHandler({intermediates:"*",final:e},(function(){return y.selectCharset("*"+e)})),b._parser.setEscHandler({intermediates:"+",final:e},(function(){return y.selectCharset("+"+e)})),b._parser.setEscHandler({intermediates:"-",final:e},(function(){return y.selectCharset("-"+e)})),b._parser.setEscHandler({intermediates:".",final:e},(function(){return y.selectCharset("."+e)})),b._parser.setEscHandler({intermediates:"/",final:e},(function(){return y.selectCharset("/"+e)}))},b=this;for(var C in a.CHARSETS)_(C);return y._parser.setEscHandler({intermediates:"#",final:"8"},(function(){return y.screenAlignmentPattern()})),y._parser.setErrorHandler((function(e){return y._logService.error("Parsing error: ",e),e})),y._parser.setDcsHandler({intermediates:"$",final:"q"},new S(y._bufferService,y._coreService,y._logService,y._optionsService)),y}return n(t,e),Object.defineProperty(t.prototype,"onRequestBell",{get:function(){return this._onRequestBell.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onRequestRefreshRows",{get:function(){return this._onRequestRefreshRows.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onRequestReset",{get:function(){return this._onRequestReset.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onRequestScroll",{get:function(){return this._onRequestScroll.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onRequestSyncScrollBar",{get:function(){return this._onRequestSyncScrollBar.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onRequestWindowsOptionsReport",{get:function(){return this._onRequestWindowsOptionsReport.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onA11yChar",{get:function(){return this._onA11yChar.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onA11yTab",{get:function(){return this._onA11yTab.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onCursorMove",{get:function(){return this._onCursorMove.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onLineFeed",{get:function(){return this._onLineFeed.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onScroll",{get:function(){return this._onScroll.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onTitleChange",{get:function(){return this._onTitleChange.event},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){e.prototype.dispose.call(this)},t.prototype.parse=function(e){var t=this._bufferService.buffer,i=t.x,r=t.y;if(this._logService.debug("parsing data",e),this._parseBuffer.length131072)for(var n=0;n0&&2===f.getWidth(s.x-1)&&f.setCellFromCodePoint(s.x-1,0,1,d.fg,d.bg,d.extended);for(var g=t;g=l)if(c){for(;s.x=this._bufferService.rows&&(s.y=this._bufferService.rows-1),s.lines.get(s.ybase+s.y).isWrapped=!0),f=s.lines.get(s.ybase+s.y)}else if(s.x=l-1,2===n)continue;if(u&&(f.insertCells(s.x,n,s.getNullCell(d),d),2===f.getWidth(l-1)&&f.setCellFromCodePoint(l-1,p.NULL_CELL_CODE,p.NULL_CELL_WIDTH,d.fg,d.bg,d.extended)),f.setCellFromCodePoint(s.x++,r,n,d.fg,d.bg,d.extended),n>0)for(;--n;)f.setCellFromCodePoint(s.x++,0,0,d.fg,d.bg,d.extended)}else f.getWidth(s.x-1)?f.addCodepointToCell(s.x-1,r):f.addCodepointToCell(s.x-2,r)}i-t>0&&(f.loadCell(s.x-1,this._workCell),2===this._workCell.getWidth()||this._workCell.getCode()>65535?this._parser.precedingCodepoint=0:this._workCell.isCombined()?this._parser.precedingCodepoint=this._workCell.getChars().charCodeAt(0):this._parser.precedingCodepoint=this._workCell.content),s.x0&&0===f.getWidth(s.x)&&!f.hasContent(s.x)&&f.setCellFromCodePoint(s.x,0,1,d.fg,d.bg,d.extended),this._dirtyRowService.markDirty(s.y)},t.prototype.addCsiHandler=function(e,t){var i=this;return"t"!==e.final||e.prefix||e.intermediates?this._parser.addCsiHandler(e,t):this._parser.addCsiHandler(e,(function(e){return!b(e.params[0],i._optionsService.options.windowOptions)||t(e)}))},t.prototype.addDcsHandler=function(e,t){return this._parser.addDcsHandler(e,new y.DcsHandler(t))},t.prototype.addEscHandler=function(e,t){return this._parser.addEscHandler(e,t)},t.prototype.addOscHandler=function(e,t){return this._parser.addOscHandler(e,new m.OscHandler(t))},t.prototype.bell=function(){this._onRequestBell.fire()},t.prototype.lineFeed=function(){var e=this._bufferService.buffer;this._dirtyRowService.markDirty(e.y),this._optionsService.options.convertEol&&(e.x=0),e.y++,e.y===e.scrollBottom+1?(e.y--,this._onRequestScroll.fire(this._eraseAttrData())):e.y>=this._bufferService.rows&&(e.y=this._bufferService.rows-1),e.x>=this._bufferService.cols&&e.x--,this._dirtyRowService.markDirty(e.y),this._onLineFeed.fire()},t.prototype.carriageReturn=function(){this._bufferService.buffer.x=0},t.prototype.backspace=function(){var e,t=this._bufferService.buffer;if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),void(t.x>0&&t.x--);if(this._restrictCursor(this._bufferService.cols),t.x>0)t.x--;else if(0===t.x&&t.y>t.scrollTop&&t.y<=t.scrollBottom&&(null===(e=t.lines.get(t.ybase+t.y))||void 0===e?void 0:e.isWrapped)){t.lines.get(t.ybase+t.y).isWrapped=!1,t.y--,t.x=this._bufferService.cols-1;var i=t.lines.get(t.ybase+t.y);i.hasWidth(t.x)&&!i.hasContent(t.x)&&t.x--}this._restrictCursor()},t.prototype.tab=function(){if(!(this._bufferService.buffer.x>=this._bufferService.cols)){var e=this._bufferService.buffer.x;this._bufferService.buffer.x=this._bufferService.buffer.nextStop(),this._optionsService.options.screenReaderMode&&this._onA11yTab.fire(this._bufferService.buffer.x-e)}},t.prototype.shiftOut=function(){this._charsetService.setgLevel(1)},t.prototype.shiftIn=function(){this._charsetService.setgLevel(0)},t.prototype._restrictCursor=function(e){void 0===e&&(e=this._bufferService.cols-1),this._bufferService.buffer.x=Math.min(e,Math.max(0,this._bufferService.buffer.x)),this._bufferService.buffer.y=this._coreService.decPrivateModes.origin?Math.min(this._bufferService.buffer.scrollBottom,Math.max(this._bufferService.buffer.scrollTop,this._bufferService.buffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._bufferService.buffer.y)),this._dirtyRowService.markDirty(this._bufferService.buffer.y)},t.prototype._setCursor=function(e,t){this._dirtyRowService.markDirty(this._bufferService.buffer.y),this._coreService.decPrivateModes.origin?(this._bufferService.buffer.x=e,this._bufferService.buffer.y=this._bufferService.buffer.scrollTop+t):(this._bufferService.buffer.x=e,this._bufferService.buffer.y=t),this._restrictCursor(),this._dirtyRowService.markDirty(this._bufferService.buffer.y)},t.prototype._moveCursor=function(e,t){this._restrictCursor(),this._setCursor(this._bufferService.buffer.x+e,this._bufferService.buffer.y+t)},t.prototype.cursorUp=function(e){var t=this._bufferService.buffer.y-this._bufferService.buffer.scrollTop;t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1))},t.prototype.cursorDown=function(e){var t=this._bufferService.buffer.scrollBottom-this._bufferService.buffer.y;t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1)},t.prototype.cursorForward=function(e){this._moveCursor(e.params[0]||1,0)},t.prototype.cursorBackward=function(e){this._moveCursor(-(e.params[0]||1),0)},t.prototype.cursorNextLine=function(e){this.cursorDown(e),this._bufferService.buffer.x=0},t.prototype.cursorPrecedingLine=function(e){this.cursorUp(e),this._bufferService.buffer.x=0},t.prototype.cursorCharAbsolute=function(e){this._setCursor((e.params[0]||1)-1,this._bufferService.buffer.y)},t.prototype.cursorPosition=function(e){this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1)},t.prototype.charPosAbsolute=function(e){this._setCursor((e.params[0]||1)-1,this._bufferService.buffer.y)},t.prototype.hPositionRelative=function(e){this._moveCursor(e.params[0]||1,0)},t.prototype.linePosAbsolute=function(e){this._setCursor(this._bufferService.buffer.x,(e.params[0]||1)-1)},t.prototype.vPositionRelative=function(e){this._moveCursor(0,e.params[0]||1)},t.prototype.hVPosition=function(e){this.cursorPosition(e)},t.prototype.tabClear=function(e){var t=e.params[0];0===t?delete this._bufferService.buffer.tabs[this._bufferService.buffer.x]:3===t&&(this._bufferService.buffer.tabs={})},t.prototype.cursorForwardTab=function(e){if(!(this._bufferService.buffer.x>=this._bufferService.cols))for(var t=e.params[0]||1;t--;)this._bufferService.buffer.x=this._bufferService.buffer.nextStop()},t.prototype.cursorBackwardTab=function(e){if(!(this._bufferService.buffer.x>=this._bufferService.cols))for(var t=e.params[0]||1,i=this._bufferService.buffer;t--;)i.x=i.prevStop()},t.prototype._eraseInBufferLine=function(e,t,i,r){void 0===r&&(r=!1);var n=this._bufferService.buffer.lines.get(this._bufferService.buffer.ybase+e);n.replaceCells(t,i,this._bufferService.buffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),r&&(n.isWrapped=!1)},t.prototype._resetBufferLine=function(e){var t=this._bufferService.buffer.lines.get(this._bufferService.buffer.ybase+e);t.fill(this._bufferService.buffer.getNullCell(this._eraseAttrData())),t.isWrapped=!1},t.prototype.eraseInDisplay=function(e){var t;switch(this._restrictCursor(),e.params[0]){case 0:for(t=this._bufferService.buffer.y,this._dirtyRowService.markDirty(t),this._eraseInBufferLine(t++,this._bufferService.buffer.x,this._bufferService.cols,0===this._bufferService.buffer.x);t=this._bufferService.cols&&(this._bufferService.buffer.lines.get(t+1).isWrapped=!1);t--;)this._resetBufferLine(t);this._dirtyRowService.markDirty(0);break;case 2:for(t=this._bufferService.rows,this._dirtyRowService.markDirty(t-1);t--;)this._resetBufferLine(t);this._dirtyRowService.markDirty(0);break;case 3:var i=this._bufferService.buffer.lines.length-this._bufferService.rows;i>0&&(this._bufferService.buffer.lines.trimStart(i),this._bufferService.buffer.ybase=Math.max(this._bufferService.buffer.ybase-i,0),this._bufferService.buffer.ydisp=Math.max(this._bufferService.buffer.ydisp-i,0),this._onScroll.fire(0))}},t.prototype.eraseInLine=function(e){switch(this._restrictCursor(),e.params[0]){case 0:this._eraseInBufferLine(this._bufferService.buffer.y,this._bufferService.buffer.x,this._bufferService.cols);break;case 1:this._eraseInBufferLine(this._bufferService.buffer.y,0,this._bufferService.buffer.x+1);break;case 2:this._eraseInBufferLine(this._bufferService.buffer.y,0,this._bufferService.cols)}this._dirtyRowService.markDirty(this._bufferService.buffer.y)},t.prototype.insertLines=function(e){this._restrictCursor();var t=e.params[0]||1,i=this._bufferService.buffer;if(!(i.y>i.scrollBottom||i.yi.scrollBottom||i.yt.scrollBottom||t.yt.scrollBottom||t.yt.scrollBottom||t.yt.scrollBottom||t.y0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(o.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(o.C0.ESC+"[?6c"))},t.prototype.sendDeviceAttributesSecondary=function(e){e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(o.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(o.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(o.C0.ESC+"[>83;40003;0c"))},t.prototype._is=function(e){return 0===(this._optionsService.options.termName+"").indexOf(e)},t.prototype.setMode=function(e){for(var t=0;t=2||2===r[1]&&s+n>=5)break;r[1]&&(n=1)}while(++s+t5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,0===e&&(t.fg&=-268435457),t.updateExtended()},t.prototype.charAttributes=function(e){if(1===e.length&&0===e.params[0])return this._curAttrData.fg=d.DEFAULT_ATTR_DATA.fg,void(this._curAttrData.bg=d.DEFAULT_ATTR_DATA.bg);for(var t,i=e.length,r=this._curAttrData,n=0;n=30&&t<=37?(r.fg&=-50331904,r.fg|=16777216|t-30):t>=40&&t<=47?(r.bg&=-50331904,r.bg|=16777216|t-40):t>=90&&t<=97?(r.fg&=-50331904,r.fg|=16777224|t-90):t>=100&&t<=107?(r.bg&=-50331904,r.bg|=16777224|t-100):0===t?(r.fg=d.DEFAULT_ATTR_DATA.fg,r.bg=d.DEFAULT_ATTR_DATA.bg):1===t?r.fg|=134217728:3===t?r.bg|=67108864:4===t?(r.fg|=268435456,this._processUnderline(e.hasSubParams(n)?e.getSubParams(n)[0]:1,r)):5===t?r.fg|=536870912:7===t?r.fg|=67108864:8===t?r.fg|=1073741824:2===t?r.bg|=134217728:21===t?this._processUnderline(2,r):22===t?(r.fg&=-134217729,r.bg&=-134217729):23===t?r.bg&=-67108865:24===t?r.fg&=-268435457:25===t?r.fg&=-536870913:27===t?r.fg&=-67108865:28===t?r.fg&=-1073741825:39===t?(r.fg&=-67108864,r.fg|=16777215&d.DEFAULT_ATTR_DATA.fg):49===t?(r.bg&=-67108864,r.bg|=16777215&d.DEFAULT_ATTR_DATA.bg):38===t||48===t||58===t?n+=this._extractColor(e,n,r):59===t?(r.extended=r.extended.clone(),r.extended.underlineColor=-1,r.updateExtended()):100===t?(r.fg&=-67108864,r.fg|=16777215&d.DEFAULT_ATTR_DATA.fg,r.bg&=-67108864,r.bg|=16777215&d.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",t)},t.prototype.deviceStatus=function(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(o.C0.ESC+"[0n");break;case 6:var t=this._bufferService.buffer.y+1,i=this._bufferService.buffer.x+1;this._coreService.triggerDataEvent(o.C0.ESC+"["+t+";"+i+"R")}},t.prototype.deviceStatusPrivate=function(e){switch(e.params[0]){case 6:var t=this._bufferService.buffer.y+1,i=this._bufferService.buffer.x+1;this._coreService.triggerDataEvent(o.C0.ESC+"[?"+t+";"+i+"R")}},t.prototype.softReset=function(e){this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._bufferService.buffer.scrollTop=0,this._bufferService.buffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=d.DEFAULT_ATTR_DATA.clone(),this._coreService.reset(),this._charsetService.reset(),this._bufferService.buffer.savedX=0,this._bufferService.buffer.savedY=this._bufferService.buffer.ybase,this._bufferService.buffer.savedCurAttrData.fg=this._curAttrData.fg,this._bufferService.buffer.savedCurAttrData.bg=this._curAttrData.bg,this._bufferService.buffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1},t.prototype.setCursorStyle=function(e){var t=e.params[0]||1;switch(t){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}var i=t%2==1;this._optionsService.options.cursorBlink=i},t.prototype.setScrollRegion=function(e){var t,i=e.params[0]||1;(e.length<2||(t=e.params[1])>this._bufferService.rows||0===t)&&(t=this._bufferService.rows),t>i&&(this._bufferService.buffer.scrollTop=i-1,this._bufferService.buffer.scrollBottom=t-1,this._setCursor(0,0))},t.prototype.windowOptions=function(e){if(b(e.params[0],this._optionsService.options.windowOptions)){var t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:2!==t&&this._onRequestWindowsOptionsReport.fire(s.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(s.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(o.C0.ESC+"[8;"+this._bufferService.rows+";"+this._bufferService.cols+"t");break;case 22:0!==t&&2!==t||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),0!==t&&1!==t||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:0!==t&&2!==t||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),0!==t&&1!==t||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}}},t.prototype.saveCursor=function(e){this._bufferService.buffer.savedX=this._bufferService.buffer.x,this._bufferService.buffer.savedY=this._bufferService.buffer.ybase+this._bufferService.buffer.y,this._bufferService.buffer.savedCurAttrData.fg=this._curAttrData.fg,this._bufferService.buffer.savedCurAttrData.bg=this._curAttrData.bg,this._bufferService.buffer.savedCharset=this._charsetService.charset},t.prototype.restoreCursor=function(e){this._bufferService.buffer.x=this._bufferService.buffer.savedX||0,this._bufferService.buffer.y=Math.max(this._bufferService.buffer.savedY-this._bufferService.buffer.ybase,0),this._curAttrData.fg=this._bufferService.buffer.savedCurAttrData.fg,this._curAttrData.bg=this._bufferService.buffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._bufferService.buffer.savedCharset&&(this._charsetService.charset=this._bufferService.buffer.savedCharset),this._restrictCursor()},t.prototype.setTitle=function(e){this._windowTitle=e,this._onTitleChange.fire(e)},t.prototype.setIconName=function(e){this._iconName=e},t.prototype.nextLine=function(){this._bufferService.buffer.x=0,this.index()},t.prototype.keypadApplicationMode=function(){this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire()},t.prototype.keypadNumericMode=function(){this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire()},t.prototype.selectDefaultCharset=function(){this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,a.DEFAULT_CHARSET)},t.prototype.selectCharset=function(e){2===e.length?"/"!==e[0]&&this._charsetService.setgCharset(_[e[0]],a.CHARSETS[e[1]]||a.DEFAULT_CHARSET):this.selectDefaultCharset()},t.prototype.index=function(){this._restrictCursor();var e=this._bufferService.buffer;this._bufferService.buffer.y++,e.y===e.scrollBottom+1?(e.y--,this._onRequestScroll.fire(this._eraseAttrData())):e.y>=this._bufferService.rows&&(e.y=this._bufferService.rows-1),this._restrictCursor()},t.prototype.tabSet=function(){this._bufferService.buffer.tabs[this._bufferService.buffer.x]=!0},t.prototype.reverseIndex=function(){this._restrictCursor();var e=this._bufferService.buffer;if(e.y===e.scrollTop){var t=e.scrollBottom-e.scrollTop;e.lines.shiftElements(e.ybase+e.y,t,1),e.lines.set(e.ybase+e.y,e.getBlankLine(this._eraseAttrData())),this._dirtyRowService.markRangeDirty(e.scrollTop,e.scrollBottom)}else e.y--,this._restrictCursor()},t.prototype.fullReset=function(){this._parser.reset(),this._onRequestReset.fire()},t.prototype.reset=function(){this._curAttrData=d.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=d.DEFAULT_ATTR_DATA.clone()},t.prototype._eraseAttrData=function(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal},t.prototype.setgLevel=function(e){this._charsetService.setgLevel(e)},t.prototype.screenAlignmentPattern=function(){var e=new g.CellData;e.content=1<<22|"E".charCodeAt(0),e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg;var t=this._bufferService.buffer;this._setCursor(0,0);for(var i=0;i256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(e),this.length=0,this._subParams=new Int32Array(t),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(e),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}return e.fromArray=function(t){var i=new e;if(!t.length)return i;for(var r=t[0]instanceof Array?1:0;r>8,r=255&this._subParamsIdx[t];r-i>0&&e.push(Array.prototype.slice.call(this._subParams,i,r))}return e},e.prototype.reset=function(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1},e.prototype.addParam=function(e){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(e<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=e>2147483647?2147483647:e}},e.prototype.addSubParam=function(e){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(e<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=e>2147483647?2147483647:e,this._subParamsIdx[this.length-1]++}},e.prototype.hasSubParams=function(e){return(255&this._subParamsIdx[e])-(this._subParamsIdx[e]>>8)>0},e.prototype.getSubParams=function(e){var t=this._subParamsIdx[e]>>8,i=255&this._subParamsIdx[e];return i-t>0?this._subParams.subarray(t,i):null},e.prototype.getSubParamsAll=function(){for(var e={},t=0;t>8,r=255&this._subParamsIdx[t];r-i>0&&(e[t]=this._subParams.slice(i,r))}return e},e.prototype.addDigit=function(e){var t;if(!(this._rejectDigits||!(t=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)){var i=this._digitIsSub?this._subParams:this.params,r=i[t-1];i[t-1]=~r?Math.min(10*r+e,2147483647):e}},e}();t.Params=r},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.OscHandler=t.OscParser=void 0;var r=i(23),n=i(8),s=function(){function e(){this._state=0,this._id=-1,this._handlers=Object.create(null),this._handlerFb=function(){}}return e.prototype.addHandler=function(e,t){void 0===this._handlers[e]&&(this._handlers[e]=[]);var i=this._handlers[e];return i.push(t),{dispose:function(){var e=i.indexOf(t);-1!==e&&i.splice(e,1)}}},e.prototype.setHandler=function(e,t){this._handlers[e]=[t]},e.prototype.clearHandler=function(e){this._handlers[e]&&delete this._handlers[e]},e.prototype.setHandlerFallback=function(e){this._handlerFb=e},e.prototype.dispose=function(){this._handlers=Object.create(null),this._handlerFb=function(){}},e.prototype.reset=function(){2===this._state&&this.end(!1),this._id=-1,this._state=0},e.prototype._start=function(){var e=this._handlers[this._id];if(e)for(var t=e.length-1;t>=0;t--)e[t].start();else this._handlerFb(this._id,"START")},e.prototype._put=function(e,t,i){var r=this._handlers[this._id];if(r)for(var s=r.length-1;s>=0;s--)r[s].put(e,t,i);else this._handlerFb(this._id,"PUT",n.utf32ToString(e,t,i))},e.prototype._end=function(e){var t=this._handlers[this._id];if(t){for(var i=t.length-1;i>=0&&!1===t[i].end(e);i--);for(i--;i>=0;i--)t[i].end(!1)}else this._handlerFb(this._id,"END",e)},e.prototype.start=function(){this.reset(),this._id=-1,this._state=1},e.prototype.put=function(e,t,i){if(3!==this._state){if(1===this._state)for(;t0&&this._put(e,t,i)}},e.prototype.end=function(e){0!==this._state&&(3!==this._state&&(1===this._state&&this._start(),this._end(e)),this._id=-1,this._state=0)},e}();t.OscParser=s;var o=function(){function e(e){this._handler=e,this._data="",this._hitLimit=!1}return e.prototype.start=function(){this._data="",this._hitLimit=!1},e.prototype.put=function(e,t,i){this._hitLimit||(this._data+=n.utf32ToString(e,t,i),this._data.length>r.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))},e.prototype.end=function(e){var t;return this._hitLimit?t=!1:e&&(t=this._handler(this._data)),this._data="",this._hitLimit=!1,t},e}();t.OscHandler=o},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PAYLOAD_LIMIT=void 0,t.PAYLOAD_LIMIT=1e7},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DcsHandler=t.DcsParser=void 0;var r=i(8),n=i(21),s=i(23),o=[],a=function(){function e(){this._handlers=Object.create(null),this._active=o,this._ident=0,this._handlerFb=function(){}}return e.prototype.dispose=function(){this._handlers=Object.create(null),this._handlerFb=function(){}},e.prototype.addHandler=function(e,t){void 0===this._handlers[e]&&(this._handlers[e]=[]);var i=this._handlers[e];return i.push(t),{dispose:function(){var e=i.indexOf(t);-1!==e&&i.splice(e,1)}}},e.prototype.setHandler=function(e,t){this._handlers[e]=[t]},e.prototype.clearHandler=function(e){this._handlers[e]&&delete this._handlers[e]},e.prototype.setHandlerFallback=function(e){this._handlerFb=e},e.prototype.reset=function(){this._active.length&&this.unhook(!1),this._active=o,this._ident=0},e.prototype.hook=function(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||o,this._active.length)for(var i=this._active.length-1;i>=0;i--)this._active[i].hook(t);else this._handlerFb(this._ident,"HOOK",t)},e.prototype.put=function(e,t,i){if(this._active.length)for(var n=this._active.length-1;n>=0;n--)this._active[n].put(e,t,i);else this._handlerFb(this._ident,"PUT",r.utf32ToString(e,t,i))},e.prototype.unhook=function(e){if(this._active.length){for(var t=this._active.length-1;t>=0&&!1===this._active[t].unhook(e);t--);for(t--;t>=0;t--)this._active[t].unhook(!1)}else this._handlerFb(this._ident,"UNHOOK",e);this._active=o,this._ident=0},e}();t.DcsParser=a;var l=function(){function e(e){this._handler=e,this._data="",this._hitLimit=!1}return e.prototype.hook=function(e){this._params=e.clone(),this._data="",this._hitLimit=!1},e.prototype.put=function(e,t,i){this._hitLimit||(this._data+=r.utf32ToString(e,t,i),this._data.length>s.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))},e.prototype.unhook=function(e){var t;return this._hitLimit?t=!1:e&&(t=this._handler(this._data,this._params||new n.Params)),this._params=void 0,this._data="",this._hitLimit=!1,t},e}();t.DcsHandler=l},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.removeTerminalFromCache=t.acquireCharAtlas=void 0;var r=i(26),n=i(43),s=[];t.acquireCharAtlas=function(e,t,i,o,a){for(var l=r.generateConfig(o,a,e,i),c=0;c=0){if(r.configEquals(h.config,l))return h.atlas;1===h.ownedBy.length?(h.atlas.dispose(),s.splice(c,1)):h.ownedBy.splice(u,1);break}}for(c=0;c1)for(var h=this._getJoinedRanges(r,a,s,t,n),d=0;d1)for(h=this._getJoinedRanges(r,a,s,t,n),d=0;d=this._line.length))return t?(this._line.loadCell(e,t),t):this._line.loadCell(e,new r.CellData)},e.prototype.translateToString=function(e,t,i){return this._line.translateToString(e,t,i)},e}(),d=function(){function e(e){this._core=e}return e.prototype.registerCsiHandler=function(e,t){return this._core.addCsiHandler(e,(function(e){return t(e.toArray())}))},e.prototype.addCsiHandler=function(e,t){return this.registerCsiHandler(e,t)},e.prototype.registerDcsHandler=function(e,t){return this._core.addDcsHandler(e,(function(e,i){return t(e,i.toArray())}))},e.prototype.addDcsHandler=function(e,t){return this.registerDcsHandler(e,t)},e.prototype.registerEscHandler=function(e,t){return this._core.addEscHandler(e,t)},e.prototype.addEscHandler=function(e,t){return this.registerEscHandler(e,t)},e.prototype.registerOscHandler=function(e,t){return this._core.addOscHandler(e,t)},e.prototype.addOscHandler=function(e,t){return this.registerOscHandler(e,t)},e}(),f=function(){function e(e){this._core=e}return e.prototype.register=function(e){this._core.unicodeService.register(e)},Object.defineProperty(e.prototype,"versions",{get:function(){return this._core.unicodeService.versions},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"activeVersion",{get:function(){return this._core.unicodeService.activeVersion},set:function(e){this._core.unicodeService.activeVersion=e},enumerable:!1,configurable:!0}),e}()},function(e,t,i){"use strict";var r,n=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)},function(e,t){function i(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)});Object.defineProperty(t,"__esModule",{value:!0}),t.Terminal=void 0;var s=i(36),o=i(37),a=i(38),l=i(12),c=i(19),u=i(40),h=i(50),d=i(51),f=i(11),p=i(7),g=i(18),v=i(54),m=i(55),y=i(56),_=i(57),b=i(59),S=i(0),C=i(16),w=i(27),k=i(60),x=i(5),E=i(61),T=i(62),L=i(63),A=i(64),R=i(65),D="undefined"!=typeof window?window.document:null,O=function(e){function t(t){void 0===t&&(t={});var i=e.call(this,t)||this;return i.browser=f,i._keyDownHandled=!1,i._onCursorMove=new S.EventEmitter,i._onKey=new S.EventEmitter,i._onRender=new S.EventEmitter,i._onSelectionChange=new S.EventEmitter,i._onTitleChange=new S.EventEmitter,i._onFocus=new S.EventEmitter,i._onBlur=new S.EventEmitter,i._onA11yCharEmitter=new S.EventEmitter,i._onA11yTabEmitter=new S.EventEmitter,i._setup(),i.linkifier=i._instantiationService.createInstance(h.Linkifier),i.linkifier2=i.register(i._instantiationService.createInstance(L.Linkifier2)),i.register(i._inputHandler.onRequestBell((function(){return i.bell()}))),i.register(i._inputHandler.onRequestRefreshRows((function(e,t){return i.refresh(e,t)}))),i.register(i._inputHandler.onRequestReset((function(){return i.reset()}))),i.register(i._inputHandler.onRequestScroll((function(e,t){return i.scroll(e,t||void 0)}))),i.register(i._inputHandler.onRequestWindowsOptionsReport((function(e){return i._reportWindowsOptions(e)}))),i.register(S.forwardEvent(i._inputHandler.onCursorMove,i._onCursorMove)),i.register(S.forwardEvent(i._inputHandler.onTitleChange,i._onTitleChange)),i.register(S.forwardEvent(i._inputHandler.onA11yChar,i._onA11yCharEmitter)),i.register(S.forwardEvent(i._inputHandler.onA11yTab,i._onA11yTabEmitter)),i.register(i._bufferService.onResize((function(e){return i._afterResize(e.cols,e.rows)}))),i}return n(t,e),Object.defineProperty(t.prototype,"options",{get:function(){return this.optionsService.options},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onCursorMove",{get:function(){return this._onCursorMove.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onKey",{get:function(){return this._onKey.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onRender",{get:function(){return this._onRender.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onSelectionChange",{get:function(){return this._onSelectionChange.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onTitleChange",{get:function(){return this._onTitleChange.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onFocus",{get:function(){return this._onFocus.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onBlur",{get:function(){return this._onBlur.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onA11yChar",{get:function(){return this._onA11yCharEmitter.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onA11yTab",{get:function(){return this._onA11yTabEmitter.event},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){var t,i,r;this._isDisposed||(e.prototype.dispose.call(this),null===(t=this._renderService)||void 0===t||t.dispose(),this._customKeyEventHandler=void 0,this.write=function(){},null===(r=null===(i=this.element)||void 0===i?void 0:i.parentNode)||void 0===r||r.removeChild(this.element))},t.prototype._setup=function(){e.prototype._setup.call(this),this._customKeyEventHandler=void 0},Object.defineProperty(t.prototype,"buffer",{get:function(){return this.buffers.active},enumerable:!1,configurable:!0}),t.prototype.focus=function(){this.textarea&&this.textarea.focus({preventScroll:!0})},t.prototype._updateOptions=function(t){var i,r,n,s;switch(e.prototype._updateOptions.call(this,t),t){case"fontFamily":case"fontSize":null===(i=this._renderService)||void 0===i||i.clear(),null===(r=this._charSizeService)||void 0===r||r.measure();break;case"cursorBlink":case"cursorStyle":this.refresh(this.buffer.y,this.buffer.y);break;case"drawBoldTextInBrightColors":case"letterSpacing":case"lineHeight":case"fontWeight":case"fontWeightBold":case"minimumContrastRatio":this._renderService&&(this._renderService.clear(),this._renderService.onResize(this.cols,this.rows),this.refresh(0,this.rows-1));break;case"rendererType":this._renderService&&(this._renderService.setRenderer(this._createRenderer()),this._renderService.onResize(this.cols,this.rows));break;case"scrollback":null===(n=this.viewport)||void 0===n||n.syncScrollArea();break;case"screenReaderMode":this.optionsService.options.screenReaderMode?!this._accessibilityManager&&this._renderService&&(this._accessibilityManager=new y.AccessibilityManager(this,this._renderService)):(null===(s=this._accessibilityManager)||void 0===s||s.dispose(),this._accessibilityManager=void 0);break;case"tabStopWidth":this.buffers.setupTabStops();break;case"theme":this._setTheme(this.optionsService.options.theme)}},t.prototype._onTextAreaFocus=function(e){this._coreService.decPrivateModes.sendFocus&&this._coreService.triggerDataEvent(l.C0.ESC+"[I"),this.updateCursorStyle(e),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()},t.prototype.blur=function(){var e;return null===(e=this.textarea)||void 0===e?void 0:e.blur()},t.prototype._onTextAreaBlur=function(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this._coreService.decPrivateModes.sendFocus&&this._coreService.triggerDataEvent(l.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()},t.prototype._syncTextArea=function(){if(this.textarea&&this.buffer.isCursorInViewport&&!this._compositionHelper.isComposing){var e=Math.ceil(this._charSizeService.height*this.optionsService.options.lineHeight),t=this._bufferService.buffer.y*e,i=this._bufferService.buffer.x*this._charSizeService.width;this.textarea.style.left=i+"px",this.textarea.style.top=t+"px",this.textarea.style.width=this._charSizeService.width+"px",this.textarea.style.height=e+"px",this.textarea.style.lineHeight=e+"px",this.textarea.style.zIndex="-5"}},t.prototype._initGlobal=function(){var e=this;this._bindKeys(),this.register(p.addDisposableDomListener(this.element,"copy",(function(t){e.hasSelection()&&a.copyHandler(t,e._selectionService)})));var t=function(t){return a.handlePasteEvent(t,e.textarea,e._coreService)};this.register(p.addDisposableDomListener(this.textarea,"paste",t)),this.register(p.addDisposableDomListener(this.element,"paste",t)),f.isFirefox?this.register(p.addDisposableDomListener(this.element,"mousedown",(function(t){2===t.button&&a.rightClickHandler(t,e.textarea,e.screenElement,e._selectionService,e.options.rightClickSelectsWord)}))):this.register(p.addDisposableDomListener(this.element,"contextmenu",(function(t){a.rightClickHandler(t,e.textarea,e.screenElement,e._selectionService,e.options.rightClickSelectsWord)}))),f.isLinux&&this.register(p.addDisposableDomListener(this.element,"auxclick",(function(t){1===t.button&&a.moveTextAreaUnderMouseCursor(t,e.textarea,e.screenElement)})))},t.prototype._bindKeys=function(){var e=this;this.register(p.addDisposableDomListener(this.textarea,"keyup",(function(t){return e._keyUp(t)}),!0)),this.register(p.addDisposableDomListener(this.textarea,"keydown",(function(t){return e._keyDown(t)}),!0)),this.register(p.addDisposableDomListener(this.textarea,"keypress",(function(t){return e._keyPress(t)}),!0)),this.register(p.addDisposableDomListener(this.textarea,"compositionstart",(function(){return e._compositionHelper.compositionstart()}))),this.register(p.addDisposableDomListener(this.textarea,"compositionupdate",(function(t){return e._compositionHelper.compositionupdate(t)}))),this.register(p.addDisposableDomListener(this.textarea,"compositionend",(function(){return e._compositionHelper.compositionend()}))),this.register(this.onRender((function(){return e._compositionHelper.updateCompositionElements()}))),this.register(this.onRender((function(t){return e._queueLinkification(t.start,t.end)})))},t.prototype.open=function(e){var t=this;if(!e)throw new Error("Terminal requires a parent element.");D.body.contains(e)||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this._document=e.ownerDocument,this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),this.element.setAttribute("tabindex","0"),e.appendChild(this.element);var i=D.createDocumentFragment();this._viewportElement=D.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),i.appendChild(this._viewportElement),this._viewportScrollArea=D.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=D.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._helperContainer=D.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),i.appendChild(this.screenElement),this.textarea=D.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",g.promptLabel),this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this.register(p.addDisposableDomListener(this.textarea,"focus",(function(e){return t._onTextAreaFocus(e)}))),this.register(p.addDisposableDomListener(this.textarea,"blur",(function(){return t._onTextAreaBlur()}))),this._helperContainer.appendChild(this.textarea);var r=this._instantiationService.createInstance(A.CoreBrowserService,this.textarea);this._instantiationService.setService(x.ICoreBrowserService,r),this._charSizeService=this._instantiationService.createInstance(E.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(x.ICharSizeService,this._charSizeService),this._compositionView=D.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(s.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this.element.appendChild(i),this._theme=this.options.theme||this._theme,this._colorManager=new w.ColorManager(D,this.options.allowTransparency),this.register(this.optionsService.onOptionChange((function(e){return t._colorManager.onOptionsChange(e)}))),this._colorManager.setTheme(this._theme);var n=this._createRenderer();this._renderService=this.register(this._instantiationService.createInstance(k.RenderService,n,this.rows,this.screenElement)),this._instantiationService.setService(x.IRenderService,this._renderService),this.register(this._renderService.onRenderedBufferChange((function(e){return t._onRender.fire(e)}))),this.onResize((function(e){return t._renderService.resize(e.cols,e.rows)})),this._soundService=this._instantiationService.createInstance(v.SoundService),this._instantiationService.setService(x.ISoundService,this._soundService),this._mouseService=this._instantiationService.createInstance(T.MouseService),this._instantiationService.setService(x.IMouseService,this._mouseService),this.viewport=this._instantiationService.createInstance(o.Viewport,(function(e,i){return t.scrollLines(e,i)}),this._viewportElement,this._viewportScrollArea),this.viewport.onThemeChange(this._colorManager.colors),this.register(this._inputHandler.onRequestSyncScrollBar((function(){return t.viewport.syncScrollArea()}))),this.register(this.viewport),this.register(this.onCursorMove((function(){t._renderService.onCursorMove(),t._syncTextArea()}))),this.register(this.onResize((function(){return t._renderService.onResize(t.cols,t.rows)}))),this.register(this.onBlur((function(){return t._renderService.onBlur()}))),this.register(this.onFocus((function(){return t._renderService.onFocus()}))),this.register(this._renderService.onDimensionsChange((function(){return t.viewport.syncScrollArea()}))),this._selectionService=this.register(this._instantiationService.createInstance(d.SelectionService,this.element,this.screenElement)),this._instantiationService.setService(x.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((function(e){return t.scrollLines(e.amount,e.suppressScrollEvent)}))),this.register(this._selectionService.onSelectionChange((function(){return t._onSelectionChange.fire()}))),this.register(this._selectionService.onRequestRedraw((function(e){return t._renderService.onSelectionChanged(e.start,e.end,e.columnSelectMode)}))),this.register(this._selectionService.onLinuxMouseSelection((function(e){t.textarea.value=e,t.textarea.focus(),t.textarea.select()}))),this.register(this.onScroll((function(){t.viewport.syncScrollArea(),t._selectionService.refresh()}))),this.register(p.addDisposableDomListener(this._viewportElement,"scroll",(function(){return t._selectionService.refresh()}))),this._mouseZoneManager=this._instantiationService.createInstance(m.MouseZoneManager,this.element,this.screenElement),this.register(this._mouseZoneManager),this.register(this.onScroll((function(){return t._mouseZoneManager.clearAll()}))),this.linkifier.attachToDom(this.element,this._mouseZoneManager),this.linkifier2.attachToDom(this.element,this._mouseService,this._renderService),this.register(p.addDisposableDomListener(this.element,"mousedown",(function(e){return t._selectionService.onMouseDown(e)}))),this._coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager=new y.AccessibilityManager(this,this._renderService)),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()},t.prototype._createRenderer=function(){switch(this.options.rendererType){case"canvas":return this._instantiationService.createInstance(u.Renderer,this._colorManager.colors,this.screenElement,this.linkifier,this.linkifier2);case"dom":return this._instantiationService.createInstance(_.DomRenderer,this._colorManager.colors,this.element,this.screenElement,this._viewportElement,this.linkifier,this.linkifier2);default:throw new Error('Unrecognized rendererType "'+this.options.rendererType+'"')}},t.prototype._setTheme=function(e){var t,i,r;this._theme=e,null===(t=this._colorManager)||void 0===t||t.setTheme(e),null===(i=this._renderService)||void 0===i||i.setColors(this._colorManager.colors),null===(r=this.viewport)||void 0===r||r.onThemeChange(this._colorManager.colors)},t.prototype.bindMouse=function(){var e=this,t=this,i=this.element;function r(e){var i,r,n=t._mouseService.getRawByteCoords(e,t.screenElement,t.cols,t.rows);if(!n)return!1;switch(e.overrideType||e.type){case"mousemove":r=32,void 0===e.buttons?(i=3,void 0!==e.button&&(i=e.button<3?e.button:3)):i=1&e.buttons?0:4&e.buttons?1:2&e.buttons?2:3;break;case"mouseup":r=0,i=e.button<3?e.button:3;break;case"mousedown":r=1,i=e.button<3?e.button:3;break;case"wheel":0!==e.deltaY&&(r=e.deltaY<0?0:1),i=4;break;default:return!1}return!(void 0===r||void 0===i||i>4)&&t._coreMouseService.triggerMouseEvent({col:n.x-33,row:n.y-33,button:i,action:r,ctrl:e.ctrlKey,alt:e.altKey,shift:e.shiftKey})}var n={mouseup:null,wheel:null,mousedrag:null,mousemove:null},s=function(t){return r(t),t.buttons||(e._document.removeEventListener("mouseup",n.mouseup),n.mousedrag&&e._document.removeEventListener("mousemove",n.mousedrag)),e.cancel(t)},o=function(t){return r(t),t.preventDefault(),e.cancel(t)},a=function(e){e.buttons&&r(e)},c=function(e){e.buttons||r(e)};this.register(this._coreMouseService.onProtocolChange((function(t){t?("debug"===e.optionsService.options.logLevel&&e._logService.debug("Binding to mouse events:",e._coreMouseService.explainEvents(t)),e.element.classList.add("enable-mouse-events"),e._selectionService.disable()):(e._logService.debug("Unbinding from mouse events."),e.element.classList.remove("enable-mouse-events"),e._selectionService.enable()),8&t?n.mousemove||(i.addEventListener("mousemove",c),n.mousemove=c):(i.removeEventListener("mousemove",n.mousemove),n.mousemove=null),16&t?n.wheel||(i.addEventListener("wheel",o,{passive:!1}),n.wheel=o):(i.removeEventListener("wheel",n.wheel),n.wheel=null),2&t?n.mouseup||(n.mouseup=s):(e._document.removeEventListener("mouseup",n.mouseup),n.mouseup=null),4&t?n.mousedrag||(n.mousedrag=a):(e._document.removeEventListener("mousemove",n.mousedrag),n.mousedrag=null)}))),this._coreMouseService.activeProtocol=this._coreMouseService.activeProtocol,this.register(p.addDisposableDomListener(i,"mousedown",(function(t){if(t.preventDefault(),e.focus(),e._coreMouseService.areMouseEventsActive&&!e._selectionService.shouldForceSelection(t))return r(t),n.mouseup&&e._document.addEventListener("mouseup",n.mouseup),n.mousedrag&&e._document.addEventListener("mousemove",n.mousedrag),e.cancel(t)}))),this.register(p.addDisposableDomListener(i,"wheel",(function(t){if(n.wheel);else if(!e.buffer.hasScrollback){var i=e.viewport.getLinesScrolled(t);if(0===i)return;for(var r=l.C0.ESC+(e._coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(t.deltaY<0?"A":"B"),s="",o=0;o47)},t.prototype._keyUp=function(e){this._customKeyEventHandler&&!1===this._customKeyEventHandler(e)||(function(e){return 16===e.keyCode||17===e.keyCode||18===e.keyCode}(e)||this.focus(),this.updateCursorStyle(e))},t.prototype._keyPress=function(e){var t;if(this._keyDownHandled)return!1;if(this._customKeyEventHandler&&!1===this._customKeyEventHandler(e))return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(null===e.which||void 0===e.which)t=e.keyCode;else{if(0===e.which||0===e.charCode)return!1;t=e.which}return!(!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)||(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this._coreService.triggerDataEvent(t,!0),0))},t.prototype.bell=function(){this._soundBell()&&this._soundService.playBellSound()},t.prototype.resize=function(t,i){t!==this.cols||i!==this.rows?e.prototype.resize.call(this,t,i):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()},t.prototype._afterResize=function(e,t){var i,r;null===(i=this._charSizeService)||void 0===i||i.measure(),null===(r=this.viewport)||void 0===r||r.syncScrollArea(!0)},t.prototype.clear=function(){if(0!==this.buffer.ybase||0!==this.buffer.y){this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(var e=1;e=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,i,o):n(t,i))||o);return s>3&&o&&Object.defineProperty(t,i,o),o},n=this&&this.__param||function(e,t){return function(i,r){t(i,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CompositionHelper=void 0;var s=i(5),o=i(1),a=function(){function e(e,t,i,r,n,s){this._textarea=e,this._compositionView=t,this._bufferService=i,this._optionsService=r,this._charSizeService=n,this._coreService=s,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0}}return Object.defineProperty(e.prototype,"isComposing",{get:function(){return this._isComposing},enumerable:!1,configurable:!0}),e.prototype.compositionstart=function(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._compositionView.classList.add("active")},e.prototype.compositionupdate=function(e){var t=this;this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout((function(){t._compositionPosition.end=t._textarea.value.length}),0)},e.prototype.compositionend=function(){this._finalizeComposition(!0)},e.prototype.keydown=function(e){if(this._isComposing||this._isSendingComposition){if(229===e.keyCode)return!1;if(16===e.keyCode||17===e.keyCode||18===e.keyCode)return!1;this._finalizeComposition(!1)}return 229!==e.keyCode||(this._handleAnyTextareaChanges(),!1)},e.prototype._finalizeComposition=function(e){var t=this;if(this._compositionView.classList.remove("active"),this._isComposing=!1,e){var i={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((function(){var e;t._isSendingComposition&&(t._isSendingComposition=!1,e=t._isComposing?t._textarea.value.substring(i.start,i.end):t._textarea.value.substring(i.start),t._coreService.triggerDataEvent(e,!0))}),0)}else{this._isSendingComposition=!1;var r=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(r,!0)}},e.prototype._handleAnyTextareaChanges=function(){var e=this,t=this._textarea.value;setTimeout((function(){if(!e._isComposing){var i=e._textarea.value.replace(t,"");i.length>0&&e._coreService.triggerDataEvent(i,!0)}}),0)},e.prototype.updateCompositionElements=function(e){var t=this;if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){var i=Math.ceil(this._charSizeService.height*this._optionsService.options.lineHeight),r=this._bufferService.buffer.y*i,n=this._bufferService.buffer.x*this._charSizeService.width;this._compositionView.style.left=n+"px",this._compositionView.style.top=r+"px",this._compositionView.style.height=i+"px",this._compositionView.style.lineHeight=i+"px",this._compositionView.style.fontFamily=this._optionsService.options.fontFamily,this._compositionView.style.fontSize=this._optionsService.options.fontSize+"px";var s=this._compositionView.getBoundingClientRect();this._textarea.style.left=n+"px",this._textarea.style.top=r+"px",this._textarea.style.width=s.width+"px",this._textarea.style.height=s.height+"px",this._textarea.style.lineHeight=s.height+"px"}e||setTimeout((function(){return t.updateCompositionElements(!0)}),0)}},r([n(2,o.IBufferService),n(3,o.IOptionsService),n(4,s.ICharSizeService),n(5,o.ICoreService)],e)}();t.CompositionHelper=a},function(e,t,i){"use strict";var r,n=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)},function(e,t){function i(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}),s=this&&this.__decorate||function(e,t,i,r){var n,s=arguments.length,o=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,r);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,i,o):n(t,i))||o);return s>3&&o&&Object.defineProperty(t,i,o),o},o=this&&this.__param||function(e,t){return function(i,r){t(i,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Viewport=void 0;var a=i(2),l=i(7),c=i(5),u=i(1),h=function(e){function t(t,i,r,n,s,o,a){var c=e.call(this)||this;return c._scrollLines=t,c._viewportElement=i,c._scrollArea=r,c._bufferService=n,c._optionsService=s,c._charSizeService=o,c._renderService=a,c.scrollBarWidth=0,c._currentRowHeight=0,c._lastRecordedBufferLength=0,c._lastRecordedViewportHeight=0,c._lastRecordedBufferHeight=0,c._lastTouchY=0,c._lastScrollTop=0,c._wheelPartialScroll=0,c._refreshAnimationFrame=null,c._ignoreNextScrollEvent=!1,c.scrollBarWidth=c._viewportElement.offsetWidth-c._scrollArea.offsetWidth||15,c.register(l.addDisposableDomListener(c._viewportElement,"scroll",c._onScroll.bind(c))),setTimeout((function(){return c.syncScrollArea()}),0),c}return n(t,e),t.prototype.onThemeChange=function(e){this._viewportElement.style.backgroundColor=e.background.css},t.prototype._refresh=function(e){var t=this;if(e)return this._innerRefresh(),void(null!==this._refreshAnimationFrame&&cancelAnimationFrame(this._refreshAnimationFrame));null===this._refreshAnimationFrame&&(this._refreshAnimationFrame=requestAnimationFrame((function(){return t._innerRefresh()})))},t.prototype._innerRefresh=function(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderService.dimensions.scaledCellHeight/window.devicePixelRatio,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;var e=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderService.dimensions.canvasHeight);this._lastRecordedBufferHeight!==e&&(this._lastRecordedBufferHeight=e,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}var t=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==t&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=t),this._refreshAnimationFrame=null},t.prototype.syncScrollArea=function(e){if(void 0===e&&(e=!1),this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(e);if(this._lastRecordedViewportHeight===this._renderService.dimensions.canvasHeight){var t=this._bufferService.buffer.ydisp*this._currentRowHeight;this._lastScrollTop===t&&this._lastScrollTop===this._viewportElement.scrollTop&&this._renderService.dimensions.scaledCellHeight/window.devicePixelRatio===this._currentRowHeight||this._refresh(e)}else this._refresh(e)},t.prototype._onScroll=function(e){if(this._lastScrollTop=this._viewportElement.scrollTop,this._viewportElement.offsetParent)if(this._ignoreNextScrollEvent)this._ignoreNextScrollEvent=!1;else{var t=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._scrollLines(t,!0)}},t.prototype._bubbleScroll=function(e,t){var i=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(t<0&&0!==this._viewportElement.scrollTop||t>0&&i0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(t*=this._bufferService.rows),t},t.prototype._applyScrollModifier=function(e,t){var i=this._optionsService.options.fastScrollModifier;return"alt"===i&&t.altKey||"ctrl"===i&&t.ctrlKey||"shift"===i&&t.shiftKey?e*this._optionsService.options.fastScrollSensitivity*this._optionsService.options.scrollSensitivity:e*this._optionsService.options.scrollSensitivity},t.prototype.onTouchStart=function(e){this._lastTouchY=e.touches[0].pageY},t.prototype.onTouchMove=function(e){var t=this._lastTouchY-e.touches[0].pageY;return this._lastTouchY=e.touches[0].pageY,0!==t&&(this._viewportElement.scrollTop+=t,this._bubbleScroll(e,t))},s([o(3,u.IBufferService),o(4,u.IOptionsService),o(5,c.ICharSizeService),o(6,c.IRenderService)],t)}(a.Disposable);t.Viewport=h},function(e,t,i){"use strict";function r(e){return e.replace(/\r?\n/g,"\r")}function n(e,t){return t?"[200~"+e+"[201~":e}function s(e,t,i){e=n(e=r(e),i.decPrivateModes.bracketedPasteMode),i.triggerDataEvent(e,!0),t.value=""}function o(e,t,i){var r=i.getBoundingClientRect(),n=e.clientX-r.left-10,s=e.clientY-r.top-10;t.style.width="20px",t.style.height="20px",t.style.left=n+"px",t.style.top=s+"px",t.style.zIndex="1000",t.focus()}Object.defineProperty(t,"__esModule",{value:!0}),t.rightClickHandler=t.moveTextAreaUnderMouseCursor=t.paste=t.handlePasteEvent=t.copyHandler=t.bracketTextForPaste=t.prepareTextForTerminal=void 0,t.prepareTextForTerminal=r,t.bracketTextForPaste=n,t.copyHandler=function(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()},t.handlePasteEvent=function(e,t,i){e.stopPropagation(),e.clipboardData&&s(e.clipboardData.getData("text/plain"),t,i)},t.paste=s,t.moveTextAreaUnderMouseCursor=o,t.rightClickHandler=function(e,t,i,r,n){o(e,t,i),n&&!r.isClickInSelection(e)&&r.selectWordAtCursor(e),t.value=r.selectionText,t.select()}},function(e,t,i){"use strict";var r,n=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)},function(e,t){function i(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)});Object.defineProperty(t,"__esModule",{value:!0}),t.EscapeSequenceParser=t.VT500_TRANSITION_TABLE=t.TransitionTable=void 0;var s=i(2),o=i(15),a=i(21),l=i(22),c=i(24),u=function(){function e(e){this.table=new Uint8Array(e)}return e.prototype.setDefault=function(e,t){o.fill(this.table,e<<4|t)},e.prototype.add=function(e,t,i,r){this.table[t<<8|e]=i<<4|r},e.prototype.addMany=function(e,t,i,r){for(var n=0;n1)throw new Error("only one byte as prefix supported");if((i=e.prefix.charCodeAt(0))&&60>i||i>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(var r=0;rn||n>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");i<<=8,i|=n}}if(1!==e.final.length)throw new Error("final must be a single byte");var s=e.final.charCodeAt(0);if(t[0]>s||s>t[1])throw new Error("final must be in range "+t[0]+" .. "+t[1]);return(i<<=8)|s},i.prototype.identToString=function(e){for(var t=[];e;)t.push(String.fromCharCode(255&e)),e>>=8;return t.reverse().join("")},i.prototype.dispose=function(){this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null),this._oscParser.dispose(),this._dcsParser.dispose()},i.prototype.setPrintHandler=function(e){this._printHandler=e},i.prototype.clearPrintHandler=function(){this._printHandler=this._printHandlerFb},i.prototype.addEscHandler=function(e,t){var i=this._identifier(e,[48,126]);void 0===this._escHandlers[i]&&(this._escHandlers[i]=[]);var r=this._escHandlers[i];return r.push(t),{dispose:function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}}},i.prototype.setEscHandler=function(e,t){this._escHandlers[this._identifier(e,[48,126])]=[t]},i.prototype.clearEscHandler=function(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]},i.prototype.setEscHandlerFallback=function(e){this._escHandlerFb=e},i.prototype.setExecuteHandler=function(e,t){this._executeHandlers[e.charCodeAt(0)]=t},i.prototype.clearExecuteHandler=function(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]},i.prototype.setExecuteHandlerFallback=function(e){this._executeHandlerFb=e},i.prototype.addCsiHandler=function(e,t){var i=this._identifier(e);void 0===this._csiHandlers[i]&&(this._csiHandlers[i]=[]);var r=this._csiHandlers[i];return r.push(t),{dispose:function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}}},i.prototype.setCsiHandler=function(e,t){this._csiHandlers[this._identifier(e)]=[t]},i.prototype.clearCsiHandler=function(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]},i.prototype.setCsiHandlerFallback=function(e){this._csiHandlerFb=e},i.prototype.addDcsHandler=function(e,t){return this._dcsParser.addHandler(this._identifier(e),t)},i.prototype.setDcsHandler=function(e,t){this._dcsParser.setHandler(this._identifier(e),t)},i.prototype.clearDcsHandler=function(e){this._dcsParser.clearHandler(this._identifier(e))},i.prototype.setDcsHandlerFallback=function(e){this._dcsParser.setHandlerFallback(e)},i.prototype.addOscHandler=function(e,t){return this._oscParser.addHandler(e,t)},i.prototype.setOscHandler=function(e,t){this._oscParser.setHandler(e,t)},i.prototype.clearOscHandler=function(e){this._oscParser.clearHandler(e)},i.prototype.setOscHandlerFallback=function(e){this._oscParser.setHandlerFallback(e)},i.prototype.setErrorHandler=function(e){this._errorHandler=e},i.prototype.clearErrorHandler=function(){this._errorHandler=this._errorHandlerFb},i.prototype.reset=function(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingCodepoint=0},i.prototype.parse=function(e,t){for(var i=0,r=0,n=this.currentState,s=this._oscParser,o=this._dcsParser,a=this._collect,l=this._params,c=this._transitions.table,u=0;u>4){case 2:for(var h=u+1;;++h){if(h>=t||(i=e[h])<32||i>126&&i<160){this._printHandler(e,u,h),u=h-1;break}if(++h>=t||(i=e[h])<32||i>126&&i<160){this._printHandler(e,u,h),u=h-1;break}if(++h>=t||(i=e[h])<32||i>126&&i<160){this._printHandler(e,u,h),u=h-1;break}if(++h>=t||(i=e[h])<32||i>126&&i<160){this._printHandler(e,u,h),u=h-1;break}}break;case 3:this._executeHandlers[i]?this._executeHandlers[i]():this._executeHandlerFb(i),this.precedingCodepoint=0;break;case 0:break;case 1:if(this._errorHandler({position:u,code:i,currentState:n,collect:a,params:l,abort:!1}).abort)return;break;case 7:for(var d=this._csiHandlers[a<<8|i],f=d?d.length-1:-1;f>=0&&!1===d[f](l);f--);f<0&&this._csiHandlerFb(a<<8|i,l),this.precedingCodepoint=0;break;case 8:do{switch(i){case 59:l.addParam(0);break;case 58:l.addSubParam(-1);break;default:l.addDigit(i-48)}}while(++u47&&i<60);u--;break;case 9:a<<=8,a|=i;break;case 10:for(var p=this._escHandlers[a<<8|i],g=p?p.length-1:-1;g>=0&&!1===p[g]();g--);g<0&&this._escHandlerFb(a<<8|i),this.precedingCodepoint=0;break;case 11:l.reset(),l.addParam(0),a=0;break;case 12:o.hook(a<<8|i,l);break;case 13:for(var v=u+1;;++v)if(v>=t||24===(i=e[v])||26===i||27===i||i>127&&i<160){o.put(e,u,v),u=v-1;break}break;case 14:o.unhook(24!==i&&26!==i),27===i&&(r|=1),l.reset(),l.addParam(0),a=0,this.precedingCodepoint=0;break;case 4:s.start();break;case 5:for(var m=u+1;;m++)if(m>=t||(i=e[m])<32||i>127&&i<=159){s.put(e,u,m),u=m-1;break}break;case 6:s.end(24!==i&&26!==i),27===i&&(r|=1),l.reset(),l.addParam(0),a=0,this.precedingCodepoint=0}n=15&r}this._collect=a,this.currentState=n},i}(s.Disposable);t.EscapeSequenceParser=h},function(e,t,i){"use strict";var r,n=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)},function(e,t){function i(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}),s=this&&this.__decorate||function(e,t,i,r){var n,s=arguments.length,o=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,r);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,i,o):n(t,i))||o);return s>3&&o&&Object.defineProperty(t,i,o),o},o=this&&this.__param||function(e,t){return function(i,r){t(i,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Renderer=void 0;var a=i(41),l=i(47),c=i(48),u=i(49),h=i(29),d=i(2),f=i(5),p=i(1),g=i(25),v=i(0),m=1,y=function(e){function t(t,i,r,n,s,o,d,f,p){var g=e.call(this)||this;g._colors=t,g._screenElement=i,g._bufferService=s,g._charSizeService=o,g._optionsService=d,g._id=m++,g._onRequestRedraw=new v.EventEmitter;var y=g._optionsService.options.allowTransparency;return g._characterJoinerRegistry=new h.CharacterJoinerRegistry(g._bufferService),g._renderLayers=[new a.TextRenderLayer(g._screenElement,0,g._colors,g._characterJoinerRegistry,y,g._id,g._bufferService,d),new l.SelectionRenderLayer(g._screenElement,1,g._colors,g._id,g._bufferService,d),new u.LinkRenderLayer(g._screenElement,2,g._colors,g._id,r,n,g._bufferService,d),new c.CursorRenderLayer(g._screenElement,3,g._colors,g._id,g._onRequestRedraw,g._bufferService,d,f,p)],g.dimensions={scaledCharWidth:0,scaledCharHeight:0,scaledCellWidth:0,scaledCellHeight:0,scaledCharLeft:0,scaledCharTop:0,scaledCanvasWidth:0,scaledCanvasHeight:0,canvasWidth:0,canvasHeight:0,actualCellWidth:0,actualCellHeight:0},g._devicePixelRatio=window.devicePixelRatio,g._updateDimensions(),g.onOptionsChanged(),g}return n(t,e),Object.defineProperty(t.prototype,"onRequestRedraw",{get:function(){return this._onRequestRedraw.event},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){for(var t=0,i=this._renderLayers;t0&&u===a[0][0]){d=!0;var p=a.shift();h=new c.JoinedCellData(this._workCell,o.translateToString(!0,p[0],p[1]),p[1]-p[0]),f=p[1]-1}!d&&this._isOverlapping(h)&&fthis._characterWidth;return this._ctx.restore(),this._characterOverlapCache[t]=i,i},t}(o.BaseRenderLayer);t.TextRenderLayer=h},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.GridCache=void 0;var r=function(){function e(){this.cache=[]}return e.prototype.resize=function(e,t){for(var i=0;i>>24,n=t.rgba>>>16&255,s=t.rgba>>>8&255,o=0;o=this.capacity)i=this._head,this._unlinkNode(i),delete this._map[i.key],i.key=e,i.value=t,this._map[e]=i;else{var r=this._nodePool;r.length>0?((i=r.pop()).key=e,i.value=t):i={prev:null,next:null,key:e,value:t},this._map[e]=i,this.size++}this._appendNode(i)},e}();t.LRUMap=r},function(e,t,i){"use strict";var r,n=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)},function(e,t){function i(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)});Object.defineProperty(t,"__esModule",{value:!0}),t.SelectionRenderLayer=void 0;var s=function(e){function t(t,i,r,n,s,o){var a=e.call(this,t,"selection",i,!0,r,n,s,o)||this;return a._clearState(),a}return n(t,e),t.prototype._clearState=function(){this._state={start:void 0,end:void 0,columnSelectMode:void 0,ydisp:void 0}},t.prototype.resize=function(t){e.prototype.resize.call(this,t),this._clearState()},t.prototype.reset=function(){this._state.start&&this._state.end&&(this._clearState(),this._clearAll())},t.prototype.onSelectionChanged=function(e,t,i){if(this._didStateChange(e,t,i,this._bufferService.buffer.ydisp))if(this._clearAll(),e&&t){var r=e[1]-this._bufferService.buffer.ydisp,n=t[1]-this._bufferService.buffer.ydisp,s=Math.max(r,0),o=Math.min(n,this._bufferService.rows-1);if(!(s>=this._bufferService.rows||o<0)){if(this._ctx.fillStyle=this._colors.selectionTransparent.css,i){var a=e[0],l=t[0]-a,c=o-s+1;this._fillCells(a,s,l,c)}else{a=r===s?e[0]:0;var u=s===o?t[0]:this._bufferService.cols;this._fillCells(a,s,u-a,1);var h=Math.max(o-s-1,0);if(this._fillCells(0,s+1,this._bufferService.cols,h),s!==o){var d=n===o?t[0]:this._bufferService.cols;this._fillCells(0,o,d,1)}}this._state.start=[e[0],e[1]],this._state.end=[t[0],t[1]],this._state.columnSelectMode=i,this._state.ydisp=this._bufferService.buffer.ydisp}}else this._clearState()},t.prototype._didStateChange=function(e,t,i,r){return!this._areCoordinatesEqual(e,this._state.start)||!this._areCoordinatesEqual(t,this._state.end)||i!==this._state.columnSelectMode||r!==this._state.ydisp},t.prototype._areCoordinatesEqual=function(e,t){return!(!e||!t)&&e[0]===t[0]&&e[1]===t[1]},t}(i(13).BaseRenderLayer);t.SelectionRenderLayer=s},function(e,t,i){"use strict";var r,n=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)},function(e,t){function i(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)});Object.defineProperty(t,"__esModule",{value:!0}),t.CursorRenderLayer=void 0;var s=i(13),o=i(4),a=function(e){function t(t,i,r,n,s,a,l,c,u){var h=e.call(this,t,"cursor",i,!0,r,n,a,l)||this;return h._onRequestRedraw=s,h._coreService=c,h._coreBrowserService=u,h._cell=new o.CellData,h._state={x:0,y:0,isFocused:!1,style:"",width:0},h._cursorRenderers={bar:h._renderBarCursor.bind(h),block:h._renderBlockCursor.bind(h),underline:h._renderUnderlineCursor.bind(h)},h}return n(t,e),t.prototype.resize=function(t){e.prototype.resize.call(this,t),this._state={x:0,y:0,isFocused:!1,style:"",width:0}},t.prototype.reset=function(){this._clearCursor(),this._cursorBlinkStateManager&&(this._cursorBlinkStateManager.dispose(),this._cursorBlinkStateManager=void 0,this.onOptionsChanged())},t.prototype.onBlur=function(){this._cursorBlinkStateManager&&this._cursorBlinkStateManager.pause(),this._onRequestRedraw.fire({start:this._bufferService.buffer.y,end:this._bufferService.buffer.y})},t.prototype.onFocus=function(){this._cursorBlinkStateManager?this._cursorBlinkStateManager.resume():this._onRequestRedraw.fire({start:this._bufferService.buffer.y,end:this._bufferService.buffer.y})},t.prototype.onOptionsChanged=function(){var e,t=this;this._optionsService.options.cursorBlink?this._cursorBlinkStateManager||(this._cursorBlinkStateManager=new l(this._coreBrowserService.isFocused,(function(){t._render(!0)}))):(null===(e=this._cursorBlinkStateManager)||void 0===e||e.dispose(),this._cursorBlinkStateManager=void 0),this._onRequestRedraw.fire({start:this._bufferService.buffer.y,end:this._bufferService.buffer.y})},t.prototype.onCursorMove=function(){this._cursorBlinkStateManager&&this._cursorBlinkStateManager.restartBlinkAnimation()},t.prototype.onGridChanged=function(e,t){!this._cursorBlinkStateManager||this._cursorBlinkStateManager.isPaused?this._render(!1):this._cursorBlinkStateManager.restartBlinkAnimation()},t.prototype._render=function(e){if(this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden){var t=this._bufferService.buffer.ybase+this._bufferService.buffer.y,i=t-this._bufferService.buffer.ydisp;if(i<0||i>=this._bufferService.rows)this._clearCursor();else{var r=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1);if(this._bufferService.buffer.lines.get(t).loadCell(r,this._cell),void 0!==this._cell.content){if(!this._coreBrowserService.isFocused){this._clearCursor(),this._ctx.save(),this._ctx.fillStyle=this._colors.cursor.css;var n=this._optionsService.options.cursorStyle;return n&&"block"!==n?this._cursorRenderers[n](r,i,this._cell):this._renderBlurCursor(r,i,this._cell),this._ctx.restore(),this._state.x=r,this._state.y=i,this._state.isFocused=!1,this._state.style=n,void(this._state.width=this._cell.getWidth())}if(!this._cursorBlinkStateManager||this._cursorBlinkStateManager.isCursorVisible){if(this._state){if(this._state.x===r&&this._state.y===i&&this._state.isFocused===this._coreBrowserService.isFocused&&this._state.style===this._optionsService.options.cursorStyle&&this._state.width===this._cell.getWidth())return;this._clearCursor()}this._ctx.save(),this._cursorRenderers[this._optionsService.options.cursorStyle||"block"](r,i,this._cell),this._ctx.restore(),this._state.x=r,this._state.y=i,this._state.isFocused=!1,this._state.style=this._optionsService.options.cursorStyle,this._state.width=this._cell.getWidth()}else this._clearCursor()}}}else this._clearCursor()},t.prototype._clearCursor=function(){this._state&&(this._clearCells(this._state.x,this._state.y,this._state.width,1),this._state={x:0,y:0,isFocused:!1,style:"",width:0})},t.prototype._renderBarCursor=function(e,t,i){this._ctx.save(),this._ctx.fillStyle=this._colors.cursor.css,this._fillLeftLineAtCell(e,t,this._optionsService.options.cursorWidth),this._ctx.restore()},t.prototype._renderBlockCursor=function(e,t,i){this._ctx.save(),this._ctx.fillStyle=this._colors.cursor.css,this._fillCells(e,t,i.getWidth(),1),this._ctx.fillStyle=this._colors.cursorAccent.css,this._fillCharTrueColor(i,e,t),this._ctx.restore()},t.prototype._renderUnderlineCursor=function(e,t,i){this._ctx.save(),this._ctx.fillStyle=this._colors.cursor.css,this._fillBottomLineAtCells(e,t),this._ctx.restore()},t.prototype._renderBlurCursor=function(e,t,i){this._ctx.save(),this._ctx.strokeStyle=this._colors.cursor.css,this._strokeRectAtCell(e,t,i.getWidth(),1),this._ctx.restore()},t}(s.BaseRenderLayer);t.CursorRenderLayer=a;var l=function(){function e(e,t){this._renderCallback=t,this.isCursorVisible=!0,e&&this._restartInterval()}return Object.defineProperty(e.prototype,"isPaused",{get:function(){return!(this._blinkStartTimeout||this._blinkInterval)},enumerable:!1,configurable:!0}),e.prototype.dispose=function(){this._blinkInterval&&(window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)},e.prototype.restartBlinkAnimation=function(){var e=this;this.isPaused||(this._animationTimeRestarted=Date.now(),this.isCursorVisible=!0,this._animationFrame||(this._animationFrame=window.requestAnimationFrame((function(){e._renderCallback(),e._animationFrame=void 0}))))},e.prototype._restartInterval=function(e){var t=this;void 0===e&&(e=600),this._blinkInterval&&window.clearInterval(this._blinkInterval),this._blinkStartTimeout=window.setTimeout((function(){if(t._animationTimeRestarted){var e=600-(Date.now()-t._animationTimeRestarted);if(t._animationTimeRestarted=void 0,e>0)return void t._restartInterval(e)}t.isCursorVisible=!1,t._animationFrame=window.requestAnimationFrame((function(){t._renderCallback(),t._animationFrame=void 0})),t._blinkInterval=window.setInterval((function(){if(t._animationTimeRestarted){var e=600-(Date.now()-t._animationTimeRestarted);return t._animationTimeRestarted=void 0,void t._restartInterval(e)}t.isCursorVisible=!t.isCursorVisible,t._animationFrame=window.requestAnimationFrame((function(){t._renderCallback(),t._animationFrame=void 0}))}),600)}),e)},e.prototype.pause=function(){this.isCursorVisible=!0,this._blinkInterval&&(window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)},e.prototype.resume=function(){this.pause(),this._animationTimeRestarted=void 0,this._restartInterval(),this.restartBlinkAnimation()},e}()},function(e,t,i){"use strict";var r,n=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)},function(e,t){function i(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)});Object.defineProperty(t,"__esModule",{value:!0}),t.LinkRenderLayer=void 0;var s=i(13),o=i(9),a=i(26),l=function(e){function t(t,i,r,n,s,o,a,l){var c=e.call(this,t,"link",i,!0,r,n,a,l)||this;return s.onShowLinkUnderline((function(e){return c._onShowLinkUnderline(e)})),s.onHideLinkUnderline((function(e){return c._onHideLinkUnderline(e)})),o.onShowLinkUnderline((function(e){return c._onShowLinkUnderline(e)})),o.onHideLinkUnderline((function(e){return c._onHideLinkUnderline(e)})),c}return n(t,e),t.prototype.resize=function(t){e.prototype.resize.call(this,t),this._state=void 0},t.prototype.reset=function(){this._clearCurrentLink()},t.prototype._clearCurrentLink=function(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);var e=this._state.y2-this._state.y1-1;e>0&&this._clearCells(0,this._state.y1+1,this._state.cols,e),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}},t.prototype._onShowLinkUnderline=function(e){if(e.fg===o.INVERTED_DEFAULT_COLOR?this._ctx.fillStyle=this._colors.background.css:e.fg&&a.is256Color(e.fg)?this._ctx.fillStyle=this._colors.ansi[e.fg].css:this._ctx.fillStyle=this._colors.foreground.css,e.y1===e.y2)this._fillBottomLineAtCells(e.x1,e.y1,e.x2-e.x1);else{this._fillBottomLineAtCells(e.x1,e.y1,e.cols-e.x1);for(var t=e.y1+1;t=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,i,o):n(t,i))||o);return s>3&&o&&Object.defineProperty(t,i,o),o},n=this&&this.__param||function(e,t){return function(i,r){t(i,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.MouseZone=t.Linkifier=void 0;var s=i(0),o=i(1),a=function(){function e(e,t,i){this._bufferService=e,this._logService=t,this._unicodeService=i,this._linkMatchers=[],this._nextLinkMatcherId=0,this._onShowLinkUnderline=new s.EventEmitter,this._onHideLinkUnderline=new s.EventEmitter,this._onLinkTooltip=new s.EventEmitter,this._rowsToLinkify={start:void 0,end:void 0}}return Object.defineProperty(e.prototype,"onShowLinkUnderline",{get:function(){return this._onShowLinkUnderline.event},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onHideLinkUnderline",{get:function(){return this._onHideLinkUnderline.event},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onLinkTooltip",{get:function(){return this._onLinkTooltip.event},enumerable:!1,configurable:!0}),e.prototype.attachToDom=function(e,t){this._element=e,this._mouseZoneManager=t},e.prototype.linkifyRows=function(t,i){var r=this;this._mouseZoneManager&&(void 0===this._rowsToLinkify.start||void 0===this._rowsToLinkify.end?(this._rowsToLinkify.start=t,this._rowsToLinkify.end=i):(this._rowsToLinkify.start=Math.min(this._rowsToLinkify.start,t),this._rowsToLinkify.end=Math.max(this._rowsToLinkify.end,i)),this._mouseZoneManager.clearAll(t,i),this._rowsTimeoutId&&clearTimeout(this._rowsTimeoutId),this._rowsTimeoutId=setTimeout((function(){return r._linkifyRows()}),e._timeBeforeLatency))},e.prototype._linkifyRows=function(){this._rowsTimeoutId=void 0;var e=this._bufferService.buffer;if(void 0!==this._rowsToLinkify.start&&void 0!==this._rowsToLinkify.end){var t=e.ydisp+this._rowsToLinkify.start;if(!(t>=e.lines.length)){for(var i=e.ydisp+Math.min(this._rowsToLinkify.end,this._bufferService.rows)+1,r=Math.ceil(2e3/this._bufferService.cols),n=this._bufferService.buffer.iterator(!1,t,i,r,r);n.hasNext();)for(var s=n.next(),o=0;o=0;t--)if(e.priority<=this._linkMatchers[t].priority)return void this._linkMatchers.splice(t+1,0,e);this._linkMatchers.splice(0,0,e)}else this._linkMatchers.push(e)},e.prototype.deregisterLinkMatcher=function(e){for(var t=0;t>9&511:void 0;i.validationCallback?i.validationCallback(a,(function(e){n._rowsTimeoutId||e&&n._addLink(c[1],c[0]-n._bufferService.buffer.ydisp,a,i,d)})):l._addLink(c[1],c[0]-l._bufferService.buffer.ydisp,a,i,d)},l=this;null!==(r=s.exec(t))&&"break"!==a(););},e.prototype._addLink=function(e,t,i,r,n){var s=this;if(this._mouseZoneManager&&this._element){var o=this._unicodeService.getStringCellWidth(i),a=e%this._bufferService.cols,c=t+Math.floor(e/this._bufferService.cols),u=(a+o)%this._bufferService.cols,h=c+Math.floor((a+o)/this._bufferService.cols);0===u&&(u=this._bufferService.cols,h--),this._mouseZoneManager.add(new l(a+1,c+1,u+1,h+1,(function(e){if(r.handler)return r.handler(e,i);var t=window.open();t?(t.opener=null,t.location.href=i):console.warn("Opening link blocked as opener could not be cleared")}),(function(){s._onShowLinkUnderline.fire(s._createLinkHoverEvent(a,c,u,h,n)),s._element.classList.add("xterm-cursor-pointer")}),(function(e){s._onLinkTooltip.fire(s._createLinkHoverEvent(a,c,u,h,n)),r.hoverTooltipCallback&&r.hoverTooltipCallback(e,i,{start:{x:a,y:c},end:{x:u,y:h}})}),(function(){s._onHideLinkUnderline.fire(s._createLinkHoverEvent(a,c,u,h,n)),s._element.classList.remove("xterm-cursor-pointer"),r.hoverLeaveCallback&&r.hoverLeaveCallback()}),(function(e){return!r.willLinkActivate||r.willLinkActivate(e,i)})))}},e.prototype._createLinkHoverEvent=function(e,t,i,r,n){return{x1:e,y1:t,x2:i,y2:r,cols:this._bufferService.cols,fg:n}},e._timeBeforeLatency=200,e=r([n(0,o.IBufferService),n(1,o.ILogService),n(2,o.IUnicodeService)],e)}();t.Linkifier=a;var l=function(e,t,i,r,n,s,o,a,l){this.x1=e,this.y1=t,this.x2=i,this.y2=r,this.clickCallback=n,this.hoverCallback=s,this.tooltipCallback=o,this.leaveCallback=a,this.willLinkActivate=l};t.MouseZone=l},function(e,t,i){"use strict";var r,n=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)},function(e,t){function i(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}),s=this&&this.__decorate||function(e,t,i,r){var n,s=arguments.length,o=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,r);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,i,o):n(t,i))||o);return s>3&&o&&Object.defineProperty(t,i,o),o},o=this&&this.__param||function(e,t){return function(i,r){t(i,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.SelectionService=void 0;var a=i(11),l=i(52),c=i(4),u=i(0),h=i(5),d=i(1),f=i(30),p=i(53),g=i(2),v=String.fromCharCode(160),m=new RegExp(v,"g"),y=function(e){function t(t,i,r,n,s,o,a){var h=e.call(this)||this;return h._element=t,h._screenElement=i,h._bufferService=r,h._coreService=n,h._mouseService=s,h._optionsService=o,h._renderService=a,h._dragScrollAmount=0,h._enabled=!0,h._workCell=new c.CellData,h._mouseDownTimeStamp=0,h._onLinuxMouseSelection=h.register(new u.EventEmitter),h._onRedrawRequest=h.register(new u.EventEmitter),h._onSelectionChange=h.register(new u.EventEmitter),h._onRequestScrollLines=h.register(new u.EventEmitter),h._mouseMoveListener=function(e){return h._onMouseMove(e)},h._mouseUpListener=function(e){return h._onMouseUp(e)},h._coreService.onUserInput((function(){h.hasSelection&&h.clearSelection()})),h._trimListener=h._bufferService.buffer.lines.onTrim((function(e){return h._onTrim(e)})),h.register(h._bufferService.buffers.onBufferActivate((function(e){return h._onBufferActivate(e)}))),h.enable(),h._model=new l.SelectionModel(h._bufferService),h._activeSelectionMode=0,h}return n(t,e),Object.defineProperty(t.prototype,"onLinuxMouseSelection",{get:function(){return this._onLinuxMouseSelection.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onRequestRedraw",{get:function(){return this._onRedrawRequest.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onSelectionChange",{get:function(){return this._onSelectionChange.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onRequestScrollLines",{get:function(){return this._onRequestScrollLines.event},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){this._removeMouseDownListeners()},t.prototype.reset=function(){this.clearSelection()},t.prototype.disable=function(){this.clearSelection(),this._enabled=!1},t.prototype.enable=function(){this._enabled=!0},Object.defineProperty(t.prototype,"selectionStart",{get:function(){return this._model.finalSelectionStart},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"selectionEnd",{get:function(){return this._model.finalSelectionEnd},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hasSelection",{get:function(){var e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!(!e||!t||e[0]===t[0]&&e[1]===t[1])},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"selectionText",{get:function(){var e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return"";var i=this._bufferService.buffer,r=[];if(3===this._activeSelectionMode){if(e[0]===t[0])return"";for(var n=e[1];n<=t[1];n++){var s=i.translateBufferLineToString(n,!0,e[0],t[0]);r.push(s)}}else{var o=e[1]===t[1]?t[0]:void 0;for(r.push(i.translateBufferLineToString(e[1],!0,e[0],o)),n=e[1]+1;n<=t[1]-1;n++){var l=i.lines.get(n);s=i.translateBufferLineToString(n,!0),l&&l.isWrapped?r[r.length-1]+=s:r.push(s)}e[1]!==t[1]&&(l=i.lines.get(t[1]),s=i.translateBufferLineToString(t[1],!0,0,t[0]),l&&l.isWrapped?r[r.length-1]+=s:r.push(s))}return r.map((function(e){return e.replace(m," ")})).join(a.isWindows?"\r\n":"\n")},enumerable:!1,configurable:!0}),t.prototype.clearSelection=function(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()},t.prototype.refresh=function(e){var t=this;this._refreshAnimationFrame||(this._refreshAnimationFrame=window.requestAnimationFrame((function(){return t._refresh()}))),a.isLinux&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)},t.prototype._refresh=function(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:3===this._activeSelectionMode})},t.prototype.isClickInSelection=function(e){var t=this._getMouseBufferCoords(e),i=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!!(i&&r&&t)&&this._areCoordsInSelection(t,i,r)},t.prototype._areCoordsInSelection=function(e,t,i){return e[1]>t[1]&&e[1]=t[0]&&e[0]=t[0]},t.prototype.selectWordAtCursor=function(e){var t=this._getMouseBufferCoords(e);t&&(this._selectWordAt(t,!1),this._model.selectionEnd=void 0,this.refresh(!0))},t.prototype.selectAll=function(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()},t.prototype.selectLines=function(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()},t.prototype._onTrim=function(e){this._model.onTrim(e)&&this.refresh()},t.prototype._getMouseBufferCoords=function(e){var t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t},t.prototype._getMouseEventScrollAmount=function(e){var t=f.getCoordsRelativeToElement(e,this._screenElement)[1],i=this._renderService.dimensions.canvasHeight;return t>=0&&t<=i?0:(t>i&&(t-=i),t=Math.min(Math.max(t,-50),50),(t/=50)/Math.abs(t)+Math.round(14*t))},t.prototype.shouldForceSelection=function(e){return a.isMac?e.altKey&&this._optionsService.options.macOptionClickForcesSelection:e.shiftKey},t.prototype.onMouseDown=function(e){if(this._mouseDownTimeStamp=e.timeStamp,(2!==e.button||!this.hasSelection)&&0===e.button){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._onIncrementalClick(e):1===e.detail?this._onSingleClick(e):2===e.detail?this._onDoubleClick(e):3===e.detail&&this._onTripleClick(e),this._addMouseDownListeners(),this.refresh(!0)}},t.prototype._addMouseDownListeners=function(){var e=this;this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=window.setInterval((function(){return e._dragScroll()}),50)},t.prototype._removeMouseDownListeners=function(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0},t.prototype._onIncrementalClick=function(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))},t.prototype._onSingleClick=function(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),this._model.selectionStart){this._model.selectionEnd=void 0;var t=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);t&&t.length!==this._model.selectionStart[0]&&0===t.hasWidth(this._model.selectionStart[0])&&this._model.selectionStart[0]++}},t.prototype._onDoubleClick=function(e){var t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=1,this._selectWordAt(t,!0))},t.prototype._onTripleClick=function(e){var t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))},t.prototype.shouldColumnSelect=function(e){return e.altKey&&!(a.isMac&&this._optionsService.options.macOptionClickForcesSelection)},t.prototype._onMouseMove=function(e){if(e.stopImmediatePropagation(),this._model.selectionStart){var t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),this._model.selectionEnd){2===this._activeSelectionMode?this._model.selectionEnd[1]0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));var i=this._bufferService.buffer;if(this._model.selectionEnd[1]0?(3!==this._activeSelectionMode&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(3!==this._activeSelectionMode&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}},t.prototype._onMouseUp=function(e){var t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&t<500&&e.altKey){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){var i=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(i&&void 0!==i[0]&&void 0!==i[1]){var r=p.moveToCellSequence(i[0]-1,i[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(r,!0)}}}else this.hasSelection&&this._onSelectionChange.fire()},t.prototype._onBufferActivate=function(e){var t=this;this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim((function(e){return t._onTrim(e)}))},t.prototype._convertViewportColToCharacterIndex=function(e,t){for(var i=t[0],r=0;t[0]>=r;r++){var n=e.loadCell(r,this._workCell).getChars().length;0===this._workCell.getWidth()?i--:n>1&&t[0]!==r&&(i+=n-1)}return i},t.prototype.setSelection=function(e,t,i){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=i,this.refresh()},t.prototype._getWordAt=function(e,t,i,r){if(void 0===i&&(i=!0),void 0===r&&(r=!0),!(e[0]>=this._bufferService.cols)){var n=this._bufferService.buffer,s=n.lines.get(e[1]);if(s){var o=n.translateBufferLineToString(e[1],!1),a=this._convertViewportColToCharacterIndex(s,e),l=a,c=e[0]-a,u=0,h=0,d=0,f=0;if(" "===o.charAt(a)){for(;a>0&&" "===o.charAt(a-1);)a--;for(;l1&&(f+=v-1,l+=v-1);p>0&&a>0&&!this._isCharWordSeparator(s.loadCell(p-1,this._workCell));){s.loadCell(p-1,this._workCell);var m=this._workCell.getChars().length;0===this._workCell.getWidth()?(u++,p--):m>1&&(d+=m-1,a-=m-1),a--,p--}for(;g1&&(f+=y-1,l+=y-1),l++,g++}}l++;var _=a+c-u+d,b=Math.min(this._bufferService.cols,l-a+u+h-d-f);if(t||""!==o.slice(a,l).trim()){if(i&&0===_&&32!==s.getCodePoint(0)){var S=n.lines.get(e[1]-1);if(S&&s.isWrapped&&32!==S.getCodePoint(this._bufferService.cols-1)){var C=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(C){var w=this._bufferService.cols-C.start;_-=w,b+=w}}}if(r&&_+b===this._bufferService.cols&&32!==s.getCodePoint(this._bufferService.cols-1)){var k=n.lines.get(e[1]+1);if(k&&k.isWrapped&&32!==k.getCodePoint(0)){var x=this._getWordAt([0,e[1]+1],!1,!1,!0);x&&(b+=x.length)}}return{start:_,length:b}}}}},t.prototype._selectWordAt=function(e,t){var i=this._getWordAt(e,t);if(i){for(;i.start<0;)i.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[i.start,e[1]],this._model.selectionStartLength=i.length}},t.prototype._selectToWordAt=function(e){var t=this._getWordAt(e,!0);if(t){for(var i=e[1];t.start<0;)t.start+=this._bufferService.cols,i--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,i++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,i]}},t.prototype._isCharWordSeparator=function(e){return 0!==e.getWidth()&&this._optionsService.options.wordSeparator.indexOf(e.getChars())>=0},t.prototype._selectLineAt=function(e){var t=this._bufferService.buffer.getWrappedRangeForLine(e);this._model.selectionStart=[0,t.first],this._model.selectionEnd=[this._bufferService.cols,t.last],this._model.selectionStartLength=0},s([o(2,d.IBufferService),o(3,d.ICoreService),o(4,h.IMouseService),o(5,d.IOptionsService),o(6,h.IRenderService)],t)}(g.Disposable);t.SelectionService=y},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SelectionModel=void 0;var r=function(){function e(e){this._bufferService=e,this.isSelectAllActive=!1,this.selectionStartLength=0}return e.prototype.clearSelection=function(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0},Object.defineProperty(e.prototype,"finalSelectionStart",{get:function(){return this.isSelectAllActive?[0,0]:this.selectionEnd&&this.selectionStart&&this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"finalSelectionEnd",{get:function(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){var e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}return this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]?[Math.max(this.selectionStart[0]+this.selectionStartLength,this.selectionEnd[0]),this.selectionEnd[1]]:this.selectionEnd}},enumerable:!1,configurable:!0}),e.prototype.areSelectionValuesReversed=function(){var e=this.selectionStart,t=this.selectionEnd;return!(!e||!t)&&(e[1]>t[1]||e[1]===t[1]&&e[0]>t[0])},e.prototype.onTrim=function(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)},e}();t.SelectionModel=r},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.moveToCellSequence=void 0;var r=i(12);function n(e,t,i,r){var n=e-s(i,e),a=t-s(i,t);return c(Math.abs(n-a)-function(e,t,i){for(var r=0,n=e-s(i,e),a=t-s(i,t),l=0;l=0&&tt?"A":"B"}function a(e,t,i,r,n,s){for(var o=e,a=t,l="";o!==i||a!==r;)o+=n?1:-1,n&&o>s.cols-1?(l+=s.buffer.translateBufferLineToString(a,!1,e,o),o=0,e=0,a++):!n&&o<0&&(l+=s.buffer.translateBufferLineToString(a,!1,0,e+1),e=o=s.cols-1,a--);return l+s.buffer.translateBufferLineToString(a,!1,e,o)}function l(e,t){var i=t?"O":"[";return r.C0.ESC+i+e}function c(e,t){e=Math.floor(e);for(var i="",r=0;r0?r-s(o,r):t;var d=r,f=function(e,t,i,r,o,a){var l;return l=n(i,r,o,a).length>0?r-s(o,r):t,e=i&&le?"D":"C",c(Math.abs(u-e),l(o,r));o=h>t?"D":"C";var d=Math.abs(h-t);return c(function(e,t){return t.cols-e}(h>t?e:u,i)+(d-1)*i.cols+1+((h>t?u:e)-1),l(o,r))}},function(e,t,i){"use strict";var r=this&&this.__decorate||function(e,t,i,r){var n,s=arguments.length,o=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,r);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,i,o):n(t,i))||o);return s>3&&o&&Object.defineProperty(t,i,o),o},n=this&&this.__param||function(e,t){return function(i,r){t(i,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.SoundService=void 0;var s=i(1),o=function(){function e(e){this._optionsService=e}return Object.defineProperty(e,"audioContext",{get:function(){if(!e._audioContext){var t=window.AudioContext||window.webkitAudioContext;if(!t)return console.warn("Web Audio API is not supported by this browser. Consider upgrading to the latest version"),null;e._audioContext=new t}return e._audioContext},enumerable:!1,configurable:!0}),e.prototype.playBellSound=function(){var t=e.audioContext;if(t){var i=t.createBufferSource();t.decodeAudioData(this._base64ToArrayBuffer(this._removeMimeType(this._optionsService.options.bellSound)),(function(e){i.buffer=e,i.connect(t.destination),i.start(0)}))}},e.prototype._base64ToArrayBuffer=function(e){for(var t=window.atob(e),i=t.length,r=new Uint8Array(i),n=0;n=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,i,o):n(t,i))||o);return s>3&&o&&Object.defineProperty(t,i,o),o},o=this&&this.__param||function(e,t){return function(i,r){t(i,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.MouseZoneManager=void 0;var a=i(2),l=i(7),c=i(5),u=i(1),h=function(e){function t(t,i,r,n,s,o){var a=e.call(this)||this;return a._element=t,a._screenElement=i,a._bufferService=r,a._mouseService=n,a._selectionService=s,a._optionsService=o,a._zones=[],a._areZonesActive=!1,a._lastHoverCoords=[void 0,void 0],a._initialSelectionLength=0,a.register(l.addDisposableDomListener(a._element,"mousedown",(function(e){return a._onMouseDown(e)}))),a._mouseMoveListener=function(e){return a._onMouseMove(e)},a._mouseLeaveListener=function(e){return a._onMouseLeave(e)},a._clickListener=function(e){return a._onClick(e)},a}return n(t,e),t.prototype.dispose=function(){e.prototype.dispose.call(this),this._deactivate()},t.prototype.add=function(e){this._zones.push(e),1===this._zones.length&&this._activate()},t.prototype.clearAll=function(e,t){if(0!==this._zones.length){e&&t||(e=0,t=this._bufferService.rows-1);for(var i=0;ie&&r.y1<=t+1||r.y2>e&&r.y2<=t+1||r.y1t+1)&&(this._currentZone&&this._currentZone===r&&(this._currentZone.leaveCallback(),this._currentZone=void 0),this._zones.splice(i--,1))}0===this._zones.length&&this._deactivate()}},t.prototype._activate=function(){this._areZonesActive||(this._areZonesActive=!0,this._element.addEventListener("mousemove",this._mouseMoveListener),this._element.addEventListener("mouseleave",this._mouseLeaveListener),this._element.addEventListener("click",this._clickListener))},t.prototype._deactivate=function(){this._areZonesActive&&(this._areZonesActive=!1,this._element.removeEventListener("mousemove",this._mouseMoveListener),this._element.removeEventListener("mouseleave",this._mouseLeaveListener),this._element.removeEventListener("click",this._clickListener))},t.prototype._onMouseMove=function(e){this._lastHoverCoords[0]===e.pageX&&this._lastHoverCoords[1]===e.pageY||(this._onHover(e),this._lastHoverCoords=[e.pageX,e.pageY])},t.prototype._onHover=function(e){var t=this,i=this._findZoneEventAt(e);i!==this._currentZone&&(this._currentZone&&(this._currentZone.leaveCallback(),this._currentZone=void 0,this._tooltipTimeout&&clearTimeout(this._tooltipTimeout)),i&&(this._currentZone=i,i.hoverCallback&&i.hoverCallback(e),this._tooltipTimeout=window.setTimeout((function(){return t._onTooltip(e)}),this._optionsService.options.linkTooltipHoverDuration)))},t.prototype._onTooltip=function(e){this._tooltipTimeout=void 0;var t=this._findZoneEventAt(e);t&&t.tooltipCallback&&t.tooltipCallback(e)},t.prototype._onMouseDown=function(e){if(this._initialSelectionLength=this._getSelectionLength(),this._areZonesActive){var t=this._findZoneEventAt(e);(null==t?void 0:t.willLinkActivate(e))&&(e.preventDefault(),e.stopImmediatePropagation())}},t.prototype._onMouseLeave=function(e){this._currentZone&&(this._currentZone.leaveCallback(),this._currentZone=void 0,this._tooltipTimeout&&clearTimeout(this._tooltipTimeout))},t.prototype._onClick=function(e){var t=this._findZoneEventAt(e),i=this._getSelectionLength();t&&i===this._initialSelectionLength&&(t.clickCallback(e),e.preventDefault(),e.stopImmediatePropagation())},t.prototype._getSelectionLength=function(){var e=this._selectionService.selectionText;return e?e.length:0},t.prototype._findZoneEventAt=function(e){var t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows);if(t)for(var i=t[0],r=t[1],n=0;n=s.x1&&i=s.x1||r===s.y2&&is.y1&&re;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()},t.prototype._createAccessibilityTreeNode=function(){var e=document.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e},t.prototype._onTab=function(e){for(var t=0;t0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,"\n"===e&&(this._liveRegionLineCount++,21===this._liveRegionLineCount&&(this._liveRegion.textContent+=s.tooMuchOutput)),o.isMac&&this._liveRegion.textContent&&this._liveRegion.textContent.length>0&&!this._liveRegion.parentNode&&setTimeout((function(){t._accessibilityTreeRoot.appendChild(t._liveRegion)}),0))},t.prototype._clearLiveRegion=function(){this._liveRegion.textContent="",this._liveRegionLineCount=0,o.isMac&&h.removeElementFromParent(this._liveRegion)},t.prototype._onKey=function(e){this._clearLiveRegion(),this._charsToConsume.push(e)},t.prototype._refreshRows=function(e,t){this._renderRowsDebouncer.refresh(e,t,this._terminal.rows)},t.prototype._renderRows=function(e,t){for(var i=this._terminal.buffer,r=i.lines.length.toString(),n=e;n<=t;n++){var s=i.translateBufferLineToString(i.ydisp+n,!0),o=(i.ydisp+n+1).toString(),a=this._rowElements[n];a&&(0===s.length?a.innerHTML=" ":a.textContent=s,a.setAttribute("aria-posinset",o),a.setAttribute("aria-setsize",r))}this._announceCharacters()},t.prototype._refreshRowsDimensions=function(){if(this._renderService.dimensions.actualCellHeight){this._rowElements.length!==this._terminal.rows&&this._onResize(this._terminal.rows);for(var e=0;e=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,i,o):n(t,i))||o);return s>3&&o&&Object.defineProperty(t,i,o),o},o=this&&this.__param||function(e,t){return function(i,r){t(i,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DomRenderer=void 0;var a=i(58),l=i(9),c=i(2),u=i(5),h=i(1),d=i(0),f=i(10),p=i(17),g=1,v=function(e){function t(t,i,r,n,s,o,l,c,u){var h=e.call(this)||this;return h._colors=t,h._element=i,h._screenElement=r,h._viewportElement=n,h._linkifier=s,h._linkifier2=o,h._charSizeService=l,h._optionsService=c,h._bufferService=u,h._terminalClass=g++,h._rowElements=[],h._rowContainer=document.createElement("div"),h._rowContainer.classList.add("xterm-rows"),h._rowContainer.style.lineHeight="normal",h._rowContainer.setAttribute("aria-hidden","true"),h._refreshRowElements(h._bufferService.cols,h._bufferService.rows),h._selectionContainer=document.createElement("div"),h._selectionContainer.classList.add("xterm-selection"),h._selectionContainer.setAttribute("aria-hidden","true"),h.dimensions={scaledCharWidth:0,scaledCharHeight:0,scaledCellWidth:0,scaledCellHeight:0,scaledCharLeft:0,scaledCharTop:0,scaledCanvasWidth:0,scaledCanvasHeight:0,canvasWidth:0,canvasHeight:0,actualCellWidth:0,actualCellHeight:0},h._updateDimensions(),h._injectCss(),h._rowFactory=new a.DomRendererRowFactory(document,h._optionsService,h._colors),h._element.classList.add("xterm-dom-renderer-owner-"+h._terminalClass),h._screenElement.appendChild(h._rowContainer),h._screenElement.appendChild(h._selectionContainer),h._linkifier.onShowLinkUnderline((function(e){return h._onLinkHover(e)})),h._linkifier.onHideLinkUnderline((function(e){return h._onLinkLeave(e)})),h._linkifier2.onShowLinkUnderline((function(e){return h._onLinkHover(e)})),h._linkifier2.onHideLinkUnderline((function(e){return h._onLinkLeave(e)})),h}return n(t,e),Object.defineProperty(t.prototype,"onRequestRedraw",{get:function(){return(new d.EventEmitter).event},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){this._element.classList.remove("xterm-dom-renderer-owner-"+this._terminalClass),p.removeElementFromParent(this._rowContainer,this._selectionContainer,this._themeStyleElement,this._dimensionsStyleElement),e.prototype.dispose.call(this)},t.prototype._updateDimensions=function(){this.dimensions.scaledCharWidth=this._charSizeService.width*window.devicePixelRatio,this.dimensions.scaledCharHeight=Math.ceil(this._charSizeService.height*window.devicePixelRatio),this.dimensions.scaledCellWidth=this.dimensions.scaledCharWidth+Math.round(this._optionsService.options.letterSpacing),this.dimensions.scaledCellHeight=Math.floor(this.dimensions.scaledCharHeight*this._optionsService.options.lineHeight),this.dimensions.scaledCharLeft=0,this.dimensions.scaledCharTop=0,this.dimensions.scaledCanvasWidth=this.dimensions.scaledCellWidth*this._bufferService.cols,this.dimensions.scaledCanvasHeight=this.dimensions.scaledCellHeight*this._bufferService.rows,this.dimensions.canvasWidth=Math.round(this.dimensions.scaledCanvasWidth/window.devicePixelRatio),this.dimensions.canvasHeight=Math.round(this.dimensions.scaledCanvasHeight/window.devicePixelRatio),this.dimensions.actualCellWidth=this.dimensions.canvasWidth/this._bufferService.cols,this.dimensions.actualCellHeight=this.dimensions.canvasHeight/this._bufferService.rows;for(var e=0,t=this._rowElements;et;)this._rowContainer.removeChild(this._rowElements.pop())},t.prototype.onResize=function(e,t){this._refreshRowElements(e,t),this._updateDimensions()},t.prototype.onCharSizeChanged=function(){this._updateDimensions()},t.prototype.onBlur=function(){this._rowContainer.classList.remove("xterm-focus")},t.prototype.onFocus=function(){this._rowContainer.classList.add("xterm-focus")},t.prototype.onSelectionChanged=function(e,t,i){for(;this._selectionContainer.children.length;)this._selectionContainer.removeChild(this._selectionContainer.children[0]);if(e&&t){var r=e[1]-this._bufferService.buffer.ydisp,n=t[1]-this._bufferService.buffer.ydisp,s=Math.max(r,0),o=Math.min(n,this._bufferService.rows-1);if(!(s>=this._bufferService.rows||o<0)){var a=document.createDocumentFragment();if(i)a.appendChild(this._createSelectionElement(s,e[0],t[0],o-s+1));else{var l=r===s?e[0]:0,c=s===o?t[0]:this._bufferService.cols;a.appendChild(this._createSelectionElement(s,l,c));var u=o-s-1;if(a.appendChild(this._createSelectionElement(s+1,0,this._bufferService.cols,u)),s!==o){var h=n===o?t[0]:this._bufferService.cols;a.appendChild(this._createSelectionElement(o,0,h))}}this._selectionContainer.appendChild(a)}}},t.prototype._createSelectionElement=function(e,t,i,r){void 0===r&&(r=1);var n=document.createElement("div");return n.style.height=r*this.dimensions.actualCellHeight+"px",n.style.top=e*this.dimensions.actualCellHeight+"px",n.style.left=t*this.dimensions.actualCellWidth+"px",n.style.width=this.dimensions.actualCellWidth*(i-t)+"px",n},t.prototype.onCursorMove=function(){},t.prototype.onOptionsChanged=function(){this._updateDimensions(),this._injectCss()},t.prototype.clear=function(){for(var e=0,t=this._rowElements;e=n&&(e=0,i++)}},s([o(6,u.ICharSizeService),o(7,h.IOptionsService),o(8,h.IBufferService)],t)}(c.Disposable);t.DomRenderer=v},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DomRendererRowFactory=t.CURSOR_STYLE_UNDERLINE_CLASS=t.CURSOR_STYLE_BAR_CLASS=t.CURSOR_STYLE_BLOCK_CLASS=t.CURSOR_BLINK_CLASS=t.CURSOR_CLASS=t.UNDERLINE_CLASS=t.ITALIC_CLASS=t.DIM_CLASS=t.BOLD_CLASS=void 0;var r=i(9),n=i(3),s=i(4),o=i(10);t.BOLD_CLASS="xterm-bold",t.DIM_CLASS="xterm-dim",t.ITALIC_CLASS="xterm-italic",t.UNDERLINE_CLASS="xterm-underline",t.CURSOR_CLASS="xterm-cursor",t.CURSOR_BLINK_CLASS="xterm-cursor-blink",t.CURSOR_STYLE_BLOCK_CLASS="xterm-cursor-block",t.CURSOR_STYLE_BAR_CLASS="xterm-cursor-bar",t.CURSOR_STYLE_UNDERLINE_CLASS="xterm-cursor-underline";var a=function(){function e(e,t,i){this._document=e,this._optionsService=t,this._colors=i,this._workCell=new s.CellData}return e.prototype.setColors=function(e){this._colors=e},e.prototype.createRow=function(e,i,s,a,c,u,h){for(var d=this._document.createDocumentFragment(),f=0,p=Math.min(e.length,h)-1;p>=0;p--)if(e.loadCell(p,this._workCell).getCode()!==n.NULL_CELL_CODE||i&&p===a){f=p+1;break}for(p=0;p1&&(v.style.width=u*g+"px"),i&&p===a)switch(v.classList.add(t.CURSOR_CLASS),c&&v.classList.add(t.CURSOR_BLINK_CLASS),s){case"bar":v.classList.add(t.CURSOR_STYLE_BAR_CLASS);break;case"underline":v.classList.add(t.CURSOR_STYLE_UNDERLINE_CLASS);break;default:v.classList.add(t.CURSOR_STYLE_BLOCK_CLASS)}this._workCell.isBold()&&v.classList.add(t.BOLD_CLASS),this._workCell.isItalic()&&v.classList.add(t.ITALIC_CLASS),this._workCell.isDim()&&v.classList.add(t.DIM_CLASS),this._workCell.isUnderline()&&v.classList.add(t.UNDERLINE_CLASS),this._workCell.isInvisible()?v.textContent=n.WHITESPACE_CELL_CHAR:v.textContent=this._workCell.getChars()||n.WHITESPACE_CELL_CHAR;var m=this._workCell.getFgColor(),y=this._workCell.getFgColorMode(),_=this._workCell.getBgColor(),b=this._workCell.getBgColorMode(),S=!!this._workCell.isInverse();if(S){var C=m;m=_,_=C;var w=y;y=b,b=w}switch(y){case 16777216:case 33554432:this._workCell.isBold()&&m<8&&this._optionsService.options.drawBoldTextInBrightColors&&(m+=8),this._applyMinimumContrast(v,this._colors.background,this._colors.ansi[m])||v.classList.add("xterm-fg-"+m);break;case 50331648:var k=o.rgba.toColor(m>>16&255,m>>8&255,255&m);this._applyMinimumContrast(v,this._colors.background,k)||this._addStyle(v,"color:#"+l(m.toString(16),"0",6));break;case 0:default:this._applyMinimumContrast(v,this._colors.background,this._colors.foreground)||S&&v.classList.add("xterm-fg-"+r.INVERTED_DEFAULT_COLOR)}switch(b){case 16777216:case 33554432:v.classList.add("xterm-bg-"+_);break;case 50331648:this._addStyle(v,"background-color:#"+l(_.toString(16),"0",6));break;case 0:default:S&&v.classList.add("xterm-bg-"+r.INVERTED_DEFAULT_COLOR)}d.appendChild(v)}}return d},e.prototype._applyMinimumContrast=function(e,t,i){if(1===this._optionsService.options.minimumContrastRatio)return!1;var r=this._colors.contrastCache.getColor(this._workCell.bg,this._workCell.fg);return void 0===r&&(r=o.color.ensureContrastRatio(t,i,this._optionsService.options.minimumContrastRatio),this._colors.contrastCache.setColor(this._workCell.bg,this._workCell.fg,null!=r?r:null)),!!r&&(this._addStyle(e,"color:"+r.css),!0)},e.prototype._addStyle=function(e,t){e.setAttribute("style",""+(e.getAttribute("style")||"")+t+";")},e}();function l(e,t,i){for(;e.length"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};t.evaluateKeyboardEvent=function(e,t,i,s){var o={type:0,cancel:!1,key:void 0},a=(e.shiftKey?1:0)|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:"UIKeyInputUpArrow"===e.key?o.key=t?r.C0.ESC+"OA":r.C0.ESC+"[A":"UIKeyInputLeftArrow"===e.key?o.key=t?r.C0.ESC+"OD":r.C0.ESC+"[D":"UIKeyInputRightArrow"===e.key?o.key=t?r.C0.ESC+"OC":r.C0.ESC+"[C":"UIKeyInputDownArrow"===e.key&&(o.key=t?r.C0.ESC+"OB":r.C0.ESC+"[B");break;case 8:if(e.shiftKey){o.key=r.C0.BS;break}if(e.altKey){o.key=r.C0.ESC+r.C0.DEL;break}o.key=r.C0.DEL;break;case 9:if(e.shiftKey){o.key=r.C0.ESC+"[Z";break}o.key=r.C0.HT,o.cancel=!0;break;case 13:o.key=e.altKey?r.C0.ESC+r.C0.CR:r.C0.CR,o.cancel=!0;break;case 27:o.key=r.C0.ESC,e.altKey&&(o.key=r.C0.ESC+r.C0.ESC),o.cancel=!0;break;case 37:if(e.metaKey)break;a?(o.key=r.C0.ESC+"[1;"+(a+1)+"D",o.key===r.C0.ESC+"[1;3D"&&(o.key=r.C0.ESC+(i?"b":"[1;5D"))):o.key=t?r.C0.ESC+"OD":r.C0.ESC+"[D";break;case 39:if(e.metaKey)break;a?(o.key=r.C0.ESC+"[1;"+(a+1)+"C",o.key===r.C0.ESC+"[1;3C"&&(o.key=r.C0.ESC+(i?"f":"[1;5C"))):o.key=t?r.C0.ESC+"OC":r.C0.ESC+"[C";break;case 38:if(e.metaKey)break;a?(o.key=r.C0.ESC+"[1;"+(a+1)+"A",i||o.key!==r.C0.ESC+"[1;3A"||(o.key=r.C0.ESC+"[1;5A")):o.key=t?r.C0.ESC+"OA":r.C0.ESC+"[A";break;case 40:if(e.metaKey)break;a?(o.key=r.C0.ESC+"[1;"+(a+1)+"B",i||o.key!==r.C0.ESC+"[1;3B"||(o.key=r.C0.ESC+"[1;5B")):o.key=t?r.C0.ESC+"OB":r.C0.ESC+"[B";break;case 45:e.shiftKey||e.ctrlKey||(o.key=r.C0.ESC+"[2~");break;case 46:o.key=a?r.C0.ESC+"[3;"+(a+1)+"~":r.C0.ESC+"[3~";break;case 36:o.key=a?r.C0.ESC+"[1;"+(a+1)+"H":t?r.C0.ESC+"OH":r.C0.ESC+"[H";break;case 35:o.key=a?r.C0.ESC+"[1;"+(a+1)+"F":t?r.C0.ESC+"OF":r.C0.ESC+"[F";break;case 33:e.shiftKey?o.type=2:o.key=r.C0.ESC+"[5~";break;case 34:e.shiftKey?o.type=3:o.key=r.C0.ESC+"[6~";break;case 112:o.key=a?r.C0.ESC+"[1;"+(a+1)+"P":r.C0.ESC+"OP";break;case 113:o.key=a?r.C0.ESC+"[1;"+(a+1)+"Q":r.C0.ESC+"OQ";break;case 114:o.key=a?r.C0.ESC+"[1;"+(a+1)+"R":r.C0.ESC+"OR";break;case 115:o.key=a?r.C0.ESC+"[1;"+(a+1)+"S":r.C0.ESC+"OS";break;case 116:o.key=a?r.C0.ESC+"[15;"+(a+1)+"~":r.C0.ESC+"[15~";break;case 117:o.key=a?r.C0.ESC+"[17;"+(a+1)+"~":r.C0.ESC+"[17~";break;case 118:o.key=a?r.C0.ESC+"[18;"+(a+1)+"~":r.C0.ESC+"[18~";break;case 119:o.key=a?r.C0.ESC+"[19;"+(a+1)+"~":r.C0.ESC+"[19~";break;case 120:o.key=a?r.C0.ESC+"[20;"+(a+1)+"~":r.C0.ESC+"[20~";break;case 121:o.key=a?r.C0.ESC+"[21;"+(a+1)+"~":r.C0.ESC+"[21~";break;case 122:o.key=a?r.C0.ESC+"[23;"+(a+1)+"~":r.C0.ESC+"[23~";break;case 123:o.key=a?r.C0.ESC+"[24;"+(a+1)+"~":r.C0.ESC+"[24~";break;default:if(!e.ctrlKey||e.shiftKey||e.altKey||e.metaKey)if(i&&!s||!e.altKey||e.metaKey)i&&!e.altKey&&!e.ctrlKey&&e.metaKey?65===e.keyCode&&(o.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&1===e.key.length?o.key=e.key:e.key&&e.ctrlKey&&"_"===e.key&&(o.key=r.C0.US);else{var l=n[e.keyCode],c=l&&l[e.shiftKey?1:0];if(c)o.key=r.C0.ESC+c;else if(e.keyCode>=65&&e.keyCode<=90){var u=e.ctrlKey?e.keyCode-64:e.keyCode+32;o.key=r.C0.ESC+String.fromCharCode(u)}}else e.keyCode>=65&&e.keyCode<=90?o.key=String.fromCharCode(e.keyCode-64):32===e.keyCode?o.key=r.C0.NUL:e.keyCode>=51&&e.keyCode<=55?o.key=String.fromCharCode(e.keyCode-51+27):56===e.keyCode?o.key=r.C0.DEL:219===e.keyCode?o.key=r.C0.ESC:220===e.keyCode?o.key=r.C0.FS:221===e.keyCode&&(o.key=r.C0.GS)}return o}},function(e,t,i){"use strict";var r,n=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)},function(e,t){function i(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}),s=this&&this.__decorate||function(e,t,i,r){var n,s=arguments.length,o=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,r);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,i,o):n(t,i))||o);return s>3&&o&&Object.defineProperty(t,i,o),o},o=this&&this.__param||function(e,t){return function(i,r){t(i,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.RenderService=void 0;var a=i(31),l=i(0),c=i(2),u=i(32),h=i(7),d=i(1),f=i(5),p=function(e){function t(t,i,r,n,s,o){var c=e.call(this)||this;if(c._renderer=t,c._rowCount=i,c._isPaused=!1,c._needsFullRefresh=!1,c._isNextRenderRedrawOnly=!0,c._needsSelectionRefresh=!1,c._canvasWidth=0,c._canvasHeight=0,c._selectionState={start:void 0,end:void 0,columnSelectMode:!1},c._onDimensionsChange=new l.EventEmitter,c._onRender=new l.EventEmitter,c._onRefreshRequest=new l.EventEmitter,c.register({dispose:function(){return c._renderer.dispose()}}),c._renderDebouncer=new a.RenderDebouncer((function(e,t){return c._renderRows(e,t)})),c.register(c._renderDebouncer),c._screenDprMonitor=new u.ScreenDprMonitor,c._screenDprMonitor.setListener((function(){return c.onDevicePixelRatioChange()})),c.register(c._screenDprMonitor),c.register(o.onResize((function(e){return c._fullRefresh()}))),c.register(n.onOptionChange((function(){return c._renderer.onOptionsChanged()}))),c.register(s.onCharSizeChange((function(){return c.onCharSizeChanged()}))),c._renderer.onRequestRedraw((function(e){return c.refreshRows(e.start,e.end,!0)})),c.register(h.addDisposableDomListener(window,"resize",(function(){return c.onDevicePixelRatioChange()}))),"IntersectionObserver"in window){var d=new IntersectionObserver((function(e){return c._onIntersectionChange(e[e.length-1])}),{threshold:0});d.observe(r),c.register({dispose:function(){return d.disconnect()}})}return c}return n(t,e),Object.defineProperty(t.prototype,"onDimensionsChange",{get:function(){return this._onDimensionsChange.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onRenderedBufferChange",{get:function(){return this._onRender.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onRefreshRequest",{get:function(){return this._onRefreshRequest.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dimensions",{get:function(){return this._renderer.dimensions},enumerable:!1,configurable:!0}),t.prototype._onIntersectionChange=function(e){this._isPaused=0===e.intersectionRatio,!this._isPaused&&this._needsFullRefresh&&(this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)},t.prototype.refreshRows=function(e,t,i){void 0===i&&(i=!1),this._isPaused?this._needsFullRefresh=!0:(i||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount))},t.prototype._renderRows=function(e,t){this._renderer.renderRows(e,t),this._needsSelectionRefresh&&(this._renderer.onSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0},t.prototype.resize=function(e,t){this._rowCount=t,this._fireOnCanvasResize()},t.prototype.changeOptions=function(){this._renderer.onOptionsChanged(),this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize()},t.prototype._fireOnCanvasResize=function(){this._renderer.dimensions.canvasWidth===this._canvasWidth&&this._renderer.dimensions.canvasHeight===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.dimensions)},t.prototype.dispose=function(){e.prototype.dispose.call(this)},t.prototype.setRenderer=function(e){var t=this;this._renderer.dispose(),this._renderer=e,this._renderer.onRequestRedraw((function(e){return t.refreshRows(e.start,e.end,!0)})),this._needsSelectionRefresh=!0,this._fullRefresh()},t.prototype._fullRefresh=function(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)},t.prototype.setColors=function(e){this._renderer.setColors(e),this._fullRefresh()},t.prototype.onDevicePixelRatioChange=function(){this._renderer.onDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1)},t.prototype.onResize=function(e,t){this._renderer.onResize(e,t),this._fullRefresh()},t.prototype.onCharSizeChanged=function(){this._renderer.onCharSizeChanged()},t.prototype.onBlur=function(){this._renderer.onBlur()},t.prototype.onFocus=function(){this._renderer.onFocus()},t.prototype.onSelectionChanged=function(e,t,i){this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=i,this._renderer.onSelectionChanged(e,t,i)},t.prototype.onCursorMove=function(){this._renderer.onCursorMove()},t.prototype.clear=function(){this._renderer.clear()},t.prototype.registerCharacterJoiner=function(e){return this._renderer.registerCharacterJoiner(e)},t.prototype.deregisterCharacterJoiner=function(e){return this._renderer.deregisterCharacterJoiner(e)},s([o(3,d.IOptionsService),o(4,f.ICharSizeService),o(5,d.IBufferService)],t)}(c.Disposable);t.RenderService=p},function(e,t,i){"use strict";var r=this&&this.__decorate||function(e,t,i,r){var n,s=arguments.length,o=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,r);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,i,o):n(t,i))||o);return s>3&&o&&Object.defineProperty(t,i,o),o},n=this&&this.__param||function(e,t){return function(i,r){t(i,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CharSizeService=void 0;var s=i(1),o=i(0),a=function(){function e(e,t,i){this._optionsService=i,this.width=0,this.height=0,this._onCharSizeChange=new o.EventEmitter,this._measureStrategy=new l(e,t,this._optionsService)}return Object.defineProperty(e.prototype,"hasValidSize",{get:function(){return this.width>0&&this.height>0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onCharSizeChange",{get:function(){return this._onCharSizeChange.event},enumerable:!1,configurable:!0}),e.prototype.measure=function(){var e=this._measureStrategy.measure();e.width===this.width&&e.height===this.height||(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())},r([n(2,s.IOptionsService)],e)}();t.CharSizeService=a;var l=function(){function e(e,t,i){this._document=e,this._parentElement=t,this._optionsService=i,this._result={width:0,height:0},this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W",this._measureElement.setAttribute("aria-hidden","true"),this._parentElement.appendChild(this._measureElement)}return e.prototype.measure=function(){this._measureElement.style.fontFamily=this._optionsService.options.fontFamily,this._measureElement.style.fontSize=this._optionsService.options.fontSize+"px";var e=this._measureElement.getBoundingClientRect();return 0!==e.width&&0!==e.height&&(this._result.width=e.width,this._result.height=Math.ceil(e.height)),this._result},e}()},function(e,t,i){"use strict";var r=this&&this.__decorate||function(e,t,i,r){var n,s=arguments.length,o=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,r);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,i,o):n(t,i))||o);return s>3&&o&&Object.defineProperty(t,i,o),o},n=this&&this.__param||function(e,t){return function(i,r){t(i,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.MouseService=void 0;var s=i(5),o=i(30),a=function(){function e(e,t){this._renderService=e,this._charSizeService=t}return e.prototype.getCoords=function(e,t,i,r,n){return o.getCoords(e,t,i,r,this._charSizeService.hasValidSize,this._renderService.dimensions.actualCellWidth,this._renderService.dimensions.actualCellHeight,n)},e.prototype.getRawByteCoords=function(e,t,i,r){var n=this.getCoords(e,t,i,r);return o.getRawByteCoords(n)},r([n(0,s.IRenderService),n(1,s.ICharSizeService)],e)}();t.MouseService=a},function(e,t,i){"use strict";var r,n=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)},function(e,t){function i(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}),s=this&&this.__decorate||function(e,t,i,r){var n,s=arguments.length,o=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,r);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,i,o):n(t,i))||o);return s>3&&o&&Object.defineProperty(t,i,o),o},o=this&&this.__param||function(e,t){return function(i,r){t(i,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Linkifier2=void 0;var a=i(1),l=i(0),c=i(2),u=i(7),h=function(e){function t(t){var i=e.call(this)||this;return i._bufferService=t,i._linkProviders=[],i._linkCacheDisposables=[],i._isMouseOut=!0,i._activeLine=-1,i._onShowLinkUnderline=i.register(new l.EventEmitter),i._onHideLinkUnderline=i.register(new l.EventEmitter),i.register(c.getDisposeArrayDisposable(i._linkCacheDisposables)),i}return n(t,e),Object.defineProperty(t.prototype,"onShowLinkUnderline",{get:function(){return this._onShowLinkUnderline.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onHideLinkUnderline",{get:function(){return this._onHideLinkUnderline.event},enumerable:!1,configurable:!0}),t.prototype.registerLinkProvider=function(e){var t=this;return this._linkProviders.push(e),{dispose:function(){var i=t._linkProviders.indexOf(e);-1!==i&&t._linkProviders.splice(i,1)}}},t.prototype.attachToDom=function(e,t,i){var r=this;this._element=e,this._mouseService=t,this._renderService=i,this.register(u.addDisposableDomListener(this._element,"mouseleave",(function(){r._isMouseOut=!0,r._clearCurrentLink()}))),this.register(u.addDisposableDomListener(this._element,"mousemove",this._onMouseMove.bind(this))),this.register(u.addDisposableDomListener(this._element,"click",this._onClick.bind(this)))},t.prototype._onMouseMove=function(e){if(this._lastMouseEvent=e,this._element&&this._mouseService){var t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(t){this._isMouseOut=!1;for(var i=e.composedPath(),r=0;re?this._bufferService.cols:o.link.range.end.x,c=a;c<=l;c++){if(i.has(c)){n.splice(s--,1);break}i.add(c)}}},t.prototype._checkLinkProviderResult=function(e,t,i){var r,n=this;if(!this._activeProviderReplies)return i;for(var s=this._activeProviderReplies.get(e),o=!1,a=0;a=e&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,c.disposeArray(this._linkCacheDisposables))},t.prototype._handleNewLink=function(e){var t=this;if(this._element&&this._lastMouseEvent&&this._mouseService){var i=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);i&&this._linkAtPosition(e.link,i)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:void 0===e.link.decorations||e.link.decorations.underline,pointerCursor:void 0===e.link.decorations||e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:function(){var e,i;return null===(i=null===(e=t._currentLink)||void 0===e?void 0:e.state)||void 0===i?void 0:i.decorations.pointerCursor},set:function(e){var i,r;(null===(i=t._currentLink)||void 0===i?void 0:i.state)&&t._currentLink.state.decorations.pointerCursor!==e&&(t._currentLink.state.decorations.pointerCursor=e,t._currentLink.state.isHovered&&(null===(r=t._element)||void 0===r||r.classList.toggle("xterm-cursor-pointer",e)))}},underline:{get:function(){var e,i;return null===(i=null===(e=t._currentLink)||void 0===e?void 0:e.state)||void 0===i?void 0:i.decorations.underline},set:function(i){var r,n,s;(null===(r=t._currentLink)||void 0===r?void 0:r.state)&&(null===(s=null===(n=t._currentLink)||void 0===n?void 0:n.state)||void 0===s?void 0:s.decorations.underline)!==i&&(t._currentLink.state.decorations.underline=i,t._currentLink.state.isHovered&&t._fireUnderlineEvent(e.link,i))}}}),this._renderService&&this._linkCacheDisposables.push(this._renderService.onRenderedBufferChange((function(e){var i=0===e.start?0:e.start+1+t._bufferService.buffer.ydisp;t._clearCurrentLink(i,e.end+1+t._bufferService.buffer.ydisp)}))))}},t.prototype._linkHover=function(e,t,i){var r;(null===(r=this._currentLink)||void 0===r?void 0:r.state)&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),t.hover&&t.hover(i,t.text)},t.prototype._fireUnderlineEvent=function(e,t){var i=e.range,r=this._bufferService.buffer.ydisp,n=this._createLinkUnderlineEvent(i.start.x-1,i.start.y-r-1,i.end.x,i.end.y-r-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(n)},t.prototype._linkLeave=function(e,t,i){var r;(null===(r=this._currentLink)||void 0===r?void 0:r.state)&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),t.leave&&t.leave(i,t.text)},t.prototype._linkAtPosition=function(e,t){var i=e.range.start.y===e.range.end.y,r=e.range.start.yt.y;return(i&&e.range.start.x<=t.x&&e.range.end.x>=t.x||r&&e.range.end.x>=t.x||n&&e.range.start.x<=t.x||r&&n)&&e.range.start.y<=t.y&&e.range.end.y>=t.y},t.prototype._positionFromMouseEvent=function(e,t,i){var r=i.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(r)return{x:r[0],y:r[1]+this._bufferService.buffer.ydisp}},t.prototype._createLinkUnderlineEvent=function(e,t,i,r,n){return{x1:e,y1:t,x2:i,y2:r,cols:this._bufferService.cols,fg:n}},s([o(0,a.IBufferService)],t)}(c.Disposable);t.Linkifier2=h},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CoreBrowserService=void 0;var r=function(){function e(e){this._textarea=e}return Object.defineProperty(e.prototype,"isFocused",{get:function(){return document.activeElement===this._textarea&&document.hasFocus()},enumerable:!1,configurable:!0}),e}();t.CoreBrowserService=r},function(e,t,i){"use strict";var r,n=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)},function(e,t){function i(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)});Object.defineProperty(t,"__esModule",{value:!0}),t.CoreTerminal=void 0;var s=i(2),o=i(1),a=i(66),l=i(67),c=i(68),u=i(74),h=i(75),d=i(0),f=i(76),p=i(77),g=i(78),v=i(80),m=i(81),y=i(19),_=i(82),b=function(e){function t(t){var i=e.call(this)||this;return i._onBinary=new d.EventEmitter,i._onData=new d.EventEmitter,i._onLineFeed=new d.EventEmitter,i._onResize=new d.EventEmitter,i._onScroll=new d.EventEmitter,i._instantiationService=new a.InstantiationService,i.optionsService=new u.OptionsService(t),i._instantiationService.setService(o.IOptionsService,i.optionsService),i._bufferService=i.register(i._instantiationService.createInstance(c.BufferService)),i._instantiationService.setService(o.IBufferService,i._bufferService),i._logService=i._instantiationService.createInstance(l.LogService),i._instantiationService.setService(o.ILogService,i._logService),i._coreService=i.register(i._instantiationService.createInstance(h.CoreService,(function(){return i.scrollToBottom()}))),i._instantiationService.setService(o.ICoreService,i._coreService),i._coreMouseService=i._instantiationService.createInstance(f.CoreMouseService),i._instantiationService.setService(o.ICoreMouseService,i._coreMouseService),i._dirtyRowService=i._instantiationService.createInstance(p.DirtyRowService),i._instantiationService.setService(o.IDirtyRowService,i._dirtyRowService),i.unicodeService=i._instantiationService.createInstance(g.UnicodeService),i._instantiationService.setService(o.IUnicodeService,i.unicodeService),i._charsetService=i._instantiationService.createInstance(v.CharsetService),i._instantiationService.setService(o.ICharsetService,i._charsetService),i._inputHandler=new y.InputHandler(i._bufferService,i._charsetService,i._coreService,i._dirtyRowService,i._logService,i.optionsService,i._coreMouseService,i.unicodeService),i.register(d.forwardEvent(i._inputHandler.onLineFeed,i._onLineFeed)),i.register(i._inputHandler),i.register(d.forwardEvent(i._bufferService.onResize,i._onResize)),i.register(d.forwardEvent(i._coreService.onData,i._onData)),i.register(d.forwardEvent(i._coreService.onBinary,i._onBinary)),i.register(i.optionsService.onOptionChange((function(e){return i._updateOptions(e)}))),i._writeBuffer=new _.WriteBuffer((function(e){return i._inputHandler.parse(e)})),i}return n(t,e),Object.defineProperty(t.prototype,"onBinary",{get:function(){return this._onBinary.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onData",{get:function(){return this._onData.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onLineFeed",{get:function(){return this._onLineFeed.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onResize",{get:function(){return this._onResize.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onScroll",{get:function(){return this._onScroll.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"cols",{get:function(){return this._bufferService.cols},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rows",{get:function(){return this._bufferService.rows},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"buffers",{get:function(){return this._bufferService.buffers},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){var t;this._isDisposed||(e.prototype.dispose.call(this),null===(t=this._windowsMode)||void 0===t||t.dispose(),this._windowsMode=void 0)},t.prototype.write=function(e,t){this._writeBuffer.write(e,t)},t.prototype.writeSync=function(e){this._writeBuffer.writeSync(e)},t.prototype.resize=function(e,t){isNaN(e)||isNaN(t)||(e=Math.max(e,c.MINIMUM_COLS),t=Math.max(t,c.MINIMUM_ROWS),this._bufferService.resize(e,t))},t.prototype.scroll=function(e,t){void 0===t&&(t=!1);var i,r=this._bufferService.buffer;(i=this._cachedBlankLine)&&i.length===this.cols&&i.getFg(0)===e.fg&&i.getBg(0)===e.bg||(i=r.getBlankLine(e,t),this._cachedBlankLine=i),i.isWrapped=t;var n=r.ybase+r.scrollTop,s=r.ybase+r.scrollBottom;if(0===r.scrollTop){var o=r.lines.isFull;s===r.lines.length-1?o?r.lines.recycle().copyFrom(i):r.lines.push(i.clone()):r.lines.splice(s+1,0,i.clone()),o?this._bufferService.isUserScrolling&&(r.ydisp=Math.max(r.ydisp-1,0)):(r.ybase++,this._bufferService.isUserScrolling||r.ydisp++)}else{var a=s-n+1;r.lines.shiftElements(n+1,a-1,-1),r.lines.set(s,i.clone())}this._bufferService.isUserScrolling||(r.ydisp=r.ybase),this._dirtyRowService.markRangeDirty(r.scrollTop,r.scrollBottom),this._onScroll.fire(r.ydisp)},t.prototype.scrollLines=function(e,t){var i=this._bufferService.buffer;if(e<0){if(0===i.ydisp)return;this._bufferService.isUserScrolling=!0}else e+i.ydisp>=i.ybase&&(this._bufferService.isUserScrolling=!1);var r=i.ydisp;i.ydisp=Math.max(Math.min(i.ydisp+e,i.ybase),0),r!==i.ydisp&&(t||this._onScroll.fire(i.ydisp))},t.prototype.scrollPages=function(e){this.scrollLines(e*(this.rows-1))},t.prototype.scrollToTop=function(){this.scrollLines(-this._bufferService.buffer.ydisp)},t.prototype.scrollToBottom=function(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)},t.prototype.scrollToLine=function(e){var t=e-this._bufferService.buffer.ydisp;0!==t&&this.scrollLines(t)},t.prototype.addEscHandler=function(e,t){return this._inputHandler.addEscHandler(e,t)},t.prototype.addDcsHandler=function(e,t){return this._inputHandler.addDcsHandler(e,t)},t.prototype.addCsiHandler=function(e,t){return this._inputHandler.addCsiHandler(e,t)},t.prototype.addOscHandler=function(e,t){return this._inputHandler.addOscHandler(e,t)},t.prototype._setup=function(){this.optionsService.options.windowsMode&&this._enableWindowsMode()},t.prototype.reset=function(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this._coreService.reset(),this._coreMouseService.reset()},t.prototype._updateOptions=function(e){var t;switch(e){case"scrollback":this.buffers.resize(this.cols,this.rows);break;case"windowsMode":this.optionsService.options.windowsMode?this._enableWindowsMode():(null===(t=this._windowsMode)||void 0===t||t.dispose(),this._windowsMode=void 0)}},t.prototype._enableWindowsMode=function(){var e=this;if(!this._windowsMode){var t=[];t.push(this.onLineFeed(m.updateWindowsModeWrappedState.bind(null,this._bufferService))),t.push(this.addCsiHandler({final:"H"},(function(){return m.updateWindowsModeWrappedState(e._bufferService),!1}))),this._windowsMode={dispose:function(){for(var e=0,i=t;e0?n[0].index:t.length;if(t.length!==h)throw new Error("[createInstance] First service dependency of "+e.name+" at position "+(h+1)+" conflicts with "+t.length+" static arguments");return new(e.bind.apply(e,r([void 0],r(t,o))))},e}();t.InstantiationService=a},function(e,t,i){"use strict";var r=this&&this.__decorate||function(e,t,i,r){var n,s=arguments.length,o=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,r);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,i,o):n(t,i))||o);return s>3&&o&&Object.defineProperty(t,i,o),o},n=this&&this.__param||function(e,t){return function(i,r){t(i,r,e)}},s=this&&this.__spreadArrays||function(){for(var e=0,t=0,i=arguments.length;t=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,i,o):n(t,i))||o);return s>3&&o&&Object.defineProperty(t,i,o),o},o=this&&this.__param||function(e,t){return function(i,r){t(i,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.BufferService=t.MINIMUM_ROWS=t.MINIMUM_COLS=void 0;var a=i(1),l=i(69),c=i(0),u=i(2);t.MINIMUM_COLS=2,t.MINIMUM_ROWS=1;var h=function(e){function i(i){var r=e.call(this)||this;return r._optionsService=i,r.isUserScrolling=!1,r._onResize=new c.EventEmitter,r.cols=Math.max(i.options.cols,t.MINIMUM_COLS),r.rows=Math.max(i.options.rows,t.MINIMUM_ROWS),r.buffers=new l.BufferSet(i,r),r}return n(i,e),Object.defineProperty(i.prototype,"onResize",{get:function(){return this._onResize.event},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"buffer",{get:function(){return this.buffers.active},enumerable:!1,configurable:!0}),i.prototype.dispose=function(){e.prototype.dispose.call(this),this.buffers.dispose()},i.prototype.resize=function(e,t){this.cols=e,this.rows=t,this.buffers.resize(e,t),this.buffers.setupTabStops(this.cols),this._onResize.fire({cols:e,rows:t})},i.prototype.reset=function(){this.buffers.dispose(),this.buffers=new l.BufferSet(this._optionsService,this),this.isUserScrolling=!1},s([o(0,a.IOptionsService)],i)}(u.Disposable);t.BufferService=h},function(e,t,i){"use strict";var r,n=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)},function(e,t){function i(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)});Object.defineProperty(t,"__esModule",{value:!0}),t.BufferSet=void 0;var s=i(70),o=i(0),a=function(e){function t(t,i){var r=e.call(this)||this;return r._onBufferActivate=r.register(new o.EventEmitter),r._normal=new s.Buffer(!0,t,i),r._normal.fillViewportRows(),r._alt=new s.Buffer(!1,t,i),r._activeBuffer=r._normal,r.setupTabStops(),r}return n(t,e),Object.defineProperty(t.prototype,"onBufferActivate",{get:function(){return this._onBufferActivate.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"alt",{get:function(){return this._alt},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"active",{get:function(){return this._activeBuffer},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"normal",{get:function(){return this._normal},enumerable:!1,configurable:!0}),t.prototype.activateNormalBuffer=function(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))},t.prototype.activateAltBuffer=function(e){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(e),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))},t.prototype.resize=function(e,t){this._normal.resize(e,t),this._alt.resize(e,t)},t.prototype.setupTabStops=function(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)},t}(i(2).Disposable);t.BufferSet=a},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BufferStringIterator=t.Buffer=t.MAX_BUFFER_SIZE=void 0;var r=i(71),n=i(16),s=i(4),o=i(3),a=i(72),l=i(73),c=i(20),u=i(6);t.MAX_BUFFER_SIZE=4294967295;var h=function(){function e(e,t,i){this._hasScrollback=e,this._optionsService=t,this._bufferService=i,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.savedY=0,this.savedX=0,this.savedCurAttrData=n.DEFAULT_ATTR_DATA.clone(),this.savedCharset=c.DEFAULT_CHARSET,this.markers=[],this._nullCell=s.CellData.fromCharData([0,o.NULL_CELL_CHAR,o.NULL_CELL_WIDTH,o.NULL_CELL_CODE]),this._whitespaceCell=s.CellData.fromCharData([0,o.WHITESPACE_CELL_CHAR,o.WHITESPACE_CELL_WIDTH,o.WHITESPACE_CELL_CODE]),this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new r.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}return e.prototype.getNullCell=function(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new u.ExtendedAttrs),this._nullCell},e.prototype.getWhitespaceCell=function(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new u.ExtendedAttrs),this._whitespaceCell},e.prototype.getBlankLine=function(e,t){return new n.BufferLine(this._bufferService.cols,this.getNullCell(e),t)},Object.defineProperty(e.prototype,"hasScrollback",{get:function(){return this._hasScrollback&&this.lines.maxLength>this._rows},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isCursorInViewport",{get:function(){var e=this.ybase+this.y-this.ydisp;return e>=0&&et.MAX_BUFFER_SIZE?t.MAX_BUFFER_SIZE:i},e.prototype.fillViewportRows=function(e){if(0===this.lines.length){void 0===e&&(e=n.DEFAULT_ATTR_DATA);for(var t=this._rows;t--;)this.lines.push(this.getBlankLine(e))}},e.prototype.clear=function(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new r.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()},e.prototype.resize=function(e,t){var i=this.getNullCell(n.DEFAULT_ATTR_DATA),r=this._getCorrectBufferLength(t);if(r>this.lines.maxLength&&(this.lines.maxLength=r),this.lines.length>0){if(this._cols0&&this.lines.length<=this.ybase+this.y+o+1?(this.ybase--,o++,this.ydisp>0&&this.ydisp--):this.lines.push(new n.BufferLine(e,i)));else for(a=this._rows;a>t;a--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(r0&&(this.lines.trimStart(l),this.ybase=Math.max(this.ybase-l,0),this.ydisp=Math.max(this.ydisp-l,0),this.savedY=Math.max(this.savedY-l,0)),this.lines.maxLength=r}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),o&&(this.y+=o),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(s=0;sthis._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))},e.prototype._reflowLarger=function(e,t){var i=a.reflowLargerGetLinesToRemove(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(n.DEFAULT_ATTR_DATA));if(i.length>0){var r=a.reflowLargerCreateNewLayout(this.lines,i);a.reflowLargerApplyNewLayout(this.lines,r.layout),this._reflowLargerAdjustViewport(e,t,r.countRemoved)}},e.prototype._reflowLargerAdjustViewport=function(e,t,i){for(var r=this.getNullCell(n.DEFAULT_ATTR_DATA),s=i;s-- >0;)0===this.ybase?(this.y>0&&this.y--,this.lines.length=0;o--){var l=this.lines.get(o);if(!(!l||!l.isWrapped&&l.getTrimmedLength()<=e)){for(var c=[l];l.isWrapped&&o>0;)l=this.lines.get(--o),c.unshift(l);var u=this.ybase+this.y;if(!(u>=o&&u0&&(r.push({start:o+c.length+s,newLines:g}),s+=g.length),c.push.apply(c,g);var y=f.length-1,_=f[y];0===_&&(_=f[--y]);for(var b=c.length-p-1,S=d;b>=0;){var C=Math.min(S,_);if(c[y].copyCellsFrom(c[b],S-C,_-C,C,!0),0==(_-=C)&&(_=f[--y]),0==(S-=C)){b--;var w=Math.max(b,0);S=a.getWrappedLineTrimmedLength(c,w,this._cols)}}for(v=0;v0;)0===this.ybase?this.y0){var x=[],E=[];for(v=0;v=0;v--)if(R&&R.start>L+D){for(var O=R.newLines.length-1;O>=0;O--)this.lines.set(v--,R.newLines[O]);v++,x.push({index:L+1,amount:R.newLines.length}),D+=R.newLines.length,R=r[++A]}else this.lines.set(v,E[L--]);var M=0;for(v=x.length-1;v>=0;v--)x[v].index+=M,this.lines.onInsertEmitter.fire(x[v]),M+=x[v].amount;var I=Math.max(0,T+s-this.lines.maxLength);I>0&&this.lines.onTrimEmitter.fire(I)}},e.prototype.stringIndexToBufferIndex=function(e,t,i){for(void 0===i&&(i=!1);t;){var r=this.lines.get(e);if(!r)return[-1,-1];for(var n=i?r.getTrimmedLength():r.length,s=0;s0&&this.lines.get(t).isWrapped;)t--;for(;i+10;);return e>=this._cols?this._cols-1:e<0?0:e},e.prototype.nextStop=function(e){for(null==e&&(e=this.x);!this.tabs[++e]&&e=this._cols?this._cols-1:e<0?0:e},e.prototype.addMarker=function(e){var t=this,i=new l.Marker(e);return this.markers.push(i),i.register(this.lines.onTrim((function(e){i.line-=e,i.line<0&&i.dispose()}))),i.register(this.lines.onInsert((function(e){i.line>=e.index&&(i.line+=e.amount)}))),i.register(this.lines.onDelete((function(e){i.line>=e.index&&i.linee.index&&(i.line-=e.amount)}))),i.register(i.onDispose((function(){return t._removeMarker(i)}))),i},e.prototype._removeMarker=function(e){this.markers.splice(this.markers.indexOf(e),1)},e.prototype.iterator=function(e,t,i,r,n){return new d(this,e,t,i,r,n)},e}();t.Buffer=h;var d=function(){function e(e,t,i,r,n,s){void 0===i&&(i=0),void 0===r&&(r=e.lines.length),void 0===n&&(n=0),void 0===s&&(s=0),this._buffer=e,this._trimRight=t,this._startIndex=i,this._endIndex=r,this._startOverscan=n,this._endOverscan=s,this._startIndex<0&&(this._startIndex=0),this._endIndex>this._buffer.lines.length&&(this._endIndex=this._buffer.lines.length),this._current=this._startIndex}return e.prototype.hasNext=function(){return this._currentthis._endIndex+this._endOverscan&&(e.last=this._endIndex+this._endOverscan),e.first=Math.max(e.first,0),e.last=Math.min(e.last,this._buffer.lines.length);for(var t="",i=e.first;i<=e.last;++i)t+=this._buffer.translateBufferLineToString(i,this._trimRight);return this._current=e.last+1,{range:e,content:t}},e}();t.BufferStringIterator=d},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CircularList=void 0;var r=i(0),n=function(){function e(e){this._maxLength=e,this.onDeleteEmitter=new r.EventEmitter,this.onInsertEmitter=new r.EventEmitter,this.onTrimEmitter=new r.EventEmitter,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}return Object.defineProperty(e.prototype,"onDelete",{get:function(){return this.onDeleteEmitter.event},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onInsert",{get:function(){return this.onInsertEmitter.event},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onTrim",{get:function(){return this.onTrimEmitter.event},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"maxLength",{get:function(){return this._maxLength},set:function(e){if(this._maxLength!==e){for(var t=new Array(e),i=0;ithis._length)for(var t=this._length;t=e;n--)this._array[this._getCyclicIndex(n+i.length)]=this._array[this._getCyclicIndex(n)];for(n=0;nthis._maxLength){var s=this._length+i.length-this._maxLength;this._startIndex+=s,this._length=this._maxLength,this.onTrimEmitter.fire(s)}else this._length+=i.length},e.prototype.trimStart=function(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)},e.prototype.shiftElements=function(e,t,i){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+i<0)throw new Error("Cannot shift elements in list beyond index 0");if(i>0){for(var r=t-1;r>=0;r--)this.set(e+r+i,this.get(e+r));var n=e+t+i-this._length;if(n>0)for(this._length+=n;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(r=0;r=a&&n0&&(b>h||0===u[b].getTrimmedLength());b--)_++;_>0&&(o.push(a+u.length-_),o.push(_)),a+=u.length-1}}}return o},t.reflowLargerCreateNewLayout=function(e,t){for(var i=[],r=0,n=t[r],s=0,o=0;oc&&(o-=c,a++);var u=2===e[a].getWidth(o-1);u&&o--;var h=u?i-1:i;n.push(h),l+=h}return n},t.getWrappedLineTrimmedLength=r},function(e,t,i){"use strict";var r,n=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)},function(e,t){function i(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)});Object.defineProperty(t,"__esModule",{value:!0}),t.Marker=void 0;var s=i(0),o=function(e){function t(i){var r=e.call(this)||this;return r.line=i,r._id=t._nextId++,r.isDisposed=!1,r._onDispose=new s.EventEmitter,r}return n(t,e),Object.defineProperty(t.prototype,"id",{get:function(){return this._id},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onDispose",{get:function(){return this._onDispose.event},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire())},t._nextId=1,t}(i(2).Disposable);t.Marker=o},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.OptionsService=t.DEFAULT_OPTIONS=t.DEFAULT_BELL_SOUND=void 0;var r=i(0),n=i(11),s=i(33);t.DEFAULT_BELL_SOUND="data:audio/mp3;base64,SUQzBAAAAAAAI1RTU0UAAAAPAAADTGF2ZjU4LjMyLjEwNAAAAAAAAAAAAAAA//tQxAADB8AhSmxhIIEVCSiJrDCQBTcu3UrAIwUdkRgQbFAZC1CQEwTJ9mjRvBA4UOLD8nKVOWfh+UlK3z/177OXrfOdKl7pyn3Xf//WreyTRUoAWgBgkOAGbZHBgG1OF6zM82DWbZaUmMBptgQhGjsyYqc9ae9XFz280948NMBWInljyzsNRFLPWdnZGWrddDsjK1unuSrVN9jJsK8KuQtQCtMBjCEtImISdNKJOopIpBFpNSMbIHCSRpRR5iakjTiyzLhchUUBwCgyKiweBv/7UsQbg8isVNoMPMjAAAA0gAAABEVFGmgqK////9bP/6XCykxBTUUzLjEwMKqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq",t.DEFAULT_OPTIONS=Object.freeze({cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,bellSound:t.DEFAULT_BELL_SOUND,bellStyle:"none",drawBoldTextInBrightColors:!0,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"courier-new, courier, monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",lineHeight:1,linkTooltipHoverDuration:500,letterSpacing:0,logLevel:"info",scrollback:1e3,scrollSensitivity:1,screenReaderMode:!1,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!0,allowTransparency:!1,tabStopWidth:8,theme:{},rightClickSelectsWord:n.isMac,rendererType:"canvas",windowOptions:{},windowsMode:!1,wordSeparator:" ()[]{}',\"`",convertEol:!1,termName:"xterm",cancelEvents:!1});var o=["cols","rows"],a=function(){function e(e){this._onOptionChange=new r.EventEmitter,this.options=s.clone(t.DEFAULT_OPTIONS);for(var i=0,n=Object.keys(e);i=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,i,o):n(t,i))||o);return s>3&&o&&Object.defineProperty(t,i,o),o},o=this&&this.__param||function(e,t){return function(i,r){t(i,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreService=void 0;var a=i(1),l=i(0),c=i(33),u=i(2),h=Object.freeze({insertMode:!1}),d=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0}),f=function(e){function t(t,i,r,n){var s=e.call(this)||this;return s._bufferService=i,s._logService=r,s._optionsService=n,s.isCursorInitialized=!1,s.isCursorHidden=!1,s._onData=s.register(new l.EventEmitter),s._onUserInput=s.register(new l.EventEmitter),s._onBinary=s.register(new l.EventEmitter),s._scrollToBottom=t,s.register({dispose:function(){return s._scrollToBottom=void 0}}),s.modes=c.clone(h),s.decPrivateModes=c.clone(d),s}return n(t,e),Object.defineProperty(t.prototype,"onData",{get:function(){return this._onData.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onUserInput",{get:function(){return this._onUserInput.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onBinary",{get:function(){return this._onBinary.event},enumerable:!1,configurable:!0}),t.prototype.reset=function(){this.modes=c.clone(h),this.decPrivateModes=c.clone(d)},t.prototype.triggerDataEvent=function(e,t){if(void 0===t&&(t=!1),!this._optionsService.options.disableStdin){var i=this._bufferService.buffer;i.ybase!==i.ydisp&&this._scrollToBottom(),t&&this._onUserInput.fire(),this._logService.debug('sending data "'+e+'"',(function(){return e.split("").map((function(e){return e.charCodeAt(0)}))})),this._onData.fire(e)}},t.prototype.triggerBinaryEvent=function(e){this._optionsService.options.disableStdin||(this._logService.debug('sending binary "'+e+'"',(function(){return e.split("").map((function(e){return e.charCodeAt(0)}))})),this._onBinary.fire(e))},s([o(1,a.IBufferService),o(2,a.ILogService),o(3,a.IOptionsService)],t)}(u.Disposable);t.CoreService=f},function(e,t,i){"use strict";var r=this&&this.__decorate||function(e,t,i,r){var n,s=arguments.length,o=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,r);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,i,o):n(t,i))||o);return s>3&&o&&Object.defineProperty(t,i,o),o},n=this&&this.__param||function(e,t){return function(i,r){t(i,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreMouseService=void 0;var s=i(1),o=i(0),a={NONE:{events:0,restrict:function(){return!1}},X10:{events:1,restrict:function(e){return 4!==e.button&&1===e.action&&(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)}},VT200:{events:19,restrict:function(e){return 32!==e.action}},DRAG:{events:23,restrict:function(e){return 32!==e.action||3!==e.button}},ANY:{events:31,restrict:function(e){return!0}}};function l(e,t){var i=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return 4===e.button?(i|=64,i|=e.action):(i|=3&e.button,4&e.button&&(i|=64),8&e.button&&(i|=128),32===e.action?i|=32:0!==e.action||t||(i|=3)),i}var c=String.fromCharCode,u={DEFAULT:function(e){var t=[l(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":""+c(t[0])+c(t[1])+c(t[2])},SGR:function(e){var t=0===e.action&&4!==e.button?"m":"M";return"[<"+l(e,!0)+";"+e.col+";"+e.row+t}},h=function(){function e(e,t){this._bufferService=e,this._coreService=t,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._onProtocolChange=new o.EventEmitter,this._lastEvent=null;for(var i=0,r=Object.keys(a);i=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows)return!1;if(4===e.button&&32===e.action)return!1;if(3===e.button&&32!==e.action)return!1;if(4!==e.button&&(2===e.action||3===e.action))return!1;if(e.col++,e.row++,32===e.action&&this._lastEvent&&this._compareEvents(this._lastEvent,e))return!1;if(!this._protocols[this._activeProtocol].restrict(e))return!1;var t=this._encodings[this._activeEncoding](e);return t&&("DEFAULT"===this._activeEncoding?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0},e.prototype.explainEvents=function(e){return{down:!!(1&e),up:!!(2&e),drag:!!(4&e),move:!!(8&e),wheel:!!(16&e)}},e.prototype._compareEvents=function(e,t){return e.col===t.col&&e.row===t.row&&e.button===t.button&&e.action===t.action&&e.ctrl===t.ctrl&&e.alt===t.alt&&e.shift===t.shift},r([n(0,s.IBufferService),n(1,s.ICoreService)],e)}();t.CoreMouseService=h},function(e,t,i){"use strict";var r=this&&this.__decorate||function(e,t,i,r){var n,s=arguments.length,o=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,r);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,i,o):n(t,i))||o);return s>3&&o&&Object.defineProperty(t,i,o),o},n=this&&this.__param||function(e,t){return function(i,r){t(i,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DirtyRowService=void 0;var s=i(1),o=function(){function e(e){this._bufferService=e,this.clearRange()}return Object.defineProperty(e.prototype,"start",{get:function(){return this._start},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"end",{get:function(){return this._end},enumerable:!1,configurable:!0}),e.prototype.clearRange=function(){this._start=this._bufferService.buffer.y,this._end=this._bufferService.buffer.y},e.prototype.markDirty=function(e){ethis._end&&(this._end=e)},e.prototype.markRangeDirty=function(e,t){if(e>t){var i=e;e=t,t=i}ethis._end&&(this._end=t)},e.prototype.markAllDirty=function(){this.markRangeDirty(0,this._bufferService.rows-1)},r([n(0,s.IBufferService)],e)}();t.DirtyRowService=o},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeService=void 0;var r=i(0),n=i(79),s=function(){function e(){this._providers=Object.create(null),this._active="",this._onChange=new r.EventEmitter;var e=new n.UnicodeV6;this.register(e),this._active=e.version,this._activeProvider=e}return Object.defineProperty(e.prototype,"onChange",{get:function(){return this._onChange.event},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"versions",{get:function(){return Object.keys(this._providers)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"activeVersion",{get:function(){return this._active},set:function(e){if(!this._providers[e])throw new Error('unknown Unicode version "'+e+'"');this._active=e,this._activeProvider=this._providers[e],this._onChange.fire(e)},enumerable:!1,configurable:!0}),e.prototype.register=function(e){this._providers[e.version]=e},e.prototype.wcwidth=function(e){return this._activeProvider.wcwidth(e)},e.prototype.getStringCellWidth=function(e){for(var t=0,i=e.length,r=0;r=i)return t+this.wcwidth(n);var s=e.charCodeAt(r);56320<=s&&s<=57343?n=1024*(n-55296)+s-56320+65536:t+=this.wcwidth(s)}t+=this.wcwidth(n)}return t},e}();t.UnicodeService=s},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeV6=void 0;var r,n=i(15),s=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],o=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],a=function(){function e(){if(this.version="6",!r){r=new Uint8Array(65536),n.fill(r,1),r[0]=0,n.fill(r,0,1,32),n.fill(r,0,127,160),n.fill(r,2,4352,4448),r[9001]=2,r[9002]=2,n.fill(r,2,11904,42192),r[12351]=1,n.fill(r,2,44032,55204),n.fill(r,2,63744,64256),n.fill(r,2,65040,65050),n.fill(r,2,65072,65136),n.fill(r,2,65280,65377),n.fill(r,2,65504,65511);for(var e=0;et[n][1])return!1;for(;n>=r;)if(e>t[i=r+n>>1][1])r=i+1;else{if(!(e=131072&&e<=196605||e>=196608&&e<=262141?2:1},e}();t.UnicodeV6=a},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CharsetService=void 0;var r=function(){function e(){this.glevel=0,this._charsets=[]}return e.prototype.reset=function(){this.charset=void 0,this._charsets=[],this.glevel=0},e.prototype.setgLevel=function(e){this.glevel=e,this.charset=this._charsets[e]},e.prototype.setgCharset=function(e,t){this._charsets[e]=t,this.glevel===e&&(this.charset=t)},e}();t.CharsetService=r},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.updateWindowsModeWrappedState=void 0;var r=i(3);t.updateWindowsModeWrappedState=function(e){var t=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1),i=null==t?void 0:t.get(e.cols-1),n=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);n&&i&&(n.isWrapped=i[r.CHAR_DATA_CODE_INDEX]!==r.NULL_CELL_CODE&&i[r.CHAR_DATA_CODE_INDEX]!==r.WHITESPACE_CELL_CODE)}},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WriteBuffer=void 0;var r=function(){function e(e){this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0}return e.prototype.writeSync=function(e){if(this._writeBuffer.length){for(var t=this._bufferOffset;t5e7)throw new Error("write data discarded, use flow control to avoid losing data");this._writeBuffer.length||(this._bufferOffset=0,setTimeout((function(){return i._innerWrite()}))),this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)},e.prototype._innerWrite=function(){for(var e=this,t=Date.now();this._writeBuffer.length>this._bufferOffset;){var i=this._writeBuffer[this._bufferOffset],r=this._callbacks[this._bufferOffset];if(this._bufferOffset++,this._action(i),this._pendingData-=i.length,r&&r(),Date.now()-t>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout((function(){return e._innerWrite()}),0)):(this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0)},e}();t.WriteBuffer=r},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AddonManager=void 0;var r=function(){function e(){this._addons=[]}return e.prototype.dispose=function(){for(var e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()},e.prototype.loadAddon=function(e,t){var i=this,r={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(r),t.dispose=function(){return i._wrappedAddonDispose(r)},t.activate(e)},e.prototype._wrappedAddonDispose=function(e){if(!e.isDisposed){for(var t=-1,i=0;i> RFB.constructor"),r._screen=document.createElement("div"),r._screen.style.display="flex",r._screen.style.width="100%",r._screen.style.height="100%",r._screen.style.overflow="auto",r._screen.style.background="rgb(40, 40, 40)",r._canvas=document.createElement("canvas"),r._canvas.style.margin="auto",r._canvas.style.outline="none",r._canvas.style.flexShrink="0",r._canvas.width=0,r._canvas.height=0,r._canvas.tabIndex=-1,r._screen.appendChild(r._canvas),r._cursor=new g.default,r._cursorImage=T.cursors.none,r._decoders[b.encodings.encodingRaw]=new S.default,r._decoders[b.encodings.encodingCopyRect]=new C.default,r._decoders[b.encodings.encodingRRE]=new w.default,r._decoders[b.encodings.encodingHextile]=new k.default,r._decoders[b.encodings.encodingTight]=new x.default,r._decoders[b.encodings.encodingTightPNG]=new E.default;try{r._display=new u.default(r._canvas)}catch(e){throw n.Error("Display exception: "+e),e}return r._display.onflush=r._onFlush.bind(I(r)),r._keyboard=new f.default(r._canvas),r._keyboard.onkeyevent=r._handleKeyEvent.bind(I(r)),r._gestures=new p.default,r._sock=new v.default,r._sock.on("message",(function(){r._handleMessage()})),r._sock.on("open",(function(){"connecting"===r._rfbConnectionState&&""===r._rfbInitState?(r._rfbInitState="ProtocolVersion",n.Debug("Starting VNC handshake")):r._fail("Unexpected server connection while "+r._rfbConnectionState)})),r._sock.on("close",(function(e){n.Debug("WebSocket on-close event");var t="";switch(e.code&&(t="(code: "+e.code,e.reason&&(t+=", reason: "+e.reason),t+=")"),r._rfbConnectionState){case"connecting":r._fail("Connection closed "+t);break;case"connected":r._updateConnectionState("disconnecting"),r._updateConnectionState("disconnected");break;case"disconnecting":r._updateConnectionState("disconnected");break;case"disconnected":r._fail("Unexpected server disconnect when already disconnected "+t);break;default:r._fail("Unexpected server disconnect before connecting "+t)}r._sock.off("close")})),r._sock.on("error",(function(e){return n.Warn("WebSocket on-error event")})),setTimeout(r._updateConnectionState.bind(I(r),"connecting")),n.Debug("<< RFB.constructor"),r.dragViewport=!1,r.focusOnClick=!0,r._viewOnly=!1,r._clipViewport=!1,r._scaleViewport=!1,r._resizeSession=!1,r._showDotCursor=!1,void 0!==i.showDotCursor&&(n.Warn("Specifying showDotCursor as a RFB constructor argument is deprecated"),r._showDotCursor=i.showDotCursor),r._qualityLevel=6,r._compressionLevel=2,r}return t=T,c=[{key:"genDES",value:function(e,t){var i=e.split("").map((function(e){return e.charCodeAt(0)}));return new m.default(i).encrypt(t)}}],(i=[{key:"disconnect",value:function(){this._updateConnectionState("disconnecting"),this._sock.off("error"),this._sock.off("message"),this._sock.off("open")}},{key:"sendCredentials",value:function(e){this._rfbCredentials=e,setTimeout(this._initMsg.bind(this),0)}},{key:"sendCtrlAltDel",value:function(){"connected"!==this._rfbConnectionState||this._viewOnly||(n.Info("Sending Ctrl-Alt-Del"),this.sendKey(y.default.XK_Control_L,"ControlLeft",!0),this.sendKey(y.default.XK_Alt_L,"AltLeft",!0),this.sendKey(y.default.XK_Delete,"Delete",!0),this.sendKey(y.default.XK_Delete,"Delete",!1),this.sendKey(y.default.XK_Alt_L,"AltLeft",!1),this.sendKey(y.default.XK_Control_L,"ControlLeft",!1))}},{key:"machineShutdown",value:function(){this._xvpOp(1,2)}},{key:"machineReboot",value:function(){this._xvpOp(1,3)}},{key:"machineReset",value:function(){this._xvpOp(1,4)}},{key:"sendKey",value:function(e,t,i){if("connected"===this._rfbConnectionState&&!this._viewOnly){if(void 0===i)return this.sendKey(e,t,!0),void this.sendKey(e,t,!1);var r=_.default[t];if(this._qemuExtKeyEventSupported&&r)e=e||0,n.Info("Sending key ("+(i?"down":"up")+"): keysym "+e+", scancode "+r),T.messages.QEMUExtendedKeyEvent(this._sock,e,i,r);else{if(!e)return;n.Info("Sending keysym ("+(i?"down":"up")+"): "+e),T.messages.keyEvent(this._sock,e,i?1:0)}}}},{key:"focus",value:function(){this._canvas.focus()}},{key:"blur",value:function(){this._canvas.blur()}},{key:"clipboardPasteFrom",value:function(e){if("connected"===this._rfbConnectionState&&!this._viewOnly)if(this._clipboardServerCapabilitiesFormats[1]&&this._clipboardServerCapabilitiesActions[1<<27])this._clipboardText=e,T.messages.extendedClipboardNotify(this._sock,[1]);else{for(var t=new Uint8Array(e.length),i=0;i> RFB.connect"),n.Info("connecting to "+this._url);try{this._sock.open(this._url,this._wsProtocols)}catch(e){"SyntaxError"===e.name?this._fail("Invalid host or port ("+e+")"):this._fail("Error when opening socket ("+e+")")}this._target.appendChild(this._screen),this._gestures.attach(this._canvas),this._cursor.attach(this._canvas),this._refreshCursor(),window.addEventListener("resize",this._eventHandlers.windowResize),this._canvas.addEventListener("mousedown",this._eventHandlers.focusCanvas),this._canvas.addEventListener("touchstart",this._eventHandlers.focusCanvas),this._canvas.addEventListener("mousedown",this._eventHandlers.handleMouse),this._canvas.addEventListener("mouseup",this._eventHandlers.handleMouse),this._canvas.addEventListener("mousemove",this._eventHandlers.handleMouse),this._canvas.addEventListener("click",this._eventHandlers.handleMouse),this._canvas.addEventListener("contextmenu",this._eventHandlers.handleMouse),this._canvas.addEventListener("wheel",this._eventHandlers.handleWheel),this._canvas.addEventListener("gesturestart",this._eventHandlers.handleGesture),this._canvas.addEventListener("gesturemove",this._eventHandlers.handleGesture),this._canvas.addEventListener("gestureend",this._eventHandlers.handleGesture),n.Debug("<< RFB.connect")}},{key:"_disconnect",value:function(){n.Debug(">> RFB.disconnect"),this._cursor.detach(),this._canvas.removeEventListener("gesturestart",this._eventHandlers.handleGesture),this._canvas.removeEventListener("gesturemove",this._eventHandlers.handleGesture),this._canvas.removeEventListener("gestureend",this._eventHandlers.handleGesture),this._canvas.removeEventListener("wheel",this._eventHandlers.handleWheel),this._canvas.removeEventListener("mousedown",this._eventHandlers.handleMouse),this._canvas.removeEventListener("mouseup",this._eventHandlers.handleMouse),this._canvas.removeEventListener("mousemove",this._eventHandlers.handleMouse),this._canvas.removeEventListener("click",this._eventHandlers.handleMouse),this._canvas.removeEventListener("contextmenu",this._eventHandlers.handleMouse),this._canvas.removeEventListener("mousedown",this._eventHandlers.focusCanvas),this._canvas.removeEventListener("touchstart",this._eventHandlers.focusCanvas),window.removeEventListener("resize",this._eventHandlers.windowResize),this._keyboard.ungrab(),this._gestures.detach(),this._sock.close();try{this._target.removeChild(this._screen)}catch(e){if("NotFoundError"!==e.name)throw e}clearTimeout(this._resizeTimeout),clearTimeout(this._mouseMoveTimer),n.Debug("<< RFB.disconnect")}},{key:"_focusCanvas",value:function(e){this.focusOnClick&&this.focus()}},{key:"_setDesktopName",value:function(e){this._fbName=e,this.dispatchEvent(new CustomEvent("desktopname",{detail:{name:this._fbName}}))}},{key:"_windowResize",value:function(e){var t=this;window.requestAnimationFrame((function(){t._updateClip(),t._updateScale()})),this._resizeSession&&(clearTimeout(this._resizeTimeout),this._resizeTimeout=setTimeout(this._requestRemoteResize.bind(this),500))}},{key:"_updateClip",value:function(){var e=this._display.clipViewport,t=this._clipViewport;if(this._scaleViewport&&(t=!1),e!==t&&(this._display.clipViewport=t),t){var i=this._screenSize();this._display.viewportChangeSize(i.w,i.h),this._fixScrollbars()}}},{key:"_updateScale",value:function(){if(this._scaleViewport){var e=this._screenSize();this._display.autoscale(e.w,e.h)}else this._display.scale=1;this._fixScrollbars()}},{key:"_requestRemoteResize",value:function(){if(clearTimeout(this._resizeTimeout),this._resizeTimeout=null,this._resizeSession&&!this._viewOnly&&this._supportsSetDesktopSize){var e=this._screenSize();T.messages.setDesktopSize(this._sock,Math.floor(e.w),Math.floor(e.h),this._screenID,this._screenFlags),n.Debug("Requested new desktop size: "+e.w+"x"+e.h)}}},{key:"_screenSize",value:function(){var e=this._screen.getBoundingClientRect();return{w:e.width,h:e.height}}},{key:"_fixScrollbars",value:function(){var e=this._screen.style.overflow;this._screen.style.overflow="hidden",this._screen.getBoundingClientRect(),this._screen.style.overflow=e}},{key:"_updateConnectionState",value:function(e){var t=this,i=this._rfbConnectionState;if(e!==i)if("disconnected"!==i){switch(e){case"connected":if("connecting"!==i)return void n.Error("Bad transition to connected state, previous connection state: "+i);break;case"disconnected":if("disconnecting"!==i)return void n.Error("Bad transition to disconnected state, previous connection state: "+i);break;case"connecting":if(""!==i)return void n.Error("Bad transition to connecting state, previous connection state: "+i);break;case"disconnecting":if("connected"!==i&&"connecting"!==i)return void n.Error("Bad transition to disconnecting state, previous connection state: "+i);break;default:return void n.Error("Unknown connection state: "+e)}switch(this._rfbConnectionState=e,n.Debug("New state '"+e+"', was '"+i+"'."),this._disconnTimer&&"disconnecting"!==e&&(n.Debug("Clearing disconnect timer"),clearTimeout(this._disconnTimer),this._disconnTimer=null,this._sock.off("close")),e){case"connecting":this._connect();break;case"connected":this.dispatchEvent(new CustomEvent("connect",{detail:{}}));break;case"disconnecting":this._disconnect(),this._disconnTimer=setTimeout((function(){n.Error("Disconnection timed out."),t._updateConnectionState("disconnected")}),3e3);break;case"disconnected":this.dispatchEvent(new CustomEvent("disconnect",{detail:{clean:this._rfbCleanDisconnect}}))}}else n.Error("Tried changing state of a disconnected RFB object");else n.Debug("Already in state '"+e+"', ignoring")}},{key:"_fail",value:function(e){switch(this._rfbConnectionState){case"disconnecting":n.Error("Failed when disconnecting: "+e);break;case"connected":n.Error("Failed while connected: "+e);break;case"connecting":n.Error("Failed when connecting: "+e);break;default:n.Error("RFB failure: "+e)}return this._rfbCleanDisconnect=!1,this._updateConnectionState("disconnecting"),this._updateConnectionState("disconnected"),!1}},{key:"_setCapability",value:function(e,t){this._capabilities[e]=t,this.dispatchEvent(new CustomEvent("capabilities",{detail:{capabilities:this._capabilities}}))}},{key:"_handleMessage",value:function(){if(0!==this._sock.rQlen)switch(this._rfbConnectionState){case"disconnected":n.Error("Got data while disconnected");break;case"connected":for(;!this._flushing&&this._normalMsg()&&0!==this._sock.rQlen;);break;default:this._initMsg()}else n.Warn("handleMessage called on an empty receive queue")}},{key:"_handleKeyEvent",value:function(e,t,i){this.sendKey(e,t,i)}},{key:"_handleMouse",value:function(e){if(("click"!==e.type||e.target===this._canvas)&&(e.stopPropagation(),e.preventDefault(),"click"!==e.type&&"contextmenu"!==e.type)){var t=(0,a.clientToElement)(e.clientX,e.clientY,this._canvas);switch(e.type){case"mousedown":(0,l.setCapture)(this._canvas),this._handleMouseButton(t.x,t.y,!0,1<o.dragThreshold||Math.abs(n)>o.dragThreshold)&&(this._viewportHasMoved=!0,this._viewportDragPos={x:e,y:t},this._display.viewportChangePos(r,n))}else if(this._mousePos={x:e,y:t},null==this._mouseMoveTimer){var s=Date.now()-this._mouseLastMoveTime;s>17?(this._sendMouse(e,t,this._mouseButtonMask),this._mouseLastMoveTime=Date.now()):this._mouseMoveTimer=setTimeout((function(){i._handleDelayedMouseMove()}),17-s)}}},{key:"_handleDelayedMouseMove",value:function(){this._mouseMoveTimer=null,this._sendMouse(this._mousePos.x,this._mousePos.y,this._mouseButtonMask),this._mouseLastMoveTime=Date.now()}},{key:"_sendMouse",value:function(e,t,i){"connected"===this._rfbConnectionState&&(this._viewOnly||T.messages.pointerEvent(this._sock,this._display.absX(e),this._display.absY(t),i))}},{key:"_handleWheel",value:function(e){if("connected"===this._rfbConnectionState&&!this._viewOnly){e.stopPropagation(),e.preventDefault();var t=(0,a.clientToElement)(e.clientX,e.clientY,this._canvas),i=e.deltaX,r=e.deltaY;0!==e.deltaMode&&(i*=19,r*=19),this._accumulatedWheelDeltaX+=i,this._accumulatedWheelDeltaY+=r,Math.abs(this._accumulatedWheelDeltaX)>=50&&(this._accumulatedWheelDeltaX<0?(this._handleMouseButton(t.x,t.y,!0,32),this._handleMouseButton(t.x,t.y,!1,32)):this._accumulatedWheelDeltaX>0&&(this._handleMouseButton(t.x,t.y,!0,64),this._handleMouseButton(t.x,t.y,!1,64)),this._accumulatedWheelDeltaX=0),Math.abs(this._accumulatedWheelDeltaY)>=50&&(this._accumulatedWheelDeltaY<0?(this._handleMouseButton(t.x,t.y,!0,8),this._handleMouseButton(t.x,t.y,!1,8)):this._accumulatedWheelDeltaY>0&&(this._handleMouseButton(t.x,t.y,!0,16),this._handleMouseButton(t.x,t.y,!1,16)),this._accumulatedWheelDeltaY=0)}}},{key:"_fakeMouseMove",value:function(e,t,i){this._handleMouseMove(t,i),this._cursor.move(e.detail.clientX,e.detail.clientY)}},{key:"_handleTapEvent",value:function(e,t){var i=(0,a.clientToElement)(e.detail.clientX,e.detail.clientY,this._canvas);if(null!==this._gestureLastTapTime&&Date.now()-this._gestureLastTapTime<1e3&&this._gestureFirstDoubleTapEv.detail.type===e.detail.type){var r=this._gestureFirstDoubleTapEv.detail.clientX-e.detail.clientX,n=this._gestureFirstDoubleTapEv.detail.clientY-e.detail.clientY;Math.hypot(r,n)<50?i=(0,a.clientToElement)(this._gestureFirstDoubleTapEv.detail.clientX,this._gestureFirstDoubleTapEv.detail.clientY,this._canvas):this._gestureFirstDoubleTapEv=e}else this._gestureFirstDoubleTapEv=e;this._gestureLastTapTime=Date.now(),this._fakeMouseMove(this._gestureFirstDoubleTapEv,i.x,i.y),this._handleMouseButton(i.x,i.y,!0,t),this._handleMouseButton(i.x,i.y,!1,t)}},{key:"_handleGesture",value:function(e){var t,i=(0,a.clientToElement)(e.detail.clientX,e.detail.clientY,this._canvas);switch(e.type){case"gesturestart":switch(e.detail.type){case"onetap":this._handleTapEvent(e,1);break;case"twotap":this._handleTapEvent(e,4);break;case"threetap":this._handleTapEvent(e,2);break;case"drag":this._fakeMouseMove(e,i.x,i.y),this._handleMouseButton(i.x,i.y,!0,1);break;case"longpress":this._fakeMouseMove(e,i.x,i.y),this._handleMouseButton(i.x,i.y,!0,4);break;case"twodrag":this._gestureLastMagnitudeX=e.detail.magnitudeX,this._gestureLastMagnitudeY=e.detail.magnitudeY,this._fakeMouseMove(e,i.x,i.y);break;case"pinch":this._gestureLastMagnitudeX=Math.hypot(e.detail.magnitudeX,e.detail.magnitudeY),this._fakeMouseMove(e,i.x,i.y)}break;case"gesturemove":switch(e.detail.type){case"onetap":case"twotap":case"threetap":break;case"drag":case"longpress":this._fakeMouseMove(e,i.x,i.y);break;case"twodrag":for(this._fakeMouseMove(e,i.x,i.y);e.detail.magnitudeY-this._gestureLastMagnitudeY>50;)this._handleMouseButton(i.x,i.y,!0,8),this._handleMouseButton(i.x,i.y,!1,8),this._gestureLastMagnitudeY+=50;for(;e.detail.magnitudeY-this._gestureLastMagnitudeY<-50;)this._handleMouseButton(i.x,i.y,!0,16),this._handleMouseButton(i.x,i.y,!1,16),this._gestureLastMagnitudeY-=50;for(;e.detail.magnitudeX-this._gestureLastMagnitudeX>50;)this._handleMouseButton(i.x,i.y,!0,32),this._handleMouseButton(i.x,i.y,!1,32),this._gestureLastMagnitudeX+=50;for(;e.detail.magnitudeX-this._gestureLastMagnitudeX<-50;)this._handleMouseButton(i.x,i.y,!0,64),this._handleMouseButton(i.x,i.y,!1,64),this._gestureLastMagnitudeX-=50;break;case"pinch":if(this._fakeMouseMove(e,i.x,i.y),t=Math.hypot(e.detail.magnitudeX,e.detail.magnitudeY),Math.abs(t-this._gestureLastMagnitudeX)>75){for(this._handleKeyEvent(y.default.XK_Control_L,"ControlLeft",!0);t-this._gestureLastMagnitudeX>75;)this._handleMouseButton(i.x,i.y,!0,8),this._handleMouseButton(i.x,i.y,!1,8),this._gestureLastMagnitudeX+=75;for(;t-this._gestureLastMagnitudeX<-75;)this._handleMouseButton(i.x,i.y,!0,16),this._handleMouseButton(i.x,i.y,!1,16),this._gestureLastMagnitudeX-=75}this._handleKeyEvent(y.default.XK_Control_L,"ControlLeft",!1)}break;case"gestureend":switch(e.detail.type){case"onetap":case"twotap":case"threetap":case"pinch":case"twodrag":break;case"drag":this._fakeMouseMove(e,i.x,i.y),this._handleMouseButton(i.x,i.y,!1,1);break;case"longpress":this._fakeMouseMove(e,i.x,i.y),this._handleMouseButton(i.x,i.y,!1,4)}}}},{key:"_negotiateProtocolVersion",value:function(){if(this._sock.rQwait("version",12))return!1;var e=this._sock.rQshiftStr(12).substr(4,7);n.Info("Server ProtocolVersion: "+e);var t=0;switch(e){case"000.000":t=1;break;case"003.003":case"003.006":case"003.889":this._rfbVersion=3.3;break;case"003.007":this._rfbVersion=3.7;break;case"003.008":case"004.000":case"004.001":case"005.000":this._rfbVersion=3.8;break;default:return this._fail("Invalid server version "+e)}if(t){for(var i="ID:"+this._repeaterID;i.length<250;)i+="\0";return this._sock.sendString(i),!0}this._rfbVersion>this._rfbMaxVersion&&(this._rfbVersion=this._rfbMaxVersion);var r="00"+parseInt(this._rfbVersion,10)+".00"+10*this._rfbVersion%10;this._sock.sendString("RFB "+r+"\n"),n.Debug("Sent ProtocolVersion: "+r),this._rfbInitState="Security"}},{key:"_negotiateSecurity",value:function(){function e(e,t){for(var i=0;i=3.7){var t=this._sock.rQshift8();if(this._sock.rQwait("security type",t,1))return!1;if(0===t)return this._rfbInitState="SecurityReason",this._securityContext="no security types",this._securityStatus=1,this._initMsg();var i=this._sock.rQshiftBytes(t);if(n.Debug("Server security types: "+i),e(1,i))this._rfbAuthScheme=1;else if(e(22,i))this._rfbAuthScheme=22;else if(e(16,i))this._rfbAuthScheme=16;else if(e(2,i))this._rfbAuthScheme=2;else{if(!e(19,i))return this._fail("Unsupported security types (types: "+i+")");this._rfbAuthScheme=19}this._sock.send([this._rfbAuthScheme])}else{if(this._sock.rQwait("security scheme",4))return!1;if(this._rfbAuthScheme=this._sock.rQshift32(),0==this._rfbAuthScheme)return this._rfbInitState="SecurityReason",this._securityContext="authentication scheme",this._securityStatus=1,this._initMsg()}return this._rfbInitState="Authentication",n.Debug("Authenticating using scheme: "+this._rfbAuthScheme),this._initMsg()}},{key:"_handleSecurityReason",value:function(){if(this._sock.rQwait("reason length",4))return!1;var e=this._sock.rQshift32(),t="";if(e>0){if(this._sock.rQwait("reason",e,4))return!1;t=this._sock.rQshiftStr(e)}return""!==t?(this.dispatchEvent(new CustomEvent("securityfailure",{detail:{status:this._securityStatus,reason:t}})),this._fail("Security negotiation failed on "+this._securityContext+" (reason: "+t+")")):(this.dispatchEvent(new CustomEvent("securityfailure",{detail:{status:this._securityStatus}})),this._fail("Security negotiation failed on "+this._securityContext))}},{key:"_negotiateXvpAuth",value:function(){if(void 0===this._rfbCredentials.username||void 0===this._rfbCredentials.password||void 0===this._rfbCredentials.target)return this.dispatchEvent(new CustomEvent("credentialsrequired",{detail:{types:["username","password","target"]}})),!1;var e=String.fromCharCode(this._rfbCredentials.username.length)+String.fromCharCode(this._rfbCredentials.target.length)+this._rfbCredentials.username+this._rfbCredentials.target;return this._sock.sendString(e),this._rfbAuthScheme=2,this._negotiateAuthentication()}},{key:"_negotiateVeNCryptAuth",value:function(){if(0==this._rfbVeNCryptState){if(this._sock.rQwait("vencrypt version",2))return!1;var e=this._sock.rQshift8(),t=this._sock.rQshift8();if(0!=e||2!=t)return this._fail("Unsupported VeNCrypt version "+e+"."+t);this._sock.send([0,2]),this._rfbVeNCryptState=1}if(1==this._rfbVeNCryptState){if(this._sock.rQwait("vencrypt ack",1))return!1;var i=this._sock.rQshift8();if(0!=i)return this._fail("VeNCrypt failure "+i);this._rfbVeNCryptState=2}if(2==this._rfbVeNCryptState){if(this._sock.rQwait("vencrypt subtypes length",1))return!1;var r=this._sock.rQshift8();if(r<1)return this._fail("VeNCrypt subtypes empty");this._rfbVeNCryptSubtypesLength=r,this._rfbVeNCryptState=3}if(3==this._rfbVeNCryptState){if(this._sock.rQwait("vencrypt subtypes",4*this._rfbVeNCryptSubtypesLength))return!1;for(var n=[],o=0;o0&&this._sock.rQwait("tunnel capabilities",16*e,4))return!1;if(this._rfbTightVNC=!0,e>0)return this._negotiateTightTunnels(e),!1}if(this._sock.rQwait("sub auth count",4))return!1;var t=this._sock.rQshift32();if(0===t)return this._rfbInitState="SecurityResult",!0;if(this._sock.rQwait("sub auth capabilities",16*t,4))return!1;for(var i={STDVNOAUTH__:1,STDVVNCAUTH_:2,TGHTULGNAUTH:129},r=[],s=0;s=3.8?(this._rfbInitState="SecurityResult",!0):(this._rfbInitState="ClientInitialisation",this._initMsg());case 22:return this._negotiateXvpAuth();case 2:return this._negotiateStdVNCAuth();case 16:return this._negotiateTightAuth();case 19:return this._negotiateVeNCryptAuth();case 129:return this._negotiateTightUnixAuth();default:return this._fail("Unsupported auth scheme (scheme: "+this._rfbAuthScheme+")")}}},{key:"_handleSecurityResult",value:function(){if(this._sock.rQwait("VNC auth response ",4))return!1;var e=this._sock.rQshift32();return 0===e?(this._rfbInitState="ClientInitialisation",n.Debug("Authentication OK"),this._initMsg()):this._rfbVersion>=3.8?(this._rfbInitState="SecurityReason",this._securityContext="security result",this._securityStatus=e,this._initMsg()):(this.dispatchEvent(new CustomEvent("securityfailure",{detail:{status:e}})),this._fail("Security handshake failed"))}},{key:"_negotiateServerInit",value:function(){if(this._sock.rQwait("server initialization",24))return!1;var e=this._sock.rQshift16(),t=this._sock.rQshift16(),i=this._sock.rQshift8(),r=this._sock.rQshift8(),o=this._sock.rQshift8(),a=this._sock.rQshift8(),l=this._sock.rQshift16(),c=this._sock.rQshift16(),u=this._sock.rQshift16(),h=this._sock.rQshift8(),d=this._sock.rQshift8(),f=this._sock.rQshift8();this._sock.rQskipBytes(3);var p=this._sock.rQshift32();if(this._sock.rQwait("server init name",p,24))return!1;var g=this._sock.rQshiftStr(p);if(g=(0,s.decodeUTF8)(g,!0),this._rfbTightVNC){if(this._sock.rQwait("TightVNC extended server init header",8,24+p))return!1;var v=this._sock.rQshift16(),m=this._sock.rQshift16(),y=this._sock.rQshift16();this._sock.rQskipBytes(2);var _=16*(v+m+y);if(this._sock.rQwait("TightVNC extended server init header",_,32+p))return!1;this._sock.rQskipBytes(16*v),this._sock.rQskipBytes(16*m),this._sock.rQskipBytes(16*y)}return n.Info("Screen: "+e+"x"+t+", bpp: "+i+", depth: "+r+", bigEndian: "+o+", trueColor: "+a+", redMax: "+l+", greenMax: "+c+", blueMax: "+u+", redShift: "+h+", greenShift: "+d+", blueShift: "+f),this._setDesktopName(g),this._resize(e,t),this._viewOnly||this._keyboard.grab(),this._fbDepth=24,"Intel(r) AMT KVM"===this._fbName&&(n.Warn("Intel AMT KVM only supports 8/16 bit depths. Using low color mode."),this._fbDepth=8),T.messages.pixelFormat(this._sock,this._fbDepth,!0),this._sendEncodings(),T.messages.fbUpdateRequest(this._sock,!1,0,0,this._fbWidth,this._fbHeight),this._updateConnectionState("connected"),!0}},{key:"_sendEncodings",value:function(){var e=[];e.push(b.encodings.encodingCopyRect),24==this._fbDepth&&(e.push(b.encodings.encodingTight),e.push(b.encodings.encodingTightPNG),e.push(b.encodings.encodingHextile),e.push(b.encodings.encodingRRE)),e.push(b.encodings.encodingRaw),e.push(b.encodings.pseudoEncodingQualityLevel0+this._qualityLevel),e.push(b.encodings.pseudoEncodingCompressLevel0+this._compressionLevel),e.push(b.encodings.pseudoEncodingDesktopSize),e.push(b.encodings.pseudoEncodingLastRect),e.push(b.encodings.pseudoEncodingQEMUExtendedKeyEvent),e.push(b.encodings.pseudoEncodingExtendedDesktopSize),e.push(b.encodings.pseudoEncodingXvp),e.push(b.encodings.pseudoEncodingFence),e.push(b.encodings.pseudoEncodingContinuousUpdates),e.push(b.encodings.pseudoEncodingDesktopName),e.push(b.encodings.pseudoEncodingExtendedClipboard),24==this._fbDepth&&(e.push(b.encodings.pseudoEncodingVMwareCursor),e.push(b.encodings.pseudoEncodingCursor)),T.messages.clientEncodings(this._sock,e)}},{key:"_initMsg",value:function(){switch(this._rfbInitState){case"ProtocolVersion":return this._negotiateProtocolVersion();case"Security":return this._negotiateSecurity();case"Authentication":return this._negotiateAuthentication();case"SecurityResult":return this._handleSecurityResult();case"SecurityReason":return this._handleSecurityReason();case"ClientInitialisation":return this._sock.send([this._shared?1:0]),this._rfbInitState="ServerInitialisation",!0;case"ServerInitialisation":return this._negotiateServerInit();default:return this._fail("Unknown init state (state: "+this._rfbInitState+")")}}},{key:"_handleSetColourMapMsg",value:function(){return n.Debug("SetColorMapEntries"),this._fail("Unexpected SetColorMapEntries message")}},{key:"_handleServerCutText",value:function(){if(n.Debug("ServerCutText"),this._sock.rQwait("ServerCutText header",7,1))return!1;this._sock.rQskipBytes(3);var e=this._sock.rQshift32();if(e=(0,r.toSigned32bit)(e),this._sock.rQwait("ServerCutText content",Math.abs(e),8))return!1;if(e>=0){var t=this._sock.rQshiftStr(e);if(this._viewOnly)return!0;this.dispatchEvent(new CustomEvent("clipboard",{detail:{text:t}}))}else{e=Math.abs(e);var i=this._sock.rQshift32(),o=65535&i,a=4278190080&i;if(a&1<<24){this._clipboardServerCapabilitiesFormats={},this._clipboardServerCapabilitiesActions={};for(var l=0;l<=15;l++){var c=1<0&&"\0"===v.charAt(v.length-1)&&(v=v.slice(0,-1)),v=v.replace("\r\n","\n"),this.dispatchEvent(new CustomEvent("clipboard",{detail:{text:v}}))}}}return!0}},{key:"_handleServerFenceMsg",value:function(){if(this._sock.rQwait("ServerFence header",8,1))return!1;this._sock.rQskipBytes(3);var e=this._sock.rQshift32(),t=this._sock.rQshift8();if(this._sock.rQwait("ServerFence payload",t,9))return!1;t>64&&(n.Warn("Bad payload length ("+t+") in fence response"),t=64);var i=this._sock.rQshiftStr(t);return this._supportsFence=!0,e&1<<31?(e&=3,T.messages.clientFence(this._sock,e,i),!0):this._fail("Unexpected fence response")}},{key:"_handleXvpMsg",value:function(){if(this._sock.rQwait("XVP version and message",3,1))return!1;this._sock.rQskipBytes(1);var e=this._sock.rQshift8(),t=this._sock.rQshift8();switch(t){case 0:n.Error("XVP Operation Failed");break;case 1:this._rfbXvpVer=e,n.Info("XVP extensions enabled (version "+this._rfbXvpVer+")"),this._setCapability("power",!0);break;default:this._fail("Illegal server XVP message (msg: "+t+")")}return!0}},{key:"_normalMsg",value:function(){var e,t,i;switch(e=this._FBU.rects>0?0:this._sock.rQshift8()){case 0:return(i=this._framebufferUpdate())&&!this._enabledContinuousUpdates&&T.messages.fbUpdateRequest(this._sock,!0,0,0,this._fbWidth,this._fbHeight),i;case 1:return this._handleSetColourMapMsg();case 2:return n.Debug("Bell"),this.dispatchEvent(new CustomEvent("bell",{detail:{}})),!0;case 3:return this._handleServerCutText();case 150:return t=!this._supportsContinuousUpdates,this._supportsContinuousUpdates=!0,this._enabledContinuousUpdates=!1,t&&(this._enabledContinuousUpdates=!0,this._updateContinuousUpdates(),n.Info("Enabling continuous updates.")),!0;case 248:return this._handleServerFenceMsg();case 250:return this._handleXvpMsg();default:return this._fail("Unexpected server message (type "+e+")"),n.Debug("sock.rQslice(0, 30): "+this._sock.rQslice(0,30)),!0}}},{key:"_onFlush",value:function(){this._flushing=!1,this._sock.rQlen>0&&this._handleMessage()}},{key:"_framebufferUpdate",value:function(){if(0===this._FBU.rects){if(this._sock.rQwait("FBU header",3,1))return!1;if(this._sock.rQskipBytes(1),this._FBU.rects=this._sock.rQshift16(),this._display.pending())return this._flushing=!0,this._display.flush(),!1}for(;this._FBU.rects>0;){if(null===this._FBU.encoding){if(this._sock.rQwait("rect header",12))return!1;var e=this._sock.rQshiftBytes(12);this._FBU.x=(e[0]<<8)+e[1],this._FBU.y=(e[2]<<8)+e[3],this._FBU.width=(e[4]<<8)+e[5],this._FBU.height=(e[6]<<8)+e[7],this._FBU.encoding=parseInt((e[8]<<24)+(e[9]<<16)+(e[10]<<8)+e[11],10)}if(!this._handleRect())return!1;this._FBU.rects--,this._FBU.encoding=null}return this._display.flip(),!0}},{key:"_handleRect",value:function(){switch(this._FBU.encoding){case b.encodings.pseudoEncodingLastRect:return this._FBU.rects=1,!0;case b.encodings.pseudoEncodingVMwareCursor:return this._handleVMwareCursor();case b.encodings.pseudoEncodingCursor:return this._handleCursor();case b.encodings.pseudoEncodingQEMUExtendedKeyEvent:try{void 0!==document.createEvent("keyboardEvent").code&&(this._qemuExtKeyEventSupported=!0)}catch(e){}return!0;case b.encodings.pseudoEncodingDesktopName:return this._handleDesktopName();case b.encodings.pseudoEncodingDesktopSize:return this._resize(this._FBU.width,this._FBU.height),!0;case b.encodings.pseudoEncodingExtendedDesktopSize:return this._handleExtendedDesktopSize();default:return this._handleDataRect()}}},{key:"_handleVMwareCursor",value:function(){var e=this._FBU.x,t=this._FBU.y,i=this._FBU.width,r=this._FBU.height;if(this._sock.rQwait("VMware cursor encoding",1))return!1;var s,o=this._sock.rQshift8();if(this._sock.rQshift8(),0==o){if(s=new Array(i*r*4),this._sock.rQwait("VMware cursor classic encoding",i*r*4*2,2))return!1;for(var a=new Array(i*r),l=0;l>8&255,p=d>>16&255,g=d>>24&255;s[4*h]=f,s[4*h+1]=p,s[4*h+2]=g,s[4*h+3]=255}else-256==(-256&a[h])?0==c[h]?(s[4*h]=0,s[4*h+1]=0,s[4*h+2]=0,s[4*h+3]=0):(c[h],s[4*h]=0,s[4*h+1]=0,s[4*h+2]=0,s[4*h+3]=255):(s[4*h]=0,s[4*h+1]=0,s[4*h+2]=0,s[4*h+3]=255)}else{if(1!=o)return n.Warn("The given cursor type is not supported: "+o+" given."),!1;if(this._sock.rQwait("VMware cursor alpha encoding",i*r*4,2))return!1;s=new Array(i*r*4);for(var v=0;v>24&255,s[4*v+1]=m>>16&255,s[4*v+2]=m>>8&255,s[4*v+3]=255&m}}return this._updateCursor(s,e,t,i,r),!0}},{key:"_handleCursor",value:function(){var e=this._FBU.x,t=this._FBU.y,i=this._FBU.width,r=this._FBU.height,n=i*r*4,s=Math.ceil(i/8)*r,o=n+s;if(this._sock.rQwait("cursor encoding",o))return!1;for(var a=this._sock.rQshiftBytes(n),l=this._sock.rQshiftBytes(s),c=new Uint8Array(i*r*4),u=0,h=0;h9?n.Error("qualityLevel must be an integer between 0 and 9"):this._qualityLevel!==e&&(this._qualityLevel=e,"connected"===this._rfbConnectionState&&this._sendEncodings())}},{key:"compressionLevel",get:function(){return this._compressionLevel},set:function(e){!Number.isInteger(e)||e<0||e>9?n.Error("compressionLevel must be an integer between 0 and 9"):this._compressionLevel!==e&&(this._compressionLevel=e,"connected"===this._rfbConnectionState&&this._sendEncodings())}}])&&R(t.prototype,i),c&&R(t,c),T}(c.default);t.default=F,F.messages={keyEvent:function(e,t,i){var r=e._sQ,n=e._sQlen;r[n]=4,r[n+1]=i,r[n+2]=0,r[n+3]=0,r[n+4]=t>>24,r[n+5]=t>>16,r[n+6]=t>>8,r[n+7]=t,e._sQlen+=8,e.flush()},QEMUExtendedKeyEvent:function(e,t,i,r){var n=e._sQ,s=e._sQlen;n[s]=255,n[s+1]=0,n[s+2]=i>>8,n[s+3]=i,n[s+4]=t>>24,n[s+5]=t>>16,n[s+6]=t>>8,n[s+7]=t;var o,a,l=(o=r,a=255&r,224==r>>8&&a<127?128|a:o);n[s+8]=l>>24,n[s+9]=l>>16,n[s+10]=l>>8,n[s+11]=l,e._sQlen+=12,e.flush()},pointerEvent:function(e,t,i,r){var n=e._sQ,s=e._sQlen;n[s]=5,n[s+1]=r,n[s+2]=t>>8,n[s+3]=t,n[s+4]=i>>8,n[s+5]=i,e._sQlen+=6,e.flush()},_buildExtendedClipboardFlags:function(e,t){for(var i=new Uint8Array(4),r=0,n=0,s=0;s>24,i[1]=0,i[2]=0,i[3]=r,i},extendedClipboardProvide:function(e,t,i){for(var r=new d.default,n=[],o=0;o>24&255,a.length>>16&255,a.length>>8&255,255&a.length);for(var l=0;l>24,n[s+1]=i[r[o]]>>16,n[s+2]=i[r[o]]>>8,n[s+3]=i[r[o]]>>0,s+=4,n[3]|=1<2&&void 0!==arguments[2]&&arguments[2],s=e._sQ,o=e._sQlen;s[o]=6,s[o+1]=0,s[o+2]=0,s[o+3]=0,i=n?(0,r.toUnsigned32bit)(-t.length):t.length,s[o+4]=i>>24,s[o+5]=i>>16,s[o+6]=i>>8,s[o+7]=i,e._sQlen+=8;for(var a=0,l=t.length;l>0;){for(var c=Math.min(l,e._sQbufferSize-e._sQlen),u=0;u>8,s[o+3]=t,s[o+4]=i>>8,s[o+5]=i,s[o+6]=1,s[o+7]=0,s[o+8]=r>>24,s[o+9]=r>>16,s[o+10]=r>>8,s[o+11]=r,s[o+12]=0,s[o+13]=0,s[o+14]=0,s[o+15]=0,s[o+16]=t>>8,s[o+17]=t,s[o+18]=i>>8,s[o+19]=i,s[o+20]=n>>24,s[o+21]=n>>16,s[o+22]=n>>8,s[o+23]=n,e._sQlen+=24,e.flush()},clientFence:function(e,t,i){var r=e._sQ,n=e._sQlen;r[n]=248,r[n+1]=0,r[n+2]=0,r[n+3]=0,r[n+4]=t>>24,r[n+5]=t>>16,r[n+6]=t>>8,r[n+7]=t;var s=i.length;r[n+8]=s;for(var o=0;o>8,o[a+3]=i,o[a+4]=r>>8,o[a+5]=r,o[a+6]=n>>8,o[a+7]=n,o[a+8]=s>>8,o[a+9]=s,e._sQlen+=10,e.flush()},pixelFormat:function(e,t,i){var r,n=e._sQ,s=e._sQlen;r=t>16?32:t>8?16:8;var o=Math.floor(t/3);n[s]=0,n[s+1]=0,n[s+2]=0,n[s+3]=0,n[s+4]=r,n[s+5]=t,n[s+6]=0,n[s+7]=i?1:0,n[s+8]=0,n[s+9]=(1<>8,i[r+3]=t.length;for(var n=r+4,s=0;s>24,i[n+1]=o>>16,i[n+2]=o>>8,i[n+3]=o,n+=4}e._sQlen+=n-r,e.flush()},fbUpdateRequest:function(e,t,i,r,n,s){var o=e._sQ,a=e._sQlen;void 0===i&&(i=0),void 0===r&&(r=0),o[a]=3,o[a+1]=t?1:0,o[a+2]=i>>8&255,o[a+3]=255&i,o[a+4]=r>>8&255,o[a+5]=255&r,o[a+6]=n>>8&255,o[a+7]=255&n,o[a+8]=s>>8&255,o[a+9]=255&s,e._sQlen+=10,e.flush()},xvpOp:function(e,t,i){var r=e._sQ,n=e._sQlen;r[n]=250,r[n+1]=0,r[n+2]=t,r[n+3]=i,e._sQlen+=4,e.flush()}},F.cursors={none:{rgbaPixels:new Uint8Array,w:0,h:0,hotx:0,hoty:0},dot:{rgbaPixels:new Uint8Array([255,255,255,255,0,0,0,255,255,255,255,255,0,0,0,255,0,0,0,0,0,0,0,255,255,255,255,255,0,0,0,255,255,255,255,255]),w:3,h:3,hotx:1,hoty:1}}},"1eCo": /*!*************************************************!*\ !*** ./node_modules/codemirror/mode/xml/xml.js ***! \*************************************************/ /*! no static exports found */ /*! all exports used */ /*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,i){!function(e){"use strict";var t={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},i={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};e.defineMode("xml",(function(r,n){var s,o,a=r.indentUnit,l={},c=n.htmlMode?t:i;for(var u in c)l[u]=c[u];for(var u in n)l[u]=n[u];function h(e,t){function i(i){return t.tokenize=i,i(e,t)}var r=e.next();return"<"==r?e.eat("!")?e.eat("[")?e.match("CDATA[")?i(f("atom","]]>")):null:e.match("--")?i(f("comment","--\x3e")):e.match("DOCTYPE",!0,!0)?(e.eatWhile(/[\w\._\-]/),i(function e(t){return function(i,r){for(var n;null!=(n=i.next());){if("<"==n)return r.tokenize=e(t+1),r.tokenize(i,r);if(">"==n){if(1==t){r.tokenize=h;break}return r.tokenize=e(t-1),r.tokenize(i,r)}}return"meta"}}(1))):null:e.eat("?")?(e.eatWhile(/[\w\._\-]/),t.tokenize=f("meta","?>"),"meta"):(s=e.eat("/")?"closeTag":"openTag",t.tokenize=d,"tag bracket"):"&"==r?(e.eat("#")?e.eat("x")?e.eatWhile(/[a-fA-F\d]/)&&e.eat(";"):e.eatWhile(/[\d]/)&&e.eat(";"):e.eatWhile(/[\w\.\-:]/)&&e.eat(";"))?"atom":"error":(e.eatWhile(/[^&<]/),null)}function d(e,t){var i,r,n=e.next();if(">"==n||"/"==n&&e.eat(">"))return t.tokenize=h,s=">"==n?"endTag":"selfcloseTag","tag bracket";if("="==n)return s="equals",null;if("<"==n){t.tokenize=h,t.state=m,t.tagName=t.tagStart=null;var o=t.tokenize(e,t);return o?o+" tag error":"tag error"}return/[\'\"]/.test(n)?(t.tokenize=(i=n,(r=function(e,t){for(;!e.eol();)if(e.next()==i){t.tokenize=d;break}return"string"}).isInAttribute=!0,r),t.stringStartCol=e.column(),t.tokenize(e,t)):(e.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function f(e,t){return function(i,r){for(;!i.eol();){if(i.match(t)){r.tokenize=h;break}i.next()}return e}}function p(e,t,i){this.prev=e.context,this.tagName=t,this.indent=e.indented,this.startOfLine=i,(l.doNotIndent.hasOwnProperty(t)||e.context&&e.context.noIndent)&&(this.noIndent=!0)}function g(e){e.context&&(e.context=e.context.prev)}function v(e,t){for(var i;;){if(!e.context)return;if(i=e.context.tagName,!l.contextGrabbers.hasOwnProperty(i)||!l.contextGrabbers[i].hasOwnProperty(t))return;g(e)}}function m(e,t,i){return"openTag"==e?(i.tagStart=t.column(),y):"closeTag"==e?_:m}function y(e,t,i){return"word"==e?(i.tagName=t.current(),o="tag",C):l.allowMissingTagName&&"endTag"==e?(o="tag bracket",C(e,0,i)):(o="error",y)}function _(e,t,i){if("word"==e){var r=t.current();return i.context&&i.context.tagName!=r&&l.implicitlyClosed.hasOwnProperty(i.context.tagName)&&g(i),i.context&&i.context.tagName==r||!1===l.matchClosing?(o="tag",b):(o="tag error",S)}return l.allowMissingTagName&&"endTag"==e?(o="tag bracket",b(e,0,i)):(o="error",S)}function b(e,t,i){return"endTag"!=e?(o="error",b):(g(i),m)}function S(e,t,i){return o="error",b(e,0,i)}function C(e,t,i){if("word"==e)return o="attribute",w;if("endTag"==e||"selfcloseTag"==e){var r=i.tagName,n=i.tagStart;return i.tagName=i.tagStart=null,"selfcloseTag"==e||l.autoSelfClosers.hasOwnProperty(r)?v(i,r):(v(i,r),i.context=new p(i,r,n==i.indented)),m}return o="error",C}function w(e,t,i){return"equals"==e?k:(l.allowMissing||(o="error"),C(e,0,i))}function k(e,t,i){return"string"==e?x:"word"==e&&l.allowUnquoted?(o="string",C):(o="error",C(e,0,i))}function x(e,t,i){return"string"==e?x:C(e,0,i)}return h.isInText=!0,{startState:function(e){var t={tokenize:h,state:m,indented:e||0,tagName:null,tagStart:null,context:null};return null!=e&&(t.baseIndent=e),t},token:function(e,t){if(!t.tagName&&e.sol()&&(t.indented=e.indentation()),e.eatSpace())return null;s=null;var i=t.tokenize(e,t);return(i||s)&&"comment"!=i&&(o=null,t.state=t.state(s||i,e,t),o&&(i="error"==o?i+" error":o)),i},indent:function(t,i,r){var n=t.context;if(t.tokenize.isInAttribute)return t.tagStart==t.indented?t.stringStartCol+1:t.indented+a;if(n&&n.noIndent)return e.Pass;if(t.tokenize!=d&&t.tokenize!=h)return r?r.match(/^(\s*)/)[0].length:0;if(t.tagName)return!1!==l.multilineTagIndentPastTag?t.tagStart+t.tagName.length+2:t.tagStart+a*(l.multilineTagIndentFactor||1);if(l.alignCDATA&&/$/,blockCommentStart:"\x3c!--",blockCommentEnd:"--\x3e",configuration:l.htmlMode?"html":"xml",helperType:l.htmlMode?"html":"xml",skipAttribute:function(e){e.state==k&&(e.state=C)},xmlCurrentTag:function(e){return e.tagName?{name:e.tagName,close:"closeTag"==e.type}:null},xmlCurrentContext:function(e){for(var t=[],i=e.context;i;i=i.prev)i.tagName&&t.push(i.tagName);return t.reverse()}}})),e.defineMIME("text/xml","xml"),e.defineMIME("application/xml","xml"),e.mimeModes.hasOwnProperty("text/html")||e.defineMIME("text/html",{name:"xml",htmlMode:!0})}(i(/*! ../../lib/codemirror */"VrN/"))},"1q3G": /*!***********************************************************************!*\ !*** ./node_modules/@novnc/novnc/lib/vendor/pako/lib/zlib/zstream.js ***! \***********************************************************************/ /*! no static exports found */ /*! all exports used */ /*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},"34/K": /*!*******************************************************!*\ !*** ./node_modules/@novnc/novnc/lib/decoders/raw.js ***! \*******************************************************/ /*! no static exports found */ /*! all exports used */ /*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,i){"use strict";function r(e,t){for(var i=0;i>0&3)/3,f[4*p+1]=255*(u[h+p]>>2&3)/3,f[4*p+2]=255*(u[h+p]>>4&3)/3,f[4*p+4]=0;u=f,h=0}return s.blitImage(e,l,i,c,u,h),n.rQskipBytes(c*a),this._lines-=c,!(this._lines>0)}}])&&r(t.prototype,i),n&&r(t,n),e}();t.default=n},3690: /*!***********************************************************!*\ !*** ./node_modules/@novnc/novnc/lib/decoders/hextile.js ***! \***********************************************************/ /*! no static exports found */ /*! all exports used */ /*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,i){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=function(e){if(e&&e.__esModule)return e;if(null===e||"object"!==r(e)&&"function"!=typeof e)return{default:e};var t=s();if(t&&t.has(e))return t.get(e);var i={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if(Object.prototype.hasOwnProperty.call(e,o)){var a=n?Object.getOwnPropertyDescriptor(e,o):null;a&&(a.get||a.set)?Object.defineProperty(i,o,a):i[o]=e[o]}i.default=e,t&&t.set(e,i);return i}(i(/*! ../util/logging.js */"Lo0S"));function s(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return s=function(){return e},e}function o(e,t){for(var i=0;i0;){var l=1;if(s.rQwait("HEXTILE",l))return!1;var c=s.rQ,u=s.rQi,h=c[u];if(h>30)throw new Error("Illegal hextile subencoding (subencoding: "+h+")");var d=this._totalTiles-this._tiles,f=e+d%this._tilesX*16,p=t+16*Math.floor(d/this._tilesX),g=Math.min(16,e+i-f),v=Math.min(16,t+r-p);if(1&h)l+=g*v*4;else if(2&h&&(l+=4),4&h&&(l+=4),8&h){if(l++,s.rQwait("HEXTILE",l))return!1;var m=c[u+l-1];l+=16&h?6*m:2*m}if(s.rQwait("HEXTILE",l))return!1;if(u++,0===h)1&this._lastsubencoding?n.Debug(" Ignoring blank after RAW"):o.fillRect(f,p,g,v,this._background);else if(1&h)o.blitImage(f,p,g,v,c,u),u+=l-1;else{if(2&h&&(this._background=[c[u],c[u+1],c[u+2],c[u+3]],u+=4),4&h&&(this._foreground=[c[u],c[u+1],c[u+2],c[u+3]],u+=4),o.startTile(f,p,g,v,this._background),8&h){var y=c[u];u++;for(var _=0;_>4,w=15&S,k=c[++u];u++;var x=1+(k>>4),E=1+(15&k);o.subTile(C,w,x,E,b)}}o.finishTile()}s.rQi=u,this._lastsubencoding=h,this._tiles--}return!0}}])&&o(t.prototype,i),r&&o(t,r),e}();t.default=a},"6BzB": /*!***********************************************************************!*\ !*** ./node_modules/@novnc/novnc/lib/vendor/pako/lib/utils/common.js ***! \***********************************************************************/ /*! no static exports found */ /*! all exports used */ /*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.shrinkBuf=function(e,t){if(e.length===t)return e;if(e.subarray)return e.subarray(0,t);return e.length=t,e},t.arraySet=function(e,t,i,r,n){if(t.subarray&&e.subarray)return void e.set(t.subarray(i,i+r),n);for(var s=0;s1&&void 0!==arguments[1]?arguments[1]:0,i=(l[e[t+0]]+l[e[t+1]]+l[e[t+2]]+l[e[t+3]]+"-"+l[e[t+4]]+l[e[t+5]]+"-"+l[e[t+6]]+l[e[t+7]]+"-"+l[e[t+8]]+l[e[t+9]]+"-"+l[e[t+10]]+l[e[t+11]]+l[e[t+12]]+l[e[t+13]]+l[e[t+14]]+l[e[t+15]]).toLowerCase();if(!a(i))throw TypeError("Stringified UUID is invalid");return i};t.a=function(e,t,i){var r=(e=e||{}).random||(e.rng||s)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){i=i||0;for(var n=0;n<16;++n)t[i+n]=r[n];return t}return u(r)}},"7ahc": /*!*************************************************************!*\ !*** ./src/components/markdown-editor/code-block/index.tsx ***! \*************************************************************/ /*! exports provided: default, MyCodeMirror */ /*! exports used: MyCodeMirror, default */function(e,t,i){"use strict";i.d(t,"a",(function(){return v}));var r=i(/*! ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/objectSpread2 */"k1fw"),n=i(/*! ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/extends */"0Owb"),s=(i(/*! antd/es/button/style */"+L6B"),i(/*! antd/es/button */"2/Rp")),o=(i(/*! antd/es/form/style */"y8nQ"),i(/*! antd/es/form */"Vl3Y")),a=i(/*! ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/slicedToArray */"tJVT"),l=(i(/*! antd/es/select/style */"OaEy"),i(/*! antd/es/select */"2fM7")),c=i(/*! react */"q1tI"),u=i.n(c),h=i(/*! codemirror */"VrN/"),d=i.n(h),f=(i(/*! codemirror/lib/codemirror.css */"p77/"),i(/*! codemirror/theme/blackboard.css */"c5Ni"),l.a.Option),p={labelCol:{span:4},wrapperCol:{span:20}},g={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"]};function v(e){var t=e.value,i=e.onChange,n=e.mode,s=e.options,o=void 0===s?{}:s,l=Object(c.useRef)(),h=Object(c.useState)(),f=Object(a.a)(h,2),p=f[0],g=f[1];return Object(c.useEffect)((function(){if(p){function e(e){var t=e.getValue();i&&i(t)}return p.on("change",e),function(){p.off("change",e)}}}),[p,i]),Object(c.useEffect)((function(){p&&p.setOption("mode",n)}),[p,n]),Object(c.useEffect)((function(){p&&(t===p.getValue()&&""!==t||setTimeout((function(){p.setValue(t||" ")}),300))}),[p,t]),Object(c.useEffect)((function(){if(l.current&&!p){var e=d.a.fromTextArea(l.current,Object(r.a)({mode:n,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},o));g(e)}}),[l.current,p]),u.a.createElement("div",{className:"my-codemirror-container"},u.a.createElement("textarea",{ref:l}))}t.b=function(e){var t=e.callback,i=e.onCancel,r=Object(c.useState)("python"),h=Object(a.a)(r,2),d=h[0],m=h[1];return u.a.createElement(o.a,Object(n.a)({},p,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:function(e){t(e)}}),u.a.createElement(o.a.Item,{label:"代码语言",name:"language"},u.a.createElement(l.a,{onChange:function(e){m(g[e][1])}},Object.keys(g).map((function(e){return u.a.createElement(f,{key:e,value:e},g[e][0])})))),u.a.createElement(o.a.Item,{label:"代码内容",name:"content",rules:[{required:!0,message:"请输入代码内容"}]},u.a.createElement(v,{mode:d})),u.a.createElement("div",{className:"flex-container flex-end"},u.a.createElement(s.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"确定"),u.a.createElement(s.a,{type:"ghost",onClick:i},"取消")))}},"7ixt": /*!**************************************************!*\ !*** ./node_modules/rc-tooltip/es/placements.js ***! \**************************************************/ /*! exports provided: placements, default */ /*! exports used: placements */function(e,t,i){"use strict";i.d(t,"a",(function(){return s}));var r={adjustX:1,adjustY:1},n=[0,0],s={left:{points:["cr","cl"],overflow:r,offset:[-4,0],targetOffset:n},right:{points:["cl","cr"],overflow:r,offset:[4,0],targetOffset:n},top:{points:["bc","tc"],overflow:r,offset:[0,-4],targetOffset:n},bottom:{points:["tc","bc"],overflow:r,offset:[0,4],targetOffset:n},topLeft:{points:["bl","tl"],overflow:r,offset:[0,-4],targetOffset:n},leftTop:{points:["tr","tl"],overflow:r,offset:[-4,0],targetOffset:n},topRight:{points:["br","tr"],overflow:r,offset:[0,-4],targetOffset:n},rightTop:{points:["tl","tr"],overflow:r,offset:[4,0],targetOffset:n},bottomRight:{points:["tr","br"],overflow:r,offset:[0,4],targetOffset:n},rightBottom:{points:["bl","br"],overflow:r,offset:[4,0],targetOffset:n},bottomLeft:{points:["tl","bl"],overflow:r,offset:[0,4],targetOffset:n},leftBottom:{points:["br","bl"],overflow:r,offset:[-4,0],targetOffset:n}}},"8+yF": /*!**********************************************************!*\ !*** ./node_modules/@novnc/novnc/lib/input/keysymdef.js ***! \**********************************************************/ /*! no static exports found */ /*! all exports used */ /*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r={256:960,257:992,258:451,259:483,260:417,261:433,262:454,263:486,264:710,265:742,266:709,267:741,268:456,269:488,270:463,271:495,272:464,273:496,274:938,275:954,278:972,279:1004,280:458,281:490,282:460,283:492,284:728,285:760,286:683,287:699,288:725,289:757,290:939,291:955,292:678,293:694,294:673,295:689,296:933,297:949,298:975,299:1007,302:967,303:999,304:681,305:697,308:684,309:700,310:979,311:1011,312:930,313:453,314:485,315:934,316:950,317:421,318:437,321:419,322:435,323:465,324:497,325:977,326:1009,327:466,328:498,330:957,331:959,332:978,333:1010,336:469,337:501,338:5052,339:5053,340:448,341:480,342:931,343:947,344:472,345:504,346:422,347:438,348:734,349:766,350:426,351:442,352:425,353:441,354:478,355:510,356:427,357:443,358:940,359:956,360:989,361:1021,362:990,363:1022,364:733,365:765,366:473,367:505,368:475,369:507,370:985,371:1017,376:5054,377:428,378:444,379:431,380:447,381:430,382:446,402:2294,466:16777681,711:439,728:418,729:511,731:434,733:445,901:1966,902:1953,904:1954,905:1955,906:1956,908:1959,910:1960,911:1963,912:1974,913:1985,914:1986,915:1987,916:1988,917:1989,918:1990,919:1991,920:1992,921:1993,922:1994,923:1995,924:1996,925:1997,926:1998,927:1999,928:2e3,929:2001,931:2002,932:2004,933:2005,934:2006,935:2007,936:2008,937:2009,938:1957,939:1961,940:1969,941:1970,942:1971,943:1972,944:1978,945:2017,946:2018,947:2019,948:2020,949:2021,950:2022,951:2023,952:2024,953:2025,954:2026,955:2027,956:2028,957:2029,958:2030,959:2031,960:2032,961:2033,962:2035,963:2034,964:2036,965:2037,966:2038,967:2039,968:2040,969:2041,970:1973,971:1977,972:1975,973:1976,974:1979,1025:1715,1026:1713,1027:1714,1028:1716,1029:1717,1030:1718,1031:1719,1032:1720,1033:1721,1034:1722,1035:1723,1036:1724,1038:1726,1039:1727,1040:1761,1041:1762,1042:1783,1043:1767,1044:1764,1045:1765,1046:1782,1047:1786,1048:1769,1049:1770,1050:1771,1051:1772,1052:1773,1053:1774,1054:1775,1055:1776,1056:1778,1057:1779,1058:1780,1059:1781,1060:1766,1061:1768,1062:1763,1063:1790,1064:1787,1065:1789,1066:1791,1067:1785,1068:1784,1069:1788,1070:1760,1071:1777,1072:1729,1073:1730,1074:1751,1075:1735,1076:1732,1077:1733,1078:1750,1079:1754,1080:1737,1081:1738,1082:1739,1083:1740,1084:1741,1085:1742,1086:1743,1087:1744,1088:1746,1089:1747,1090:1748,1091:1749,1092:1734,1093:1736,1094:1731,1095:1758,1096:1755,1097:1757,1098:1759,1099:1753,1100:1752,1101:1756,1102:1728,1103:1745,1105:1699,1106:1697,1107:1698,1108:1700,1109:1701,1110:1702,1111:1703,1112:1704,1113:1705,1114:1706,1115:1707,1116:1708,1118:1710,1119:1711,1168:1725,1169:1709,1488:3296,1489:3297,1490:3298,1491:3299,1492:3300,1493:3301,1494:3302,1495:3303,1496:3304,1497:3305,1498:3306,1499:3307,1500:3308,1501:3309,1502:3310,1503:3311,1504:3312,1505:3313,1506:3314,1507:3315,1508:3316,1509:3317,1510:3318,1511:3319,1512:3320,1513:3321,1514:3322,1548:1452,1563:1467,1567:1471,1569:1473,1570:1474,1571:1475,1572:1476,1573:1477,1574:1478,1575:1479,1576:1480,1577:1481,1578:1482,1579:1483,1580:1484,1581:1485,1582:1486,1583:1487,1584:1488,1585:1489,1586:1490,1587:1491,1588:1492,1589:1493,1590:1494,1591:1495,1592:1496,1593:1497,1594:1498,1600:1504,1601:1505,1602:1506,1603:1507,1604:1508,1605:1509,1606:1510,1607:1511,1608:1512,1609:1513,1610:1514,1611:1515,1612:1516,1613:1517,1614:1518,1615:1519,1616:1520,1617:1521,1618:1522,3585:3489,3586:3490,3587:3491,3588:3492,3589:3493,3590:3494,3591:3495,3592:3496,3593:3497,3594:3498,3595:3499,3596:3500,3597:3501,3598:3502,3599:3503,3600:3504,3601:3505,3602:3506,3603:3507,3604:3508,3605:3509,3606:3510,3607:3511,3608:3512,3609:3513,3610:3514,3611:3515,3612:3516,3613:3517,3614:3518,3615:3519,3616:3520,3617:3521,3618:3522,3619:3523,3620:3524,3621:3525,3622:3526,3623:3527,3624:3528,3625:3529,3626:3530,3627:3531,3628:3532,3629:3533,3630:3534,3631:3535,3632:3536,3633:3537,3634:3538,3635:3539,3636:3540,3637:3541,3638:3542,3639:3543,3640:3544,3641:3545,3642:3546,3647:3551,3648:3552,3649:3553,3650:3554,3651:3555,3652:3556,3653:3557,3654:3558,3655:3559,3656:3560,3657:3561,3658:3562,3659:3563,3660:3564,3661:3565,3664:3568,3665:3569,3666:3570,3667:3571,3668:3572,3669:3573,3670:3574,3671:3575,3672:3576,3673:3577,8194:2722,8195:2721,8196:2723,8197:2724,8199:2725,8200:2726,8201:2727,8202:2728,8210:2747,8211:2730,8212:2729,8213:1967,8215:3295,8216:2768,8217:2769,8218:2813,8220:2770,8221:2771,8222:2814,8224:2801,8225:2802,8226:2790,8229:2735,8230:2734,8240:2773,8242:2774,8243:2775,8248:2812,8254:1150,8361:3839,8364:8364,8453:2744,8470:1712,8471:2811,8478:2772,8482:2761,8531:2736,8532:2737,8533:2738,8534:2739,8535:2740,8536:2741,8537:2742,8538:2743,8539:2755,8540:2756,8541:2757,8542:2758,8592:2299,8593:2300,8594:2301,8595:2302,8658:2254,8660:2253,8706:2287,8711:2245,8728:3018,8730:2262,8733:2241,8734:2242,8743:2270,8744:2271,8745:2268,8746:2269,8747:2239,8756:2240,8764:2248,8771:2249,8773:16785992,8800:2237,8801:2255,8804:2236,8805:2238,8834:2266,8835:2267,8866:3068,8867:3036,8868:3010,8869:3022,8968:3027,8970:3012,8981:2810,8992:2212,8993:2213,9109:3020,9115:2219,9117:2220,9118:2221,9120:2222,9121:2215,9123:2216,9124:2217,9126:2218,9128:2223,9132:2224,9143:2209,9146:2543,9147:2544,9148:2546,9149:2547,9225:2530,9226:2533,9227:2537,9228:2531,9229:2532,9251:2732,9252:2536,9472:2211,9474:2214,9484:2210,9488:2539,9492:2541,9496:2538,9500:2548,9508:2549,9516:2551,9524:2550,9532:2542,9618:2529,9642:2791,9643:2785,9644:2779,9645:2786,9646:2783,9647:2767,9650:2792,9651:2787,9654:2781,9655:2765,9660:2793,9661:2788,9664:2780,9665:2764,9670:2528,9675:2766,9679:2782,9702:2784,9734:2789,9742:2809,9747:2762,9756:2794,9758:2795,9792:2808,9794:2807,9827:2796,9829:2798,9830:2797,9837:2806,9839:2805,10003:2803,10007:2804,10013:2777,10016:2800,10216:2748,10217:2750,12289:1188,12290:1185,12300:1186,12301:1187,12443:1246,12444:1247,12449:1191,12450:1201,12451:1192,12452:1202,12453:1193,12454:1203,12455:1194,12456:1204,12457:1195,12458:1205,12459:1206,12461:1207,12463:1208,12465:1209,12467:1210,12469:1211,12471:1212,12473:1213,12475:1214,12477:1215,12479:1216,12481:1217,12483:1199,12484:1218,12486:1219,12488:1220,12490:1221,12491:1222,12492:1223,12493:1224,12494:1225,12495:1226,12498:1227,12501:1228,12504:1229,12507:1230,12510:1231,12511:1232,12512:1233,12513:1234,12514:1235,12515:1196,12516:1236,12517:1197,12518:1237,12519:1198,12520:1238,12521:1239,12522:1240,12523:1241,12524:1242,12525:1243,12527:1244,12530:1190,12531:1245,12539:1189,12540:1200},n={lookup:function(e){if(e>=32&&e<=255)return e;var t=r[e];return void 0!==t?t:16777216|e}};t.default=n},"8CQX": /*!*****************************************************!*\ !*** ./node_modules/@novnc/novnc/lib/input/util.js ***! \*****************************************************/ /*! no static exports found */ /*! all exports used */ /*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,i){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.getKeycode=d,t.getKey=f,t.getKeysym=function(e){var t=f(e);if("Unidentified"===t)return null;if(t in l.default){var i=e.location;if("Meta"===t&&0===i&&(i=2),"Clear"===t&&3===i)"NumLock"===d(e)&&(i=0);if((void 0===i||i>3)&&(i=0),"Meta"===t){var r=d(e);if("AltLeft"===r)return n.default.XK_Meta_L;if("AltRight"===r)return n.default.XK_Meta_R}if("Clear"===t)if("NumLock"===d(e))return n.default.XK_Num_Lock;return l.default[t][i]}if(1!==t.length)return null;var o=t.charCodeAt();if(o)return s.default.lookup(o);return null};var n=h(i(/*! ./keysym.js */"mHUz")),s=h(i(/*! ./keysymdef.js */"8+yF")),o=h(i(/*! ./vkeys.js */"6Qwc")),a=h(i(/*! ./fixedkeys.js */"gIYZ")),l=h(i(/*! ./domkeytable.js */"mTgk")),c=function(e){if(e&&e.__esModule)return e;if(null===e||"object"!==r(e)&&"function"!=typeof e)return{default:e};var t=u();if(t&&t.has(e))return t.get(e);var i={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){var o=n?Object.getOwnPropertyDescriptor(e,s):null;o&&(o.get||o.set)?Object.defineProperty(i,s,o):i[s]=e[s]}i.default=e,t&&t.set(e,i);return i}(i(/*! ../util/browser.js */"GdRQ"));function u(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return u=function(){return e},e}function h(e){return e&&e.__esModule?e:{default:e}}function d(e){if(e.code){switch(e.code){case"OSLeft":return"MetaLeft";case"OSRight":return"MetaRight"}return e.code}if("keypress"!==e.type&&e.keyCode in o.default){var t=o.default[e.keyCode];if(c.isMac()&&"ContextMenu"===t&&(t="MetaRight"),2===e.location)switch(t){case"ShiftLeft":return"ShiftRight";case"ControlLeft":return"ControlRight";case"AltLeft":return"AltRight"}if(3===e.location)switch(t){case"Delete":return"NumpadDecimal";case"Insert":return"Numpad0";case"End":return"Numpad1";case"ArrowDown":return"Numpad2";case"PageDown":return"Numpad3";case"ArrowLeft":return"Numpad4";case"ArrowRight":return"Numpad6";case"Home":return"Numpad7";case"ArrowUp":return"Numpad8";case"PageUp":return"Numpad9";case"Enter":return"NumpadEnter"}return t}return"Unidentified"}function f(e){if(void 0!==e.key){switch(e.key){case"Spacebar":return" ";case"Esc":return"Escape";case"Scroll":return"ScrollLock";case"Win":return"Meta";case"Apps":return"ContextMenu";case"Up":return"ArrowUp";case"Left":return"ArrowLeft";case"Right":return"ArrowRight";case"Down":return"ArrowDown";case"Del":return"Delete";case"Divide":return"/";case"Multiply":return"*";case"Subtract":return"-";case"Add":return"+";case"Decimal":return e.char}switch(e.key){case"OS":return"Meta";case"LaunchMyComputer":return"LaunchApplication1";case"LaunchCalculator":return"LaunchApplication2"}switch(e.key){case"UIKeyInputUpArrow":return"ArrowUp";case"UIKeyInputDownArrow":return"ArrowDown";case"UIKeyInputLeftArrow":return"ArrowLeft";case"UIKeyInputRightArrow":return"ArrowRight";case"UIKeyInputEscape":return"Escape"}if("\0"===e.key&&"NumpadDecimal"===e.code)return"Delete";if(!c.isIE()&&!c.isEdge())return e.key;if(1!==e.key.length&&"Unidentified"!==e.key)return e.key}var t=d(e);return t in a.default?a.default[t]:e.charCode?String.fromCharCode(e.charCode):"Unidentified"}},"8EBN": /*!**********************************************!*\ !*** ./node_modules/codemirror/mode/meta.js ***! \**********************************************/ /*! no static exports found */ /*! all exports used */ /*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,i){!function(e){"use strict";e.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 t=0;t-1&&t.substring(n+1,t.length);if(s)return e.findModeByExtension(s)},e.findModeByName=function(t){t=t.toLowerCase();for(var i=0;i>l&1&&(this._zlibs[l].reset(),s.Info("Reset zlib stream "+l));this._ctl=this._ctl>>4}var c;if(8===this._ctl)c=this._fillRect(e,t,i,r,n,o,a);else if(9===this._ctl)c=this._jpegRect(e,t,i,r,n,o,a);else if(10===this._ctl)c=this._pngRect(e,t,i,r,n,o,a);else{if(0!=(128&this._ctl))throw new Error("Illegal tight compression received (ctl: "+this._ctl+")");c=this._basicRect(this._ctl,e,t,i,r,n,o,a)}return c&&(this._ctl=null),c}},{key:"_fillRect",value:function(e,t,i,r,n,s,o){if(n.rQwait("TIGHT",3))return!1;var a=n.rQi,l=n.rQ;return s.fillRect(e,t,i,r,[l[a+2],l[a+1],l[a]],!1),n.rQskipBytes(3),!0}},{key:"_jpegRect",value:function(e,t,i,r,n,s,o){var a=this._readData(n);return null!==a&&(s.imageRect(e,t,i,r,"image/jpeg",a),!0)}},{key:"_pngRect",value:function(e,t,i,r,n,s,o){throw new Error("PNG received in standard Tight rect")}},{key:"_basicRect",value:function(e,t,i,r,n,s,o,a){if(null===this._filter)if(4&e){if(s.rQwait("TIGHT",1))return!1;this._filter=s.rQshift8()}else this._filter=0;var l,c=3&e;switch(this._filter){case 0:l=this._copyFilter(c,t,i,r,n,s,o,a);break;case 1:l=this._paletteFilter(c,t,i,r,n,s,o,a);break;case 2:l=this._gradientFilter(c,t,i,r,n,s,o,a);break;default:throw new Error("Illegal tight filter received (ctl: "+this._filter+")")}return l&&(this._filter=null),l}},{key:"_copyFilter",value:function(e,t,i,r,n,s,o,a){var l,c=r*n*3;if(c<12){if(s.rQwait("TIGHT",c))return!1;l=s.rQshiftBytes(c)}else{if(null===(l=this._readData(s)))return!1;this._zlibs[e].setInput(l),l=this._zlibs[e].inflate(c),this._zlibs[e].setInput(null)}return o.blitRgbImage(t,i,r,n,l,0,!1),!0}},{key:"_paletteFilter",value:function(e,t,i,r,n,s,o,a){if(0===this._numColors){if(s.rQwait("TIGHT palette",1))return!1;var l=s.rQpeek8()+1,c=3*l;if(s.rQwait("TIGHT palette",1+c))return!1;this._numColors=l,s.rQskipBytes(1),s.rQshiftTo(this._palette,c)}var u,h=this._numColors<=2?1:8,d=Math.floor((r*h+7)/8)*n;if(d<12){if(s.rQwait("TIGHT",d))return!1;u=s.rQshiftBytes(d)}else{if(null===(u=this._readData(s)))return!1;this._zlibs[e].setInput(u),u=this._zlibs[e].inflate(d),this._zlibs[e].setInput(null)}return 2==this._numColors?this._monoRect(t,i,r,n,u,this._palette,o):this._paletteRect(t,i,r,n,u,this._palette,o),this._numColors=0,!0}},{key:"_monoRect",value:function(e,t,i,r,n,s,o){for(var a=this._getScratchBuffer(i*r*4),l=Math.floor((i+7)/8),c=Math.floor(i/8),u=0;u=0;p--)h=4*(u*i+8*f+7-p),d=3*(n[u*l+f]>>p&1),a[h]=s[d],a[h+1]=s[d+1],a[h+2]=s[d+2],a[h+3]=255;for(var g=7;g>=8-i%8;g--)h=4*(u*i+8*f+7-g),d=3*(n[u*l+f]>>g&1),a[h]=s[d],a[h+1]=s[d+1],a[h+2]=s[d+2],a[h+3]=255}o.blitRgbxImage(e,t,i,r,a,0,!1)}},{key:"_paletteRect",value:function(e,t,i,r,n,s,o){for(var a=this._getScratchBuffer(i*r*4),l=i*r*4,c=0,u=0;c"],m=new f.a.Renderer,y=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function _(){g.length=0,v=["
    "]}var b={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function S(){return function e(t,i,r,n){if(i>=t.length||t[i].level<=r)return i;var s=t[i];n.push("
  • "+s.text+"");var o=[];return i=e(t,++i,s.level,o),o.length>0&&(n.push("
      "),o.forEach((function(e){n.push(e)})),n.push("
    ")),n.push("
  • "),i=e(t,i,r,n)}(g,0,0,v),v.push("
"),v.join("")}var C={heading:function(e){var t=y.exec(e);if(t)return{type:"heading",raw:t[0],depth:t[1].length,text:t[2]}},fences:function(e){var t=this.rules.block.fences.exec(e);if(t){var i=t[0],r=function(e,t){var i=e.match(/^(\s+)(?:```)/);if(null===i)return t;var r=i[1];return t.split("\n").map((function(e){var t=e.match(/^\s+/);return null===t?e:Object(a.a)(t,1)[0].length>=r.length?e.slice(r.length):e})).join("\n")}(i,t[3]||""),n=t[2]?t[2].trim():t[2];if(["latex","katex","math"].indexOf(n)>=0){var s=x(),o=r;r=s,E[s]={type:"block",expression:o}}return{type:"code",raw:i,lang:n,text:r}}}},w=/(?:\${2})([^\n`]+?)(?:\${2})/gi,k=0,x=function(){return"__special_katext_id_".concat(k++,"__")},E={};function T(){k=0,E={}}function L(e){return e=e.replace(w,(function(e,t){var i=x();return E[i]={type:"inline",expression:t},i}))}var A=m.listitem;m.listitem=function(e){return A(L(e))};var R=m.paragraph;m.paragraph=function(e){return R(L(e))};var D=m.tablecell;m.tablecell=function(e,t){return D(L(e),t)},m.code=function(e,t,i){var r=(t||"").match(/\S*/)[0];return r?["latex","katex","math"].indexOf(r)>=0?"

".concat(e,"

"):'
').concat(i?e:Object(p.escape)(e,!0),"
\n"):'
'+(i?e:Object(p.escape)(e,!0))+"
"},m.heading=function(e,t,i){var r=this.options.headerPrefix+i.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return g.push({anchor:r,level:t,text:e}),"'+e+""},f.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),f.a.use({tokenizer:C,renderer:m});var O=f.a,M=(i("SJMd"),i("ulZh")),I=i.n(M),P=i("m3rI"),F=i("Oy/b"),B=i("p5ED"),N=i("ErOA"),H=function(e,t){return(H=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])})(e,t)};function j(e,t){function i(){this.constructor=e}H(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}function U(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))}function K(e,t){var i,r,n,s,o={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(s){return function(a){return function(s){if(i)throw new TypeError("Generator is already executing.");for(;o;)try{if(i=1,r&&(n=2&s[0]?r.return:s[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,s[1])).done)return n;switch(r=0,n&&(s=[2&s[0],n.value]),s[0]){case 0:case 1:n=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((n=(n=o.trys).length>0&&n[n.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!n||s[1]>n[0]&&s[1]',"select"),this.addActionButton(i,'',"delete"),this.uiStyleSettings.clearButtonVisible&&this.addActionButton(i,'',"clear"),this.uiStyleSettings.undoButtonVisible&&this.addActionButton(i,'',"undo"),this.uiStyleSettings.redoButtonVisible&&this.addActionButton(i,'',"redo"),this.uiStyleSettings.zoomButtonVisible&&this.addActionButton(i,'',"zoom"),this.uiStyleSettings.zoomButtonVisible&&this.uiStyleSettings.zoomOutButtonVisible&&this.addActionButton(i,'',"zoom-out"),this.uiStyleSettings.notesButtonVisible&&this.addActionButton(i,'',"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(e){var i=document.createElement("div");i.className=""+t.toolbarButtonStyleClass.name,i.setAttribute("data-type-name",e.typeName),i.innerHTML=e.icon,i.addEventListener("click",(function(){t.markerToolbarButtonClicked(i,e)})),t.buttons.push(i),t.markerButtons.push(i)})),this.overflowButton=document.createElement("div"),this.overflowButton.className=this.toolbarButtonStyleClass.name+" "+(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name),this.overflowButton.innerHTML='',this.overflowButton.addEventListener("click",this.overflowButtonClicked),this.markerButtonBlock.appendChild(this.overflowButton));var r=document.createElement("div");r.className=this.toolbarBlockStyleClass.name,r.style.whiteSpace="nowrap",r.style.display=!1!==this.uiStyleSettings.resultButtonBlockVisible?"":"none",this.uiContainer.appendChild(r),this.addActionButton(r,'',"render"),this.addActionButton(r,'',"close"),this.markerjsContainer.appendChild(this.uiContainer),this.setSelectMode(),this.setCurrentMarker(),this.adjustLayout()},e.prototype.addButtonClickListener=function(e){this.buttonClickListeners.push(e)},e.prototype.removeButtonClickListener=function(e){this.buttonClickListeners.indexOf(e)>-1&&this.buttonClickListeners.splice(this.buttonClickListeners.indexOf(e),1)},e.prototype.setSelectMode=function(){this.resetButtonStyles(),this.setActiveButton(this.buttons[0])},e.prototype.adjustLayout=function(){if(this.markerButtons&&this.markerButtons.length>0){var e=Math.floor(this.markerButtonBlock.clientWidth/this.uiStyleSettings.toolbarHeight)-1;this.markerButtonBlock.innerHTML="",this.markerButtonOverflowBlock.innerHTML="";for(var t=0;t0&&this.buttonClickListeners.forEach((function(e){return e("marker",t)})),this.markerButtonOverflowBlock.style.display="none"},e.prototype.actionToolbarButtonClicked=function(e,t){this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach((function(e){return e("action",t)})),this.markerButtonOverflowBlock.style.display="none",this.setActiveButton(this.buttons[0])},e.prototype.setActiveButton=function(e){this.resetButtonStyles(),e.className=e.className.replace(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,"").trim(),e.className+=" "+(this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name)},e.prototype.setActiveMarkerButton=function(e){var t=this.markerButtons.find((function(t){return t.getAttribute("data-type-name")===e}));t&&this.setActiveButton(t)},e.prototype.setCurrentMarker=function(e){var t=this;this.currentMarker=e,this.buttons.filter((function(e){return/delete|notes/.test(e.getAttribute("data-action"))})).forEach((function(e){void 0===t.currentMarker?(e.style.fillOpacity="0.4",e.style.pointerEvents="none"):(e.style.fillOpacity="1",e.style.pointerEvents="all")}))},e}(),$=function(){function e(e,t,i,r){this.panels=[],this.panelButtons=[],this.markerjsContainer=e,this.displayMode=t,this.uiStyleSettings=i,this.styles=r,this.panelButtonClick=this.panelButtonClick.bind(this),this.addStyles()}return e.prototype.addStyles=function(){var e;this.toolboxStyleClass=this.styles.addClass(new Y("toolbox","\n width: 100%;\n flex-shrink: 0;\n display: flex;\n flex-direction: column;\n font-family: sans-serif;\n "+("popup"===this.displayMode?"height:"+2.5*this.uiStyleSettings.toolbarHeight+"px;":"")+"\n box-sizing: content-box;\n "+("popup"===this.displayMode?"background-color: "+this.uiStyleSettings.canvasBackgroundColor+";":"")+"\n "+("inline"===this.displayMode?"border-bottom-left-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+"\n "+("inline"===this.displayMode?"border-bottom-right-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+"\n overflow: hidden;\n ")),this.toolboxStyleColorsClass=this.styles.addClass(new Y("toolbox_colors","\n color: "+this.uiStyleSettings.toolboxColor+";\n "));var t=this.uiStyleSettings.toolbarHeight/4;this.toolboxButtonRowStyleClass=this.styles.addClass(new Y("toolbox-button-row","\n display: flex;\n cursor: default;\n box-sizing: content-box;\n ")),this.toolboxButtonRowStyleColorsClass=this.styles.addClass(new Y("toolbox-button-row_colors","\n background-color: "+this.uiStyleSettings.toolbarBackgroundColor+";\n ")),this.toolboxPanelRowStyleClass=this.styles.addClass(new Y("toolbox-panel-row","\n display: flex;\n "+("inline"===this.displayMode?"position: absolute;":"")+"\n "+("inline"===this.displayMode?"bottom: "+this.uiStyleSettings.toolbarHeight+"px;":"")+"\n cursor: default;\n height: "+1.5*this.uiStyleSettings.toolbarHeight+"px;\n "+("inline"===this.displayMode?"width: 100%;":"")+"\n box-sizing: content-box;\n ")),this.toolboxPanelRowStyleColorsClass=this.styles.addClass(new Y("toolbox-panel-row_colors","\n background-color: "+(null!==(e=this.uiStyleSettings.toolboxBackgroundColor)&&void 0!==e?e:this.uiStyleSettings.toolbarBackgroundHoverColor)+";\n ")),this.toolboxButtonStyleClass=this.styles.addClass(new Y("toolbox_button","\n display: inline-block;\n width: "+(this.uiStyleSettings.toolbarHeight-2*t)+"px;\n height: "+(this.uiStyleSettings.toolbarHeight-2*t)+"px;\n padding: "+t+"px;\n box-sizing: content-box;\n ")),this.toolboxButtonStyleColorsClass=this.styles.addClass(new Y("toolbox-button_colors","\n fill: "+this.uiStyleSettings.toolbarColor+";\n ")),this.toolboxActiveButtonStyleColorsClass=this.styles.addClass(new Y("toolbox-active-button_colors","\n background-color: "+this.uiStyleSettings.toolbarBackgroundHoverColor+";\n fill: "+this.uiStyleSettings.toolbarColor+";\n ")),this.styles.addRule(new Q("."+this.toolboxButtonStyleColorsClass.name+":hover","\n background-color: "+this.uiStyleSettings.toolbarBackgroundHoverColor+"\n ")),this.styles.addRule(new Q("."+this.toolboxButtonStyleClass.name+" svg","\n height: "+this.uiStyleSettings.toolbarHeight/2+"px;\n "))},e.prototype.show=function(e){var t;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=e,this.uiContainer.className=this.toolboxStyleClass.name+" "+(null!==(t=this.uiStyleSettings.toolboxStyleColorsClassName)&&void 0!==t?t:this.toolboxStyleColorsClass.name),this.markerjsContainer.appendChild(this.uiContainer)},e.prototype.setPanelButtons=function(e){var t,i,r=this;this.panels=e,void 0!==this.uiContainer&&(this.uiContainer.innerHTML="",this.panelRow=document.createElement("div"),this.panelRow.className=this.toolboxPanelRowStyleClass.name+" "+(null!==(t=this.uiStyleSettings.toolboxPanelRowStyleColorsClassName)&&void 0!==t?t:this.toolboxPanelRowStyleColorsClass.name),this.uiContainer.appendChild(this.panelRow),this.buttonRow=document.createElement("div"),this.buttonRow.className=this.toolboxButtonRowStyleClass.name+" "+(null!==(i=this.uiStyleSettings.toolboxButtonRowStyleColorsClassName)&&void 0!==i?i:this.toolboxButtonRowStyleColorsClass.name)+" ",this.uiContainer.appendChild(this.buttonRow),this.panelButtons.splice(0),this.panels.forEach((function(e){var t;e.uiStyleSettings=r.uiStyleSettings;var i=document.createElement("div");i.className=r.toolboxButtonStyleClass.name+" "+(null!==(t=r.uiStyleSettings.toolboxButtonStyleColorsClassName)&&void 0!==t?t:r.toolboxButtonStyleColorsClass.name),i.innerHTML=e.icon,i.title=e.title,i.addEventListener("click",(function(){r.panelButtonClick(e)})),r.panelButtons.push(i),r.buttonRow.appendChild(i)})),"inline"===this.displayMode?this.panelRow.style.display="none":this.panelRow.style.visibility="hidden")},e.prototype.panelButtonClick=function(e){var t=this,i=-1;if(e!==this.activePanel){i=this.panels.indexOf(e),this.panelRow.innerHTML="";var r=e.getUi();r.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.panelRow.appendChild(r),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=e}else this.activePanel=void 0,this.panelRow.className=this.panelRow.className.replace(this.styles.fadeInAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeOutAnimationClassName,setTimeout((function(){"inline"===t.displayMode?t.panelRow.style.display="none":t.panelRow.style.visibility="hidden"}),200);this.panelButtons.forEach((function(e,r){var n,s;e.className=t.toolboxButtonStyleClass.name+" "+(r===i?""+(null!==(n=t.uiStyleSettings.toolboxActiveButtonStyleColorsClassName)&&void 0!==n?n:t.toolboxActiveButtonStyleColorsClass.name):""+(null!==(s=t.uiStyleSettings.toolboxButtonStyleColorsClassName)&&void 0!==s?s:t.toolboxButtonStyleColorsClass.name))}))},e}(),J=function(e,t){this.title=e,this.icon=t},ee=function(e){function t(t,i,r,n){var s=e.call(this,t,n||'')||this;return s.colors=[],s.addTransparent=!1,s.colorBoxes=[],s.colors=i,s.currentColor=r,s.setCurrentColor=s.setCurrentColor.bind(s),s.getColorBox=s.getColorBox.bind(s),s}return j(t,e),t.prototype.getUi=function(){var e=this,t=document.createElement("div");return t.style.overflow="hidden",t.style.whiteSpace="nowrap",this.colors.forEach((function(i){var r=e.getColorBox(i);t.appendChild(r),e.colorBoxes.push(r)})),t},t.prototype.getColorBox=function(e){var t=this,i=this.uiStyleSettings.toolbarHeight/4,r=this.uiStyleSettings.toolbarHeight-i,n=document.createElement("div");n.style.display="inline-block",n.style.boxSizing="content-box",n.style.width=r-2+"px",n.style.height=r-2+"px",n.style.padding="1px",n.style.marginRight="2px",n.style.marginBottom="2px",n.style.borderWidth="2px",n.style.borderStyle="solid",n.style.borderRadius=(r+2)/2+"px",n.style.borderColor=e===this.currentColor?this.uiStyleSettings.toolboxAccentColor:"transparent",n.addEventListener("click",(function(){t.setCurrentColor(e,n)}));var s=document.createElement("div");return s.style.display="inline-block",s.style.width=r-2+"px",s.style.height=r-2+"px",s.style.backgroundColor=e,s.style.borderRadius=r/2+"px","transparent"===e&&(s.style.fill=this.uiStyleSettings.toolboxAccentColor,s.innerHTML='\n \n '),n.appendChild(s),n},t.prototype.setCurrentColor=function(e,t){var i=this;this.currentColor=e,this.colorBoxes.forEach((function(e){e.style.borderColor=e===t?i.uiStyleSettings.toolboxAccentColor:"transparent"})),this.onColorChanged&&this.onColorChanged(e)},t}(J),te=function(){function e(e,t,i){this._state="new",this._isSelected=!1,this._container=e,this._overlayContainer=t,this.globalSettings=i,this.stateChanged=this.stateChanged.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this)}return Object.defineProperty(e.prototype,"typeName",{get:function(){return Object.getPrototypeOf(this).constructor.typeName},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"container",{get:function(){return this._container},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"overlayContainer",{get:function(){return this._overlayContainer},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"toolboxPanels",{get:function(){return[]},enumerable:!1,configurable:!0}),e.prototype.ownsTarget=function(e){return!1},Object.defineProperty(e.prototype,"isSelected",{get:function(){return this._isSelected},enumerable:!1,configurable:!0}),e.prototype.select=function(){this.container.style.cursor="move",this._isSelected=!0,this.manipulationStartState=this.getState()},e.prototype.deselect=function(){this.container.style.cursor="default",this._isSelected=!1,this.stateChanged()},e.prototype.pointerDown=function(e,t){},e.prototype.dblClick=function(e,t){},e.prototype.manipulate=function(e){},e.prototype.pointerUp=function(e){this.stateChanged()},e.prototype.dispose=function(){},e.prototype.addMarkerVisualToContainer=function(e){this.container.childNodes.length>0?this.container.insertBefore(e,this.container.childNodes[0]):this.container.appendChild(e)},e.prototype.getState=function(){return{typeName:e.typeName,state:this.state,notes:this.notes}},e.prototype.restoreState=function(e){this._state=e.state,this.notes=e.notes},e.prototype.scale=function(e,t){},e.prototype.colorChanged=function(e){this.onColorChanged&&this.onColorChanged(e),this.stateChanged()},e.prototype.fillColorChanged=function(e){this.onFillColorChanged&&this.onFillColorChanged(e),this.stateChanged()},e.prototype.stateChanged=function(){if(this.onStateChanged&&"creating"!==this.state&&"new"!==this.state){var e=this.getState();void 0!==this.manipulationStartState&&(this.manipulationStartState.state="select"),e.state="select",JSON.stringify(this.manipulationStartState)!=JSON.stringify(e)&&this.onStateChanged(this)}},e.typeName="MarkerBase",e}(),ie=function(){function e(){this.findGripByVisual=this.findGripByVisual.bind(this)}return e.prototype.findGripByVisual=function(e){return this.topLeft.ownsTarget(e)?this.topLeft:this.topCenter.ownsTarget(e)?this.topCenter:this.topRight.ownsTarget(e)?this.topRight:this.centerLeft.ownsTarget(e)?this.centerLeft:this.centerRight.ownsTarget(e)?this.centerRight:this.bottomLeft.ownsTarget(e)?this.bottomLeft:this.bottomCenter.ownsTarget(e)?this.bottomCenter:this.bottomRight.ownsTarget(e)?this.bottomRight:void 0},e}(),re=function(){function e(){this.GRIP_SIZE=10,this.visual=W.createGroup(),this.visual.appendChild(W.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(W.createCircle(this.GRIP_SIZE,[["fill","#cccccc"],["fill-opacity","0.7"],["stroke","#333333"],["stroke-width","2"],["stroke-opacity","0.7"]]))}return e.prototype.ownsTarget=function(e){return e===this.visual||e===this.visual.childNodes[0]||e===this.visual.childNodes[1]},e}(),ne=function(){function e(){}return e.toITransformMatrix=function(e){return{a:e.a,b:e.b,c:e.c,d:e.d,e:e.e,f:e.f}},e.toSVGMatrix=function(e,t){return e.a=t.a,e.b=t.b,e.c=t.c,e.d=t.d,e.e=t.e,e.f=t.f,e},e}(),se=function(e){function t(t,i,r){var n=e.call(this,t,i,r)||this;return n.left=0,n.top=0,n.width=0,n.height=0,n.defaultSize={x:50,y:20},n.offsetX=0,n.offsetY=0,n.rotationAngle=0,n.CB_DISTANCE=10,n._suppressMarkerCreateEvent=!1,n.container.transform.baseVal.appendItem(W.createTransform()),n.setupControlBox(),n}return j(t,e),Object.defineProperty(t.prototype,"centerX",{get:function(){return this.left+this.width/2},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"centerY",{get:function(){return this.top+this.height/2},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"visual",{get:function(){return this._visual},set:function(e){this._visual=e;var t=W.createTransform();this._visual.transform.baseVal.appendItem(t)},enumerable:!1,configurable:!0}),t.prototype.ownsTarget=function(t){return!!e.prototype.ownsTarget.call(this,t)||!!(void 0!==this.controlGrips.findGripByVisual(t)||void 0!==this.rotatorGrip&&this.rotatorGrip.ownsTarget(t))},t.prototype.pointerDown=function(t,i){e.prototype.pointerDown.call(this,t,i),"new"===this.state&&(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 r=this.unrotatePoint(t);if(this.manipulationStartX=r.x,this.manipulationStartY=r.y,this.offsetX=r.x-this.left,this.offsetY=r.y-this.top,"new"!==this.state)if(this.select(),this.activeGrip=this.controlGrips.findGripByVisual(i),void 0!==this.activeGrip)this._state="resize";else if(void 0!==this.rotatorGrip&&this.rotatorGrip.ownsTarget(i)){this.activeGrip=this.rotatorGrip;var n=this.rotatePoint({x:this.centerX,y:this.centerY});this.left=n.x-this.width/2,this.top=n.y-this.height/2,this.moveVisual({x:this.left,y:this.top});var s=this.container.transform.baseVal.getItem(0);s.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(s,0),this.adjustControlBox(),this._state="rotate"}else this._state="move"},t.prototype.pointerUp=function(t){var i=this.state;e.prototype.pointerUp.call(this,t),"creating"===this.state&&this.width<10&&this.height<10?(this.width=this.defaultSize.x,this.height=this.defaultSize.y):this.manipulate(t),this._state="select","creating"===i&&this.onMarkerCreated&&!1===this._suppressMarkerCreateEvent&&this.onMarkerCreated(this)},t.prototype.moveVisual=function(e){this.visual.style.transform="translate("+e.x+"px, "+e.y+"px)"},t.prototype.manipulate=function(e){var t=this.unrotatePoint(e);"creating"===this.state?this.resize(e):"move"===this.state?(this.left=this.manipulationStartLeft+(t.x-this.manipulationStartLeft)-this.offsetX,this.top=this.manipulationStartTop+(t.y-this.manipulationStartTop)-this.offsetY,this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()):"resize"===this.state?this.resize(t):"rotate"===this.state&&this.rotate(e)},t.prototype.resize=function(e){var t=this.manipulationStartLeft,i=this.manipulationStartWidth,r=this.manipulationStartTop,n=this.manipulationStartHeight;switch(this.activeGrip){case this.controlGrips.bottomLeft:case this.controlGrips.centerLeft:case this.controlGrips.topLeft:t=this.manipulationStartLeft+e.x-this.manipulationStartX,i=this.manipulationStartWidth+this.manipulationStartLeft-t;break;case this.controlGrips.bottomRight:case this.controlGrips.centerRight:case this.controlGrips.topRight:case void 0:i=this.manipulationStartWidth+e.x-this.manipulationStartX}switch(this.activeGrip){case this.controlGrips.topCenter:case this.controlGrips.topLeft:case this.controlGrips.topRight:r=this.manipulationStartTop+e.y-this.manipulationStartY,n=this.manipulationStartHeight+this.manipulationStartTop-r;break;case this.controlGrips.bottomCenter:case this.controlGrips.bottomLeft:case this.controlGrips.bottomRight:case void 0:n=this.manipulationStartHeight+e.y-this.manipulationStartY}i>=0?(this.left=t,this.width=i):(this.left=t+i,this.width=-i),n>=0?(this.top=r,this.height=n):(this.top=r+n,this.height=-n),this.setSize()},t.prototype.setSize=function(){this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()},t.prototype.rotate=function(e){if(Math.abs(e.x-this.centerX)>.1){var t=Math.sign(e.x-this.centerX);this.rotationAngle=180*Math.atan((e.y-this.centerY)/(e.x-this.centerX))/Math.PI+90*t,this.applyRotation()}},t.prototype.applyRotation=function(){var e=this.container.transform.baseVal.getItem(0);e.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(e,0)},t.prototype.rotatePoint=function(e){if(0===this.rotationAngle)return e;var t=this.container.getCTM(),i=W.createPoint(e.x,e.y);return{x:(i=i.matrixTransform(t)).x,y:i.y}},t.prototype.unrotatePoint=function(e){if(0===this.rotationAngle)return e;var t=this.container.getCTM();t=t.inverse();var i=W.createPoint(e.x,e.y);return{x:(i=i.matrixTransform(t)).x,y:i.y}},t.prototype.select=function(){e.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},t.prototype.deselect=function(){e.prototype.deselect.call(this),this.controlBox.style.display="none"},t.prototype.setupControlBox=function(){this.controlBox=W.createGroup();var e=W.createTransform();e.setTranslate(-this.CB_DISTANCE/2,-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.appendItem(e),this.container.appendChild(this.controlBox),this.controlRect=W.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),!0!==this.globalSettings.disableRotation&&(this.rotatorGripLine=W.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 ie,this.addControlGrips(),this.controlBox.style.display="none"},t.prototype.adjustControlBox=function(){var e=this.controlBox.transform.baseVal.getItem(0);e.setTranslate(this.left-this.CB_DISTANCE/2,this.top-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.replaceItem(e,0),this.controlRect.setAttribute("width",(this.width+this.CB_DISTANCE).toString()),this.controlRect.setAttribute("height",(this.height+this.CB_DISTANCE).toString()),void 0!==this.rotatorGripLine&&(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()},t.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(),!0!==this.globalSettings.disableRotation&&(this.rotatorGrip=this.createGrip()),this.positionGrips()},t.prototype.createGrip=function(){var e=new re;return e.visual.transform.baseVal.appendItem(W.createTransform()),this.controlBox.appendChild(e.visual),e},t.prototype.positionGrips=function(){var e=this.controlGrips.topLeft.GRIP_SIZE,t=-e/2,i=t,r=(this.width+this.CB_DISTANCE)/2-e/2,n=(this.height+this.CB_DISTANCE)/2-e/2,s=this.height+this.CB_DISTANCE-e/2,o=this.width+this.CB_DISTANCE-e/2;this.positionGrip(this.controlGrips.topLeft.visual,t,i),this.positionGrip(this.controlGrips.topCenter.visual,r,i),this.positionGrip(this.controlGrips.topRight.visual,o,i),this.positionGrip(this.controlGrips.centerLeft.visual,t,n),this.positionGrip(this.controlGrips.centerRight.visual,o,n),this.positionGrip(this.controlGrips.bottomLeft.visual,t,s),this.positionGrip(this.controlGrips.bottomCenter.visual,r,s),this.positionGrip(this.controlGrips.bottomRight.visual,o,s),void 0!==this.rotatorGrip&&this.positionGrip(this.rotatorGrip.visual,r,i-3*this.CB_DISTANCE)},t.prototype.positionGrip=function(e,t,i){var r=e.transform.baseVal.getItem(0);r.setTranslate(t,i),e.transform.baseVal.replaceItem(r,0)},t.prototype.hideControlBox=function(){this.controlBox.style.display="none"},t.prototype.showControlBox=function(){this.controlBox.style.display=""},t.prototype.getState=function(){return Object.assign({left:this.left,top:this.top,width:this.width,height:this.height,rotationAngle:this.rotationAngle,visualTransformMatrix:ne.toITransformMatrix(this.visual.transform.baseVal.getItem(0).matrix),containerTransformMatrix:ne.toITransformMatrix(this.container.transform.baseVal.getItem(0).matrix)},e.prototype.getState.call(this))},t.prototype.restoreState=function(t){e.prototype.restoreState.call(this,t);var i=t;this.left=i.left,this.top=i.top,this.width=i.width,this.height=i.height,this.rotationAngle=i.rotationAngle,this.visual.transform.baseVal.getItem(0).setMatrix(ne.toSVGMatrix(this.visual.transform.baseVal.getItem(0).matrix,i.visualTransformMatrix)),this.container.transform.baseVal.getItem(0).setMatrix(ne.toSVGMatrix(this.container.transform.baseVal.getItem(0).matrix,i.containerTransformMatrix))},t.prototype.scale=function(t,i){e.prototype.scale.call(this,t,i);var r=this.rotatePoint({x:this.left,y:this.top}),n=this.unrotatePoint({x:r.x*t,y:r.y*i});this.left=n.x,this.top=n.y,this.width=this.width*t,this.height=this.height*i,this.adjustControlBox()},t}(te),oe=function(e){function t(t,i,r){var n=e.call(this,t,i,r)||this;return n.fillColor="transparent",n.strokeColor="transparent",n.strokeWidth=0,n.strokeDasharray="",n.opacity=1,n.setStrokeColor=n.setStrokeColor.bind(n),n.setFillColor=n.setFillColor.bind(n),n.setStrokeWidth=n.setStrokeWidth.bind(n),n.setStrokeDasharray=n.setStrokeDasharray.bind(n),n.createVisual=n.createVisual.bind(n),n}return j(t,e),t.prototype.ownsTarget=function(t){return!(!e.prototype.ownsTarget.call(this,t)&&t!==this.visual)},t.prototype.createVisual=function(){this.visual=W.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)},t.prototype.pointerDown=function(t,i){e.prototype.pointerDown.call(this,t,i),"new"===this.state&&(this.createVisual(),this.moveVisual(t),this._state="creating")},t.prototype.manipulate=function(t){e.prototype.manipulate.call(this,t)},t.prototype.resize=function(t){e.prototype.resize.call(this,t),this.setSize()},t.prototype.setSize=function(){e.prototype.setSize.call(this),W.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]])},t.prototype.pointerUp=function(t){e.prototype.pointerUp.call(this,t),this.setSize()},t.prototype.setStrokeColor=function(e){this.strokeColor=e,this.visual&&W.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(e),this.stateChanged()},t.prototype.setFillColor=function(e){this.fillColor=e,this.visual&&W.setAttributes(this.visual,[["fill",this.fillColor]]),this.stateChanged()},t.prototype.setStrokeWidth=function(e){this.strokeWidth=e,this.visual&&W.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},t.prototype.setStrokeDasharray=function(e){this.strokeDasharray=e,this.visual&&W.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},t.prototype.getState=function(){return Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},e.prototype.getState.call(this))},t.prototype.restoreState=function(t){var i=t;this.fillColor=i.fillColor,this.strokeColor=i.strokeColor,this.strokeWidth=i.strokeWidth,this.strokeDasharray=i.strokeDasharray,this.opacity=i.opacity,this.createVisual(),e.prototype.restoreState.call(this,t),this.setSize()},t.prototype.scale=function(t,i){e.prototype.scale.call(this,t,i),this.setSize()},t.title="Rectangle marker",t}(se),ae=function(e){function t(t,i,r,n){var s=e.call(this,t,n||'')||this;return s.widths=[],s.widthBoxes=[],s.widths=i,s.currentWidth=r,s.setCurrentWidth=s.setCurrentWidth.bind(s),s}return j(t,e),t.prototype.getUi=function(){var e=this,t=document.createElement("div");return t.style.display="flex",t.style.overflow="hidden",t.style.flexGrow="2",this.widths.forEach((function(i){var r=document.createElement("div");r.style.display="flex",r.style.flexGrow="2",r.style.alignItems="center",r.style.justifyContent="space-between",r.style.padding="5px",r.style.borderWidth="2px",r.style.borderStyle="solid",r.style.borderColor=i===e.currentWidth?e.uiStyleSettings.toolboxAccentColor:"transparent",r.addEventListener("click",(function(){e.setCurrentWidth(i,r)})),t.appendChild(r);var n=document.createElement("div");n.innerText=i.toString(),n.style.marginRight="5px",r.appendChild(n);var s=document.createElement("div");s.style.minHeight="20px",s.style.flexGrow="2",s.style.display="flex",s.style.alignItems="center";var o=document.createElement("hr");o.style.minWidth="20px",o.style.border="0px",o.style.borderTop=i+"px solid "+e.uiStyleSettings.toolboxColor,o.style.flexGrow="2",s.appendChild(o),r.appendChild(s),e.widthBoxes.push(r)})),t},t.prototype.setCurrentWidth=function(e,t){var i=this;this.currentWidth=e,this.widthBoxes.forEach((function(e){e.style.borderColor=e===t?i.uiStyleSettings.toolboxAccentColor:"transparent"})),this.onWidthChanged&&this.onWidthChanged(this.currentWidth)},t}(J),le=function(e){function t(t,i,r,n){var s=e.call(this,t,n||'')||this;return s.styles=[],s.styleBoxes=[],s.styles=i,s.currentStyle=r,s.setCurrentStyle=s.setCurrentStyle.bind(s),s}return j(t,e),t.prototype.getUi=function(){var e=this,t=document.createElement("div");return t.style.display="flex",t.style.overflow="hidden",t.style.flexGrow="2",this.styles.forEach((function(i){var r=document.createElement("div");r.style.display="flex",r.style.alignItems="center",r.style.justifyContent="space-between",r.style.padding="5px",r.style.borderWidth="2px",r.style.borderStyle="solid",r.style.overflow="hidden",r.style.maxWidth=100/e.styles.length-5+"%",r.style.borderColor=i===e.currentStyle?e.uiStyleSettings.toolboxAccentColor:"transparent",r.addEventListener("click",(function(){e.setCurrentStyle(i,r)})),t.appendChild(r);var n=document.createElement("div");n.style.minHeight="20px",n.style.flexGrow="2",n.style.overflow="hidden";var s='\n \n ";n.innerHTML=s,r.appendChild(n),e.styleBoxes.push(r)})),t},t.prototype.setCurrentStyle=function(e,t){var i=this;this.currentStyle=e,this.styleBoxes.forEach((function(e){e.style.borderColor=e===t?i.uiStyleSettings.toolboxAccentColor:"transparent"})),this.onStyleChanged&&this.onStyleChanged(this.currentStyle)},t}(J),ce=function(e){function t(t,i,r){var n=e.call(this,t,i,r)||this;return n.strokeColor=r.defaultColor,n.strokeWidth=r.defaultStrokeWidth,n.strokeDasharray=r.defaultStrokeDasharray,n.strokePanel=new ee("Line color",r.defaultColorSet,r.defaultColor),n.strokePanel.onColorChanged=n.setStrokeColor,n.strokeWidthPanel=new ae("Line width",r.defaultStrokeWidths,r.defaultStrokeWidth),n.strokeWidthPanel.onWidthChanged=n.setStrokeWidth,n.strokeStylePanel=new le("Line style",r.defaultStrokeDasharrays,r.defaultStrokeDasharray),n.strokeStylePanel.onStyleChanged=n.setStrokeDasharray,n}return j(t,e),Object.defineProperty(t.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),t.prototype.getState=function(){var i=e.prototype.getState.call(this);return i.typeName=t.typeName,i},t.typeName="FrameMarker",t.title="Frame marker",t.icon='',t}(oe),ue=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},he=function(e){function t(t,i,r){var n=e.call(this,t,i,r)||this;return n.x1=0,n.y1=0,n.x2=0,n.y2=0,n.defaultLength=50,n.manipulationStartX=0,n.manipulationStartY=0,n.manipulationStartX1=0,n.manipulationStartY1=0,n.manipulationStartX2=0,n.manipulationStartY2=0,n.setupControlBox(),n}return j(t,e),t.prototype.ownsTarget=function(t){return!!e.prototype.ownsTarget.call(this,t)||!(!this.grip1.ownsTarget(t)&&!this.grip2.ownsTarget(t))},t.prototype.pointerDown=function(t,i){e.prototype.pointerDown.call(this,t,i),this.manipulationStartX=t.x,this.manipulationStartY=t.y,"new"===this.state&&(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,"new"!==this.state&&(this.select(),this.grip1.ownsTarget(i)?this.activeGrip=this.grip1:this.grip2.ownsTarget(i)?this.activeGrip=this.grip2:this.activeGrip=void 0,this.activeGrip?this._state="resize":this._state="move")},t.prototype.pointerUp=function(t){var i=this.state;e.prototype.pointerUp.call(this,t),"creating"===this.state&&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","creating"===i&&this.onMarkerCreated&&this.onMarkerCreated(this)},t.prototype.adjustVisual=function(){},t.prototype.manipulate=function(e){"creating"===this.state?this.resize(e):"move"===this.state?(this.x1=this.manipulationStartX1+e.x-this.manipulationStartX,this.y1=this.manipulationStartY1+e.y-this.manipulationStartY,this.x2=this.manipulationStartX2+e.x-this.manipulationStartX,this.y2=this.manipulationStartY2+e.y-this.manipulationStartY,this.adjustVisual(),this.adjustControlBox()):"resize"===this.state&&this.resize(e)},t.prototype.resize=function(e){switch(this.activeGrip){case this.grip1:this.x1=e.x,this.y1=e.y;break;case this.grip2:case void 0:this.x2=e.x,this.y2=e.y}this.adjustVisual(),this.adjustControlBox()},t.prototype.select=function(){e.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},t.prototype.deselect=function(){e.prototype.deselect.call(this),this.controlBox.style.display="none"},t.prototype.setupControlBox=function(){this.controlBox=W.createGroup(),this.container.appendChild(this.controlBox),this.addControlGrips(),this.controlBox.style.display="none"},t.prototype.adjustControlBox=function(){this.positionGrips()},t.prototype.addControlGrips=function(){this.grip1=this.createGrip(),this.grip2=this.createGrip(),this.positionGrips()},t.prototype.createGrip=function(){var e=new re;return e.visual.transform.baseVal.appendItem(W.createTransform()),this.controlBox.appendChild(e.visual),e},t.prototype.positionGrips=function(){var e=this.grip1.GRIP_SIZE;this.positionGrip(this.grip1.visual,this.x1-e/2,this.y1-e/2),this.positionGrip(this.grip2.visual,this.x2-e/2,this.y2-e/2)},t.prototype.positionGrip=function(e,t,i){var r=e.transform.baseVal.getItem(0);r.setTranslate(t,i),e.transform.baseVal.replaceItem(r,0)},t.prototype.getState=function(){return Object.assign({x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2},e.prototype.getState.call(this))},t.prototype.restoreState=function(t){e.prototype.restoreState.call(this,t);var i=t;this.x1=i.x1,this.y1=i.y1,this.x2=i.x2,this.y2=i.y2},t.prototype.scale=function(t,i){e.prototype.scale.call(this,t,i),this.x1=this.x1*t,this.y1=this.y1*i,this.x2=this.x2*t,this.y2=this.y2*i,this.adjustVisual(),this.adjustControlBox()},t}(te),de=function(e){function t(t,i,r){var n=e.call(this,t,i,r)||this;return n.strokeColor="transparent",n.strokeWidth=0,n.strokeDasharray="",n.setStrokeColor=n.setStrokeColor.bind(n),n.setStrokeWidth=n.setStrokeWidth.bind(n),n.setStrokeDasharray=n.setStrokeDasharray.bind(n),n.strokeColor=r.defaultColor,n.strokeWidth=r.defaultStrokeWidth,n.strokeDasharray=r.defaultStrokeDasharray,n.strokePanel=new ee("Line color",r.defaultColorSet,r.defaultColor),n.strokePanel.onColorChanged=n.setStrokeColor,n.strokeWidthPanel=new ae("Line width",r.defaultStrokeWidths,r.defaultStrokeWidth),n.strokeWidthPanel.onWidthChanged=n.setStrokeWidth,n.strokeStylePanel=new le("Line style",r.defaultStrokeDasharrays,r.defaultStrokeDasharray),n.strokeStylePanel.onStyleChanged=n.setStrokeDasharray,n}return j(t,e),t.prototype.ownsTarget=function(t){return!(!e.prototype.ownsTarget.call(this,t)&&t!==this.visual&&t!==this.selectorLine&&t!==this.visibleLine)},t.prototype.createVisual=function(){this.visual=W.createGroup(),this.selectorLine=W.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()]]),this.visibleLine=W.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)},t.prototype.pointerDown=function(t,i){e.prototype.pointerDown.call(this,t,i),"new"===this.state&&(this.createVisual(),this.adjustVisual(),this._state="creating")},t.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()),W.setAttributes(this.visibleLine,[["stroke",this.strokeColor]]),W.setAttributes(this.visibleLine,[["stroke-width",this.strokeWidth.toString()]]),W.setAttributes(this.visibleLine,[["stroke-dasharray",this.strokeDasharray.toString()]]))},t.prototype.setStrokeColor=function(e){this.strokeColor=e,this.adjustVisual(),this.colorChanged(e)},t.prototype.setStrokeWidth=function(e){this.strokeWidth=e,this.adjustVisual()},t.prototype.setStrokeDasharray=function(e){this.strokeDasharray=e,this.adjustVisual(),this.stateChanged()},Object.defineProperty(t.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),t.prototype.getState=function(){var i=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray},e.prototype.getState.call(this));return i.typeName=t.typeName,i},t.prototype.restoreState=function(t){e.prototype.restoreState.call(this,t);var i=t;this.strokeColor=i.strokeColor,this.strokeWidth=i.strokeWidth,this.strokeDasharray=i.strokeDasharray,this.createVisual(),this.adjustVisual()},t.typeName="LineMarker",t.title="Line marker",t.icon='',t}(he),fe=function(e){function t(t,i,r,n){var s=e.call(this,t,n||'')||this;return s.fonts=[],s.fontBoxes=[],s.fonts=i,s.currentFont=r,s.setCurrentFont=s.setCurrentFont.bind(s),s}return j(t,e),t.prototype.getUi=function(){var e=this,t=document.createElement("div");return t.style.overflow="hidden",t.style.flexGrow="2",this.fonts.forEach((function(i){var r=document.createElement("div");r.style.display="inline-block",r.style.alignItems="center",r.style.justifyContent="space-between",r.style.padding="5px",r.style.borderWidth="2px",r.style.borderStyle="solid",r.style.overflow="hidden",r.style.maxWidth=100/e.fonts.length-5+"%",r.style.borderColor=i===e.currentFont?e.uiStyleSettings.toolboxAccentColor:"transparent",r.addEventListener("click",(function(){e.setCurrentFont(i,r)})),t.appendChild(r);var n=document.createElement("div");n.style.display="flex",n.style.minHeight="20px",n.style.flexGrow="2",n.style.fontFamily=i,n.style.overflow="hidden";var s=document.createElement("div");s.style.whiteSpace="nowrap",s.style.overflow="hidden",s.style.textOverflow="ellipsis",s.innerHTML="The quick brown fox jumps over the lazy dog",n.appendChild(s),r.appendChild(n),e.fontBoxes.push(r)})),t},t.prototype.setCurrentFont=function(e,t){var i=this;this.currentFont=e,this.fontBoxes.forEach((function(e){e.style.borderColor=e===t?i.uiStyleSettings.toolboxAccentColor:"transparent"})),this.onFontChanged&&this.onFontChanged(this.currentFont)},t}(J),pe=function(e){function t(t,i,r){var n=e.call(this,t,i,r)||this;return n.color="transparent",n.padding=5,n.DEFAULT_TEXT="your text here",n.text=n.DEFAULT_TEXT,n.isMoved=!1,n.color=r.defaultColor,n.fontFamily=r.defaultFontFamily,n.defaultSize={x:100,y:30},n.setColor=n.setColor.bind(n),n.setFont=n.setFont.bind(n),n.renderText=n.renderText.bind(n),n.sizeText=n.sizeText.bind(n),n.textEditDivClicked=n.textEditDivClicked.bind(n),n.showTextEditor=n.showTextEditor.bind(n),n.setSize=n.setSize.bind(n),n.positionTextEditor=n.positionTextEditor.bind(n),n.colorPanel=new ee("Color",r.defaultColorSet,r.defaultColor),n.colorPanel.onColorChanged=n.setColor,n.fontFamilyPanel=new fe("Font",r.defaultFontFamilies,r.defaultFontFamily),n.fontFamilyPanel.onFontChanged=n.setFont,n}return j(t,e),t.prototype.ownsTarget=function(t){if(e.prototype.ownsTarget.call(this,t)||t===this.visual||t===this.textElement||t===this.bgRectangle)return!0;var i=!1;return this.textElement.childNodes.forEach((function(e){e===t&&(i=!0)})),i},t.prototype.createVisual=function(){this.visual=W.createGroup(),this.bgRectangle=W.createRect(1,1,[["fill","transparent"]]),this.visual.appendChild(this.bgRectangle),this.textElement=W.createText([["fill",this.color],["font-family",this.fontFamily],["font-size","16px"],["x","0"],["y","0"]]),this.textElement.transform.baseVal.appendItem(W.createTransform()),this.textElement.transform.baseVal.appendItem(W.createTransform()),this.visual.appendChild(this.textElement),this.addMarkerVisualToContainer(this.visual),this.renderText()},t.prototype.pointerDown=function(t,i){e.prototype.pointerDown.call(this,t,i),this.isMoved=!1,this.pointerDownPoint=t,this.pointerDownTimestamp=Date.now(),"new"===this.state&&(this.createVisual(),this.moveVisual(t),this._state="creating")},t.prototype.renderText=function(){var e=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(t){e.textElement.appendChild(W.createTSpan(""===t.trim()?" ":t.trim(),[["x","0"],["dy","1.2em"]]))})),setTimeout(this.sizeText,10)}},t.prototype.getTextScale=function(){var e=this.textElement.getBBox(),t=1;if(e.width>0&&e.height>0){var i=(1*this.width-this.width*this.padding*2/100)/e.width,r=(1*this.height-this.height*this.padding*2/100)/e.height;t=Math.min(i,r)}return t},t.prototype.getTextPosition=function(e){var t=this.textElement.getBBox(),i=0,r=0;return t.width>0&&t.height>0&&(i=(this.width-t.width*e)/2,r=this.height/2-t.height*e/2),{x:i,y:r}},t.prototype.sizeText=function(){var e=this.textElement.getBBox(),t=this.getTextScale(),i=this.getTextPosition(t);i.y-=e.y*t,navigator.userAgent.indexOf("Edge/")>-1?this.textElement.style.transform="translate("+i.x+"px, "+i.y+"px) scale("+t+", "+t+")":(this.textElement.transform.baseVal.getItem(0).setTranslate(i.x,i.y),this.textElement.transform.baseVal.getItem(1).setScale(t,t))},t.prototype.manipulate=function(t){e.prototype.manipulate.call(this,t),void 0!==this.pointerDownPoint&&(this.isMoved=Math.abs(t.x-this.pointerDownPoint.x)>5||Math.abs(t.y-this.pointerDownPoint.y)>5)},t.prototype.resize=function(t){e.prototype.resize.call(this,t),this.isMoved=!0,this.setSize(),this.sizeText()},t.prototype.setSize=function(){e.prototype.setSize.call(this),this.visual&&this.bgRectangle&&(W.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),W.setAttributes(this.bgRectangle,[["width",this.width.toString()],["height",this.height.toString()]]))},t.prototype.pointerUp=function(t){var i=this.state;"creating"===i&&(this._suppressMarkerCreateEvent=!0),e.prototype.pointerUp.call(this,t),this.setSize(),("creating"===i||!this.isMoved&&Date.now()-this.pointerDownTimestamp>500)&&this.showTextEditor(),this.pointerDownPoint=void 0},t.prototype.showTextEditor=function(){var e=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(e){e.stopPropagation()})),this.textEditor.addEventListener("input",(function(){for(var t=Number.parseFloat(e.textEditor.style.fontSize);e.textEditor.clientWidth>=Number.parseInt(e.textEditor.style.maxWidth)&&t>.9;)t-=.1,e.textEditor.style.fontSize=Math.max(t,.9)+"em"})),this.textEditor.addEventListener("keyup",(function(e){e.cancelBubble=!0})),this.textEditor.addEventListener("paste",(function(e){if(e.clipboardData){var t=e.clipboardData.getData("text"),i=window.getSelection();if(!i.rangeCount)return!1;i.deleteFromDocument(),i.getRangeAt(0).insertNode(document.createTextNode(t)),e.preventDefault()}})),this.textEditDiv.addEventListener("pointerup",(function(){e.textEditDivClicked(e.textEditor.innerText)})),this.textEditDiv.appendChild(this.textEditor),this.overlayContainer.appendChild(this.textEditDiv),this.hideVisual(),this.textEditor.focus(),document.execCommand("selectAll")},t.prototype.positionTextEditor=function(){if("edit"===this.state)if(void 0===this.textEditor)this.showTextEditor();else{this.textElement.style.display="";var e=this.getTextScale(),t=this.rotatePoint({x:this.left+this.width/2,y:this.top+this.height/2}),i=this.textElement.getBBox(),r={x:i.width*e,y:i.height*e};t.x-=r.x/2,t.y-=r.y/2,this.textEditor.style.top=t.y+"px",this.textEditor.style.left=t.x+"px",this.textEditor.style.maxWidth=this.overlayContainer.offsetWidth-t.x+"px",this.textEditor.style.fontSize=Math.max(16*e,12)+"px",this.textElement.style.display="none"}},t.prototype.textEditDivClicked=function(e){this.text=e.trim(),this.overlayContainer.innerHTML="",this.renderText(),this.showVisual(),this._suppressMarkerCreateEvent&&(this._suppressMarkerCreateEvent=!1,this.onMarkerCreated&&this.onMarkerCreated(this)),this.stateChanged()},t.prototype.select=function(){e.prototype.select.call(this),"edit"===this.state&&this.textEditDivClicked(this.textEditor.innerText)},t.prototype.deselect=function(){"edit"===this.state&&this.textEditDivClicked(this.textEditor.innerText),e.prototype.deselect.call(this)},t.prototype.dblClick=function(t,i){e.prototype.dblClick.call(this,t,i),this.showTextEditor()},t.prototype.setColor=function(e){this.textElement&&W.setAttributes(this.textElement,[["fill",e]]),this.color=e,this.textEditor&&(this.textEditor.style.color=this.color),this.colorChanged(e)},t.prototype.setFont=function(e){this.textElement&&W.setAttributes(this.textElement,[["font-family",e]]),this.fontFamily=e,this.textEditor&&(this.textEditor.style.fontFamily=this.fontFamily),this.renderText(),this.stateChanged()},t.prototype.hideVisual=function(){this.textElement.style.display="none",this.hideControlBox()},t.prototype.showVisual=function(){"edit"===this.state&&(this._state="select"),this.textElement.style.display="",this.showControlBox()},Object.defineProperty(t.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),t.prototype.getState=function(){var i=Object.assign({color:this.color,fontFamily:this.fontFamily,padding:this.padding,text:this.text},e.prototype.getState.call(this));return i.typeName=t.typeName,i},t.prototype.restoreState=function(t){var i=t;this.color=i.color,this.fontFamily=i.fontFamily,this.padding=i.padding,this.text=i.text,this.createVisual(),e.prototype.restoreState.call(this,t),this.setSize()},t.prototype.scale=function(t,i){e.prototype.scale.call(this,t,i),this.setSize(),this.sizeText(),this.positionTextEditor()},t.typeName="TextMarker",t.title="Text marker",t.icon='',t}(se),ge=function(e){function t(t,i,r){var n=e.call(this,t,i,r)||this;return n.color="transparent",n.lineWidth=3,n.drawing=!1,n.pixelRatio=1,n.color=r.defaultColor,n.lineWidth=r.defaultStrokeWidth,n.pixelRatio=r.freehandPixelRatio,n.setColor=n.setColor.bind(n),n.addCanvas=n.addCanvas.bind(n),n.finishCreation=n.finishCreation.bind(n),n.setLineWidth=n.setLineWidth.bind(n),n.colorPanel=new ee("Color",r.defaultColorSet,r.defaultColor),n.colorPanel.onColorChanged=n.setColor,n.lineWidthPanel=new ae("Line width",r.defaultStrokeWidths,r.defaultStrokeWidth),n.lineWidthPanel.onWidthChanged=n.setLineWidth,n}return j(t,e),t.prototype.ownsTarget=function(t){return!(!e.prototype.ownsTarget.call(this,t)&&t!==this.visual&&t!==this.drawingImage)},t.prototype.createVisual=function(){this.visual=W.createGroup(),this.drawingImage=W.createImage(),this.visual.appendChild(this.drawingImage);var e=W.createTransform();this.visual.transform.baseVal.appendItem(e),this.addMarkerVisualToContainer(this.visual)},t.prototype.pointerDown=function(t,i){"new"===this.state&&(this.addCanvas(),this.createVisual(),this._state="creating"),"creating"===this.state?(this.canvasContext.strokeStyle=this.color,this.canvasContext.lineWidth=this.lineWidth,this.canvasContext.beginPath(),this.canvasContext.moveTo(t.x,t.y),this.drawing=!0):e.prototype.pointerDown.call(this,t,i)},t.prototype.manipulate=function(t){"creating"===this.state?this.drawing&&(this.canvasContext.lineTo(t.x,t.y),this.canvasContext.stroke()):e.prototype.manipulate.call(this,t)},t.prototype.resize=function(t){e.prototype.resize.call(this,t),W.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),W.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]])},t.prototype.pointerUp=function(t){"creating"===this._state?this.drawing&&(this.canvasContext.closePath(),this.drawing=!1,this.globalSettings.newFreehandMarkerOnPointerUp&&this.finishCreation()):e.prototype.pointerUp.call(this,t)},t.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)},t.prototype.select=function(){"creating"===this.state&&this.finishCreation(),e.prototype.select.call(this)},t.prototype.deselect=function(){"creating"===this.state&&this.finishCreation(),e.prototype.deselect.call(this)},t.prototype.finishCreation=function(){for(var e=this.canvasContext.getImageData(0,0,this.canvasElement.width,this.canvasElement.height),t=[this.canvasElement.width+1,this.canvasElement.height+1,-1,-1],i=t[0],r=t[1],n=t[2],s=t[3],o=!1,a=0;a0&&(o=!0,as&&(s=a),l>n&&(n=l));if(o){this.left=i/this.pixelRatio,this.top=r/this.pixelRatio,this.width=(n-i)/this.pixelRatio,this.height=(s-r)/this.pixelRatio;var c=document.createElement("canvas");c.width=n-i,c.height=s-r,c.getContext("2d").putImageData(this.canvasContext.getImageData(i,r,n-i,s-r),0,0),this.drawingImgUrl=c.toDataURL("image/png"),this.setDrawingImage(),this._state="select",this.onMarkerCreated&&this.onMarkerCreated(this)}this.overlayContainer.innerHTML=""},t.prototype.setDrawingImage=function(){W.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]]),W.setAttributes(this.drawingImage,[["href",this.drawingImgUrl]]),this.moveVisual({x:this.left,y:this.top})},t.prototype.setColor=function(e){this.color=e,this.colorChanged(e)},t.prototype.setLineWidth=function(e){this.lineWidth=e},Object.defineProperty(t.prototype,"toolboxPanels",{get:function(){return"new"===this.state||"creating"===this.state?[this.colorPanel,this.lineWidthPanel]:[]},enumerable:!1,configurable:!0}),t.prototype.getState=function(){var i=Object.assign({drawingImgUrl:this.drawingImgUrl},e.prototype.getState.call(this));return i.typeName=t.typeName,i},t.prototype.restoreState=function(t){this.createVisual(),e.prototype.restoreState.call(this,t),this.drawingImgUrl=t.drawingImgUrl,this.setDrawingImage()},t.prototype.scale=function(t,i){e.prototype.scale.call(this,t,i),this.setDrawingImage()},t.typeName="FreehandMarker",t.title="Freehand marker",t.icon='',t}(se),ve=function(e){function t(t,i,r){var n=e.call(this,t,r||'')||this;return n.typeBoxes=[],n.currentType=i,n.setCurrentType=n.setCurrentType.bind(n),n}return j(t,e),t.prototype.getUi=function(){var e=this,t=document.createElement("div");t.style.display="flex",t.style.overflow="hidden",t.style.flexGrow="2";for(var i=function(i){var n="both";switch(i){case 0:n="both";break;case 1:n="start";break;case 2:n="end";break;case 3:n="none"}var s=document.createElement("div");if(s.style.display="flex",s.style.flexGrow="2",s.style.alignItems="center",s.style.justifyContent="space-between",s.style.padding="5px",s.style.borderWidth="2px",s.style.borderStyle="solid",s.style.borderColor=n===r.currentType?r.uiStyleSettings.toolboxAccentColor:"transparent",s.addEventListener("click",(function(){e.setCurrentType(n,s)})),t.appendChild(s),"both"===n||"start"===n){var o=document.createElement("div");o.style.display="flex",o.style.alignItems="center",o.style.minHeight="20px",o.innerHTML='\n \n ',o.style.marginLeft="5px",s.appendChild(o)}var a=document.createElement("div");a.style.display="flex",a.style.alignItems="center",a.style.minHeight="20px",a.style.flexGrow="2";var l=document.createElement("hr");if(l.style.minWidth="20px",l.style.border="0px",l.style.borderTop="3px solid "+(void 0!==r.uiStyleSettings?r.uiStyleSettings.toolboxColor:"#eeeeee"),l.style.flexGrow="2",a.appendChild(l),s.appendChild(a),"both"===n||"end"===n){var c=document.createElement("div");c.style.display="flex",c.style.alignItems="center",c.style.minHeight="20px",c.innerHTML='\n \n ',c.style.marginRight="5px",s.appendChild(c)}r.typeBoxes.push(s)},r=this,n=0;n<4;n++)i(n);return t},t.prototype.setCurrentType=function(e,t){var i=this;this.currentType=e,this.typeBoxes.forEach((function(e){e.style.borderColor=e===t?void 0!==i.uiStyleSettings?i.uiStyleSettings.toolboxAccentColor:"#3080c3":"transparent"})),this.onArrowTypeChanged&&this.onArrowTypeChanged(this.currentType)},t}(J),me=function(e){function t(t,i,r){var n=e.call(this,t,i,r)||this;return n.arrowType="end",n.arrowBaseHeight=10,n.arrowBaseWidth=10,n.getArrowPoints=n.getArrowPoints.bind(n),n.setArrowType=n.setArrowType.bind(n),n.arrowTypePanel=new ve("Arrow type","end"),n.arrowTypePanel.onArrowTypeChanged=n.setArrowType,n}return j(t,e),t.prototype.ownsTarget=function(t){return!(!e.prototype.ownsTarget.call(this,t)&&t!==this.arrow1&&t!==this.arrow2)},t.prototype.getArrowPoints=function(e,t){var i=this.arrowBaseWidth+2*this.strokeWidth,r=this.arrowBaseHeight+2*this.strokeWidth;return e-i/2+","+(t+r/2)+" "+e+","+(t-r/2)+" "+(e+i/2)+","+(t+r/2)},t.prototype.createTips=function(){this.arrow1=W.createPolygon(this.getArrowPoints(this.x1,this.y1),[["fill",this.strokeColor]]),this.arrow1.transform.baseVal.appendItem(W.createTransform()),this.visual.appendChild(this.arrow1),this.arrow2=W.createPolygon(this.getArrowPoints(this.x2,this.y2),[["fill",this.strokeColor]]),this.arrow2.transform.baseVal.appendItem(W.createTransform()),this.visual.appendChild(this.arrow2)},t.prototype.pointerDown=function(t,i){e.prototype.pointerDown.call(this,t,i),"creating"===this.state&&this.createTips()},t.prototype.adjustVisual=function(){if(e.prototype.adjustVisual.call(this),this.arrow1&&this.arrow2&&(this.arrow1.style.display="both"===this.arrowType||"start"===this.arrowType?"":"none",this.arrow2.style.display="both"===this.arrowType||"end"===this.arrowType?"":"none",W.setAttributes(this.arrow1,[["points",this.getArrowPoints(this.x1,this.y1)],["fill",this.strokeColor]]),W.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),i=this.arrow1.transform.baseVal.getItem(0);i.setRotate(t,this.x1,this.y1),this.arrow1.transform.baseVal.replaceItem(i,0);var r=this.arrow2.transform.baseVal.getItem(0);r.setRotate(t+180,this.x2,this.y2),this.arrow2.transform.baseVal.replaceItem(r,0)}},t.prototype.setArrowType=function(e){this.arrowType=e,this.adjustVisual(),this.stateChanged()},Object.defineProperty(t.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel,this.arrowTypePanel]},enumerable:!1,configurable:!0}),t.prototype.getState=function(){var i=Object.assign({arrowType:this.arrowType},e.prototype.getState.call(this));return i.typeName=t.typeName,i},t.prototype.restoreState=function(t){e.prototype.restoreState.call(this,t);var i=t;this.arrowType=i.arrowType,this.createTips(),this.adjustVisual()},t.typeName="ArrowMarker",t.title="Arrow marker",t.icon='',t}(de),ye=function(e){function t(t,i,r){var n=e.call(this,t,i,r)||this;return n.fillColor=r.defaultFillColor,n.strokeWidth=0,n.fillPanel=new ee("Color",r.defaultColorSet,r.defaultFillColor),n.fillPanel.onColorChanged=n.setFillColor,n}return j(t,e),Object.defineProperty(t.prototype,"toolboxPanels",{get:function(){return[this.fillPanel]},enumerable:!1,configurable:!0}),t.prototype.getState=function(){var i=e.prototype.getState.call(this);return i.typeName=t.typeName,i},t.typeName="CoverMarker",t.title="Cover marker",t.icon='',t}(oe),_e=function(e){function t(t,i,r,n){var s=e.call(this,t,n||'')||this;return s.opacities=[],s.opacityBoxes=[],s.opacities=i,s.currentOpacity=r,s.setCurrentOpacity=s.setCurrentOpacity.bind(s),s}return j(t,e),t.prototype.getUi=function(){var e=this,t=document.createElement("div");return t.style.display="flex",t.style.overflow="hidden",t.style.flexGrow="2",t.style.justifyContent="space-between",this.opacities.forEach((function(i){var r=document.createElement("div");r.style.display="flex",r.style.alignItems="center",r.style.justifyContent="center",r.style.padding="5px",r.style.borderWidth="2px",r.style.borderStyle="solid",r.style.borderColor=i===e.currentOpacity?e.uiStyleSettings.toolboxAccentColor:"transparent",r.addEventListener("click",(function(){e.setCurrentOpacity(i,r)})),t.appendChild(r);var n=document.createElement("div");n.innerText=100*i+"%",r.appendChild(n),e.opacityBoxes.push(r)})),t},t.prototype.setCurrentOpacity=function(e,t){var i=this;this.currentOpacity=e,this.opacityBoxes.forEach((function(e){e.style.borderColor=e===t?i.uiStyleSettings.toolboxAccentColor:"transparent"})),this.onOpacityChanged&&this.onOpacityChanged(this.currentOpacity)},t}(J),be=function(e){function t(t,i,r){var n=e.call(this,t,i,r)||this;return n.setOpacity=n.setOpacity.bind(n),n.fillColor=r.defaultHighlightColor,n.strokeWidth=0,n.opacity=r.defaultHighlightOpacity,n.fillPanel=new ee("Color",r.defaultColorSet,n.fillColor),n.fillPanel.onColorChanged=n.setFillColor,n.opacityPanel=new _e("Opacity",r.defaultOpacitySteps,n.opacity),n.opacityPanel.onOpacityChanged=n.setOpacity,n}return j(t,e),t.prototype.setOpacity=function(e){this.opacity=e,this.visual&&W.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(t.prototype,"toolboxPanels",{get:function(){return[this.fillPanel,this.opacityPanel]},enumerable:!1,configurable:!0}),t.prototype.getState=function(){var i=e.prototype.getState.call(this);return i.typeName=t.typeName,i},t.typeName="HighlightMarker",t.title="Highlight marker",t.icon='',t}(ye),Se='',Ce=function(e){function t(t,i,r){var n=e.call(this,t,i,r)||this;return n.bgColor="transparent",n.tipPosition={x:0,y:0},n.tipBase1Position={x:0,y:0},n.tipBase2Position={x:0,y:0},n.tipMoving=!1,n.color=r.defaultStrokeColor,n.bgColor=r.defaultFillColor,n.fontFamily=r.defaultFontFamily,n.defaultSize={x:100,y:30},n.setBgColor=n.setBgColor.bind(n),n.getTipPoints=n.getTipPoints.bind(n),n.positionTip=n.positionTip.bind(n),n.setTipPoints=n.setTipPoints.bind(n),n.colorPanel=new ee("Text color",r.defaultColorSet,n.color,''),n.colorPanel.onColorChanged=n.setColor,n.bgColorPanel=new ee("Fill color",r.defaultColorSet,n.bgColor,Se),n.bgColorPanel.onColorChanged=n.setBgColor,n.fontFamilyPanel=new fe("Font",r.defaultFontFamilies,r.defaultFontFamily),n.fontFamilyPanel.onFontChanged=n.setFont,n.tipGrip=new re,n.tipGrip.visual.transform.baseVal.appendItem(W.createTransform()),n.controlBox.appendChild(n.tipGrip.visual),n}return j(t,e),t.prototype.ownsTarget=function(t){return e.prototype.ownsTarget.call(this,t)||this.tipGrip.ownsTarget(t)||this.tip===t},t.prototype.createTip=function(){W.setAttributes(this.bgRectangle,[["fill",this.bgColor],["rx","10px"]]),this.tip=W.createPolygon(this.getTipPoints(),[["fill",this.bgColor]]),this.visual.appendChild(this.tip)},t.prototype.pointerDown=function(t,i){"new"===this.state&&e.prototype.pointerDown.call(this,t,i),"creating"===this.state?this.createTip():this.tipGrip.ownsTarget(i)?(this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.tipMoving=!0):e.prototype.pointerDown.call(this,t,i)},t.prototype.pointerUp=function(t){if(this.tipMoving)this.tipMoving=!1,this.isMoved=!0,e.prototype.pointerUp.call(this,t);else{var i="creating"===this.state;e.prototype.pointerUp.call(this,t),this.setTipPoints(i),this.positionTip()}},t.prototype.manipulate=function(t){if(this.tipMoving){var i=this.unrotatePoint(t);this.tipPosition={x:i.x-this.manipulationStartLeft,y:i.y-this.manipulationStartTop},this.positionTip()}else e.prototype.manipulate.call(this,t)},t.prototype.setBgColor=function(e){this.bgRectangle&&this.tip&&(W.setAttributes(this.bgRectangle,[["fill",e]]),W.setAttributes(this.tip,[["fill",e]])),this.bgColor=e,this.fillColorChanged(e)},t.prototype.getTipPoints=function(){return this.setTipPoints("creating"===this.state),this.tipBase1Position.x+","+this.tipBase1Position.y+" "+this.tipBase2Position.x+","+this.tipBase2Position.y+" "+this.tipPosition.x+","+this.tipPosition.y},t.prototype.setTipPoints=function(e){void 0===e&&(e=!1);var t=Math.min(this.height/2,15),i=this.height/5;e&&(this.tipPosition={x:t+i/2,y:this.height+20});var r=Math.atan(this.height/2/(this.width/2));this.tipPosition.x=this.width/2&&this.tipPosition.y=this.width/2&&this.tipPosition.y>=this.height/2?r.1)){var t=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),i=this.tip1.transform.baseVal.getItem(0);i.setRotate(t,this.x1,this.y1),this.tip1.transform.baseVal.replaceItem(i,0);var r=this.tip2.transform.baseVal.getItem(0);r.setRotate(t+180,this.x2,this.y2),this.tip2.transform.baseVal.replaceItem(r,0)}},Object.defineProperty(t.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),t.prototype.getState=function(){var i=e.prototype.getState.call(this);return i.typeName=t.typeName,i},t.prototype.restoreState=function(t){e.prototype.restoreState.call(this,t),this.createTips(),this.adjustVisual()},t.typeName="MeasurementMarker",t.title="Measurement marker",t.icon='',t}(de),xe=function(e){function t(t,i,r){var n=e.call(this,t,i,r)||this;return n.strokePanel.colors=r.defaultColorSet,n.fillColor="transparent",n}return j(t,e),Object.defineProperty(t.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),t.prototype.getState=function(){var i=e.prototype.getState.call(this);return i.typeName=t.typeName,i},t.typeName="EllipseFrameMarker",t.title="Ellipse frame marker",t.icon='',t}(we),Ee=function(){function e(){this.undoStack=[],this.redoStack=[]}return Object.defineProperty(e.prototype,"isUndoPossible",{get:function(){return this.undoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isRedoPossible",{get:function(){return this.redoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"undoStepCount",{get:function(){return this.undoStack.length},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"redoStepCount",{get:function(){return this.redoStack.length},enumerable:!1,configurable:!0}),e.prototype.addUndoStep=function(e){0!==this.undoStack.length&&JSON.stringify(this.undoStack[this.undoStack.length-1])===JSON.stringify(e)||(this.undoStack.push(e),JSON.stringify(this.lastRedoStep)!==JSON.stringify(e)&&this.redoStack.splice(0,this.redoStack.length))},e.prototype.replaceLastUndoStep=function(e){this.undoStack.length>0&&(this.undoStack[this.undoStack.length-1]=e)},e.prototype.getLastUndoStep=function(){return this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0},e.prototype.undo=function(){if(this.undoStack.length>1){var e=this.undoStack.pop();return void 0!==e&&this.redoStack.push(e),this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0}},e.prototype.redo=function(){return this.lastRedoStep=this.redoStack.pop(),this.lastRedoStep},e}(),Te=function(e){function t(t,i,r){var n=e.call(this,t,i,r)||this;return n.strokeColor="transparent",n.strokeWidth=0,n.strokeDasharray="",n.curveX=0,n.curveY=0,n.manipulationStartCurveX=0,n.manipulationStartCurveY=0,n.setStrokeColor=n.setStrokeColor.bind(n),n.setStrokeWidth=n.setStrokeWidth.bind(n),n.setStrokeDasharray=n.setStrokeDasharray.bind(n),n.positionGrips=n.positionGrips.bind(n),n.addControlGrips=n.addControlGrips.bind(n),n.adjustVisual=n.adjustVisual.bind(n),n.setupControlBox=n.setupControlBox.bind(n),n.resize=n.resize.bind(n),n.strokeColor=r.defaultColor,n.strokeWidth=r.defaultStrokeWidth,n.strokeDasharray=r.defaultStrokeDasharray,n.strokePanel=new ee("Line color",r.defaultColorSet,r.defaultColor),n.strokePanel.onColorChanged=n.setStrokeColor,n.strokeWidthPanel=new ae("Line width",r.defaultStrokeWidths,r.defaultStrokeWidth),n.strokeWidthPanel.onWidthChanged=n.setStrokeWidth,n.strokeStylePanel=new le("Line style",r.defaultStrokeDasharrays,r.defaultStrokeDasharray),n.strokeStylePanel.onStyleChanged=n.setStrokeDasharray,n}return j(t,e),t.prototype.ownsTarget=function(t){return!(!e.prototype.ownsTarget.call(this,t)&&t!==this.visual&&t!==this.selectorCurve&&t!==this.visibleCurve&&!this.curveGrip.ownsTarget(t))},t.prototype.getPathD=function(){return"M "+this.x1+" "+this.y1+" Q "+this.curveX+" "+this.curveY+", "+this.x2+" "+this.y2},t.prototype.createVisual=function(){this.visual=W.createGroup(),this.selectorCurve=W.createPath(this.getPathD(),[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()],["fill","transparent"]]),this.visibleCurve=W.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)},t.prototype.pointerDown=function(t,i){e.prototype.pointerDown.call(this,t,i),this.manipulationStartCurveX=this.curveX,this.manipulationStartCurveY=this.curveY,"new"===this.state&&(this.curveX=t.x,this.curveY=t.y),"new"===this.state?(this.createVisual(),this.adjustVisual(),this._state="creating"):this.curveGrip.ownsTarget(i)&&(this.activeGrip=this.curveGrip,this._state="resize")},t.prototype.adjustVisual=function(){this.selectorCurve&&this.visibleCurve&&(this.selectorCurve.setAttribute("d",this.getPathD()),this.visibleCurve.setAttribute("d",this.getPathD()),W.setAttributes(this.visibleCurve,[["stroke",this.strokeColor]]),W.setAttributes(this.visibleCurve,[["stroke-width",this.strokeWidth.toString()]]),W.setAttributes(this.visibleCurve,[["stroke-dasharray",this.strokeDasharray.toString()]]))},t.prototype.setupControlBox=function(){e.prototype.setupControlBox.call(this),this.curveControlLine1=W.createLine(this.x1,this.y1,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.curveControlLine2=W.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)},t.prototype.addControlGrips=function(){this.curveGrip=this.createGrip(),this.curveX=0,this.curveY=0,e.prototype.addControlGrips.call(this)},t.prototype.positionGrips=function(){e.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()))},t.prototype.manipulate=function(t){"move"===this.state&&(this.curveX=this.manipulationStartCurveX+t.x-this.manipulationStartX,this.curveY=this.manipulationStartCurveY+t.y-this.manipulationStartY),e.prototype.manipulate.call(this,t)},t.prototype.resize=function(t){this.activeGrip===this.curveGrip&&(this.curveX=t.x,this.curveY=t.y),e.prototype.resize.call(this,t),"creating"===this.state&&(this.curveX=this.x1+(this.x2-this.x1)/2,this.curveY=this.y1+(this.y2-this.y1)/2)},t.prototype.setStrokeColor=function(e){this.strokeColor=e,this.adjustVisual(),this.colorChanged(e)},t.prototype.setStrokeWidth=function(e){this.strokeWidth=e,this.adjustVisual()},t.prototype.setStrokeDasharray=function(e){this.strokeDasharray=e,this.adjustVisual()},t.prototype.scale=function(t,i){this.curveX=this.curveX*t,this.curveY=this.curveY*i,e.prototype.scale.call(this,t,i)},Object.defineProperty(t.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),t.prototype.getState=function(){var i=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,curveX:this.curveX,curveY:this.curveY},e.prototype.getState.call(this));return i.typeName=t.typeName,i},t.prototype.restoreState=function(t){e.prototype.restoreState.call(this,t);var i=t;this.strokeColor=i.strokeColor,this.strokeWidth=i.strokeWidth,this.strokeDasharray=i.strokeDasharray,this.curveX=i.curveX,this.curveY=i.curveY,this.createVisual(),this.adjustVisual()},t.typeName="CurveMarker",t.title="Curve marker",t.icon='',t}(he),Le=function(){function e(e,t){void 0===t&&(t=!1),this.cancelable=!1,this._defaultPrevented=!1,this.markerArea=e,this.cancelable=t}return Object.defineProperty(e.prototype,"defaultPrevented",{get:function(){return this._defaultPrevented},enumerable:!1,configurable:!0}),e.prototype.preventDefault=function(){this._defaultPrevented=!0},e}(),Ae=function(e){function t(t,i,r){var n=e.call(this,t,!1)||this;return n.dataUrl=i,n.state=r,n}return j(t,e),t}(Le),Re=function(e){function t(t,i,r){void 0===r&&(r=!1);var n=e.call(this,t,r)||this;return n.marker=i,n}return j(t,e),t}(Le),De=function(){function e(){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 e.prototype.addEventListener=function(e,t){this[e].push(t)},e.prototype.removeEventListener=function(e,t){var i=this[e].indexOf(t);i>-1&&this[e].splice(i,1)},e}(),Oe=function(){function e(t){this.touchPoints=0,this._availableMarkerTypes=this.DEFAULT_MARKER_TYPES,this.mode="select",this.markers=[],this.isDragging=!1,this.renderEventListeners=[],this.closeEventListeners=[],this.settings=new ue,this._isOpen=!1,this.undoRedoManager=new Ee,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 De,this._silentRenderMode=!1,this._isFocused=!1,this._instanceNo=e.instanceCounter++,this.styles=new q(this.instanceNo),this.uiStyleSettings=this.styles.settings,this.target=t,this.targetRoot=document.body,this.width=t.clientWidth,this.height=t.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(e.prototype,"ALL_MARKER_TYPES",{get:function(){return[ce,ge,me,pe,xe,we,be,Ce,ke,ye,de,Te]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"DEFAULT_MARKER_TYPES",{get:function(){return[ce,ge,me,pe,we,be,Ce]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"BASIC_MARKER_TYPES",{get:function(){return[ce,ge,me,pe,be]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"availableMarkerTypes",{get:function(){return this._availableMarkerTypes},set:function(e){var t=this;this._availableMarkerTypes.splice(0),e.forEach((function(e){if("string"==typeof e){var i=t.ALL_MARKER_TYPES.find((function(t){return t.typeName===e}));void 0!==i&&t._availableMarkerTypes.push(i)}else t._availableMarkerTypes.push(e)}))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentMarker",{get:function(){return this._currentMarker},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isUndoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isUndoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isRedoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isRedoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"zoomLevel",{get:function(){return this._zoomLevel},set:function(e){this._zoomLevel=e,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(e.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),e.prototype.open=function(){this.setupResizeObserver(),this.setEditingTarget(),this.setTopLeft(),this.initMarkerCanvas(),this.initOverlay(),this.attachEvents(),"popup"===this.settings.displayMode&&this.onPopupTargetResize(),z.isLicensed||this.addLogo(),this._isOpen=!0,this._isFocused=!0},e.prototype.show=function(){var e=this;void 0===this.styles.styleSheetRoot&&void 0!==V.styleSheetRoot&&(this.styles.styleSheetRoot=V.styleSheetRoot),this.setWindowHeight(),this.showUI(),this.open(),this.eventListeners.show.forEach((function(t){return t(new Le(e))}))},e.prototype.render=function(){return U(this,void 0,void 0,(function(){var e;return K(this,(function(t){switch(t.label){case 0:return this.setCurrentMarker(),(e=new G).naturalSize=this.renderAtNaturalSize,e.imageType=this.renderImageType,e.imageQuality=this.renderImageQuality,e.markersOnly=this.renderMarkersOnly,e.width=this.renderWidth,e.height=this.renderHeight,[4,e.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 1:return t.sent(),[4,e.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 2:return[2,t.sent()]}}))}))},e.prototype.close=function(e){var t=this;if(void 0===e&&(e=!1),this.isOpen){var i=!1;e||this.eventListeners.beforeclose.forEach((function(e){var r=new Le(t,!0);e(r),r.defaultPrevented&&(i=!0)})),i||(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),"popup"===this.settings.displayMode&&window.removeEventListener("resize",this.setWindowHeight),this.eventListeners.close.forEach((function(e){return e(new Le(t))})),this.detachEvents(),this._isOpen=!1)}},e.prototype.addMarkersToToolbar=function(){for(var e,t=[],i=0;ithis.editorCanvas.clientHeight?this.editorCanvas.clientHeight*e:this.editorCanvas.clientWidth,i=t',e.title="Powered by marker.js",e.style.display="grid",e.style.alignItems="center",e.style.justifyItems="center",e.style.padding="3px",e.style.width="20px",e.style.height="20px",this.logoUI.appendChild(e),this.editorCanvas.appendChild(this.logoUI),this.logoUI.style.position="absolute",this.logoUI.style.pointerEvents="all",this.positionLogo()},e.prototype.positionLogo=function(){this.logoUI&&("right"!==this.uiStyleSettings.logoPosition?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")},e.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"},e.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},e.prototype.showUI=function(){switch("popup"===this.settings.displayMode&&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 e=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=e+"px",this.coverDiv.style.left=this.target.offsetLeft.toString()+"px",this.coverDiv.style.width=this.target.offsetWidth.toString()+"px",this.coverDiv.style.zIndex=void 0!==this.uiStyleSettings.zIndex?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=void 0!==this.uiStyleSettings.zIndex?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="popup"===this.settings.displayMode?this.settings.popupMargin+"px":"0px",this.uiDiv.style.border="0px",this.coverDiv.appendChild(this.uiDiv),this.toolbar=new Z(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","popup"===this.settings.displayMode&&(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","popup"===this.settings.displayMode&&(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-1&&this.markers.splice(this.markers.indexOf(e),1),e.dispose()},e.prototype.switchToSelectMode=function(){this.mode="select",this.hideNotesEditor(),void 0!==this._currentMarker&&("new"!==this._currentMarker.state?this._currentMarker.select():(this.removeMarker(this._currentMarker),this.setCurrentMarker(),this.markerImage.style.cursor="default"),this.addUndoStep())},e.prototype.toolbarButtonClicked=function(e,t){if("marker"===e&&void 0!==t)this.createNewMarker(t);else if("action"===e)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":void 0===this.notesArea?(this.switchToSelectMode(),this.zoomLevel=1,this.showNotesEditor()):this.switchToSelectMode();break;case"close":this.close();break;case"render":this.switchToSelectMode(),this.startRenderAndClose()}},e.prototype.deleteSelectedMarker=function(){var e=this;if(void 0!==this._currentMarker){var t=!1;if(this.eventListeners.markerbeforedelete.forEach((function(i){var r=new Re(e,e._currentMarker,!0);i(r),r.defaultPrevented&&(t=!0)})),!t){var i=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(t){return t(new Re(e,i))}))}}},e.prototype.clear=function(){var e=this,t=!1;if(this.markers.length>0&&(this.eventListeners.markerbeforedelete.forEach((function(i){var r=new Re(e,void 0,!0);i(r),r.defaultPrevented&&(t=!0)})),!t)){this.setCurrentMarker();for(var i=function(t){var i=r.markers[t];r.setCurrentMarker(r.markers[t]),r._currentMarker.dispose(),r.markerImage.removeChild(r._currentMarker.container),r.markers.splice(r.markers.indexOf(r._currentMarker),1),r.eventListeners.markerdelete.forEach((function(t){return t(new Re(e,i))}))},r=this,n=this.markers.length-1;n>=0;n--)i(n);this.addUndoStep()}},Object.defineProperty(e.prototype,"isNotesAreaOpen",{get:function(){return void 0!==this.notesArea},enumerable:!1,configurable:!0}),e.prototype.showNotesEditor=function(){var e;void 0!==this._currentMarker&&(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=null!==(e=this._currentMarker.notes)&&void 0!==e?e:"",this.overlayContainer.appendChild(this.notesArea))},e.prototype.hideNotesEditor=function(){this.isNotesAreaOpen&&(void 0!==this._currentMarker&&(this._currentMarker.notes=""!==this.notesArea.value.trim()?this.notesArea.value:void 0),this.overlayContainer.removeChild(this.notesArea),this.notesArea=void 0)},e.prototype.selectLastMarker=function(){this.markers.length>0?this.setCurrentMarker(this.markers[this.markers.length-1]):this.setCurrentMarker()},e.prototype.addUndoStep=function(){var e=this;if(void 0===this._currentMarker||"edit"!==this._currentMarker.state){var t=this.getState(),i=this.undoRedoManager.getLastUndoStep();if(!i||i.width===t.width&&i.height===t.height){var r=this.undoRedoManager.undoStepCount;this.undoRedoManager.addUndoStep(t),r1&&this.panTo({x:e.clientX,y:e.clientY}))},e.prototype.onPointerUp=function(e){this.touchPoints>0&&this.touchPoints--,0===this.touchPoints&&this.isDragging&&void 0!==this._currentMarker&&this._currentMarker.pointerUp(this.clientToLocalCoordinates(e.clientX,e.clientY)),this.isDragging=!1,this.addUndoStep()},e.prototype.onPointerOut=function(){this.touchPoints>0&&this.touchPoints--},e.prototype.onKeyUp=function(e){void 0===this._currentMarker||void 0!==this.notesArea||"Delete"!==e.key&&"Backspace"!==e.key||this.deleteSelectedMarker()},e.prototype.clientToLocalCoordinates=function(e,t){var i=this.markerImage.getBoundingClientRect();return{x:(e-i.left)/this.zoomLevel,y:(t-i.top)/this.zoomLevel}},e.prototype.onWindowResize=function(){this.positionUI()},e.prototype.positionUI=function(){switch(this.setTopLeft(),this.settings.displayMode){case"inline":var e=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=e+"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()},e.prototype.addLicenseKey=function(e){z.addKey(e)},e.prototype.addEventListener=function(e,t){this.eventListeners.addEventListener(e,t)},e.prototype.removeEventListener=function(e,t){this.eventListeners.removeEventListener(e,t)},e.prototype.renderState=function(e){this._silentRenderMode=!0,this.settings.displayMode="inline",this.isOpen||this.show(),this.restoreState(e),this.startRenderAndClose(),this._silentRenderMode=!1},Object.defineProperty(e.prototype,"isFocused",{get:function(){return this._isFocused},enumerable:!1,configurable:!0}),e.prototype.focus=function(){var e=this;this._isFocused||(this.attachWindowEvents(),this._isFocused=!0,void 0!==this._previousCurrentMarker&&this.setCurrentMarker(this._previousCurrentMarker),this.eventListeners.focus.forEach((function(t){return t(new Le(e))})))},e.prototype.blur=function(){var e=this;this._isFocused&&(this.detachWindowEvents(),this._isFocused=!1,this._previousCurrentMarker=this._currentMarker,this.setCurrentMarker(),this.eventListeners.blur.forEach((function(t){return t(new Le(e))})))},e.instanceCounter=0,e}(),Me=function(e,t){return(Me=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])})(e,t)}; /* ********************************** 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. ***************************************************************************** */function Ie(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function i(){this.constructor=e}Me(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}function Pe(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))}function Fe(e,t){var i,r,n,s,o={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(s){return function(a){return function(s){if(i)throw new TypeError("Generator is already executing.");for(;o;)try{if(i=1,r&&(n=2&s[0]?r.return:s[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,s[1])).done)return n;switch(r=0,n&&(s=[2&s[0],n.value]),s[0]){case 0:case 1:n=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((n=(n=o.trys).length>0&&n[n.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!n||s[1]>n[0]&&s[1]0&&t>0){var i=new Ve(e,t),r=i.ratio>=1?20:i.getHorizontalLength(20),n=i.ratio<1?20:i.getVerticalLength(20),s=document.createElementNS("http://www.w3.org/2000/svg","svg");s.setAttribute("xmlns","http://www.w3.org/2000/svg"),s.setAttribute("viewBox","0 0 24 24"),document.body.appendChild(s);var o=Ne.createDefs();s.appendChild(o);var a=Ne.createElement("clipPath",[["id","text-bg-clip"]]);o.appendChild(a);var l=Ne.createPath(Ne.getHollowRectanglePath((24-r)/2,(24-n)/2,r,n,(24-r)/2+2,(24-n)/2+2,r-4,n-4));s.appendChild(l);var c=Ne.createText([["x","0"],["y","0"],["font-size","7px"],["font-family","monospace"]]);c.appendChild(Ne.createTSpan(e+":"+t)),s.appendChild(c);var u=c.getBBox();Ne.setAttributes(c,[["x",((24-u.width)/2).toString()],["y",((24-u.height)/2-u.y).toString()]]);var h=Ne.createPath(Ne.getHollowRectanglePath(0,0,24,24,(24-Math.ceil(u.width))/2,(24-Math.ceil(u.height))/2,Math.ceil(u.width),Math.ceil(u.height)));return a.appendChild(h),Ne.setAttributes(l,[["clip-path","url(#text-bg-clip)"]]),document.body.removeChild(s),s.outerHTML}return''},e}(),Qe=function(e){function t(t,i,r){var n=e.call(this,t,i)||this;return n.isDropdownOpen=!1,n.onClick=n.dropdownButtonClicked,n.dropdownButtons=r,n}return Ie(t,e),t.prototype.setupDropdown=function(){var e=this;this.dropdownBlock=document.createElement("div"),this.dropdownBlock.className=this.dropdownClassName+" "+this.dropdownColorsClassName,this.dropdownBlock.style.display="none",this.dropdownButtons.forEach((function(t){t.className=e.className,t.colorsClassName=e.colorsClassName,e.dropdownBlock.appendChild(t.getUI())})),this.uiContainer.appendChild(this.dropdownBlock)},t.prototype.positionDropdown=function(){this.dropdownBlock.style.left=this.uiContainer.clientLeft+"px",this.dropdownBlock.style.top=this.uiContainer.clientTop+this.uiContainer.clientHeight+"px"},t.prototype.dropdownButtonClicked=function(){void 0===this.dropdownBlock&&this.setupDropdown(),this.isDropdownOpen=!this.isDropdownOpen,this.toggleDropdown()},t.prototype.toggleDropdown=function(){this.positionDropdown(),this.dropdownBlock.style.display=this.isDropdownOpen?"inline-block":"none"},t.prototype.showDropdown=function(){this.isDropdownOpen=!0,this.toggleDropdown()},t.prototype.hideDropdown=function(){this.isDropdownOpen=!1,this.toggleDropdown()},t}(ze),Ye=function(){function e(e,t){this.GRIP_SIZE=10,this.color=e,this.fillColor=t,this.visual=Ne.createGroup(),this.visual.appendChild(Ne.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(Ne.createCircle(this.GRIP_SIZE,[["fill",this.fillColor],["fill-opacity","0.9"],["stroke",this.color],["stroke-width","2"],["stroke-opacity","0.7"]]))}return e.prototype.ownsTarget=function(e){return e===this.visual||e===this.visual.childNodes[0]||e===this.visual.childNodes[1]},e.prototype.setCenter=function(e,t){this.visual.childNodes.forEach((function(i){return Ne.setAttributes(i,[["cx",e.toString()],["cy",t.toString()]])}))},e}(),Ze=function(){function e(e,t,i,r){this.isMoving=!1,this._isGridVisible=!0,this.numberOfGridLines=2,this.horizontalGridLines=[],this.verticalGridLines=[],this._zoomFactor=1,this.cropRectChanged=!1,this.canvasWidth=e,this.canvasHeight=t,this.margin=i,this.container=r,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(e.prototype,"aspectRatio",{get:function(){return this._aspectRatio},set:function(e){this._aspectRatio=e,this.adjustCropRect(),this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(e){this._isGridVisible=e,this.gridContainer&&Ne.setAttributes(this.gridContainer,[["display",this._isGridVisible?"":"none"]])},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"zoomFactor",{get:function(){return this._zoomFactor},set:function(e){this._zoomFactor=e,this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),e.prototype.open=function(){var e=this;this.cropShadeElement=Ne.createPath("M0,0Z",[["fill",this.cropShadeColor],["fill-opacity","0.8"]]),this.container.appendChild(this.cropShadeElement),this.gridContainer=Ne.createGroup([["display",this.isGridVisible?"":"none"]]),this.container.appendChild(this.gridContainer);for(var t=0;tthis.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasHeight/2-t.height/2),Ne.setAttributes(this.cropRectElement,[["x",t.x.toString()],["y",t.y.toString()],["width",t.width.toString()],["height",t.height.toString()]]);var i=t.height/(this.numberOfGridLines+1);this.horizontalGridLines.forEach((function(e,r){var n=t.y+i*(r+1);Ne.setAttributes(e,[["x1",""+t.x],["y1",""+n],["x2",""+(t.x+t.width)],["y2",""+n]])}));var r=t.width/(this.numberOfGridLines+1);this.verticalGridLines.forEach((function(e,i){var n=t.x+r*(i+1);Ne.setAttributes(e,[["x1",""+n],["y1",""+t.y],["x2",""+n],["y2",""+(t.y+t.height)]])})),Ne.setAttributes(this.cropShadeElement,[["d",Ne.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},e.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)},e.prototype.clientToLocalCoordinates=function(e,t){var i=this.container.getBoundingClientRect();return{x:e-i.left+this.margin,y:t-i.top+this.margin}},e.prototype.onPointerDown=function(e){this.container.setPointerCapture(e.pointerId),this.previousPoint=this.clientToLocalCoordinates(e.clientX,e.clientY),this.cropRectElement===e.target?this.isMoving=!0:this.topLeftGrip.ownsTarget(e.target)?this.activeGrip=this.topLeftGrip:this.bottomLeftGrip.ownsTarget(e.target)?this.activeGrip=this.bottomLeftGrip:this.topRightGrip.ownsTarget(e.target)?this.activeGrip=this.topRightGrip:this.bottomRightGrip.ownsTarget(e.target)&&(this.activeGrip=this.bottomRightGrip)},e.prototype.onPointerMove=function(e){if(this.isMoving)this.move(this.clientToLocalCoordinates(e.clientX,e.clientY));else if(this.activeGrip){var t=this.clientToLocalCoordinates(e.clientX,e.clientY);this.resize(t)}e.preventDefault()},e.prototype.onPointerUp=function(e){this.activeGrip=void 0,this.isMoving=!1,this.container.releasePointerCapture(e.pointerId)},e.prototype.move=function(e){var t=e.x-this.previousPoint.x,i=e.y-this.previousPoint.y;1!==this.zoomFactor&&(t=-t/this.zoomFactor,i=-i/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+i),this.canvasHeight-this.cropRect.height+this.margin),this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect),this.previousPoint=e},e.prototype.resize=function(e){var t=Object.assign({},this.cropRect),i=e.x-this.previousPoint.x,r=e.y-this.previousPoint.y;switch(this.activeGrip){case this.bottomLeftGrip:case this.topLeftGrip:t.x+ithis.canvasWidth*this.zoomFactor&&(i=this.canvasWidth*this.zoomFactor-t.width),t.width+=i}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(i),t.height=this.aspectRatio.getVerticalLength(t.width)):(t.y+=r,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+=r}t.width<10&&(t.x=this.cropRect.x,t.width=10),t.height<10&&(t.y=this.cropRect.y,t.height=10),this.previousPoint=e,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))},e.prototype.adjustCropRect=function(){if(this.aspectRatio&&Math.round(this.cropRect.height)!==Math.round(this.aspectRatio.getVerticalLength(this.cropRect.width))){var e=this.cropRect.x+this.cropRect.width/2,t=this.cropRect.y+this.cropRect.height/2,i=this.aspectRatio.getHorizontalLength(this.cropRect.height),r=this.aspectRatio.getVerticalLength(this.cropRect.width);i/this.canvasWidththis.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=e-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)}},e.prototype.getRescaledRect=function(e,t,i,r,n,s){var o=i/e,a=r/t;return{x:(n.x-s)*o+s,y:(n.y-s)*a+s,width:n.width*o,height:n.height*a}},e.prototype.scaleCanvas=function(e,t){var i=this.getRescaledRect(this.canvasWidth,this.canvasHeight,e,t,this.cropRect,this.margin);this.canvasWidth=e,this.canvasHeight=t,this.onCropChange&&this.onCropChange(i),this.setCropRectangle(i)},e}(),$e=function(){function e(e){this._angle=0,this.isDragging=!1,this.width=401,this.height=24,this.title=e,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(e.prototype,"angle",{get:function(){return this._angle},set:function(e){this._angle=e,this.setAngleLabel(),this.positionScaleShape()},enumerable:!1,configurable:!0}),e.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},e.prototype.onPointerDown=function(e){this.controlContainer.setPointerCapture(e.pointerId),this.isDragging=!0,this.previousPoint={x:e.clientX,y:e.clientY}},e.prototype.onPointerMove=function(e){this.isDragging&&(this.onAngleChange&&this.onAngleChange((e.clientX-this.previousPoint.x)/5),this.previousPoint.x=e.clientX)},e.prototype.onPointerUp=function(e){this.isDragging&&this.onAngleChange&&this.onAngleChange((e.clientX-this.previousPoint.x)/5),this.isDragging=!1,this.controlContainer.releasePointerCapture(e.pointerId)},e.prototype.setAngleLabel=function(){if(this.angleLabelText){this.angleLabelText.innerHTML=""+Math.round(this._angle);var e=this.angleLabelText.getBBox();Ne.setAttributes(this.angleLabelElement,[["x",((this.width-e.width)/2).toString()],["y",(this.height/2).toString()]])}},e.prototype.positionScaleShape=function(){if(this.scaleShape){var e=this.scaleShape.transform.baseVal.getItem(0);e.setTranslate(this._angle%5*5-25,0),this.scaleShape.transform.baseVal.replaceItem(e,0)}},e.prototype.getVisual=function(){var e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("xmlns","http://www.w3.org/2000/svg"),e.setAttribute("width",this.width+"px"),e.setAttribute("height",this.height+"px"),e.setAttribute("viewBox","0 0 "+this.width+" "+this.height),e.style.flexShrink="0",document.body.appendChild(e);for(var t="M0,"+(this.height-1)+" v"+-this.height/3+"h1v"+this.height/3,i=1;i<=this.width/5+10;i++){var r=i%5==0?this.height/3:this.height/6;t+="h4v"+-r+"h1v"+r}t+="v1H0Z",this.scaleShape=Ne.createPath(t);var n=Ne.createTransform();this.scaleShape.transform.baseVal.appendItem(n),e.appendChild(this.scaleShape),this.angleLabelElement=Ne.createText([["x","0"],["y","0"],["font-size","10px"],["font-family","monospace"]]),this.angleLabelText=Ne.createTSpan(""),this.angleLabelElement.appendChild(this.angleLabelText);var s=Ne.createTSpan("");return s.innerHTML="°",this.angleLabelElement.appendChild(s),e.appendChild(this.angleLabelElement),document.body.removeChild(e),e},e}(),Je=function(){function e(){this.naturalSize=!1,this.imageType="image/png"}return e.prototype.rasterize=function(e,t,i,r,n,s,o){var a=this;return new Promise((function(l){var c=document.createElement("canvas");c.width=e.width.baseVal.value-2*r,c.height=e.height.baseVal.value-2*r;var u=1,h=1;!0===a.naturalSize?(u=t.naturalWidth/(e.width.baseVal.value-2*r)/s,h=t.naturalHeight/(e.height.baseVal.value-2*r)/o,c.width=t.naturalWidth/s,c.height=t.naturalHeight/o):void 0!==a.width&&void 0!==a.height&&(u=a.width/i.width,h=a.height/i.height,c.width*=u,c.height*=h);var d=c.getContext("2d");d.translate(c.width/2,c.height/2),d.rotate(n*Math.PI/180),d.scale(s,o),d.translate(-c.width/2,-c.height/2),d.drawImage(t,0,0,c.width,c.height);var f=document.createElement("canvas");f.width=i.width*u,f.height=i.height*h,f.getContext("2d").putImageData(d.getImageData((i.x-r)*u,(i.y-r)*h,i.width*u,i.height*h),0,0),l(f.toDataURL(a.imageType,a.imageQuality))}))},e}(),et=function(){function e(t){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=e.instanceCounter++,this.styles=new He(this.instanceNo),this.target=t,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(e.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"zoomToCropEnabled",{get:function(){return this._zoomToCropEnabled},set:function(e){this._zoomToCropEnabled=e,e?this.zoomToCrop():this.unzoomFromCrop()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(e){this._isGridVisible=e,this.cropLayer&&(this.cropLayer.isGridVisible=this._isGridVisible)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"gridLines",{get:function(){return this._gridLines},set:function(e){this._gridLines=e,this.cropLayer&&(this.cropLayer.numberOfGridLines=this._gridLines)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rotationAngle",{get:function(){return this._rotationAngle},set:function(e){this._rotationAngle=e,this.straightener&&(this.straightener.angle=this._rotationAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"paddedImageWidth",{get:function(){return this.imageWidth+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"paddedImageHeight",{get:function(){return this.imageHeight+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"aspectRatio",{get:function(){var e;return null!==(e=this._aspectRatio)&&void 0!==e?e:this.aspectRatios[0]},set:function(e){this._aspectRatio=e},enumerable:!1,configurable:!0}),e.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(),"popup"===this.displayMode&&this.onPopupResize(),this._isOpen=!0},e.prototype.show=function(){this.showUI(),this.open()},e.prototype.close=function(e){void 0===e&&(e=!1),this.isOpen&&(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),"popup"===this.displayMode&&window.removeEventListener("resize",this.setWindowHeight),e||this.closeEventListeners.forEach((function(e){return e()})),this._isOpen=!1)},e.prototype.addRenderEventListener=function(e){this.renderEventListeners.push(e)},e.prototype.removeRenderEventListener=function(e){this.renderEventListeners.indexOf(e)>-1&&this.renderEventListeners.splice(this.renderEventListeners.indexOf(e),1)},e.prototype.addCloseEventListener=function(e){this.closeEventListeners.push(e)},e.prototype.removeCloseEventListener=function(e){this.closeEventListeners.indexOf(e)>-1&&this.closeEventListeners.splice(this.closeEventListeners.indexOf(e),1)},e.prototype.setupResizeObserver=function(){var e=this;"inline"===this.displayMode?window.ResizeObserver&&(this.targetObserver=new ResizeObserver((function(){e.resize(e.target.clientWidth,e.target.clientHeight)})),this.targetObserver.observe(this.target)):"popup"===this.displayMode&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(this.onPopupResize),this.targetObserver.observe(this.contentDiv)),window.addEventListener("resize",this.setWindowHeight))},e.prototype.onPopupResize=function(){if(this.contentDiv.clientWidth>0&&this.contentDiv.clientHeight>0){var e=1*this.target.clientWidth/this.target.clientHeight,t=this.contentDiv.clientWidth/e>this.contentDiv.clientHeight?(this.contentDiv.clientHeight-2*this.CANVAS_MARGIN)*e:this.contentDiv.clientWidth-2*this.CANVAS_MARGIN,i=t+2*this.CANVAS_MARGINe+this.CANVAS_MARGIN?this.target.offsetTop-(e+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=void 0!==this.styles.settings.zIndex?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=void 0!==this.styles.settings.zIndex?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="popup"===this.displayMode?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,"popup"===this.displayMode&&(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","popup"===this.displayMode&&(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},e.prototype.addToolbars=function(){this.addTopToolbar(),this.addBottomToolbar()},e.prototype.addTopToolbar=function(){var e=this;this.topToolbar=new Ke,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 We;t.minWidth=3*this.toolbarHeight+"px",this.topToolbar.addButtonBlock(t);var i=[];this.aspectRatios.forEach((function(t){var r=new ze(qe.getIcon(t.horizontal,t.vertical),0===t.horizontal&&0===t.vertical?"FREE":t.horizontal+":"+t.vertical);r.onClick=function(){return e.ratioButtonClicked(t)},i.push(r)})),this.aspectRatioButton=new Qe(qe.getIcon(0,0),"Aspect ratio",i),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 r=new ze('',"Toggle grid");r.isActive=this.isGridVisible,r.onClick=function(){e.isGridVisible=!e.isGridVisible,r.isActive=e.isGridVisible},t.addButton(r);var n=new ze('',"Zoom to selection");if(n.isActive=this.zoomToCropEnabled,n.onClick=function(){e.zoomToCropEnabled=!e.zoomToCropEnabled,n.isActive=e.zoomToCropEnabled},t.addButton(n),!Be.isLicensed){var s=new Ge;this.topToolbar.addElementBlock(s);var o=document.createElement("div");o.className=this.topToolbar.buttonClassName+" "+this.topToolbar.buttonColorsClassName;var a=document.createElement("a");a.style.color="currentColor",a.href="https://markerjs.com/products/cropro",a.target="_blank",a.innerHTML='',o.appendChild(a),s.addElement(o)}var l=new We;l.minWidth=3*this.toolbarHeight+"px",l.contentAlign="end",this.topToolbar.addButtonBlock(l);var c=new ze('',"OK");c.onClick=this.startRenderAndClose,l.addButton(c),this.styles.settings.toolbarOkButtonStyleColorsClassName&&(c.colorsClassName=this.styles.settings.toolbarOkButtonStyleColorsClassName);var u=new ze('',"Close");u.onClick=this.close,l.addButton(u),this.styles.settings.toolbarCloseButtonStyleColorsClassName&&(u.colorsClassName=this.styles.settings.toolbarCloseButtonStyleColorsClassName)},e.prototype.addBottomToolbar=function(){var e=this;this.bottomToolbar=new Ke,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 We;t.minWidth=2*this.toolbarHeight+"px",this.bottomToolbar.addButtonBlock(t);var i=new ze('',"Rotate left");i.onClick=this.rotateLeftButtonClicked,t.addButton(i);var r=new ze('',"Rotate right");r.onClick=this.rotateRightButtonClicked,t.addButton(r);var n=new Ge;n.className=this.toolbarStraightenerBlockStyleClass.name,this.bottomToolbar.addElementBlock(n),this.straightener=new $e("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(t){e.rotateBy(t),e.straightener.angle=e.rotationAngle},n.addElement(this.straightener.getUI());var s=new We;s.minWidth=2*this.toolbarHeight+"px",s.contentAlign="end",this.bottomToolbar.addButtonBlock(s);var o=new ze('',"Flip horizontal");o.onClick=this.flipHorizontallyButtonClicked,s.addButton(o);var a=new ze('',"Flip vertical");a.onClick=this.flipVerticallyButtonClicked,s.addButton(a)},e.prototype.ratioButtonClicked=function(e){this.aspectRatio=e,this.applyAspectRatio(),this.aspectRatioButton.hideDropdown()},e.prototype.applyAspectRatio=function(){this.setCropLayerAspectRatio(),this.aspectRatioButton.icon=qe.getIcon(this.aspectRatio.horizontal,this.aspectRatio.vertical)},e.prototype.setCropLayerAspectRatio=function(){this.cropLayer&&(this.aspectRatio&&0!==this.aspectRatio.horizontal&&0!==this.aspectRatio.vertical?this.cropLayer.aspectRatio=new Ve(this.aspectRatio.horizontal,this.aspectRatio.vertical):this.cropLayer.aspectRatio=void 0)},e.prototype.closeUI=function(){"popup"===this.displayMode&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},e.prototype.getState=function(){return{width:this.imageWidth,height:this.imageHeight,rotationAngle:this.rotationAngle,flippedHorizontally:this.flippedHorizontally,flippedVertically:this.flippedVertically,cropRect:Object.assign({},this.cropRect)}},e.prototype.restoreState=function(e){if(e){var t=this.cropLayer.getRescaledRect(e.width,e.height,this.imageWidth,this.imageHeight,e.cropRect,this.CANVAS_MARGIN);this.cropLayer.setCropRectangle(t),this.cropRectChanged(t),this.flippedHorizontally=e.flippedHorizontally,this.flippedVertically=e.flippedVertically,this.applyFlip(),this.rotationAngle=e.rotationAngle,this.applyRotation()}},e.prototype.clientToLocalCoordinates=function(e,t){var i=this.cropImage.getBoundingClientRect();return{x:e-i.left,y:t-i.top}},e.prototype.onWindowResize=function(){this.positionUI()},e.prototype.positionUI=function(){switch(this.setTopLeft(),this.displayMode){case"inline":var e=this.target.offsetTop>this.toolbarHeight?this.target.offsetTop-this.toolbarHeight:0;this.coverDiv.style.top=e+"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()},e.prototype.rotateLeftButtonClicked=function(){var e=this.rotationAngle-90;this.rotationAngle%90!=0&&(e+=this.rotationAngle>=0?90-this.rotationAngle%90:-this.rotationAngle%90),this.rotateTo(e)},e.prototype.rotateRightButtonClicked=function(){var e=this.rotationAngle+90;this.rotationAngle%90!=0&&(e-=this.rotationAngle>=0?this.rotationAngle%90:90+this.rotationAngle%90),this.rotateTo(e)},e.prototype.rotateTo=function(e){e=(e=e>180?e-360:e)<=-180?e+360:e,this.rotationAngle=e,this.applyRotation()},e.prototype.rotateBy=function(e){this.rotateTo((this.rotationAngle+e)%360)},e.prototype.applyRotation=function(){var e=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 i=this.editingTarget.getBoundingClientRect();this.scaleFactor=Math.min(this.imageWidth/i.width,this.imageHeight/i.height),this.editingTargetRotationScaleContainer.style.transform="scale("+this.scaleFactor+")",this.zoomToCropEnabled=e},e.prototype.flipHorizontallyButtonClicked=function(){this.flippedHorizontally=!this.flippedHorizontally,this.applyFlip()},e.prototype.flipVerticallyButtonClicked=function(){this.flippedVertically=!this.flippedVertically,this.applyFlip()},e.prototype.applyFlip=function(){this.editingTarget.style.transform="scale("+(this.flippedHorizontally?-1:1)+","+(this.flippedVertically?-1:1)+")"},e.prototype.startRenderAndClose=function(){return Pe(this,void 0,void 0,(function(){var e,t;return Fe(this,(function(i){switch(i.label){case 0:return[4,this.render()];case 1:return e=i.sent(),t=this.getState(),this.renderEventListeners.forEach((function(i){return i(e,t)})),this.close(!0),[2]}}))}))},e.prototype.render=function(){return Pe(this,void 0,void 0,(function(){var e;return Fe(this,(function(t){switch(t.label){case 0:return(e=new Je).naturalSize=this.renderAtNaturalSize,e.imageType=this.renderImageType,e.imageQuality=this.renderImageQuality,e.width=this.renderWidth,e.height=this.renderHeight,this.unzoomFromCrop(),Ne.setAttributes(this.cropLayerContainer,[["display","none"]]),[4,e.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,e.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()]}}))}))},e.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new Ue("toolbar","\n width: "+("inline"===this.displayMode?"100%":"calc(100vw - "+2*this.popupMargin+"px)")+";\n flex-shrink: 0;\n display: flex;\n flex-direction: row;\n justify-content: space-between; \n height: "+this.toolbarHeight+"px;\n box-sizing: content-box;\n overflow: hidden;\n line-height: 0px;\n ")),this.toolbarStyleColorsClass=this.styles.addClass(new Ue("toolbar_colors","\n background-color: "+this.styles.settings.toolbarBackgroundColor+";\n ")),this.toolbarBlockStyleClass=this.styles.addClass(new Ue("toolbar-block","\n display: flex;\n align-items: center;\n box-sizing: content-box;\n "));var e=this.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new Ue("toolbar_button","\n display: inline-block;\n width: "+(this.toolbarHeight-2*e)+"px;\n height: "+(this.toolbarHeight-2*e)+"px;\n padding: "+e+"px;\n cursor: default;\n user-select: none;\n box-sizing: content-box;\n ")),this.toolbarButtonStyleColorsClass=this.styles.addClass(new Ue("toolbar_button_colors","\n color: "+this.styles.settings.toolbarColor+";\n fill: currentColor;\n ")),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new Ue("toolbar_active_button","\n color: "+this.styles.settings.toolbarColor+";\n fill: currentColor;\n background-color: "+this.styles.settings.toolbarBackgroundActiveColor+"\n ")),this.styles.addRule(new je("."+this.toolbarButtonStyleClass.name+" svg","\n height: "+this.toolbarHeight/2+"px;\n ")),this.styles.addRule(new je("."+this.toolbarButtonStyleColorsClass.name+":hover","\n background-color: "+this.styles.settings.toolbarBackgroundHoverColor+"\n ")),this.toolbarDropdownStyleClass=this.styles.addClass(new Ue("toolbar_dropdown","\n position: absolute;\n max-width: "+4*this.toolbarHeight+"px;\n z-index: 20;\n white-space: normal;\n box-sizing: content-box;\n box-shadow: 3px 3px rgba(33, 33, 33, 0.1);\n margin: "+("inline"===this.displayMode?"0":this.popupMargin)+"px;\n line-height: 0px;\n ")),this.toolbarDropdownStyleColorsClass=this.styles.addClass(new Ue("toolbar_dropdown_colors","\n background-color: "+this.styles.settings.toolbarBackgroundColor+";\n ")),this.toolbarStraightenerBlockStyleClass=this.styles.addClass(new Ue("toolbar_straightener_block","\n display: flex;\n overflow: hidden;\n justify-content: center;\n -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%);\n ")),this.toolbarStraightenerStyleClass=this.styles.addClass(new Ue("toolbar_straightener","\n display: flex;\n overflow: hidden;\n justify-content: center;\n height: "+(this.toolbarHeight-2*e)+"px;\n padding: "+e+"px;\n cursor: default;\n user-select: none;\n box-sizing: content-box;\n ")),this.toolbarStraightenerStyleColorsClass=this.styles.addClass(new Ue("toolbar_straightener_colors","\n color: "+this.styles.settings.toolbarColor+";\n fill: currentColor;\n "))},e.instanceCounter=0,e}(),tt=i("8hTe"),it=i.n(tt),rt=/]*>/g;t.a=function(e){var t=e.value,i=void 0===t?"":t,l=e.edit,d=void 0!==l&&l,f=e.className,p=e.showTextOnly,g=e.showLines,v=e.replaces,m=e.zoomImg,y=e.hasMask,C=e.style,w=void 0===C?{}:C,k=e.stylesPrev,x=void 0===k?{}:k,L=String(i),A=Object(u.useRef)(),R=Object(u.useRef)(),D=Object(u.useState)(""),M=Object(a.a)(D,2),H=M[0],j=M[1],U=Object(u.useState)("office"),K=Object(a.a)(U,2),X=K[0],W=K[1],z=Object(u.useMemo)((function(){try{L=(L=L.replace(/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,"("+P.a.API_SERVER+"/api/attachments/").replace(/\"\/api\/attachments\/|\"\/attachments\/download\//g,'"'+P.a.API_SERVER+"/api/attachments/").replace(/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g,'"'+P.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,"\n")).replace(new RegExp("(?[TOC]

",S()),_()),e=(e=e.replace(/(__special_katext_id_\d+__)/g,(function(e,i){var r=t[i],n=r.type,s=r.expression;return Object(F.renderToString)(function(e){var t=document.createElement("div");return t.innerHTML=e,0===t.childNodes.length?"":t.childNodes[0].nodeValue}(s)||"",{displayMode:"block"===n,throwOnError:!1,output:"html"})}))).replace(/▁/g,"▁▁▁"),T(),p){var i=document.createElement("div");return i.innerHTML=e,i.innerText}return setTimeout((function(){return q()}),500),e}),[L]),G=Object(u.useRef)();function V(e){var t=e.target;if("IMG"===t.tagName.toUpperCase()){if(m){var i=t.getAttribute("src");j(i),W("image")}}else if("A"===t.tagName.toUpperCase()){var r=t.getAttribute("href");if(r.indexOf("office")>-1)e.preventDefault(),j(r),W("office");else if(r.indexOf("application/pdf")>-1)e.preventDefault(),j(r),W("pdf");else if(r.indexOf("type=text")>-1)e.preventDefault(),j(r),W("html");else if(r.startsWith("#")){e.preventDefault();var n=document.getElementById(r.replace("#",""));n&&n.scrollIntoView(!0)}}}b.WebkitLineClamp=g,g&&(w=Object(s.a)(Object(s.a)({},w),b));var q=function(){var e,t=null===(e=G.current)||void 0===e?void 0:e.querySelectorAll("video");null==t||t.forEach((function(e){if(e.oncontextmenu=function(){return!1},e.src.indexOf(".m3u8")>-1)if(e.canPlayType("application/vnd.apple.mpegurl"));else if(I.a.isSupported()){var t=new I.a;t.loadSource(e.src),t.attachMedia(e)}}))};Object(u.useEffect)((function(){if(G.current&&z&&z.match(rt)&&window.PR.prettyPrint(),G.current)return G.current.addEventListener("click",V),function(){G.current.removeEventListener("click",V),T(),_()}}),[z,G.current,V]);return h.a.createElement("div",{style:{position:"relative"}},h.a.createElement("div",{ref:G,style:Object(s.a)({},w),className:"".concat(f||""," markdown-body ").concat(it.a.mdBody),onMouseOver:function(e){d&&("IMG"===e.target.nodeName?(A.current.style.display="flex",A.current.style.width=e.target.clientWidth+"px",A.current.style.height=e.target.clientHeight+"px",A.current.style.top=e.target.offsetTop+"px",A.current.style.left=e.target.offsetLeft+"px",R.current.src=e.target.getAttribute("src")):A.current.style.display="none")},dangerouslySetInnerHTML:{__html:z}}),h.a.createElement("div",{ref:A,className:it.a.button},h.a.createElement(r.a,null,h.a.createElement(n.a,{onClick:function(){return(e=new et(R.current)).displayMode="popup",e.addRenderEventListener(function(){var e=Object(o.a)(c.a.mark((function e(t){var i;return c.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return A.current.style.display="none",e.next=3,Object(N.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:t}});case 3:null!=(i=e.sent)&&i.id&&v(R.current.getAttribute("src").replace(P.a.API_SERVER,""),"/api/attachments/".concat(null==i?void 0:i.id,"?type=").concat(i.content_type));case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),void e.show();var e}},"裁剪"),h.a.createElement(n.a,{onClick:function(){return(e=new Oe(R.current)).settings.displayMode="popup",e.addEventListener("render",function(){var e=Object(o.a)(c.a.mark((function e(t){var i;return c.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(A.current.style.display="none",!R.current){e.next=6;break}return e.next=4,Object(N.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:t.dataUrl}});case 4:null!=(i=e.sent)&&i.id&&v(R.current.getAttribute("src").replace(P.a.API_SERVER,""),"/api/attachments/".concat(null==i?void 0:i.id,"?type=").concat(i.content_type));case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),e.show(),void(window.markerArea=e);var e}},"编辑"))),h.a.createElement("img",{ref:R,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1}}),h.a.createElement(B.a,{close:!0,data:H,hasMask:y,type:null!=H&&H.length?X:"",style:Object(s.a)({},x),onClose:function(){return j("")}}))}},"9VGf": /*!****************************************!*\ !*** ./src/components/useInterval.tsx ***! \****************************************/ /*! exports provided: default */ /*! exports used: default */function(e,t,i){"use strict";i.d(t,"a",(function(){return n}));var r=i(/*! react */"q1tI");function n(e,t){var i=Object(r.useRef)();Object(r.useEffect)((function(){i.current=e})),Object(r.useEffect)((function(){if(null!==t){var e=setInterval((function(){i.current()}),t);return function(){return clearInterval(e)}}}),[t])}},BU3w: /*!***************************************************!*\ !*** ./node_modules/rc-util/es/Dom/dynamicCSS.js ***! \***************************************************/ /*! exports provided: injectCSS, updateCSS */ /*! exports used: updateCSS */function(e,t,i){"use strict";i.d(t,"a",(function(){return a}));var r=i(/*! ./canUseDom */"MNnm");function n(e){return e.attachTo?e.attachTo:document.querySelector("head")||document.body}function s(e){var t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!Object(r.a)())return null;var s,o=document.createElement("style");(null===(t=i.csp)||void 0===t?void 0:t.nonce)&&(o.nonce=null===(s=i.csp)||void 0===s?void 0:s.nonce);o.innerHTML=e;var a=n(i),l=a.firstChild;return i.prepend&&a.prepend?a.prepend(o):i.prepend&&l?a.insertBefore(o,l):a.appendChild(o),o}var o=new Map;function a(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n(i);if(!o.has(r)){var a=s("",i),l=a.parentNode;o.set(r,l),l.removeChild(a)}var c=Array.from(o.get(r).children).find((function(e){return"STYLE"===e.tagName&&e["rc-util-key"]===t}));if(c){var u,h,d;if((null===(u=i.csp)||void 0===u?void 0:u.nonce)&&c.nonce!==(null===(h=i.csp)||void 0===h?void 0:h.nonce))c.nonce=null===(d=i.csp)||void 0===d?void 0:d.nonce;return c.innerHTML!==e&&(c.innerHTML=e),c}var f=s(e,i);return f["rc-util-key"]=t,f}},Bd2K: /*!********************************************************!*\ !*** ./node_modules/codemirror/addon/edit/closetag.js ***! \********************************************************/ /*! no static exports found */ /*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,i){!function(e){e.defineOption("autoCloseTags",!1,(function(o,a,l){if(l!=e.Init&&l&&o.removeKeyMap("autoCloseTags"),a){var c={name:"autoCloseTags"};"object"==typeof a&&!1===a.whenClosing||(c["'/'"]=function(t){return function(t){return t.getOption("disableInput")?e.Pass:r(t,!0)}(t)}),"object"==typeof a&&!1===a.whenOpening||(c["'>'"]=function(r){return function(r){if(r.getOption("disableInput"))return e.Pass;for(var o=r.listSelections(),a=[],l=r.getOption("autoCloseTags"),c=0;cu.ch&&(g=g.slice(0,g.length-h.end+u.ch));var _=g.toLowerCase();if(!g||"string"==h.type&&(h.end!=u.ch||!/[\"\']/.test(h.string.charAt(h.string.length-1))||1==h.string.length)||"tag"==h.type&&p.close||h.string.indexOf("/")==u.ch-h.start-1||m&&n(m,_)>-1||s(r,d.mode.xmlCurrentContext&&d.mode.xmlCurrentContext(f)||[],g,u,!0))return e.Pass;var b="object"==typeof l&&l.emptyTags;if(b&&n(b,g)>-1)a[c]={text:"/>",newPos:e.Pos(u.line,u.ch+2)};else{var S=y&&n(y,_)>-1;a[c]={indent:S,text:">"+(S?"\n\n":"")+"",newPos:S?e.Pos(u.line+1,0):e.Pos(u.line,u.ch+1)}}}var C="object"==typeof l&&l.dontIndentOnAutoClose;for(c=o.length-1;c>=0;c--){var w=a[c];r.replaceRange(w.text,o[c].head,o[c].anchor,"+insert");var k=r.listSelections().slice(0);k[c]={head:w.newPos,anchor:w.newPos},r.setSelections(k),!C&&w.indent&&(r.indentLine(w.newPos.line,null,!0),r.indentLine(w.newPos.line+1,null,!0))}}(r)}),o.addKeyMap(c)}}));var t=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],i=["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 r(t,i){for(var r=t.listSelections(),n=[],o=i?"/":""!=t.getLine(u.line).charAt(h.end)&&(p+=">"),n[c]=p}if(t.replaceSelections(n),r=t.listSelections(),!l)for(c=0;c=0&&i[c]==r;c--)++l;for(n=a.to,c=1;c0){for(var i=0;i1&&void 0!==arguments[1]?arguments[1]:"",i=[],r=0;re.length)&&(t=e.length);for(var i=0,r=new Array(t);i=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(r=e[Symbol.iterator]()).next.bind(r)}var r=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(e){function t(){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}}e.exports={defaults:{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},getDefaults:t,changeDefaults:function(t){e.exports.defaults=t}}})),n=(r.defaults,r.getDefaults,r.changeDefaults,/[&<>"']/),s=/[&<>"']/g,o=/[<>"']|&(?!#?\w+;)/,a=/[<>"']|&(?!#?\w+;)/g,l={"&":"&","<":"<",">":">",'"':""","'":"'"},c=function(e){return l[e]},u=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi;function h(e){return e.replace(u,(function(e,t){return"colon"===(t=t.toLowerCase())?":":"#"===t.charAt(0)?"x"===t.charAt(1)?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):""}))}var d=/(^|[^\[])\^/g,f=/[^\w:]/g,p=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i,g={},v=/^[^:]+:\/*[^/]*$/,m=/^([^:]+:)[\s\S]*$/,y=/^([^:]+:\/*[^/]*)[\s\S]*$/;function _(e,t){g[" "+e]||(v.test(e)?g[" "+e]=e+"/":g[" "+e]=b(e,"/",!0));var i=-1===(e=g[" "+e]).indexOf(":");return"//"===t.substring(0,2)?i?t:e.replace(m,"$1")+t:"/"===t.charAt(0)?i?t:e.replace(y,"$1")+t:e+t}function b(e,t,i){var r=e.length;if(0===r)return"";for(var n=0;n=0&&"\\"===i[n];)r=!r;return r?"|":" |"})).split(/ \|/),r=0;if(i.length>t)i.splice(t);else for(;i.length1?{type:"space",raw:t[0]}:{raw:"\n"}},t.code=function(e,t){var i=this.rules.block.code.exec(e);if(i){var r=t[t.length-1];if(r&&"paragraph"===r.type)return{raw:i[0],text:i[0].trimRight()};var n=i[0].replace(/^ {4}/gm,"");return{type:"code",raw:i[0],codeBlockStyle:"indented",text:this.options.pedantic?n:O(n,"\n")}}},t.fences=function(e){var t=this.rules.block.fences.exec(e);if(t){var i=t[0],r=function(e,t){var i=e.match(/^(\s+)(?:```)/);if(null===i)return t;var r=i[1];return t.split("\n").map((function(e){var t=e.match(/^\s+/);return null===t?e:t[0].length>=r.length?e.slice(r.length):e})).join("\n")}(i,t[3]||"");return{type:"code",raw:i,lang:t[2]?t[2].trim():t[2],text:r}}},t.heading=function(e){var t=this.rules.block.heading.exec(e);if(t)return{type:"heading",raw:t[0],depth:t[1].length,text:t[2]}},t.nptable=function(e){var t=this.rules.block.nptable.exec(e);if(t){var i={type:"table",header:M(t[1].replace(/^ *| *\| *$/g,"")),align:t[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:t[3]?t[3].replace(/\n$/,"").split("\n"):[],raw:t[0]};if(i.header.length===i.align.length){var r,n=i.align.length;for(r=0;r ?/gm,"");return{type:"blockquote",raw:t[0],text:i}}},t.list=function(e){var t=this.rules.block.list.exec(e);if(t){for(var i,r,n,s,o,a,l,c=t[0],u=t[2],h=u.length>1,d=")"===u[u.length-1],f={type:"list",raw:c,ordered:h,start:h?+u.slice(0,-1):"",loose:!1,items:[]},p=t[0].match(this.rules.block.item),g=!1,v=p.length,m=0;m1||this.options.smartLists&&n!==u)&&(s=p.slice(m+1).join("\n"),f.raw=f.raw.substring(0,f.raw.length-s.length),m=v-1)),o=g||/\n\n(?!\s*$)/.test(i),m!==v-1&&(g="\n"===i.charAt(i.length-1),o||(o=g)),o&&(f.loose=!0),l=void 0,(a=/^\[[ xX]\] /.test(i))&&(l=" "!==i[1],i=i.replace(/^\[[ xX]\] +/,"")),f.items.push({type:"list_item",raw:c,task:a,checked:l,loose:o,text:i});return f}},t.html=function(e){var t=this.rules.block.html.exec(e);if(t)return{type:this.options.sanitize?"paragraph":"html",raw:t[0],pre:!this.options.sanitizer&&("pre"===t[1]||"script"===t[1]||"style"===t[1]),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(t[0]):I(t[0]):t[0]}},t.def=function(e){var t=this.rules.block.def.exec(e);if(t)return t[3]&&(t[3]=t[3].substring(1,t[3].length-1)),{tag:t[1].toLowerCase().replace(/\s+/g," "),raw:t[0],href:t[2],title:t[3]}},t.table=function(e){var t=this.rules.block.table.exec(e);if(t){var i={type:"table",header:M(t[1].replace(/^ *| *\| *$/g,"")),align:t[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:t[3]?t[3].replace(/\n$/,"").split("\n"):[]};if(i.header.length===i.align.length){i.raw=t[0];var r,n=i.align.length;for(r=0;r/i.test(r[0])&&(t=!1),!i&&/^<(pre|code|kbd|script)(\s|>)/i.test(r[0])?i=!0:i&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(r[0])&&(i=!1),{type:this.options.sanitize?"text":"html",raw:r[0],inLink:t,inRawBlock:i,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(r[0]):I(r[0]):r[0]}},t.link=function(e){var t=this.rules.inline.link.exec(e);if(t){var i=P(t[2],"()");if(i>-1){var r=(0===t[0].indexOf("!")?5:4)+t[1].length+i;t[2]=t[2].substring(0,i),t[0]=t[0].substring(0,r).trim(),t[3]=""}var n=t[2],s="";if(this.options.pedantic){var o=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(n);o?(n=o[1],s=o[3]):s=""}else s=t[3]?t[3].slice(1,-1):"";return F(t,{href:(n=n.trim().replace(/^<([\s\S]*)>$/,"$1"))?n.replace(this.rules.inline._escapes,"$1"):n,title:s?s.replace(this.rules.inline._escapes,"$1"):s},t[0])}},t.reflink=function(e,t){var i;if((i=this.rules.inline.reflink.exec(e))||(i=this.rules.inline.nolink.exec(e))){var r=(i[2]||i[1]).replace(/\s+/g," ");if(!(r=t[r.toLowerCase()])||!r.href){var n=i[0].charAt(0);return{type:"text",raw:n,text:n}}return F(i,r,i[0])}},t.strong=function(e,t,i){void 0===i&&(i="");var r=this.rules.inline.strong.start.exec(e);if(r&&(!r[1]||r[1]&&(""===i||this.rules.inline.punctuation.exec(i)))){t=t.slice(-1*e.length);var n,s="**"===r[0]?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;for(s.lastIndex=0;null!=(r=s.exec(t));)if(n=this.rules.inline.strong.middle.exec(t.slice(0,r.index+3)))return{type:"strong",raw:e.slice(0,n[0].length),text:e.slice(2,n[0].length-2)}}},t.em=function(e,t,i){void 0===i&&(i="");var r=this.rules.inline.em.start.exec(e);if(r&&(!r[1]||r[1]&&(""===i||this.rules.inline.punctuation.exec(i)))){t=t.slice(-1*e.length);var n,s="*"===r[0]?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;for(s.lastIndex=0;null!=(r=s.exec(t));)if(n=this.rules.inline.em.middle.exec(t.slice(0,r.index+2)))return{type:"em",raw:e.slice(0,n[0].length),text:e.slice(1,n[0].length-1)}}},t.codespan=function(e){var t=this.rules.inline.code.exec(e);if(t){var i=t[2].replace(/\n/g," "),r=/[^ ]/.test(i),n=i.startsWith(" ")&&i.endsWith(" ");return r&&n&&(i=i.substring(1,i.length-1)),i=I(i,!0),{type:"codespan",raw:t[0],text:i}}},t.br=function(e){var t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}},t.del=function(e){var t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[1]}},t.autolink=function(e,t){var i,r,n=this.rules.inline.autolink.exec(e);if(n)return r="@"===n[2]?"mailto:"+(i=I(this.options.mangle?t(n[1]):n[1])):i=I(n[1]),{type:"link",raw:n[0],text:i,href:r,tokens:[{type:"text",raw:i,text:i}]}},t.url=function(e,t){var i;if(i=this.rules.inline.url.exec(e)){var r,n;if("@"===i[2])n="mailto:"+(r=I(this.options.mangle?t(i[0]):i[0]));else{var s;do{s=i[0],i[0]=this.rules.inline._backpedal.exec(i[0])[0]}while(s!==i[0]);r=I(i[0]),n="www."===i[1]?"http://"+r:r}return{type:"link",raw:i[0],text:r,href:n,tokens:[{type:"text",raw:r,text:r}]}}},t.inlineText=function(e,t,i){var r,n=this.rules.inline.text.exec(e);if(n)return r=t?this.options.sanitize?this.options.sanitizer?this.options.sanitizer(n[0]):I(n[0]):n[0]:I(this.options.smartypants?i(n[0]):n[0]),{type:"text",raw:n[0],text:r}},e}(),N=x,H=w,j=E,U={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]*?(?:[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?\\?>\\n*|\\n*|\\n*|)[\\s\\S]*?(?:\\n{2,}|$)|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)|(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$))",def:/^ {0,3}\[(label)\]: *\n? *]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,nptable:N,table:N,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/,_label:/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,_title:/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/};U.def=H(U.def).replace("label",U._label).replace("title",U._title).getRegex(),U.bullet=/(?:[*+-]|\d{1,9}[.)])/,U.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,U.item=H(U.item,"gm").replace(/bull/g,U.bullet).getRegex(),U.list=H(U.list).replace(/bull/g,U.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+U.def.source+")").getRegex(),U._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",U._comment=//,U.html=H(U.html,"i").replace("comment",U._comment).replace("tag",U._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),U.paragraph=H(U._paragraph).replace("hr",U.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",")|<(?:script|pre|style|!--)").replace("tag",U._tag).getRegex(),U.blockquote=H(U.blockquote).replace("paragraph",U.paragraph).getRegex(),U.normal=j({},U),U.gfm=j({},U.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*|$)"}),U.gfm.nptable=H(U.gfm.nptable).replace("hr",U.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",")|<(?:script|pre|style|!--)").replace("tag",U._tag).getRegex(),U.gfm.table=H(U.gfm.table).replace("hr",U.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",")|<(?:script|pre|style|!--)").replace("tag",U._tag).getRegex(),U.pedantic=j({},U.normal,{html:H("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",U._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:/^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/,fences:N,paragraph:H(U.normal._paragraph).replace("hr",U.hr).replace("heading"," *#{1,6} *[^\n]").replace("lheading",U.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var K={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:N,tag:"^comment|^|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\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:N,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\?@\\[\\]`^{|}~"};K.punctuation=H(K.punctuation).replace(/punctuation/g,K._punctuation).getRegex(),K._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",K._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",K.em.start=H(K.em.start).replace(/punctuation/g,K._punctuation).getRegex(),K.em.middle=H(K.em.middle).replace(/punctuation/g,K._punctuation).replace(/overlapSkip/g,K._overlapSkip).getRegex(),K.em.endAst=H(K.em.endAst,"g").replace(/punctuation/g,K._punctuation).getRegex(),K.em.endUnd=H(K.em.endUnd,"g").replace(/punctuation/g,K._punctuation).getRegex(),K.strong.start=H(K.strong.start).replace(/punctuation/g,K._punctuation).getRegex(),K.strong.middle=H(K.strong.middle).replace(/punctuation/g,K._punctuation).replace(/blockSkip/g,K._blockSkip).getRegex(),K.strong.endAst=H(K.strong.endAst,"g").replace(/punctuation/g,K._punctuation).getRegex(),K.strong.endUnd=H(K.strong.endUnd,"g").replace(/punctuation/g,K._punctuation).getRegex(),K.blockSkip=H(K._blockSkip,"g").getRegex(),K.overlapSkip=H(K._overlapSkip,"g").getRegex(),K._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,K._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,K._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])?)+(?![-_])/,K.autolink=H(K.autolink).replace("scheme",K._scheme).replace("email",K._email).getRegex(),K._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,K.tag=H(K.tag).replace("comment",U._comment).replace("attribute",K._attribute).getRegex(),K._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,K._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,K._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,K.link=H(K.link).replace("label",K._label).replace("href",K._href).replace("title",K._title).getRegex(),K.reflink=H(K.reflink).replace("label",K._label).getRegex(),K.reflinkSearch=H(K.reflinkSearch,"g").replace("reflink",K.reflink).replace("nolink",K.nolink).getRegex(),K.normal=j({},K),K.pedantic=j({},K.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:H(/^!?\[(label)\]\((.*?)\)/).replace("label",K._label).getRegex(),reflink:H(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",K._label).getRegex()}),K.gfm=j({},K.normal,{escape:H(K.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]*?(?:(?=[\\.5&&(i="x"+i.toString(16)),r+="&#"+i+";";return r}var Q=function(){function t(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||W,this.options.tokenizer=this.options.tokenizer||new B,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var t={block:z.normal,inline:G.normal};this.options.pedantic?(t.block=z.pedantic,t.inline=G.pedantic):this.options.gfm&&(t.block=z.gfm,this.options.breaks?t.inline=G.breaks:t.inline=G.gfm),this.tokenizer.rules=t}t.lex=function(e,i){return new t(i).lex(e)};var i,r,n,s=t.prototype;return s.lex=function(e){return e=e.replace(/\r\n|\r/g,"\n").replace(/\t/g," "),this.blockTokens(e,this.tokens,!0),this.inline(this.tokens),this.tokens},s.blockTokens=function(e,t,i){var r,n,s,o;for(void 0===t&&(t=[]),void 0===i&&(i=!0),e=e.replace(/^ +$/gm,"");e;)if(r=this.tokenizer.space(e))e=e.substring(r.raw.length),r.type&&t.push(r);else if(r=this.tokenizer.code(e,t))e=e.substring(r.raw.length),r.type?t.push(r):((o=t[t.length-1]).raw+="\n"+r.raw,o.text+="\n"+r.text);else if(r=this.tokenizer.fences(e))e=e.substring(r.raw.length),t.push(r);else if(r=this.tokenizer.heading(e))e=e.substring(r.raw.length),t.push(r);else if(r=this.tokenizer.nptable(e))e=e.substring(r.raw.length),t.push(r);else if(r=this.tokenizer.hr(e))e=e.substring(r.raw.length),t.push(r);else if(r=this.tokenizer.blockquote(e))e=e.substring(r.raw.length),r.tokens=this.blockTokens(r.text,[],i),t.push(r);else if(r=this.tokenizer.list(e)){for(e=e.substring(r.raw.length),s=r.items.length,n=0;n0)for(;null!=(o=this.tokenizer.rules.inline.reflinkSearch.exec(a));)l.includes(o[0].slice(o[0].lastIndexOf("[")+1,-1))&&(a=a.slice(0,o.index)+"["+"a".repeat(o[0].length-2)+"]"+a.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;null!=(o=this.tokenizer.rules.inline.blockSkip.exec(a));)a=a.slice(0,o.index)+"["+"a".repeat(o[0].length-2)+"]"+a.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;e;)if(s=this.tokenizer.escape(e))e=e.substring(s.raw.length),t.push(s);else if(s=this.tokenizer.tag(e,i,r))e=e.substring(s.raw.length),i=s.inLink,r=s.inRawBlock,t.push(s);else if(s=this.tokenizer.link(e))e=e.substring(s.raw.length),"link"===s.type&&(s.tokens=this.inlineTokens(s.text,[],!0,r)),t.push(s);else if(s=this.tokenizer.reflink(e,this.tokens.links))e=e.substring(s.raw.length),"link"===s.type&&(s.tokens=this.inlineTokens(s.text,[],!0,r)),t.push(s);else if(s=this.tokenizer.strong(e,a,n))e=e.substring(s.raw.length),s.tokens=this.inlineTokens(s.text,[],i,r),t.push(s);else if(s=this.tokenizer.em(e,a,n))e=e.substring(s.raw.length),s.tokens=this.inlineTokens(s.text,[],i,r),t.push(s);else if(s=this.tokenizer.codespan(e))e=e.substring(s.raw.length),t.push(s);else if(s=this.tokenizer.br(e))e=e.substring(s.raw.length),t.push(s);else if(s=this.tokenizer.del(e))e=e.substring(s.raw.length),s.tokens=this.inlineTokens(s.text,[],i,r),t.push(s);else if(s=this.tokenizer.autolink(e,q))e=e.substring(s.raw.length),t.push(s);else if(i||!(s=this.tokenizer.url(e,q))){if(s=this.tokenizer.inlineText(e,r,V))e=e.substring(s.raw.length),n=s.raw.slice(-1),t.push(s);else if(e){var c="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(c);break}throw new Error(c)}}else e=e.substring(s.raw.length),t.push(s);return t},i=t,n=[{key:"rules",get:function(){return{block:z,inline:G}}}],(r=null)&&e(i.prototype,r),n&&e(i,n),t}(),Y=r.defaults,Z=k,$=S,J=function(){function e(e){this.options=e||Y}var t=e.prototype;return t.code=function(e,t,i){var r=(t||"").match(/\S*/)[0];if(this.options.highlight){var n=this.options.highlight(e,r);null!=n&&n!==e&&(i=!0,e=n)}return r?'
'+(i?e:$(e,!0))+"
\n":"
"+(i?e:$(e,!0))+"
\n"},t.blockquote=function(e){return"
\n"+e+"
\n"},t.html=function(e){return e},t.heading=function(e,t,i,r){return this.options.headerIds?"'+e+"\n":""+e+"\n"},t.hr=function(){return this.options.xhtml?"
\n":"
\n"},t.list=function(e,t,i){var r=t?"ol":"ul";return"<"+r+(t&&1!==i?' start="'+i+'"':"")+">\n"+e+"\n"},t.listitem=function(e){return"
  • "+e+"
  • \n"},t.checkbox=function(e){return" "},t.paragraph=function(e){return"

    "+e+"

    \n"},t.table=function(e,t){return t&&(t=""+t+""),"\n\n"+e+"\n"+t+"
    \n"},t.tablerow=function(e){return"\n"+e+"\n"},t.tablecell=function(e,t){var i=t.header?"th":"td";return(t.align?"<"+i+' align="'+t.align+'">':"<"+i+">")+e+"\n"},t.strong=function(e){return""+e+""},t.em=function(e){return""+e+""},t.codespan=function(e){return""+e+""},t.br=function(){return this.options.xhtml?"
    ":"
    "},t.del=function(e){return""+e+""},t.link=function(e,t,i){if(null===(e=Z(this.options.sanitize,this.options.baseUrl,e)))return i;var r='"},t.image=function(e,t,i){if(null===(e=Z(this.options.sanitize,this.options.baseUrl,e)))return i;var r=''+i+'":">"},t.text=function(e){return e},e}(),ee=function(){function e(){}var t=e.prototype;return t.strong=function(e){return e},t.em=function(e){return e},t.codespan=function(e){return e},t.del=function(e){return e},t.html=function(e){return e},t.text=function(e){return e},t.link=function(e,t,i){return""+i},t.image=function(e,t,i){return""+i},t.br=function(){return""},e}(),te=function(){function e(){this.seen={}}return e.prototype.slug=function(e){var t=e.toLowerCase().trim().replace(/<[!\/a-z].*?>/gi,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(t)){var i=t;do{this.seen[i]++,t=i+"-"+this.seen[i]}while(this.seen.hasOwnProperty(t))}return this.seen[t]=0,t},e}(),ie=r.defaults,re=C,ne=function(){function e(e){this.options=e||ie,this.options.renderer=this.options.renderer||new J,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new ee,this.slugger=new te}e.parse=function(t,i){return new e(i).parse(t)};var t=e.prototype;return t.parse=function(e,t){void 0===t&&(t=!0);var i,r,n,s,o,a,l,c,u,h,d,f,p,g,v,m,y,_,b="",S=e.length;for(i=0;i0&&"text"===v.tokens[0].type?(v.tokens[0].text=_+" "+v.tokens[0].text,v.tokens[0].tokens&&v.tokens[0].tokens.length>0&&"text"===v.tokens[0].tokens[0].type&&(v.tokens[0].tokens[0].text=_+" "+v.tokens[0].tokens[0].text)):v.tokens.unshift({type:"text",text:_}):g+=_),g+=this.parse(v.tokens,p),u+=this.renderer.listitem(g,y,m);b+=this.renderer.list(u,d,f);continue;case"html":b+=this.renderer.html(h.text);continue;case"paragraph":b+=this.renderer.paragraph(this.parseInline(h.tokens));continue;case"text":for(u=h.tokens?this.parseInline(h.tokens):h.text;i+1An error occurred:

    "+ae(e.message+"",!0)+"
    ";throw e}}return he.options=he.setOptions=function(e){return se(he.defaults,e),ce(he.defaults),he},he.getDefaults=le,he.defaults=ue,he.use=function(e){var t=se({},e);if(e.renderer&&function(){var i=he.defaults.renderer||new J,r=function(t){var r=i[t];i[t]=function(){for(var n=arguments.length,s=new Array(n),o=0;o0||o.target.offsetWidth>0){var a=p(o.target.offsetWidth,o.target.offsetHeight,e),c=Object(n.a)(a,2),u=c[0],h=c[1];console.log("cols, rows",u,h),d.a.publish("ssh-xterm-resize",{columns:u,rows:h,width:o.target.offsetWidth,height:o.target.offsetHeight}),e.resize(u,h);var f=l.Base64.decode("IA=="),g=l.Base64.decode("CBtbSw==");e.write(f),e.write(g)}}}catch(e){r.e(e)}finally{r.f()}}));return i.observe(t),i}(e,S.current);return function(){e.dispose(),t.unobserve(S.current)}}}),[y,S.current]),Object(o.useEffect)((function(){if(v&&y){var e=setInterval((function(){C.current&&C.current.send(JSON.stringify({tp:"h"}))}),3e4),n=d.a.subscribe("create-socket",(function(n){var s;i==n&&(C.current&&1===C.current.readyState?v.focus():(s=new WebSocket(y),C.current=s,s.onopen=function(){var e=v.element.parentElement;if(e){var i=e.offsetWidth,n=e.offsetHeight;console.log("init",{tp:"init",data:Object(r.a)(Object(r.a)({},t),{},{secret:_,width:i,height:n,rows:v.rows,columns:v.cols})}),s.send(JSON.stringify({tp:"init",data:Object(r.a)(Object(r.a)({},t),{},{secret:_,width:i,height:n,rows:v.rows,columns:v.cols})}))}v.focus()},s.onerror=function(e){console.log("------in socket error----",e,s,y)},s.onmessage=function(e){w.current||(v.write("\r"),setTimeout((function(){}),1e3)),w.current=!0,console.log("event:",e);var t=l.Base64.decode(e.data.toString()),i=v._core._renderService.dimensions.actualCellWidth||9.5;console.log("data:",t,i,v),v.write(t)},s.onclose=function(t){e&&clearInterval(e),v.write("\r\nconnection closed")}),v.focus())})),s=d.a.subscribe("close-socket",(function(e){i===e&&(C.current&&(C.current.close(),w.current=!1,v.clear()),C.current=null)})),o=d.a.subscribe("ssh-xterm-resize",(function(e){C.current&&1===C.current.readyState&&C.current.send(JSON.stringify({tp:"resize",data:Object(r.a)({},e)}))})),a=d.a.subscribe("ssh-add-connect-time",(function(){C.current&&1===C.current.readyState&&C.current.send(JSON.stringify({tp:"overtime"}))}));return function(){s(),n(),o(),a(),C.current&&(C.current.close(),w.current=!1)}}}),[v,y,b]),a.a.createElement("div",{ref:S,className:h.a["xterm-panel"]},y?null:a.a.createElement("p",{style:{color:"#fff"}},"正在连接命令行服务..."))}},ELLl: /*!*************************************************************!*\ !*** ./node_modules/codemirror/addon/edit/closebrackets.js ***! \*************************************************************/ /*! no static exports found */ /*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,i){!function(e){var t={pairs:"()[]{}''\"\"",closeBefore:")]}'\":;>",triples:"",explode:"[]{}"},i=e.Pos;function r(e,i){return"pairs"==i&&"string"==typeof e?e:"object"==typeof e&&null!=e[i]?e[i]:t[i]}e.defineOption("autoCloseBrackets",!1,(function(t,i,o){o&&o!=e.Init&&(t.removeKeyMap(n),t.state.closeBrackets=null),i&&(s(r(i,"pairs")),t.state.closeBrackets=i,t.addKeyMap(n))}));var n={Backspace:function(t){var n=a(t);if(!n||t.getOption("disableInput"))return e.Pass;for(var s=r(n,"pairs"),o=t.listSelections(),c=0;c=0;c--){var h=o[c].head;t.replaceRange("",i(h.line,h.ch-1),i(h.line,h.ch+1),"+delete")}},Enter:function(t){var i=a(t),n=i&&r(i,"explode");if(!n||t.getOption("disableInput"))return e.Pass;for(var s=t.listSelections(),o=0;o1&&d.indexOf(n)>=0&&t.getRange(i(_.line,_.ch-2),_)==n+n){if(_.ch>2&&/\bstring/.test(t.getTokenTypeAt(i(_.line,_.ch-2))))return e.Pass;m="addFour"}else if(f){var S=0==_.ch?" ":t.getRange(i(_.line,_.ch-1),_);if(e.isWordChar(b)||S==n||e.isWordChar(S))return e.Pass;m="both"}else{if(!g||!(0===b.length||/\s/.test(b)||h.indexOf(b)>-1))return e.Pass;m="both"}else m=f&&c(t,_)?"both":d.indexOf(n)>=0&&t.getRange(_,i(_.line,_.ch+3))==n+n+n?"skipThree":"skip";if(u){if(u!=m)return e.Pass}else u=m}var C=l%2?o.charAt(l-1):n,w=l%2?n:o.charAt(l+1);t.operation((function(){if("skip"==u)t.execCommand("goCharRight");else if("skipThree"==u)for(var r=0;r<3;r++)t.execCommand("goCharRight");else if("surround"==u){var n=t.getSelections();for(r=0;r0,{anchor:new i(s.anchor.line,s.anchor.ch+(o?-1:1)),head:new i(s.head.line,s.head.ch+(o?1:-1))});t.setSelections(n)}else"both"==u?(t.replaceSelection(C+w,null),t.triggerElectric(C+w),t.execCommand("goCharLeft")):"addFour"==u&&(t.replaceSelection(C+C+C+C,"before"),t.execCommand("goCharRight"));var s,o}))}(n,t)}}function a(e){var t=e.state.closeBrackets;return!t||t.override?t:e.getModeAt(e.getCursor()).closeBrackets||t}function l(e,t){var r=e.getRange(i(t.line,t.ch-1),i(t.line,t.ch+1));return 2==r.length?r:null}function c(e,t){var r=e.getTokenAt(i(t.line,t.ch+1));return/\bstring/.test(r.type)&&r.start==t.ch&&(0==t.ch||!/\bstring/.test(e.getTokenTypeAt(t)))}s(t.pairs+"`")}(i(/*! ../../lib/codemirror */"VrN/"))},"ER/M": /*!********************************************************!*\ !*** ./src/pages/tasks/xterm-panel/index.less?modules ***! \********************************************************/ /*! no static exports found */ /*! exports used: default */ /*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,i){e.exports={"xterm-panel":"xterm-panel___2r2xx"}},Fv0C: /*!*********************************************************!*\ !*** ./node_modules/@novnc/novnc/lib/input/keyboard.js ***! \*********************************************************/ /*! no static exports found */ /*! all exports used */ /*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,i){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n,s=h(i(/*! ../util/logging.js */"Lo0S")),o=i(/*! ../util/events.js */"vewr"),a=h(i(/*! ./util.js */"8CQX")),l=(n=i(/*! ./keysym.js */"mHUz"))&&n.__esModule?n:{default:n},c=h(i(/*! ../util/browser.js */"GdRQ"));function u(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return u=function(){return e},e}function h(e){if(e&&e.__esModule)return e;if(null===e||"object"!==r(e)&&"function"!=typeof e)return{default:e};var t=u();if(t&&t.has(e))return t.get(e);var i={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){var o=n?Object.getOwnPropertyDescriptor(e,s):null;o&&(o.get||o.set)?Object.defineProperty(i,s,o):i[s]=e[s]}return i.default=e,t&&t.set(e,i),i}function d(e,t){for(var i=0;i=48&&e.keyCode<=57)t=e.keyCode;else if(e.keyCode>=65&&e.keyCode<=90){var r=String.fromCharCode(e.keyCode);t=(r=e.shiftKey?r.toUpperCase():r.toLowerCase()).charCodeAt()}else t=0;this._sendKeyEvent(t,i,!0)}}},{key:"_handleKeyUp",value:function(e){(0,o.stopEvent)(e);var t=this._getKeyCode(e);if(this._altGrArmed&&(this._altGrArmed=!1,clearTimeout(this._altGrTimeout),this._sendKeyEvent(l.default.XK_Control_L,"ControlLeft",!0)),(c.isMac()||c.isIOS())&&"CapsLock"===t)return this._sendKeyEvent(l.default.XK_Caps_Lock,"CapsLock",!0),void this._sendKeyEvent(l.default.XK_Caps_Lock,"CapsLock",!1);this._sendKeyEvent(this._keyDownList[t],t,!1),!c.isWindows()||"ShiftLeft"!==t&&"ShiftRight"!==t||("ShiftRight"in this._keyDownList&&this._sendKeyEvent(this._keyDownList.ShiftRight,"ShiftRight",!1),"ShiftLeft"in this._keyDownList&&this._sendKeyEvent(this._keyDownList.ShiftLeft,"ShiftLeft",!1))}},{key:"_handleAltGrTimeout",value:function(){this._altGrArmed=!1,clearTimeout(this._altGrTimeout),this._sendKeyEvent(l.default.XK_Control_L,"ControlLeft",!0)}},{key:"_allKeysUp",value:function(){for(var e in s.Debug(">> Keyboard.allKeysUp"),this._keyDownList)this._sendKeyEvent(this._keyDownList[e],e,!1);s.Debug("<< Keyboard.allKeysUp")}},{key:"_checkAlt",value:function(e){if(!e.skipCheckAlt&&!e.altKey){var t=this._target,i=this._keyDownList;["AltLeft","AltRight"].forEach((function(e){if(e in i){var r=new KeyboardEvent("keyup",{key:i[e],code:e});r.skipCheckAlt=!0,t.dispatchEvent(r)}}))}}},{key:"grab",value:function(){if(this._target.addEventListener("keydown",this._eventHandlers.keydown),this._target.addEventListener("keyup",this._eventHandlers.keyup),this._target.addEventListener("keypress",this._eventHandlers.keypress),window.addEventListener("blur",this._eventHandlers.blur),c.isWindows()&&c.isFirefox()){var e=this._eventHandlers.checkalt;["mousedown","mouseup","mousemove","wheel","touchstart","touchend","touchmove","keydown","keyup"].forEach((function(t){return document.addEventListener(t,e,{capture:!0,passive:!0})}))}}},{key:"ungrab",value:function(){if(c.isWindows()&&c.isFirefox()){var e=this._eventHandlers.checkalt;["mousedown","mouseup","mousemove","wheel","touchstart","touchend","touchmove","keydown","keyup"].forEach((function(t){return document.removeEventListener(t,e)}))}this._target.removeEventListener("keydown",this._eventHandlers.keydown),this._target.removeEventListener("keyup",this._eventHandlers.keyup),this._target.removeEventListener("keypress",this._eventHandlers.keypress),window.removeEventListener("blur",this._eventHandlers.blur),this._allKeysUp()}}])&&d(t.prototype,i),r&&d(t,r),e}();t.default=f},GQ8N: /*!***************************************************!*\ !*** ./node_modules/@novnc/novnc/lib/util/int.js ***! \***************************************************/ /*! no static exports found */ /*! all exports used */ /*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.toUnsigned32bit=function(e){return e>>>0},t.toSigned32bit=function(e){return 0|e}},GdRQ: /*!*******************************************************!*\ !*** ./node_modules/@novnc/novnc/lib/util/browser.js ***! \*******************************************************/ /*! no static exports found */ /*! all exports used */ /*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,i){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.isMac=function(){return navigator&&!!/mac/i.exec(navigator.platform)},t.isWindows=function(){return navigator&&!!/win/i.exec(navigator.platform)},t.isIOS=function(){return navigator&&(!!/ipad/i.exec(navigator.platform)||!!/iphone/i.exec(navigator.platform)||!!/ipod/i.exec(navigator.platform))},t.isSafari=function(){return navigator&&-1!==navigator.userAgent.indexOf("Safari")&&-1===navigator.userAgent.indexOf("Chrome")},t.isIE=function(){return navigator&&!!/trident/i.exec(navigator.userAgent)},t.isEdge=function(){return navigator&&!!/edge/i.exec(navigator.userAgent)},t.isFirefox=function(){return navigator&&!!/firefox/i.exec(navigator.userAgent)},t.hasScrollbarGutter=t.supportsImageMetadata=t.supportsCursorURIs=t.dragThreshold=t.isTouchDevice=void 0;var n=function(e){if(e&&e.__esModule)return e;if(null===e||"object"!==r(e)&&"function"!=typeof e)return{default:e};var t=s();if(t&&t.has(e))return t.get(e);var i={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if(Object.prototype.hasOwnProperty.call(e,o)){var a=n?Object.getOwnPropertyDescriptor(e,o):null;a&&(a.get||a.set)?Object.defineProperty(i,o,a):i[o]=e[o]}i.default=e,t&&t.set(e,i);return i}(i(/*! ./logging.js */"Lo0S"));function s(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return s=function(){return e},e}var o="ontouchstart"in document.documentElement||void 0!==document.ontouchstart||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0;t.isTouchDevice=o,window.addEventListener("touchstart",(function e(){t.isTouchDevice=o=!0,window.removeEventListener("touchstart",e,!1)}),!1);var a=10*(window.devicePixelRatio||1);t.dragThreshold=a;var l=!1;try{var c=document.createElement("canvas");c.style.cursor='url("data:image/x-icon;base64,AAACAAEACAgAAAIAAgA4AQAAFgAAACgAAAAIAAAAEAAAAAEAIAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////AAAAAAAAAAAAAAAAAAAAAA==") 2 2, default',0===c.style.cursor.indexOf("url")?(n.Info("Data URI scheme cursor supported"),l=!0):n.Warn("Data URI scheme cursor not supported")}catch(e){n.Error("Data URI scheme cursor test exception: "+e)}var u=l;t.supportsCursorURIs=u;var h=!1;try{new ImageData(new Uint8ClampedArray(4),1,1),h=!0}catch(e){}var d=h;t.supportsImageMetadata=d;var f=!0;try{var p=document.createElement("div");p.style.visibility="hidden",p.style.overflow="scroll",document.body.appendChild(p);var g=document.createElement("div");p.appendChild(g);var v=p.offsetWidth-g.offsetWidth;p.parentNode.removeChild(p),f=0!=v}catch(e){n.Error("Scrollbar test exception: "+e)}var m=f;t.hasScrollbarGutter=m},Gytx: /*!********************************************!*\ !*** ./node_modules/shallowequal/index.js ***! \********************************************/ /*! no static exports found */ /*! exports used: default */ /*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t){e.exports=function(e,t,i,r){var n=i?i.call(r,e,t):void 0;if(void 0!==n)return!!n;if(e===t)return!0;if("object"!=typeof e||!e||"object"!=typeof t||!t)return!1;var s=Object.keys(e),o=Object.keys(t);if(s.length!==o.length)return!1;for(var a=Object.prototype.hasOwnProperty.bind(t),l=0;lthis.chunkSize&&(this.chunkSize=e,this.strm.output=new Uint8Array(this.chunkSize)),this.strm.next_out=0,this.strm.avail_out=e,(0,n.inflate)(this.strm,0)<0)throw new Error("zlib inflate failed");if(this.strm.next_out!=e)throw new Error("Incomplete zlib block");return new Uint8Array(this.strm.output.buffer,0,this.strm.next_out)}},{key:"reset",value:function(){(0,n.inflateReset)(this.strm)}}])&&o(t.prototype,i),r&&o(t,r),e}();t.default=a},IxHN: /*!******************************************!*\ !*** ./src/components/Spinner/index.tsx ***! \******************************************/ /*! exports provided: default */ /*! exports used: default */function(e,t,i){"use strict";var r=i(/*! react */"q1tI"),n=i.n(r),s=i(/*! ./index.less?modules */"07cG"),o=i.n(s);t.a=function(e){var t=e.message,i=e.className,r=e.children,s=e.style,a=void 0===s?{}:s;return n.a.createElement("div",{className:"".concat(o.a.idsRingWrapper," ").concat(i)},n.a.createElement("div",{className:o.a.ldsRing},n.a.createElement("div",null),n.a.createElement("div",null),n.a.createElement("div",null),n.a.createElement("div",null)),t?n.a.createElement("p",{style:a},t):null,r)}},J66h: /*!******************************************!*\ !*** ./node_modules/js-base64/base64.js ***! \******************************************/ /*! no static exports found */ /*! exports used: Base64 */ /*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,i){(function(i){var r;!function(i,n){e.exports=function(i){"use strict";var n,s=(i=i||{}).Base64,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=function(e){for(var t={},i=0,r=e.length;i>>6)+l(128|63&t):l(224|t>>>12&15)+l(128|t>>>6&63)+l(128|63&t);var t=65536+1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320);return l(240|t>>>18&7)+l(128|t>>>12&63)+l(128|t>>>6&63)+l(128|63&t)},u=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,h=function(e){return e.replace(u,c)},d=function(e){var t=[0,2,1][e.length%3],i=e.charCodeAt(0)<<16|(e.length>1?e.charCodeAt(1):0)<<8|(e.length>2?e.charCodeAt(2):0);return[o.charAt(i>>>18),o.charAt(i>>>12&63),t>=2?"=":o.charAt(i>>>6&63),t>=1?"=":o.charAt(63&i)].join("")},f=i.btoa&&"function"==typeof i.btoa?function(e){return i.btoa(e)}:function(e){if(e.match(/[^\x00-\xFF]/))throw new RangeError("The string contains invalid characters.");return e.replace(/[\s\S]{1,3}/g,d)},p=function(e){return f(h(String(e)))},g=function(e){return e.replace(/[+\/]/g,(function(e){return"+"==e?"-":"_"})).replace(/=/g,"")},v=function(e,t){return t?g(p(e)):p(e)};i.Uint8Array&&(n=function(e,t){for(var i="",r=0,n=e.length;r>>18)+o.charAt(c>>>12&63)+(void 0!==a?o.charAt(c>>>6&63):"=")+(void 0!==l?o.charAt(63&c):"=")}return t?g(i):i});var m,y=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,_=function(e){switch(e.length){case 4:var t=((7&e.charCodeAt(0))<<18|(63&e.charCodeAt(1))<<12|(63&e.charCodeAt(2))<<6|63&e.charCodeAt(3))-65536;return l(55296+(t>>>10))+l(56320+(1023&t));case 3:return l((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return l((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}},b=function(e){return e.replace(y,_)},S=function(e){var t=e.length,i=t%4,r=(t>0?a[e.charAt(0)]<<18:0)|(t>1?a[e.charAt(1)]<<12:0)|(t>2?a[e.charAt(2)]<<6:0)|(t>3?a[e.charAt(3)]:0),n=[l(r>>>16),l(r>>>8&255),l(255&r)];return n.length-=[0,0,2,1][i],n.join("")},C=i.atob&&"function"==typeof i.atob?function(e){return i.atob(e)}:function(e){return e.replace(/\S{1,4}/g,S)},w=function(e){return C(String(e).replace(/[^A-Za-z0-9\+\/]/g,""))},k=function(e){return String(e).replace(/[-_]/g,(function(e){return"-"==e?"+":"/"})).replace(/[^A-Za-z0-9\+\/]/g,"")},x=function(e){return function(e){return b(C(e))}(k(e))};i.Uint8Array&&(m=function(e){return Uint8Array.from(w(k(e)),(function(e){return e.charCodeAt(0)}))});var E=function(){var e=i.Base64;return i.Base64=s,e};if(i.Base64={VERSION:"2.6.4",atob:w,btoa:f,fromBase64:x,toBase64:v,utob:h,encode:v,encodeURI:function(e){return v(e,!0)},btou:b,decode:x,noConflict:E,fromUint8Array:n,toUint8Array:m},"function"==typeof Object.defineProperty){var T=function(e){return{value:e,enumerable:!1,writable:!0,configurable:!0}};i.Base64.extendString=function(){Object.defineProperty(String.prototype,"fromBase64",T((function(){return x(this)}))),Object.defineProperty(String.prototype,"toBase64",T((function(e){return v(this,e)}))),Object.defineProperty(String.prototype,"toBase64URI",T((function(){return v(this,!0)})))}}i.Meteor&&(Base64=i.Base64);e.exports?e.exports.Base64=i.Base64:void 0===(r=function(){return i.Base64}.apply(t,[]))||(e.exports=r);return{Base64:i.Base64}}(i)}("undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==i?i:this)}).call(this,i(/*! ./../@umijs/deps/compiled/webpack/4/global.js */"IyRk"))},JSwD: /*!************************************************************************!*\ !*** ./node_modules/@novnc/novnc/lib/vendor/pako/lib/zlib/inftrees.js ***! \************************************************************************/ /*! no static exports found */ /*! all exports used */ /*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,i){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,i,r,s,u,h,d){var f,p,g,v,m,y,_,b,S,C=d.bits,w=0,k=0,x=0,E=0,T=0,L=0,A=0,R=0,D=0,O=0,M=null,I=0,P=new n.Buf16(16),F=new n.Buf16(16),B=null,N=0;for(w=0;w<=15;w++)P[w]=0;for(k=0;k=1&&0===P[E];E--);T>E&&(T=E);if(0===E)return s[u++]=20971520,s[u++]=20971520,d.bits=1,0;for(x=1;x0&&(0===e||1!==E))return-1;for(F[1]=0,w=1;w<15;w++)F[w+1]=F[w]+P[w];for(k=0;k852||2===e&&D>592)return 1;for(;;){_=w-A,h[k]y?(b=B[N+h[k]],S=M[I+h[k]]):(b=96,S=0),f=1<>A)+(p-=f)]=_<<24|b<<16|S|0}while(0!==p);for(f=1<>=1;if(0!==f?(O&=f-1,O+=f):O=0,k++,0==--P[w]){if(w===E)break;w=t[i+h[k]]}if(w>T&&(O&v)!==g){for(0===A&&(A=T),m+=x,R=1<<(L=w-A);L+A852||2===e&&D>592)return 1;s[g=O&v]=T<<24|L<<16|m-u|0}}0!==O&&(s[m+O]=w-A<<24|64<<16|0);return d.bits=T,0};var n=function(e){if(e&&e.__esModule)return e;if(null===e||"object"!==r(e)&&"function"!=typeof e)return{default:e};var t=s();if(t&&t.has(e))return t.get(e);var i={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if(Object.prototype.hasOwnProperty.call(e,o)){var a=n?Object.getOwnPropertyDescriptor(e,o):null;a&&(a.get||a.set)?Object.defineProperty(i,o,a):i[o]=e[o]}i.default=e,t&&t.set(e,i);return i}(i(/*! ../utils/common.js */"6BzB"));function s(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return s=function(){return e},e}var o=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],a=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],l=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],c=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]},LCi9: /*!***************************************************************!*\ !*** ./node_modules/@novnc/novnc/lib/input/gesturehandler.js ***! \***************************************************************/ /*! no static exports found */ /*! all exports used */ /*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,i){"use strict";function r(e,t){for(var i=0;i0&&Date.now()-this._tracked[0].started>250)return this._state=0,void this._ignored.push(e);if(this._waitingRelease)return this._state=0,void this._ignored.push(e);switch(this._tracked.push({id:e,started:Date.now(),active:!0,firstX:t,firstY:i,lastX:t,lastY:i,angle:0}),this._tracked.length){case 1:this._startLongpressTimeout();break;case 2:this._state&=-26,this._stopLongpressTimeout();break;case 3:this._state&=-99;break;default:this._state=0}}}},{key:"_touchMove",value:function(e,t,i){var r=this._tracked.find((function(t){return t.id===e}));if(void 0!==r){r.lastX=t,r.lastY=i;var n=t-r.firstX,s=i-r.firstY;if(r.firstX===r.lastX&&r.firstY===r.lastY||(r.angle=180*Math.atan2(s,n)/Math.PI),!this._hasDetectedGesture()){if(Math.hypot(n,s)<50)return;if(this._state&=-24,this._stopLongpressTimeout(),1!==this._tracked.length&&(this._state&=-9),2!==this._tracked.length&&(this._state&=-97),2===this._tracked.length){var o=this._tracked.find((function(t){return t.id!==e}));if(Math.hypot(o.firstX-o.lastX,o.firstY-o.lastY)>50){var a=Math.abs(r.angle-o.angle);a=Math.abs((a+180)%360-180),this._state&=a>90?-33:-65,this._isTwoTouchTimeoutRunning()&&this._stopTwoTouchTimeout()}else this._isTwoTouchTimeoutRunning()||this._startTwoTouchTimeout()}if(!this._hasDetectedGesture())return;this._pushEvent("gesturestart")}this._pushEvent("gesturemove")}}},{key:"_touchEnd",value:function(e,t,i){if(-1!==this._ignored.indexOf(e))return this._ignored.splice(this._ignored.indexOf(e),1),void(0===this._ignored.length&&0===this._tracked.length&&(this._state=127,this._waitingRelease=!1));if(!this._hasDetectedGesture()&&this._isTwoTouchTimeoutRunning()&&(this._stopTwoTouchTimeout(),this._state=0),!this._hasDetectedGesture()&&(this._state&=-105,this._state&=-17,this._stopLongpressTimeout(),!this._waitingRelease))switch(this._releaseStart=Date.now(),this._waitingRelease=!0,this._tracked.length){case 1:this._state&=-7;break;case 2:this._state&=-6}if(this._waitingRelease)if(Date.now()-this._releaseStart>250&&(this._state=0),this._tracked.some((function(e){return Date.now()-e.started>1e3}))&&(this._state=0),this._tracked.find((function(t){return t.id===e})).active=!1,this._hasDetectedGesture())this._pushEvent("gesturestart");else if(0!==this._state)return;this._hasDetectedGesture()&&this._pushEvent("gestureend");for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:1,i=O.length,r=0;r1&&void 0!==arguments[1]&&arguments[1];return Object(x.a)(e).map((function(e,i){if(!a.isValidElement(e)||!e.type)return null;var r=e.type.isSelectOptGroup,n=e.key,s=e.props,o=s.children,l=Object(c.a)(s,["children"]);return t||!r?E(e):Object(k.a)(Object(k.a)({key:"__RC_SELECT_GRP__".concat(null===n?i:n,"__"),label:n},l),{},{options:T(o)})})).filter((function(e){return e}))}var L=i("2Qr1"),A=i("qNPg"),R=i("U8pU"),D=i("Kwbf"),O=i("WKfj");var M=function(e){var t=e.mode,i=e.options,r=e.children,n=e.backfill,s=e.allowClear,o=e.placeholder,l=e.getInputElement,c=e.showSearch,u=e.onSearch,h=e.defaultOpen,d=e.autoFocus,f=e.labelInValue,p=e.value,g=e.inputValue,v=e.optionLabelProp,m="multiple"===t||"tags"===t,y=void 0!==c?c:m||"combobox"===t,_=i||T(r);if(Object(D.a)("tags"!==t||_.every((function(e){return!e.disabled})),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),"tags"===t||"combobox"===t){var b=_.some((function(e){return e.options?e.options.some((function(e){return"number"==typeof("value"in e?e.value:e.key)})):"number"==typeof("value"in e?e.value:e.key)}));Object(D.a)(!b,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(D.a)("combobox"!==t||!v,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(D.a)("combobox"===t||!n,"`backfill` only works with `combobox` mode."),Object(D.a)("combobox"===t||!l,"`getInputElement` only work with `combobox` mode."),Object(D.b)("combobox"!==t||!l||!s||!o,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),u&&!y&&"combobox"!==t&&"tags"!==t&&Object(D.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(D.b)(!h||d,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),null!=p){var S=Object(O.d)(p);Object(D.a)(!f||S.every((function(e){return"object"===Object(R.a)(e)&&("key"in e||"value"in e)})),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(D.a)(!m||Array.isArray(p),"`value` should be array when `mode` is `multiple` or `tags`")}if(r){var C=null;Object(x.a)(r).some((function(e){if(!a.isValidElement(e)||!e.type)return!1;var t=e.type;return!t.isSelectOption&&(t.isSelectOptGroup?!Object(x.a)(e.props.children).every((function(t){return!(a.isValidElement(t)&&e.type&&!t.type.isSelectOption)||(C=t.type,!1)})):(C=t,!0))})),C&&Object(D.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(C.displayName||C.name||C,"`.")),Object(D.a)(void 0===g,"`inputValue` is deprecated, please use `searchValue` instead.")}},I=Object(A.a)({prefixCls:"rc-select",components:{optionList:_},convertChildrenToData:T,flattenOptions:L.d,getLabeledValue:L.e,filterOptions:L.b,isValueDisabled:L.g,findValueOption:L.c,warningProps:M,fillOptionsWithMissingValue:L.a}),P=function(e){Object(s.a)(i,e);var t=Object(o.a)(i);function i(){var e;return Object(r.a)(this,i),(e=t.apply(this,arguments)).selectRef=a.createRef(),e.focus=function(){e.selectRef.current.focus()},e.blur=function(){e.selectRef.current.blur()},e}return Object(n.a)(i,[{key:"render",value:function(){return a.createElement(I,Object.assign({ref:this.selectRef},this.props))}}]),i}(a.Component);P.Option=S,P.OptGroup=w;var F=P;t.c=F},Lmeb: /*!*********************************************!*\ !*** ./src/pages/tasks/vnc-view/index.less ***! \*********************************************/ /*! no static exports found */ /*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,i){},Lo0S: /*!*******************************************************!*\ !*** ./node_modules/@novnc/novnc/lib/util/logging.js ***! \*******************************************************/ /*! no static exports found */ /*! all exports used */ /*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.initLogging=l,t.getLogging=function(){return r},t.Error=t.Warn=t.Info=t.Debug=void 0;var r="warn",n=function(){};t.Debug=n;var s=function(){};t.Info=s;var o=function(){};t.Warn=o;var a=function(){};function l(e){if(void 0===e?e=r:r=e,t.Debug=n=t.Info=s=t.Warn=o=t.Error=a=function(){},void 0!==window.console)switch(e){case"debug":t.Debug=n=console.debug.bind(window.console);case"info":t.Info=s=console.info.bind(window.console);case"warn":t.Warn=o=console.warn.bind(window.console);case"error":t.Error=a=console.error.bind(window.console);case"none":break;default:throw new window.Error("invalid logging type '"+e+"'")}}t.Error=a,l()},M8RZ: /*!**********************************!*\ !*** ./src/components/modal.tsx ***! \**********************************/ /*! exports provided: default */ /*! exports used: default */function(e,t,i){"use strict";i.d(t,"a",(function(){return u}));var r=i(/*! ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/classCallCheck */"fWQN"),n=i(/*! ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/createClass */"mtLc"),s=i(/*! ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/inherits */"yKVA"),o=i(/*! ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/createSuper */"879j"),a=i(/*! react */"q1tI"),l=i.n(a),c=i(/*! react-dom */"i8i4"),u=function(e){Object(s.a)(i,e);var t=Object(o.a)(i);function i(e){var n;Object(r.a)(this,i),n=t.call(this,e);var s=window.document;return n.node=s.createElement("div"),s.body.appendChild(n.node),n}return Object(n.a)(i,[{key:"render",value:function(){var e=this.props.children;return Object(c.createPortal)(e,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),i}(l.a.Component)},MZdM: /*!**************************************************!*\ !*** ./node_modules/@novnc/novnc/lib/display.js ***! \**************************************************/ /*! no static exports found */ /*! all exports used */ /*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,i){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n,s=function(e){if(e&&e.__esModule)return e;if(null===e||"object"!==r(e)&&"function"!=typeof e)return{default:e};var t=c();if(t&&t.has(e))return t.get(e);var i={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){var o=n?Object.getOwnPropertyDescriptor(e,s):null;o&&(o.get||o.set)?Object.defineProperty(i,s,o):i[s]=e[s]}i.default=e,t&&t.set(e,i);return i}(i(/*! ./util/logging.js */"Lo0S")),o=(n=i(/*! ./base64.js */"N/zr"))&&n.__esModule?n:{default:n},a=i(/*! ./util/browser.js */"GdRQ"),l=i(/*! ./util/int.js */"GQ8N");function c(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return c=function(){return e},e}function u(e,t){for(var i=0;i> Display.constructor"),this._target=t,!this._target)throw new Error("Target must be set");if("string"==typeof this._target)throw new Error("target must be a DOM element");if(!this._target.getContext)throw new Error("no getContext method");if(this._targetCtx=this._target.getContext("2d"),this._viewportLoc={x:0,y:0,w:this._target.width,h:this._target.height},this._backbuffer=document.createElement("canvas"),this._drawCtx=this._backbuffer.getContext("2d"),this._damageBounds={left:0,top:0,right:this._backbuffer.width,bottom:this._backbuffer.height},s.Debug("User Agent: "+navigator.userAgent),!("createImageData"in this._drawCtx))throw new Error("Canvas does not support createImageData");this._tile16x16=this._drawCtx.createImageData(16,16),s.Debug("<< Display.constructor"),this._scale=1,this._clipViewport=!1,this.onflush=function(){}}var t,i,r;return t=e,(i=[{key:"viewportChangePos",value:function(e,t){var i=this._viewportLoc;e=Math.floor(e),t=Math.floor(t),this._clipViewport||(e=-i.w,t=-i.h);var r=i.x+i.w-1,n=i.y+i.h-1;e<0&&i.x+e<0&&(e=-i.x),r+e>=this._fbWidth&&(e-=r+e-this._fbWidth+1),i.y+t<0&&(t=-i.y),n+t>=this._fbHeight&&(t-=n+t-this._fbHeight+1),0===e&&0===t||(s.Debug("viewportChange deltaX: "+e+", deltaY: "+t),i.x+=e,i.y+=t,this._damage(i.x,i.y,i.w,i.h),this.flip())}},{key:"viewportChangeSize",value:function(e,t){this._clipViewport&&void 0!==e&&void 0!==t||(s.Debug("Setting viewport to full display region"),e=this._fbWidth,t=this._fbHeight),e=Math.floor(e),t=Math.floor(t),e>this._fbWidth&&(e=this._fbWidth),t>this._fbHeight&&(t=this._fbHeight);var i=this._viewportLoc;if(i.w!==e||i.h!==t){i.w=e,i.h=t;var r=this._target;r.width=e,r.height=t,this.viewportChangePos(0,0),this._damage(i.x,i.y,i.w,i.h),this.flip(),this._rescale(this._scale)}}},{key:"absX",value:function(e){return 0===this._scale?0:(0,l.toSigned32bit)(e/this._scale+this._viewportLoc.x)}},{key:"absY",value:function(e){return 0===this._scale?0:(0,l.toSigned32bit)(e/this._scale+this._viewportLoc.y)}},{key:"resize",value:function(e,t){this._prevDrawStyle="",this._fbWidth=e,this._fbHeight=t;var i=this._backbuffer;if(i.width!==e||i.height!==t){var r=null;i.width>0&&i.height>0&&(r=this._drawCtx.getImageData(0,0,i.width,i.height)),i.width!==e&&(i.width=e),i.height!==t&&(i.height=t),r&&this._drawCtx.putImageData(r,0,0)}var n=this._viewportLoc;this.viewportChangeSize(n.w,n.h),this.viewportChangePos(0,0)}},{key:"_damage",value:function(e,t,i,r){ethis._damageBounds.right&&(this._damageBounds.right=e+i),t+r>this._damageBounds.bottom&&(this._damageBounds.bottom=t+r)}},{key:"flip",value:function(e){if(0===this._renderQ.length||e){var t=this._damageBounds.left,i=this._damageBounds.top,r=this._damageBounds.right-t,n=this._damageBounds.bottom-i,s=t-this._viewportLoc.x,o=i-this._viewportLoc.y;s<0&&(r+=s,t-=s,s=0),o<0&&(n+=o,i-=o,o=0),s+r>this._viewportLoc.w&&(r=this._viewportLoc.w-s),o+n>this._viewportLoc.h&&(n=this._viewportLoc.h-o),r>0&&n>0&&this._targetCtx.drawImage(this._backbuffer,t,i,r,n,s,o,r,n),this._damageBounds.left=this._damageBounds.top=65535,this._damageBounds.right=this._damageBounds.bottom=0}else this._renderQPush({type:"flip"})}},{key:"pending",value:function(){return this._renderQ.length>0}},{key:"flush",value:function(){0===this._renderQ.length?this.onflush():this._flushing=!0}},{key:"fillRect",value:function(e,t,i,r,n,s){0===this._renderQ.length||s?(this._setFillColor(n),this._drawCtx.fillRect(e,t,i,r),this._damage(e,t,i,r)):this._renderQPush({type:"fill",x:e,y:t,width:i,height:r,color:n})}},{key:"copyImage",value:function(e,t,i,r,n,s,o){0===this._renderQ.length||o?(this._drawCtx.mozImageSmoothingEnabled=!1,this._drawCtx.webkitImageSmoothingEnabled=!1,this._drawCtx.msImageSmoothingEnabled=!1,this._drawCtx.imageSmoothingEnabled=!1,this._drawCtx.drawImage(this._backbuffer,e,t,n,s,i,r,n,s),this._damage(i,r,n,s)):this._renderQPush({type:"copy",oldX:e,oldY:t,x:i,y:r,width:n,height:s})}},{key:"imageRect",value:function(e,t,i,r,n,s){if(0!==i&&0!==r){var a=new Image;a.src="data: "+n+";base64,"+o.default.encode(s),this._renderQPush({type:"img",img:a,x:e,y:t,width:i,height:r})}}},{key:"startTile",value:function(e,t,i,r,n){this._tileX=e,this._tileY=t,this._tile=16===i&&16===r?this._tile16x16:this._drawCtx.createImageData(i,r);for(var s=n[2],o=n[1],a=n[0],l=this._tile.data,c=0;c=n?e/r.w:t/r.h}this._rescale(i)}},{key:"_rescale",value:function(e){this._scale=e;var t=this._viewportLoc,i=e*t.w+"px",r=e*t.h+"px";this._target.style.width===i&&this._target.style.height===r||(this._target.style.width=i,this._target.style.height=r)}},{key:"_setFillColor",value:function(e){var t="rgb("+e[2]+","+e[1]+","+e[0]+")";t!==this._prevDrawStyle&&(this._drawCtx.fillStyle=t,this._prevDrawStyle=t)}},{key:"_rgbImageData",value:function(e,t,i,r,n,s){for(var o=this._drawCtx.createImageData(i,r),a=o.data,l=0,c=s;l0;){var t=this._renderQ[0];switch(t.type){case"flip":this.flip(!0);break;case"copy":this.copyImage(t.oldX,t.oldY,t.x,t.y,t.width,t.height,!0);break;case"fill":this.fillRect(t.x,t.y,t.width,t.height,t.color,!0);break;case"blit":this.blitImage(t.x,t.y,t.width,t.height,t.data,0,!0);break;case"blitRgb":this.blitRgbImage(t.x,t.y,t.width,t.height,t.data,0,!0);break;case"blitRgbx":this.blitRgbxImage(t.x,t.y,t.width,t.height,t.data,0,!0);break;case"img":if(t.img.complete&&0!==t.img.width&&0!==t.img.height){if(t.img.width!==t.width||t.img.height!==t.height)return void s.Error("Decoded image has incorrect dimensions. Got "+t.img.width+"x"+t.img.height+". Expected "+t.width+"x"+t.height+".");this.drawImage(t.img,t.x,t.y)}else t.img._noVNCDisplay=this,t.img.addEventListener("load",this._resumeRenderQ),e=!1}e&&this._renderQ.shift()}0===this._renderQ.length&&this._flushing&&(this._flushing=!1,this.onflush())}},{key:"scale",get:function(){return this._scale},set:function(e){this._rescale(e)}},{key:"clipViewport",get:function(){return this._clipViewport},set:function(e){this._clipViewport=e;var t=this._viewportLoc;this.viewportChangeSize(t.w,t.h),this.viewportChangePos(0,0)}},{key:"width",get:function(){return this._fbWidth}},{key:"height",get:function(){return this._fbHeight}}])&&u(t.prototype,i),r&&u(t,r),e}();t.default=h},Mmt2: /*!**************************************************!*\ !*** ./node_modules/@novnc/novnc/lib/websock.js ***! \**************************************************/ /*! no static exports found */ /*! all exports used */ /*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,i){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=function(e){if(e&&e.__esModule)return e;if(null===e||"object"!==r(e)&&"function"!=typeof e)return{default:e};var t=s();if(t&&t.has(e))return t.get(e);var i={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if(Object.prototype.hasOwnProperty.call(e,o)){var a=n?Object.getOwnPropertyDescriptor(e,o):null;a&&(a.get||a.set)?Object.defineProperty(i,o,a):i[o]=e[o]}i.default=e,t&&t.set(e,i);return i}(i(/*! ./util/logging.js */"Lo0S"));function s(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return s=function(){return e},e}function o(e,t){for(var i=0;i=0;i--)t+=this._rQ[this._rQi++]<<8*i;return t}},{key:"rQshiftStr",value:function(e){void 0===e&&(e=this.rQlen);for(var t="",i=0;i1&&void 0!==arguments[1]?arguments[1]:this.rQlen;return new Uint8Array(this._rQ.buffer,this._rQi+e,t-e)}},{key:"rQwait",value:function(e,t,i){if(this.rQlen0&&this._websocket.readyState===WebSocket.OPEN&&(this._websocket.send(this._encodeMessage()),this._sQlen=0)}},{key:"send",value:function(e){this._sQ.set(e,this._sQlen),this._sQlen+=e.length,this.flush()}},{key:"sendString",value:function(e){this.send(e.split("").map((function(e){return e.charCodeAt(0)})))}},{key:"off",value:function(e){this._eventHandlers[e]=function(){}}},{key:"on",value:function(e,t){this._eventHandlers[e]=t}},{key:"_allocateBuffers",value:function(){this._rQ=new Uint8Array(this._rQbufferSize),this._sQ=new Uint8Array(this._sQbufferSize)}},{key:"init",value:function(){this._allocateBuffers(),this._rQi=0,this._websocket=null}},{key:"open",value:function(e,t){var i=this;this.init(),this._websocket=new WebSocket(e,t),this._websocket.binaryType="arraybuffer",this._websocket.onmessage=this._recvMessage.bind(this),this._websocket.onopen=function(){n.Debug(">> WebSock.onopen"),i._websocket.protocol&&n.Info("Server choose sub-protocol: "+i._websocket.protocol),i._eventHandlers.open(),n.Debug("<< WebSock.onopen")},this._websocket.onclose=function(e){n.Debug(">> WebSock.onclose"),i._eventHandlers.close(e),n.Debug("<< WebSock.onclose")},this._websocket.onerror=function(e){n.Debug(">> WebSock.onerror: "+e),i._eventHandlers.error(e),n.Debug("<< WebSock.onerror: "+e)}}},{key:"close",value:function(){this._websocket&&(this._websocket.readyState!==WebSocket.OPEN&&this._websocket.readyState!==WebSocket.CONNECTING||(n.Info("Closing WebSocket connection"),this._websocket.close()),this._websocket.onmessage=function(){})}},{key:"_encodeMessage",value:function(){return new Uint8Array(this._sQ.buffer,0,this._sQlen)}},{key:"_expandCompactRQ",value:function(e){var t=8*(this._rQlen-this._rQi+e),i=this._rQbufferSize41943040&&(this._rQbufferSize=41943040,this._rQbufferSize-this.rQlenthis._rQbufferSize-this._rQlen&&this._expandCompactRQ(t.length),this._rQ.set(t,this._rQlen),this._rQlen+=t.length}},{key:"_recvMessage",value:function(e){this._DecodeMessage(e.data),this.rQlen>0?(this._eventHandlers.message(),this._rQlen==this._rQi&&(this._rQlen=0,this._rQi=0)):n.Debug("Ignoring empty message")}},{key:"sQ",get:function(){return this._sQ}},{key:"rQ",get:function(){return this._rQ}},{key:"rQi",get:function(){return this._rQi},set:function(e){this._rQi=e}},{key:"rQlen",get:function(){return this._rQlen-this._rQi}}])&&o(t.prototype,i),r&&o(t,r),e}();t.default=a},"N/zr": /*!*************************************************!*\ !*** ./node_modules/@novnc/novnc/lib/base64.js ***! \*************************************************/ /*! no static exports found */ /*! all exports used */ /*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,i){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=function(e){if(e&&e.__esModule)return e;if(null===e||"object"!==r(e)&&"function"!=typeof e)return{default:e};var t=s();if(t&&t.has(e))return t.get(e);var i={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if(Object.prototype.hasOwnProperty.call(e,o)){var a=n?Object.getOwnPropertyDescriptor(e,o):null;a&&(a.get||a.set)?Object.defineProperty(i,o,a):i[o]=e[o]}i.default=e,t&&t.set(e,i);return i}(i(/*! ./util/logging.js */"Lo0S"));function s(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return s=function(){return e},e}var o={toBase64Table:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".split(""),base64Pad:"=",encode:function(e){for(var t="",i=e.length,r=i%3,n=0;n>2],t+=this.toBase64Table[((3&e[n])<<4)+(e[n+1]>>4)],t+=this.toBase64Table[((15&e[n+1])<<2)+(e[n+2]>>6)],t+=this.toBase64Table[63&e[n+2]];var s=i-r;return 2===r?(t+=this.toBase64Table[e[s]>>2],t+=this.toBase64Table[((3&e[s])<<4)+(e[s+1]>>4)],t+=this.toBase64Table[(15&e[s+1])<<2],t+=this.toBase64Table[64]):1===r&&(t+=this.toBase64Table[e[s]>>2],t+=this.toBase64Table[(3&e[s])<<4],t+=this.toBase64Table[64],t+=this.toBase64Table[64]),t},toBinaryTable:[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,0,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,-1,-1,-1,-1,-1],decode:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=e.indexOf("=")-t;i<0&&(i=e.length-t);for(var r=3*(i>>2)+Math.floor(i%4/1.5),s=new Array(r),o=0,a=0,l=0,c=t;c=8&&(o-=8,h||(s[l++]=a>>o&255),a&=(1<=0?"Cmd":"Ctrl",J=["pptm","pptx","ppt","pot","pps","ppa","potx","ppsx","ppam","pptm","potm","ppsm","doc","docx","dot","dotx","docm","dotm","xls","xlsx","csv","xlt","xla","xltx","xlsm","xltm","xlam","xlsb"],ee=(H={},Object(l.a)(H,$+"-B","bold"),Object(l.a)(H,$+"-I","italic"),H),te=(j={},Object(l.a)(j,"link","添加链接"),Object(l.a)(j,"code-block","添加代码块"),Object(l.a)(j,"upload-image","添加文件"),Object(l.a)(j,"add-table","添加表格"),j);t.a=function(e){var t=e.defaultValue,i=void 0===t?"":t,c=e.onChange,f=e.width,y=void 0===f?"100%":f,_=e.height,S=void 0===_?400:_,C=e.miniToolbar,x=void 0!==C&&C,E=e.isFocus,T=void 0!==E&&E,L=e.watch,D=e.insertTemp,O=e.mode,M=void 0===O?"markdown":O,I=e.id,P=void 0===I?"markdown-editor-id":I,B=e.showResizeBar,H=void 0!==B&&B,j=e.noStorage,U=void 0!==j&&j,K=e.showNullButton,X=void 0!==K&&K,W=e.hidetoolBar,q=void 0!==W&&W,$=e.fullScreen,ie=void 0!==$&&$,re=e.onBlur,ne=e.onCMBeforeChange,se=e.onFullScreen,oe=e.className,ae=void 0===oe?"":oe,le=e.disablePaste,ce=void 0!==le&&le,ue=e.placeholder,he=void 0===ue?"":ue,de=e.values,fe=void 0===de?"":de,pe=Object(h.useState)(null),ge=Object(a.a)(pe,2),ve=ge[0],me=ge[1],ye=Object(h.useState)(i),_e=Object(a.a)(ye,2),be=_e[0],Se=_e[1],Ce=Object(h.useState)(L),we=Object(a.a)(Ce,2),ke=we[0],xe=we[1],Ee=Object(h.useState)(ie),Te=Object(a.a)(Ee,2),Le=Te[0],Ae=Te[1],Re=Object(h.useState)(""),De=Object(a.a)(Re,2),Oe=De[0],Me=De[1],Ie=Object(h.useState)(0),Pe=Object(a.a)(Ie,2),Fe=Pe[0],Be=Pe[1],Ne=Object(h.useState)(S),He=Object(a.a)(Ne,2),je=He[0],Ue=He[1],Ke=Object(h.useState)(!1),Xe=Object(a.a)(Ke,2),We=(Xe[0],Xe[1]),ze=Object(h.useRef)(Object(V.a)()),Ge=Object(h.useRef)(!1),Ve=Object(h.useRef)(),qe=Object(h.useRef)(),Qe=Object(h.useRef)(),Ye=Object(h.useRef)(),Ze=Object(h.useRef)(),$e=function(){var e=Object(o.a)(u.a.mark((function e(){var t,i;return u.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Object(G.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:ze.current}});case 2:null!=(i=e.sent)&&null!==(t=i.attachments)&&void 0!==t&&t.length&&(console.log("cm:",ve,qe),i.attachments.map((function(e){e.content_type.indexOf("image")>-1?ve.replaceSelection("![,](/api/attachments/".concat(e.id,"?type=").concat(e.content_type,")")):e.content_type.indexOf("video")>-1?ve.replaceSelection('')):e.content_type.indexOf("pdf")>-1?ve.replaceSelection('
    ').concat(e.name,"")):ve.replaceSelection("[".concat(e.name,"](").concat(b.a.API_SERVER,"/api/attachments/").concat(e.id,"?type=").concat(e.content_type,")"))})));case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();Object(h.useEffect)((function(){Se(fe),null==ve||ve.setValue(fe)}),[fe]),Object(h.useEffect)((function(){null==se||se(Le)}),[Le]),Object(h.useEffect)((function(){if(qe.current){var e=p.a.fromTextArea(qe.current,{mode:M,lineNumbers:!x,lineWrapping:!0,value:i,autoCloseTags:!0,autoCloseBrackets:!0});function t(t,i){if(!ce){var r=i.clipboardData;if(r){var n=r.types.toString(),o=r.items;if("Files"===n||r.types.indexOf("Files")>-1){if(i.preventDefault(),"stex"==M)return;try{var a,l=o[1];"file"===(null===(a=o[0])||void 0===a?void 0:a.kind)&&(l=o[0]);var c=l.getAsFile(),u=c.name.split(".").pop();N(c,(function(t){var i,r,n;t.id?(null==c||null===(i=c.type)||void 0===i?void 0:i.indexOf("image"))>-1?e.replaceSelection("![,](/api/attachments/".concat(t.id,"?type=").concat(t.content_type,")")):(null==c||null===(r=c.type)||void 0===r?void 0:r.indexOf("video"))>-1?e.replaceSelection('')):(null==c||null===(n=c.type)||void 0===n?void 0:n.indexOf("pdf"))>-1?e.replaceSelection('').concat(c.name,"")):J.includes(u)?e.replaceSelection('').concat(c.name,"")):e.replaceSelection("[".concat(c.name,"](").concat(b.a.API_SERVER,"/api/attachments/").concat(t.id,"?type=").concat(t.content_type,")")):401===(null==t?void 0:t.status)&&(document.location.href="/user/login")}))}catch(i){s.b.warn("请使用chrome浏览器粘贴")}return!0}return!0}return!0}i.preventDefault()}return T&&e.focus(),e.on("paste",t),e.on("dragleave",(function(e,t){Qe.current.classList.remove("mouse-hover-md")})),e.on("dragover",(function(e,t){Qe.current.classList.add("mouse-hover-md")})),e.on("drop",(function(t,i){var r;if(Qe.current.classList.add("mouse-hover-md"),(r=i.dataTransfer.files).length>0){i.preventDefault(),i.stopPropagation();for(var n=function(t){var i=r[t],n=i.name.split(".").pop();N(i,(function(t){var r,s,o;t.id?(null==i||null===(r=i.type)||void 0===r?void 0:r.indexOf("image"))>-1?e.replaceSelection("![,](/api/attachments/".concat(t.id,"?type=").concat(t.content_type,")")):(null==i||null===(s=i.type)||void 0===s?void 0:s.indexOf("video"))>-1?e.replaceSelection('')):(null==i||null===(o=i.type)||void 0===o?void 0:o.indexOf("pdf"))>-1?e.replaceSelection('').concat(i.name,"")):J.includes(n)?e.replaceSelection('').concat(i.name,"")):e.replaceSelection("[".concat(i.name,"](").concat(b.a.API_SERVER,"/api/attachments/").concat(t.id,"?type=").concat(t.content_type,")")):401===(null==t?void 0:t.status)&&(document.location.href="/user/login")}))},s=0;s0||r.target.offsetWidth>0)&&(Je(),ve.setSize("100%","100%"),ve.refresh())}}catch(e){i.e(e)}finally{i.f()}}));return e.observe(qe.current.parentElement),e}();return function(){e.unobserve(qe.current.parentElement)}}}),[ve,Je]),Object(h.useEffect)((function(){if(ve){for(var e=[],t=function(){var t=r[i],n=(s=Object(a.a)(t,2))[0],o=s[1],c=Object(l.a)({},n,(function(){et(o)}));e.push(c),ve.addKeyMap(c)},i=0,r=Object.entries(ee);i0){var e=(new Date).getTime(),t=window.sessionStorage.getItem(P);e>=Fe+1e4&&(!t||t!==be)&&(window.sessionStorage.setItem(P,be),We(!0))}}),1e4),Object(h.useEffect)((function(){xe(L)}),[ve,L]),Object(h.useEffect)((function(){ve&&T&&ve.focus()}),[ve,T]),Object(h.useEffect)((function(){if(ke&&ve){var e=ve.getScrollerElement();function t(e){var t=e.target;if(Ze.current){var i=t.scrollTop/t.scrollHeight;Ze.current.scrollTop=Ze.current.scrollHeight*i}}return e.addEventListener("scroll",t),function(){e.removeEventListener("scroll",t)}}}),[ve,ke]),Object(h.useEffect)((function(){if(ve&&ne){function e(e,t){ne(e,t)}return ve.on("beforeChange",e),function(){ve.off("beforeChange",e)}}}),[ve,ne]),Object(h.useEffect)((function(){if(ve&&re){function e(){re(ve.getValue())}return ve.on("blur",e),function(){ve.off("blur",e)}}}),[ve,re]),Object(h.useEffect)((function(){if(ve){function e(e){var t=e.getValue();Se(t),Be((new Date).getTime()),e.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),c&&c(t)}return ve.on("change",e),function(){ve.off("change",e)}}}),[ve,c]),Object(h.useEffect)((function(){ve&&(null==i?(ve.setValue(""),Se("")):i!==ve.getValue()&&(ve.setValue(i),Se(i),ve.setCursor(ve.lineCount(),0)))}),[ve,i]);var et=Object(h.useCallback)((function(e){var t=ve.getCursor(),i=ve.getSelection(),r=i.split("\n");switch(e){case"bold":return ve.replaceSelection("**"+i+"**"),""===i&&ve.setCursor(t.line,t.ch+2),ve.focus();case"italic":return ve.replaceSelection("*"+i+"*"),""===i&&ve.setCursor(t.line,t.ch+1),ve.focus();case"code":return ve.replaceSelection("`"+i+"`"),""===i&&ve.setCursor(t.line,t.ch+1),ve.focus();case"inline-latex":return ve.replaceSelection("`$$"+i+"$$`"),""===i&&ve.setCursor(t.line,t.ch+3),ve.focus();case"latex":return ve.replaceSelection("```latex\n"+i+"\n```"),ve.setCursor(t.line+1,i.length+1),ve.focus();case"line-break":return ve.replaceSelection("
    \n"),ve.focus();case"list-ul":return""===i?ve.replaceSelection("- "+i):ve.replaceSelection(r.map((function(e){return""===e?"":"- ".concat(e)})).join("\n")),ve.focus();case"list-ol":return""===i?ve.replaceSelection("1. "+i):ve.replaceSelection(r.map((function(e,t){return""===e?"":"".concat(t+1,". ").concat(e)})).join("\n")),ve.focus();case"add-null-ch":return""===i&&ve.setCursor(t.line,t.ch+1),ve.replaceSelection("▁"),ve.focus();case"inster-template-1":return""===i&&ve.setCursor(t.line,t.ch),ve.replaceSelection("\n**模板标题**\n模板正文内容,可输入文本内容和粘贴图片等操作"),ve.focus();case"eraser":return ve.setValue(""),ve.focus();case"trigger-watch":return xe(!ke),ve.focus();case"trigger-full-screen":return Ae(!Le),ve.focus();case"link":return void Me("link");case"code-block":return void Me("code-block");case"upload-image":return void Me("upload-image");case"add-table":return void Me("add-table");default:throw new Error}}),[ve,ke,Le]),tt=Object(h.useCallback)((function(e){switch(Me(""),Oe){case"link":var t=e.title,i=e.link;return ve.replaceSelection("[".concat(t,"](").concat(i,")")),ve.focus();case"code-block":var r=e.language,n=e.content;return ve.replaceSelection(["```"+r,n,"```"].join("\n")),ve.focus();case"upload-image":var s=e.src,o=e.alt,a=e.name;return s.indexOf("type=image")>-1?ve.replaceSelection("![ ".concat(o||""," ]( ").concat(s,' "').concat(o||"",'" )')):s.indexOf("type=application/pdf")>-1?ve.replaceSelection('').concat(a,"")):ve.replaceSelection('').concat(a,"")),ve.focus();case"add-table":for(var l=e.row,c=e.col,u=e.align,h="\n",d=0;d300&&(r=300),Ue(S+r+"px")}}return e.addEventListener("mousedown",r),document.addEventListener("mousemove",s),document.addEventListener("mouseup",n),function(){e.removeEventListener("mousedown",r),document.removeEventListener("mousemove",s),document.removeEventListener("mouseup",n)}}}),[ve,Ye]),Object(h.useEffect)((function(){Ue(S)}),[S]);var nt={width:Z(y),height:Z(je)};Object(h.useMemo)((function(){if(Fe){var e=new Date(Fe),t=e.getHours(),i=e.getMinutes(),r=e.getSeconds();return i=i<10?"0"+i:i,r=r<10?"0"+r:r,"".concat(t=t<10?"0"+t:t,":").concat(i,":").concat(r)}return 0}),[Fe]);return d.a.createElement(h.Fragment,null,d.a.createElement("div",{className:"markdown-editor-wrapper",ref:Qe},d.a.createElement("div",{className:"markdown-editor-container ".concat(ae," ").concat(ke?"on-preview":""," ").concat(x?"mini":""," ").concat(Le?"full-screen":""),style:nt},d.a.createElement(w,{insertTemp:D,watch:ke,fullScreen:Le,showNullButton:X,onActionCallback:et,hidetoolBar:q,uuid:ze.current,setOpenPhones:function(){Ge.current=!0}}),d.a.createElement("div",{className:"markdown-editor-body"},d.a.createElement("div",{className:"codemirror-container"},d.a.createElement("textarea",{ref:qe,placeholder:he})),ke?d.a.createElement("div",{ref:Ze,className:"preview-container"},"stex"===M&&d.a.createElement(m,{value:be}),"stex"!==M&&d.a.createElement(v.a,{edit:!0,value:be,replaces:function(e,t){var i=ve.getValue();i=i.replace(e,t),Se(i),null==ve||ve.setValue(i)}})):null))),H?d.a.createElement("a",{ref:Ye,className:"editor-resize"}):null,d.a.createElement(k.a,null,te[Oe]?d.a.createElement(r.a,{centered:!0,title:te[Oe],visible:!0,onCancel:rt,footer:null},it):null))}},P2ho: /*!************************************************************!*\ !*** ./node_modules/@novnc/novnc/lib/input/xtscancodes.js ***! \************************************************************/ /*! no static exports found */ /*! all exports used */ /*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;t.default={Again:57349,AltLeft:56,AltRight:57400,ArrowDown:57424,ArrowLeft:57419,ArrowRight:57421,ArrowUp:57416,AudioVolumeDown:57390,AudioVolumeMute:57376,AudioVolumeUp:57392,Backquote:41,Backslash:43,Backspace:14,BracketLeft:26,BracketRight:27,BrowserBack:57450,BrowserFavorites:57446,BrowserForward:57449,BrowserHome:57394,BrowserRefresh:57447,BrowserSearch:57445,BrowserStop:57448,CapsLock:58,Comma:51,ContextMenu:57437,ControlLeft:29,ControlRight:57373,Convert:121,Copy:57464,Cut:57404,Delete:57427,Digit0:11,Digit1:2,Digit2:3,Digit3:4,Digit4:5,Digit5:6,Digit6:7,Digit7:8,Digit8:9,Digit9:10,Eject:57469,End:57423,Enter:28,Equal:13,Escape:1,F1:59,F10:68,F11:87,F12:88,F13:93,F14:94,F15:95,F16:85,F17:57347,F18:57463,F19:57348,F2:60,F20:90,F21:116,F22:57465,F23:109,F24:111,F3:61,F4:62,F5:63,F6:64,F7:65,F8:66,F9:67,Find:57409,Help:57461,Hiragana:119,Home:57415,Insert:57426,IntlBackslash:86,IntlRo:115,IntlYen:125,KanaMode:112,Katakana:120,KeyA:30,KeyB:48,KeyC:46,KeyD:32,KeyE:18,KeyF:33,KeyG:34,KeyH:35,KeyI:23,KeyJ:36,KeyK:37,KeyL:38,KeyM:50,KeyN:49,KeyO:24,KeyP:25,KeyQ:16,KeyR:19,KeyS:31,KeyT:20,KeyU:22,KeyV:47,KeyW:17,KeyX:45,KeyY:21,KeyZ:44,Lang3:120,Lang4:119,Lang5:118,LaunchApp1:57451,LaunchApp2:57377,LaunchMail:57452,MediaPlayPause:57378,MediaSelect:57453,MediaStop:57380,MediaTrackNext:57369,MediaTrackPrevious:57360,MetaLeft:57435,MetaRight:57436,Minus:12,NonConvert:123,NumLock:69,Numpad0:82,Numpad1:79,Numpad2:80,Numpad3:81,Numpad4:75,Numpad5:76,Numpad6:77,Numpad7:71,Numpad8:72,Numpad9:73,NumpadAdd:78,NumpadComma:126,NumpadDecimal:83,NumpadDivide:57397,NumpadEnter:57372,NumpadEqual:89,NumpadMultiply:55,NumpadParenLeft:57462,NumpadParenRight:57467,NumpadSubtract:74,Open:100,PageDown:57425,PageUp:57417,Paste:101,Pause:57414,Period:52,Power:57438,PrintScreen:84,Props:57350,Quote:40,ScrollLock:70,Semicolon:39,ShiftLeft:42,ShiftRight:54,Slash:53,Sleep:57439,Space:57,Suspend:57381,Tab:15,Undo:57351,WakeUp:57443}},QV2g: /*!*********************************************************************!*\ !*** ./node_modules/@novnc/novnc/lib/vendor/pako/lib/zlib/crc32.js ***! \*********************************************************************/ /*! no static exports found */ /*! all exports used */ /*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,i){"use strict";function r(){for(var e,t=[],i=0;i<256;i++){e=i;for(var r=0;r<8;r++)e=1&e?3988292384^e>>>1:e>>>1;t[i]=e}return t}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r;r()},SJMd: /*!****************************************************!*\ !*** ./node_modules/code-prettify/src/prettify.js ***! \****************************************************/ /*! no static exports found */ /*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t){window.PR_SHOULD_USE_CONTINUATION=!0,function(){var e=window,t=["break,continue,do,else,for,if,return,while"],i=[[t,"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"],"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],r=[i,"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"],n=[i,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],s=[i,"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"],o=[i,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],a="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",l=[t,"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"],c=[t,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],u=[t,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],h=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/;function d(e,t,i,r,n){if(i){var s={sourceNode:e,pre:1,langExtension:null,numberLines:null,sourceCode:i,spans:null,basePos:t,decorations:null};r(s),n.push.apply(n,s.decorations)}}var f=/\S/;function p(e){for(var t=void 0,i=e.firstChild;i;i=i.nextSibling){var r=i.nodeType;t=1===r?t?e:i:3===r&&f.test(i.nodeValue)?e:t}return t===e?void 0:t}function g(e,t){var i,r={};!function(){for(var n=e.concat(t),s=[],o={},a=0,l=n.length;a=0;)r[u.charAt(h)]=c;var d=c[1],f=""+d;o.hasOwnProperty(f)||(s.push(d),o[f]=null)}s.push(/[\0-\uffff]/),i=function(e){for(var t=0,i=!1,r=!1,n=0,s=e.length;n122||(u<65||h>90||i.push([32|Math.max(65,h),32|Math.min(u,90)]),u<97||h>122||i.push([-33&Math.max(97,h),-33&Math.min(u,122)]))}}i.sort((function(e,t){return e[0]-t[0]||t[1]-e[1]}));var d=[],f=[];for(s=0;sp[0]&&(p[1]+1>p[0]&&n.push("-"),n.push(l(p[1])))}return n.push("]"),n.join("")}function u(e){for(var r=e.source.match(new RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g")),n=r.length,s=[],o=0,a=0;o=2&&"["===d?r[o]=c(h):"\\"!==d&&(r[o]=h.replace(/[a-zA-Z]/g,(function(e){var t=e.charCodeAt(0);return"["+String.fromCharCode(-33&t,32|t)+"]"})))}return r.join("")}var h=[];for(n=0,s=e.length;n=5&&"lang-"===y.substring(0,5))||_&&"string"==typeof _[1]||(v=!1,y="src"),v||(f[m]=y)}var w=u;if(u+=m.length,v){var k=_[1],x=m.indexOf(k),E=x+k.length;_[2]&&(x=(E=m.length-_[2].length)-k.length);var T=y.substring(5);d(l,a+w,m.substring(0,x),s,c),d(l,a+w+x,k,S(T,k),c),d(l,a+w+E,m.substring(E),s,c)}else c.push(a+w,y)}e.decorations=c};return s}function v(e){var t=[],i=[];e.tripleQuotedStrings?t.push(["str",/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,"'\""]):e.multiLineStrings?t.push(["str",/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):t.push(["str",/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,"\"'"]),e.verbatimStrings&&i.push(["str",/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var r=e.hashComments;r&&(e.cStyleComments?(r>1?t.push(["com",/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):t.push(["com",/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),i.push(["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):t.push(["com",/^#[^\r\n]*/,null,"#"])),e.cStyleComments&&(i.push(["com",/^\/\/[^\r\n]*/,null]),i.push(["com",/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var n=e.regexLiterals;if(n){var s=n>1?"":"\n\r",o=s?".":"[\\S\\s]",a="/(?=[^/*"+s+"])(?:[^/\\x5B\\x5C"+s+"]|\\x5C"+o+"|\\x5B(?:[^\\x5C\\x5D"+s+"]|\\x5C"+o+")*(?:\\x5D|$))+/";i.push(["lang-regex",RegExp("^(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*("+a+")")])}var l=e.types;l&&i.push(["typ",l]);var c=(""+e.keywords).replace(/^ | $/g,"");c.length&&i.push(["kwd",new RegExp("^(?:"+c.replace(/[\s,]+/g,"|")+")\\b"),null]),t.push(["pln",/^\s+/,null," \r\n\t "]);var u="^.[^\\s\\w.$@'\"`/\\\\]*";return e.regexLiterals&&(u+="(?!s*/)"),i.push(["lit",/^@[a-z_$][a-z_$@0-9]*/i,null],["typ",/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],["pln",/^[a-z_$][a-z_$@0-9]*/i,null],["lit",new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],["pln",/^\\[\s\S]?/,null],["pun",new RegExp(u),null]),g(t,i)}var m=v({keywords:[r,s,n,o,a,l,c,u],hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function y(e,t,i){for(var r=/(?:^|\s)nocode(?:\s|$)/,n=/\r\n?|\n/,s=e.ownerDocument,o=s.createElement("li");e.firstChild;)o.appendChild(e.firstChild);var a=[o];function l(e){var t=e.nodeType;if(1!=t||r.test(e.className)){if((3==t||4==t)&&i){var o=e.nodeValue,a=o.match(n);if(a){var u=o.substring(0,a.index);e.nodeValue=u;var h=o.substring(a.index+a[0].length);if(h)e.parentNode.insertBefore(s.createTextNode(h),e.nextSibling);c(e),u||e.parentNode.removeChild(e)}}}else if("br"===e.nodeName)c(e),e.parentNode&&e.parentNode.removeChild(e);else for(var d=e.firstChild;d;d=d.nextSibling)l(d)}function c(e){for(;!e.nextSibling;)if(!(e=e.parentNode))return;for(var t,i=function e(t,i){var r=i?t.cloneNode(!1):t,n=t.parentNode;if(n){var s=e(n,1),o=t.nextSibling;s.appendChild(r);for(var a=o;a;a=o)o=a.nextSibling,s.appendChild(a)}return r}(e.nextSibling,0);(t=i.parentNode)&&1===t.nodeType;)i=t;a.push(i)}for(var u=0;u=0;){var n=i[r];_.hasOwnProperty(n)?e.console&&console.warn("cannot override language handler %s",n):_[n]=t}}function S(e,t){return e&&_.hasOwnProperty(e)||(e=/^\s*=b&&(u+=2),a>=S&&(f+=2)}}finally{m&&(m.style.display=y)}}(t)}catch(t){e.console&&console.log(t&&t.stack||t)}}function w(e,t,i){var r=i||!1,n=t||null,s=document.createElement("div");return s.innerHTML="
    "+e+"
    ",s=s.firstChild,r&&y(s,r,!0),C({langExtension:n,numberLines:r,sourceNode:s,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null}),s.innerHTML}function k(t,i){var r=i||document.body,n=r.ownerDocument||document;function s(e){return r.getElementsByTagName(e)}for(var o=[s("pre"),s("code"),s("xmp")],a=[],l=0;l]*(?:>|$)/],["com",/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],["pun",/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]),b(g([["pln",/^[\s]+/,null," \t\r\n"],["atv",/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,"\"'"]],[["tag",/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],["atn",/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],["pun",/^[=<>\/]+/],["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"]),b(g([],[["atv",/^[\s\S]+/]]),["uq.val"]),b(v({keywords:r,hashComments:!0,cStyleComments:!0,types:h}),["c","cc","cpp","cxx","cyc","m"]),b(v({keywords:"null,true,false"}),["json"]),b(v({keywords:s,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:h}),["cs"]),b(v({keywords:n,cStyleComments:!0}),["java"]),b(v({keywords:u,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),b(v({keywords:l,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),b(v({keywords:a,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),b(v({keywords:c,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),b(v({keywords:o,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),b(v({keywords:"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",hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),b(g([],[["str",/^[\s\S]+/]]),["regex"]);var x=e.PR={createSimpleLexer:g,registerLangHandler:b,sourceDecorator:v,PR_ATTRIB_NAME:"atn",PR_ATTRIB_VALUE:"atv",PR_COMMENT:"com",PR_DECLARATION:"dec",PR_KEYWORD:"kwd",PR_LITERAL:"lit",PR_NOCODE:"nocode",PR_PLAIN:"pln",PR_PUNCTUATION:"pun",PR_SOURCE:"src",PR_STRING:"str",PR_TAG:"tag",PR_TYPE:"typ",prettyPrintOne:w,prettyPrint:k},E=e.define;"function"==typeof E&&E.amd&&E("google-code-prettify",[],(function(){return x}))}()},SZEN: /*!*******************************************************!*\ !*** ./node_modules/@novnc/novnc/lib/util/element.js ***! \*******************************************************/ /*! no static exports found */ /*! all exports used */ /*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.clientToElement=function(e,t,i){var r=i.getBoundingClientRect(),n={x:0,y:0};e=r.right?n.x=r.width-1:n.x=e-r.left;t=r.bottom?n.y=r.height-1:n.y=t-r.top;return n}},SgaC: /*!*******************************************************!*\ !*** ./node_modules/@novnc/novnc/lib/decoders/rre.js ***! \*******************************************************/ /*! no static exports found */ /*! all exports used */ /*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,i){"use strict";function r(e,t){for(var i=0;i0;){if(n.rQwait("RRE",12))return!1;var l=n.rQshiftBytes(4),c=n.rQshift16(),u=n.rQshift16(),h=n.rQshift16(),d=n.rQshift16();s.fillRect(e+c,t+u,h,d,l),this._subrects--}return!0}}])&&r(t.prototype,i),n&&r(t,n),e}();t.default=n},VSMT: /*!*******************************************************!*\ !*** ./node_modules/@novnc/novnc/lib/util/strings.js ***! \*******************************************************/ /*! no static exports found */ /*! all exports used */ /*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.decodeUTF8=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];try{return decodeURIComponent(escape(e))}catch(i){if(i instanceof URIError&&t)return e;throw i}},t.encodeUTF8=function(e){return unescape(encodeURIComponent(e))}},"VaU+": /*!***************************************************************!*\ !*** ./src/pages/Shixuns/New/ImagePreview/index.less?modules ***! \***************************************************************/ /*! no static exports found */ /*! exports used: default */ /*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,i){e.exports={wrp:"wrp___1lJPu",header:"header___2p05v",cuttDown:"cuttDown___1-ls7",container:"container___1Nx55",info:"info___2lI6e",buttons:"buttons___3Q0yr",fullBtn:"fullBtn___18HVx",shrink:"shrink___367DS",elseShrink:"elseShrink___3Anw7",spin:"spin___3h9s3"}},"VrN/": /*!***************************************************!*\ !*** ./node_modules/codemirror/lib/codemirror.js ***! \***************************************************/ /*! no static exports found */ /*! all exports used */ /*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,i){e.exports=function(){"use strict";var e=navigator.userAgent,t=navigator.platform,i=/gecko\/\d/i.test(e),r=/MSIE \d/.test(e),n=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(e),s=/Edge\/(\d+)/.exec(e),o=r||n||s,a=o&&(r?document.documentMode||6:+(s||n)[1]),l=!s&&/WebKit\//.test(e),c=l&&/Qt\/\d+\.\d+/.test(e),u=!s&&/Chrome\//.test(e),h=/Opera\//.test(e),d=/Apple Computer/.test(navigator.vendor),f=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(e),p=/PhantomJS/.test(e),g=!s&&/AppleWebKit/.test(e)&&/Mobile\/\w+/.test(e),v=/Android/.test(e),m=g||v||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(e),y=g||/Mac/.test(t),_=/\bCrOS\b/.test(e),b=/win/i.test(t),S=h&&e.match(/Version\/(\d*\.\d*)/);S&&(S=Number(S[1])),S&&S>=15&&(h=!1,l=!0);var C=y&&(c||h&&(null==S||S<12.11)),w=i||o&&a>=9;function k(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var x,E=function(e,t){var i=e.className,r=k(t).exec(i);if(r){var n=i.slice(r.index+r[0].length);e.className=i.slice(0,r.index)+(n?r[1]+n:"")}};function T(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function L(e,t){return T(e).appendChild(t)}function A(e,t,i,r){var n=document.createElement(e);if(i&&(n.className=i),r&&(n.style.cssText=r),"string"==typeof t)n.appendChild(document.createTextNode(t));else if(t)for(var s=0;s=t)return o+(t-s);o+=a-s,o+=i-o%i,s=a+1}}g?P=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:o&&(P=function(e){try{e.select()}catch(e){}});var H=function(){this.id=null,this.f=null,this.time=0,this.handler=F(this.onTimeout,this)};function j(e,t){for(var i=0;i=t)return r+Math.min(o,t-n);if(n+=s-r,r=s+1,(n+=i-n%i)>=t)return r}}var G=[""];function V(e){for(;G.length<=e;)G.push(q(G)+" ");return G[e]}function q(e){return e[e.length-1]}function Q(e,t){for(var i=[],r=0;r"€"&&(e.toUpperCase()!=e.toLowerCase()||$.test(e))}function ee(e,t){return t?!!(t.source.indexOf("\\w")>-1&&J(e))||t.test(e):J(e)}function te(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var ie=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function re(e){return e.charCodeAt(0)>=768&&ie.test(e)}function ne(e,t,i){for(;(i<0?t>0:ti?-1:1;;){if(t==i)return t;var n=(t+i)/2,s=r<0?Math.ceil(n):Math.floor(n);if(s==t)return e(s)?t:i;e(s)?i=s:t=s+r}}var oe=null;function ae(e,t,i){var r;oe=null;for(var n=0;nt)return n;s.to==t&&(s.from!=s.to&&"before"==i?r=n:oe=n),s.from==t&&(s.from!=s.to&&"before"!=i?r=n:oe=n)}return null!=r?r:oe}var le=function(){var e=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,t=/[stwN]/,i=/[LRr]/,r=/[Lb1n]/,n=/[1n]/;function s(e,t,i){this.level=e,this.from=t,this.to=i}return function(o,a){var l="ltr"==a?"L":"R";if(0==o.length||"ltr"==a&&!e.test(o))return!1;for(var c,u=o.length,h=[],d=0;d-1&&(r[t]=n.slice(0,s).concat(n.slice(s+1)))}}}function pe(e,t){var i=de(e,t);if(i.length)for(var r=Array.prototype.slice.call(arguments,2),n=0;n0}function ye(e){e.prototype.on=function(e,t){he(this,e,t)},e.prototype.off=function(e,t){fe(this,e,t)}}function _e(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function be(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function Se(e){return null!=e.defaultPrevented?e.defaultPrevented:0==e.returnValue}function Ce(e){_e(e),be(e)}function we(e){return e.target||e.srcElement}function ke(e){var t=e.which;return null==t&&(1&e.button?t=1:2&e.button?t=3:4&e.button&&(t=2)),y&&e.ctrlKey&&1==t&&(t=3),t}var xe,Ee,Te=function(){if(o&&a<9)return!1;var e=A("div");return"draggable"in e||"dragDrop"in e}();function Le(e){if(null==xe){var t=A("span","​");L(e,A("span",[t,document.createTextNode("x")])),0!=e.firstChild.offsetHeight&&(xe=t.offsetWidth<=1&&t.offsetHeight>2&&!(o&&a<8))}var i=xe?A("span","​"):A("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return i.setAttribute("cm-text",""),i}function Ae(e){if(null!=Ee)return Ee;var t=L(e,document.createTextNode("AخA")),i=x(t,0,1).getBoundingClientRect(),r=x(t,1,2).getBoundingClientRect();return T(e),!(!i||i.left==i.right)&&(Ee=r.right-i.right<3)}var Re,De=3!="\n\nb".split(/\n/).length?function(e){for(var t=0,i=[],r=e.length;t<=r;){var n=e.indexOf("\n",t);-1==n&&(n=e.length);var s=e.slice(t,"\r"==e.charAt(n-1)?n-1:n),o=s.indexOf("\r");-1!=o?(i.push(s.slice(0,o)),t+=o+1):(i.push(s),t=n+1)}return i}:function(e){return e.split(/\r\n?|\n/)},Oe=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(e){return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch(e){}return!(!t||t.parentElement()!=e)&&0!=t.compareEndPoints("StartToEnd",t)},Me="oncopy"in(Re=A("div"))||(Re.setAttribute("oncopy","return;"),"function"==typeof Re.oncopy),Ie=null,Pe={},Fe={};function Be(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Pe[e]=t}function Ne(e){if("string"==typeof e&&Fe.hasOwnProperty(e))e=Fe[e];else if(e&&"string"==typeof e.name&&Fe.hasOwnProperty(e.name)){var t=Fe[e.name];"string"==typeof t&&(t={name:t}),(e=Z(t,e)).name=t.name}else{if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Ne("application/xml");if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Ne("application/json")}return"string"==typeof e?{name:e}:e||{name:"null"}}function He(e,t){t=Ne(t);var i=Pe[t.name];if(!i)return He(e,"text/plain");var r=i(e,t);if(je.hasOwnProperty(t.name)){var n=je[t.name];for(var s in n)n.hasOwnProperty(s)&&(r.hasOwnProperty(s)&&(r["_"+s]=r[s]),r[s]=n[s])}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var o in t.modeProps)r[o]=t.modeProps[o];return r}var je={};function Ue(e,t){B(t,je.hasOwnProperty(e)?je[e]:je[e]={})}function Ke(e,t){if(!0===t)return t;if(e.copyState)return e.copyState(t);var i={};for(var r in t){var n=t[r];n instanceof Array&&(n=n.concat([])),i[r]=n}return i}function Xe(e,t){for(var i;e.innerMode&&(i=e.innerMode(t))&&i.mode!=e;)t=i.state,e=i.mode;return i||{mode:e,state:t}}function We(e,t,i){return!e.startState||e.startState(t,i)}var ze=function(e,t,i){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=i};function Ge(e,t){if((t-=e.first)<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var i=e;!i.lines;)for(var r=0;;++r){var n=i.children[r],s=n.chunkSize();if(t=e.first&&ti?et(i,Ge(e,i).text.length):function(e,t){var i=e.ch;return null==i||i>t?et(e.line,t):i<0?et(e.line,0):e}(t,Ge(e,t.line).text.length)}function lt(e,t){for(var i=[],r=0;r=this.string.length},ze.prototype.sol=function(){return this.pos==this.lineStart},ze.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},ze.prototype.next=function(){if(this.post},ze.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},ze.prototype.skipToEnd=function(){this.pos=this.string.length},ze.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},ze.prototype.backUp=function(e){this.pos-=e},ze.prototype.column=function(){return this.lastColumnPos0?null:(r&&!1!==t&&(this.pos+=r[0].length),r)}var n=function(e){return i?e.toLowerCase():e};if(n(this.string.substr(this.pos,e.length))==n(e))return!1!==t&&(this.pos+=e.length),!0},ze.prototype.current=function(){return this.string.slice(this.start,this.pos)},ze.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},ze.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},ze.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};var ct=function(e,t){this.state=e,this.lookAhead=t},ut=function(e,t,i,r){this.state=t,this.doc=e,this.line=i,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};function ht(e,t,i,r){var n=[e.state.modeGen],s={};bt(e,t.text,e.doc.mode,i,(function(e,t){return n.push(e,t)}),s,r);for(var o=i.state,a=function(r){i.baseTokens=n;var a=e.state.overlays[r],l=1,c=0;i.state=!0,bt(e,t.text,a.mode,i,(function(e,t){for(var i=l;ce&&n.splice(l,1,e,n[l+1],r),l+=2,c=Math.min(e,r)}if(t)if(a.opaque)n.splice(i,l-i,e,"overlay "+t),l=i+2;else for(;ie.options.maxHighlightLength&&Ke(e.doc.mode,r.state),s=ht(e,t,r);n&&(r.state=n),t.stateAfter=r.save(!n),t.styles=s.styles,s.classes?t.styleClasses=s.classes:t.styleClasses&&(t.styleClasses=null),i===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function ft(e,t,i){var r=e.doc,n=e.display;if(!r.mode.startState)return new ut(r,!0,t);var s=function(e,t,i){for(var r,n,s=e.doc,o=i?-1:t-(e.doc.mode.innerMode?1e3:100),a=t;a>o;--a){if(a<=s.first)return s.first;var l=Ge(s,a-1),c=l.stateAfter;if(c&&(!i||a+(c instanceof ct?c.lookAhead:0)<=s.modeFrontier))return a;var u=N(l.text,null,e.options.tabSize);(null==n||r>u)&&(n=a-1,r=u)}return n}(e,t,i),o=s>r.first&&Ge(r,s-1).stateAfter,a=o?ut.fromSaved(r,o,s):new ut(r,We(r.mode),s);return r.iter(s,t,(function(i){pt(e,i.text,a);var r=a.line;i.stateAfter=r==t-1||r%5==0||r>=n.viewFrom&&rt.start)return s}throw new Error("Mode "+e.name+" failed to advance stream.")}ut.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return null!=t&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},ut.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}},ut.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},ut.fromSaved=function(e,t,i){return t instanceof ct?new ut(e,Ke(e.mode,t.state),i,t.lookAhead):new ut(e,Ke(e.mode,t),i)},ut.prototype.save=function(e){var t=!1!==e?Ke(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new ct(t,this.maxLookAhead):t};var mt=function(e,t,i){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=i};function yt(e,t,i,r){var n,s,o=e.doc,a=o.mode,l=Ge(o,(t=at(o,t)).line),c=ft(e,t.line,i),u=new ze(l.text,e.options.tabSize,c);for(r&&(s=[]);(r||u.pose.options.maxHighlightLength?(a=!1,o&&pt(e,t,r,h.pos),h.pos=t.length,l=null):l=_t(vt(i,h,r.state,d),s),d){var f=d[0].name;f&&(l="m-"+(l?f+" "+l:f))}if(!a||u!=l){for(;c=t:s.to>t);(r||(r=[])).push(new wt(o,s.from,a?null:s.to))}}return r}(i,n,o),l=function(e,t,i){var r;if(e)for(var n=0;n=t:s.to>t)||s.from==t&&"bookmark"==o.type&&(!i||s.marker.insertLeft)){var a=null==s.from||(o.inclusiveLeft?s.from<=t:s.from0&&a)for(var _=0;_t)&&(!i||Ot(i,s.marker)<0)&&(i=s.marker)}return i}function Bt(e,t,i,r,n){var s=Ge(e,t),o=Ct&&s.markedSpans;if(o)for(var a=0;a=0&&h<=0||u<=0&&h>=0)&&(u<=0&&(l.marker.inclusiveRight&&n.inclusiveLeft?tt(c.to,i)>=0:tt(c.to,i)>0)||u>=0&&(l.marker.inclusiveRight&&n.inclusiveLeft?tt(c.from,r)<=0:tt(c.from,r)<0)))return!0}}}function Nt(e){for(var t;t=It(e);)e=t.find(-1,!0).line;return e}function Ht(e,t){var i=Ge(e,t),r=Nt(i);return i==r?t:Ye(r)}function jt(e,t){if(t>e.lastLine())return t;var i,r=Ge(e,t);if(!Ut(e,r))return t;for(;i=Pt(r);)r=i.find(1,!0).line;return Ye(r)+1}function Ut(e,t){var i=Ct&&t.markedSpans;if(i)for(var r=void 0,n=0;nt.maxLineLength&&(t.maxLineLength=i,t.maxLine=e)}))}var Gt=function(e,t,i){this.text=e,At(this,t),this.height=i?i(this):1};function Vt(e){e.parent=null,Lt(e)}Gt.prototype.lineNo=function(){return Ye(this)},ye(Gt);var qt={},Qt={};function Yt(e,t){if(!e||/^\s*$/.test(e))return null;var i=t.addModeClass?Qt:qt;return i[e]||(i[e]=e.replace(/\S+/g,"cm-$&"))}function Zt(e,t){var i=R("span",null,null,l?"padding-right: .1px":null),r={pre:R("pre",[i],"CodeMirror-line"),content:i,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var n=0;n<=(t.rest?t.rest.length:0);n++){var s=n?t.rest[n-1]:t.line,o=void 0;r.pos=0,r.addToken=Jt,Ae(e.display.measure)&&(o=ce(s,e.doc.direction))&&(r.addToken=ei(r.addToken,o)),r.map=[],ii(s,r,dt(e,s,t!=e.display.externalMeasured&&Ye(s))),s.styleClasses&&(s.styleClasses.bgClass&&(r.bgClass=I(s.styleClasses.bgClass,r.bgClass||"")),s.styleClasses.textClass&&(r.textClass=I(s.styleClasses.textClass,r.textClass||""))),0==r.map.length&&r.map.push(0,0,r.content.appendChild(Le(e.display.measure))),0==n?(t.measure.map=r.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(r.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(l){var a=r.content.lastChild;(/\bcm-tab\b/.test(a.className)||a.querySelector&&a.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return pe(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=I(r.pre.className,r.textClass||"")),r}function $t(e){var t=A("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Jt(e,t,i,r,n,s,l){if(t){var c,u=e.splitSpaces?function(e,t){if(e.length>1&&!/ /.test(e))return e;for(var i=t,r="",n=0;nc&&h.from<=c);d++);if(h.to>=u)return e(i,r,n,s,o,a,l);e(i,r.slice(0,h.to-c),n,s,null,a,l),s=null,r=r.slice(h.to-c),c=h.to}}}function ti(e,t,i,r){var n=!r&&i.widgetNode;n&&e.map.push(e.pos,e.pos+t,n),!r&&e.cm.display.input.needsContentAttribute&&(n||(n=e.content.appendChild(document.createElement("span"))),n.setAttribute("cm-marker",i.id)),n&&(e.cm.display.input.setUneditable(n),e.content.appendChild(n)),e.pos+=t,e.trailingSpace=!1}function ii(e,t,i){var r=e.markedSpans,n=e.text,s=0;if(r)for(var o,a,l,c,u,h,d,f=n.length,p=0,g=1,v="",m=0;;){if(m==p){l=c=u=a="",d=null,h=null,m=1/0;for(var y=[],_=void 0,b=0;bp||C.collapsed&&S.to==p&&S.from==p)){if(null!=S.to&&S.to!=p&&m>S.to&&(m=S.to,c=""),C.className&&(l+=" "+C.className),C.css&&(a=(a?a+";":"")+C.css),C.startStyle&&S.from==p&&(u+=" "+C.startStyle),C.endStyle&&S.to==m&&(_||(_=[])).push(C.endStyle,S.to),C.title&&((d||(d={})).title=C.title),C.attributes)for(var w in C.attributes)(d||(d={}))[w]=C.attributes[w];C.collapsed&&(!h||Ot(h.marker,C)<0)&&(h=S)}else S.from>p&&m>S.from&&(m=S.from)}if(_)for(var k=0;k<_.length;k+=2)_[k+1]==m&&(c+=" "+_[k]);if(!h||h.from==p)for(var x=0;x=f)break;for(var E=Math.min(f,m);;){if(v){var T=p+v.length;if(!h){var L=T>E?v.slice(0,E-p):v;t.addToken(t,L,o?o+l:l,u,p+L.length==m?c:"",a,d)}if(T>=E){v=v.slice(E-p),p=E;break}p=T,u=""}v=n.slice(s,s=i[g++]),o=Yt(i[g++],t.cm.options)}}else for(var A=1;Ai)return{map:e.measure.maps[n],cache:e.measure.caches[n],before:!0}}function Ai(e,t,i,r){return Oi(e,Di(e,t),i,r)}function Ri(e,t){if(t>=e.display.viewFrom&&t=i.lineN&&t2&&s.push((l.bottom+c.top)/2-i.top)}}s.push(i.bottom-i.top)}}(e,t.view,t.rect),t.hasHeights=!0),(s=function(e,t,i,r){var n,s=Pi(t.map,i,r),l=s.node,c=s.start,u=s.end,h=s.collapse;if(3==l.nodeType){for(var d=0;d<4;d++){for(;c&&re(t.line.text.charAt(s.coverStart+c));)--c;for(;s.coverStart+u1}(e))return t;var i=screen.logicalXDPI/screen.deviceXDPI,r=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*i,right:t.right*i,top:t.top*r,bottom:t.bottom*r}}(e.display.measure,n))}else{var f;c>0&&(h=r="right"),n=e.options.lineWrapping&&(f=l.getClientRects()).length>1?f["right"==r?f.length-1:0]:l.getBoundingClientRect()}if(o&&a<9&&!c&&(!n||!n.left&&!n.right)){var p=l.parentNode.getClientRects()[0];n=p?{left:p.left,right:p.left+rr(e.display),top:p.top,bottom:p.bottom}:Ii}for(var g=n.top-t.rect.top,v=n.bottom-t.rect.top,m=(g+v)/2,y=t.view.measure.heights,_=0;_t)&&(n=(s=l-a)-1,t>=l&&(o="right")),null!=n){if(r=e[c+2],a==l&&i==(r.insertLeft?"left":"right")&&(o=i),"left"==i&&0==n)for(;c&&e[c-2]==e[c-3]&&e[c-1].insertLeft;)r=e[2+(c-=3)],o="left";if("right"==i&&n==l-a)for(;c=0&&(i=e[n]).left==i.right;n--);return i}function Bi(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t=r.text.length?(l=r.text.length,c="before"):l<=0&&(l=0,c="after"),!a)return o("before"==c?l-1:l,"before"==c);function u(e,t,i){return o(i?e-1:e,1==a[t].level!=i)}var h=ae(a,l,c),d=oe,f=u(l,h,"before"==c);return null!=d&&(f.other=u(l,d,"before"!=c)),f}function Vi(e,t){var i=0;t=at(e.doc,t),e.options.lineWrapping||(i=rr(e.display)*t.ch);var r=Ge(e.doc,t.line),n=Xt(r)+Ci(e.display);return{left:i,right:i,top:n,bottom:n+r.height}}function qi(e,t,i,r,n){var s=et(e,t,i);return s.xRel=n,r&&(s.outside=r),s}function Qi(e,t,i){var r=e.doc;if((i+=e.display.viewOffset)<0)return qi(r.first,0,null,-1,-1);var n=Ze(r,i),s=r.first+r.size-1;if(n>s)return qi(r.first+r.size-1,Ge(r,s).text.length,null,1,1);t<0&&(t=0);for(var o=Ge(r,n);;){var a=Ji(e,o,n,t,i),l=Ft(o,a.ch+(a.xRel>0||a.outside>0?1:0));if(!l)return a;var c=l.find(1);if(c.line==n)return c;o=Ge(r,n=c.line)}}function Yi(e,t,i,r){r-=Ki(t);var n=t.text.length,s=se((function(t){return Oi(e,i,t-1).bottom<=r}),n,0);return{begin:s,end:n=se((function(t){return Oi(e,i,t).top>r}),s,n)}}function Zi(e,t,i,r){return i||(i=Di(e,t)),Yi(e,t,i,Xi(e,t,Oi(e,i,r),"line").top)}function $i(e,t,i,r){return!(e.bottom<=i)&&(e.top>i||(r?e.left:e.right)>t)}function Ji(e,t,i,r,n){n-=Xt(t);var s=Di(e,t),o=Ki(t),a=0,l=t.text.length,c=!0,u=ce(t,e.doc.direction);if(u){var h=(e.options.lineWrapping?tr:er)(e,t,i,s,u,r,n);a=(c=1!=h.level)?h.from:h.to-1,l=c?h.to:h.from-1}var d,f,p=null,g=null,v=se((function(t){var i=Oi(e,s,t);return i.top+=o,i.bottom+=o,!!$i(i,r,n,!1)&&(i.top<=n&&i.left<=r&&(p=t,g=i),!0)}),a,l),m=!1;if(g){var y=r-g.left=b.bottom?1:0}return qi(i,v=ne(t.text,v,1),f,m,r-d)}function er(e,t,i,r,n,s,o){var a=se((function(a){var l=n[a],c=1!=l.level;return $i(Gi(e,et(i,c?l.to:l.from,c?"before":"after"),"line",t,r),s,o,!0)}),0,n.length-1),l=n[a];if(a>0){var c=1!=l.level,u=Gi(e,et(i,c?l.from:l.to,c?"after":"before"),"line",t,r);$i(u,s,o,!0)&&u.top>o&&(l=n[a-1])}return l}function tr(e,t,i,r,n,s,o){var a=Yi(e,t,r,o),l=a.begin,c=a.end;/\s/.test(t.text.charAt(c-1))&&c--;for(var u=null,h=null,d=0;d=c||f.to<=l)){var p=Oi(e,r,1!=f.level?Math.min(c,f.to)-1:Math.max(l,f.from)).right,g=pg)&&(u=f,h=g)}}return u||(u=n[n.length-1]),u.fromc&&(u={from:u.from,to:c,level:u.level}),u}function ir(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==Mi){Mi=A("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)Mi.appendChild(document.createTextNode("x")),Mi.appendChild(A("br"));Mi.appendChild(document.createTextNode("x"))}L(e.measure,Mi);var i=Mi.offsetHeight/50;return i>3&&(e.cachedTextHeight=i),T(e.measure),i||1}function rr(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth;var t=A("span","xxxxxxxxxx"),i=A("pre",[t],"CodeMirror-line-like");L(e.measure,i);var r=t.getBoundingClientRect(),n=(r.right-r.left)/10;return n>2&&(e.cachedCharWidth=n),n||10}function nr(e){for(var t=e.display,i={},r={},n=t.gutters.clientLeft,s=t.gutters.firstChild,o=0;s;s=s.nextSibling,++o){var a=e.display.gutterSpecs[o].className;i[a]=s.offsetLeft+s.clientLeft+n,r[a]=s.clientWidth}return{fixedPos:sr(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:i,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function sr(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function or(e){var t=ir(e.display),i=e.options.lineWrapping,r=i&&Math.max(5,e.display.scroller.clientWidth/rr(e.display)-3);return function(n){if(Ut(e.doc,n))return 0;var s=0;if(n.widgets)for(var o=0;o0&&(l=Ge(e.doc,c.line).text).length==c.ch){var u=N(l,l.length,e.options.tabSize)-l.length;c=et(c.line,Math.max(0,Math.round((s-ki(e.display).left)/rr(e.display))-u))}return c}function cr(e,t){if(t>=e.display.viewTo)return null;if((t-=e.display.viewFrom)<0)return null;for(var i=e.display.view,r=0;rt)&&(n.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=n.viewTo)Ct&&Ht(e.doc,t)n.viewFrom?dr(e):(n.viewFrom+=r,n.viewTo+=r);else if(t<=n.viewFrom&&i>=n.viewTo)dr(e);else if(t<=n.viewFrom){var s=fr(e,i,i+r,1);s?(n.view=n.view.slice(s.index),n.viewFrom=s.lineN,n.viewTo+=r):dr(e)}else if(i>=n.viewTo){var o=fr(e,t,t,-1);o?(n.view=n.view.slice(0,o.index),n.viewTo=o.lineN):dr(e)}else{var a=fr(e,t,t,-1),l=fr(e,i,i+r,1);a&&l?(n.view=n.view.slice(0,a.index).concat(ni(e,a.lineN,l.lineN)).concat(n.view.slice(l.index)),n.viewTo+=r):dr(e)}var c=n.externalMeasured;c&&(i=n.lineN&&t=r.viewTo)){var s=r.view[cr(e,t)];if(null!=s.node){var o=s.changes||(s.changes=[]);-1==j(o,i)&&o.push(i)}}}function dr(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function fr(e,t,i,r){var n,s=cr(e,t),o=e.display.view;if(!Ct||i==e.doc.first+e.doc.size)return{index:s,lineN:i};for(var a=e.display.viewFrom,l=0;l0){if(s==o.length-1)return null;n=a+o[s].size-t,s++}else n=a-t;t+=n,i+=n}for(;Ht(e.doc,i)!=i;){if(s==(r<0?0:o.length-1))return null;i+=r*o[s-(r<0?1:0)].size,s+=r}return{index:s,lineN:i}}function pr(e){for(var t=e.display.view,i=0,r=0;r=e.display.viewTo||a.to().linet||t==i&&o.to==t)&&(r(Math.max(o.from,t),Math.min(o.to,i),1==o.level?"rtl":"ltr",s),n=!0)}n||r(t,i,"ltr")}(g,i||0,null==r?d:r,(function(e,t,n,h){var v="ltr"==n,m=f(e,v?"left":"right"),y=f(t-1,v?"right":"left"),_=null==i&&0==e,b=null==r&&t==d,S=0==h,C=!g||h==g.length-1;if(y.top-m.top<=3){var w=(c?b:_)&&C,k=(c?_:b)&&S?a:(v?m:y).left,x=w?l:(v?y:m).right;u(k,m.top,x-k,m.bottom)}else{var E,T,L,A;v?(E=c&&_&&S?a:m.left,T=c?l:p(e,n,"before"),L=c?a:p(t,n,"after"),A=c&&b&&C?l:y.right):(E=c?p(e,n,"before"):a,T=!c&&_&&S?l:m.right,L=!c&&b&&C?a:y.left,A=c?p(t,n,"after"):l),u(E,m.top,T-E,m.bottom),m.bottom0?t.blinker=setInterval((function(){e.hasFocus()||kr(e),t.cursorDiv.style.visibility=(i=!i)?"":"hidden"}),e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function Sr(e){e.state.focused||(e.display.input.focus(),wr(e))}function Cr(e){e.state.delayingBlurEvent=!0,setTimeout((function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,kr(e))}),100)}function wr(e,t){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),"nocursor"!=e.options.readOnly&&(e.state.focused||(pe(e,"focus",e,t),e.state.focused=!0,M(e.display.wrapper,"CodeMirror-focused"),e.curOp||e.display.selForContextMenu==e.doc.sel||(e.display.input.reset(),l&&setTimeout((function(){return e.display.input.reset(!0)}),20)),e.display.input.receivedFocus()),br(e))}function kr(e,t){e.state.delayingBlurEvent||(e.state.focused&&(pe(e,"blur",e,t),e.state.focused=!1,E(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout((function(){e.state.focused||(e.display.shift=!1)}),150))}function xr(e){for(var t=e.display,i=t.lineDiv.offsetTop,r=0;r.005||d<-.005)&&(Qe(n.line,l),Er(n.line),n.rest))for(var f=0;fe.display.sizerWidth){var p=Math.ceil(c/rr(e.display));p>e.display.maxLineLength&&(e.display.maxLineLength=p,e.display.maxLine=n.line,e.display.maxLineChanged=!0)}}}}function Er(e){if(e.widgets)for(var t=0;t=o&&(s=Ze(t,Xt(Ge(t,l))-e.wrapper.clientHeight),o=l)}return{from:s,to:Math.max(o,s+1)}}function Lr(e,t){var i=e.display,r=ir(e.display);t.top<0&&(t.top=0);var n=e.curOp&&null!=e.curOp.scrollTop?e.curOp.scrollTop:i.scroller.scrollTop,s=Ti(e),o={};t.bottom-t.top>s&&(t.bottom=t.top+s);var a=e.doc.height+wi(i),l=t.topa-r;if(t.topn+s){var u=Math.min(t.top,(c?a:t.bottom)-s);u!=n&&(o.scrollTop=u)}var h=e.options.fixedGutter?0:i.gutters.offsetWidth,d=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:i.scroller.scrollLeft-h,f=Ei(e)-i.gutters.offsetWidth,p=t.right-t.left>f;return p&&(t.right=t.left+f),t.left<10?o.scrollLeft=0:t.leftf+d-3&&(o.scrollLeft=t.right+(p?0:10)-f),o}function Ar(e,t){null!=t&&(Or(e),e.curOp.scrollTop=(null==e.curOp.scrollTop?e.doc.scrollTop:e.curOp.scrollTop)+t)}function Rr(e){Or(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function Dr(e,t,i){null==t&&null==i||Or(e),null!=t&&(e.curOp.scrollLeft=t),null!=i&&(e.curOp.scrollTop=i)}function Or(e){var t=e.curOp.scrollToPos;t&&(e.curOp.scrollToPos=null,Mr(e,Vi(e,t.from),Vi(e,t.to),t.margin))}function Mr(e,t,i,r){var n=Lr(e,{left:Math.min(t.left,i.left),top:Math.min(t.top,i.top)-r,right:Math.max(t.right,i.right),bottom:Math.max(t.bottom,i.bottom)+r});Dr(e,n.scrollLeft,n.scrollTop)}function Ir(e,t){Math.abs(e.doc.scrollTop-t)<2||(i||ln(e,{top:t}),Pr(e,t,!0),i&&ln(e),rn(e,100))}function Pr(e,t,i){t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),(e.display.scroller.scrollTop!=t||i)&&(e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t))}function Fr(e,t,i,r){t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),(i?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!r||(e.doc.scrollLeft=t,hn(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function Br(e){var t=e.display,i=t.gutters.offsetWidth,r=Math.round(e.doc.height+wi(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?i:0,docHeight:r,scrollHeight:r+xi(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:i}}var Nr=function(e,t,i){this.cm=i;var r=this.vert=A("div",[A("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),n=this.horiz=A("div",[A("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=n.tabIndex=-1,e(r),e(n),he(r,"scroll",(function(){r.clientHeight&&t(r.scrollTop,"vertical")})),he(n,"scroll",(function(){n.clientWidth&&t(n.scrollLeft,"horizontal")})),this.checkedZeroWidth=!1,o&&a<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Nr.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,i=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(i){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var n=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+n)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=i?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var s=e.viewWidth-e.barLeft-(i?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+s)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(0==r&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:i?r:0,bottom:t?r:0}},Nr.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Nr.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Nr.prototype.zeroWidthHack=function(){var e=y&&!f?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new H,this.disableVert=new H},Nr.prototype.enableZeroWidthBar=function(e,t,i){e.style.pointerEvents="auto",t.set(1e3,(function r(){var n=e.getBoundingClientRect();("vert"==i?document.elementFromPoint(n.right-1,(n.top+n.bottom)/2):document.elementFromPoint((n.right+n.left)/2,n.bottom-1))!=e?e.style.pointerEvents="none":t.set(1e3,r)}))},Nr.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var Hr=function(){};function jr(e,t){t||(t=Br(e));var i=e.display.barWidth,r=e.display.barHeight;Ur(e,t);for(var n=0;n<4&&i!=e.display.barWidth||r!=e.display.barHeight;n++)i!=e.display.barWidth&&e.options.lineWrapping&&xr(e),Ur(e,Br(e)),i=e.display.barWidth,r=e.display.barHeight}function Ur(e,t){var i=e.display,r=i.scrollbars.update(t);i.sizer.style.paddingRight=(i.barWidth=r.right)+"px",i.sizer.style.paddingBottom=(i.barHeight=r.bottom)+"px",i.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(i.scrollbarFiller.style.display="block",i.scrollbarFiller.style.height=r.bottom+"px",i.scrollbarFiller.style.width=r.right+"px"):i.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(i.gutterFiller.style.display="block",i.gutterFiller.style.height=r.bottom+"px",i.gutterFiller.style.width=t.gutterWidth+"px"):i.gutterFiller.style.display=""}Hr.prototype.update=function(){return{bottom:0,right:0}},Hr.prototype.setScrollLeft=function(){},Hr.prototype.setScrollTop=function(){},Hr.prototype.clear=function(){};var Kr={native:Nr,null:Hr};function Xr(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&E(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new Kr[e.options.scrollbarStyle]((function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),he(t,"mousedown",(function(){e.state.focused&&setTimeout((function(){return e.display.input.focus()}),0)})),t.setAttribute("cm-not-content","true")}),(function(t,i){"horizontal"==i?Fr(e,t):Ir(e,t)}),e),e.display.scrollbars.addClass&&M(e.display.wrapper,e.display.scrollbars.addClass)}var Wr=0;function zr(e){var t;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:++Wr},t=e.curOp,si?si.ops.push(t):t.ownsGroup=si={ops:[t],delayedCallbacks:[]}}function Gr(e){var t=e.curOp;t&&function(e,t){var i=e.ownsGroup;if(i)try{!function(e){var t=e.delayedCallbacks,i=0;do{for(;i=i.viewTo)||i.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new sn(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function qr(e){e.updatedDisplay=e.mustUpdate&&on(e.cm,e.update)}function Qr(e){var t=e.cm,i=t.display;e.updatedDisplay&&xr(t),e.barMeasure=Br(t),i.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=Ai(t,i.maxLine,i.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(i.scroller.clientWidth,i.sizer.offsetLeft+e.adjustWidthTo+xi(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,i.sizer.offsetLeft+e.adjustWidthTo-Ei(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=i.input.prepareSelection())}function Yr(e){var t=e.cm;null!=e.adjustWidthTo&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft(window.innerHeight||document.documentElement.clientHeight)&&(n=!1),null!=n&&!p){var s=A("div","​",null,"position: absolute;\n top: "+(t.top-i.viewOffset-Ci(e.display))+"px;\n height: "+(t.bottom-t.top+xi(e)+i.barHeight)+"px;\n left: "+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(s),s.scrollIntoView(n),e.display.lineSpace.removeChild(s)}}}(t,function(e,t,i,r){var n;null==r&&(r=0),e.options.lineWrapping||t!=i||(i="before"==(t=t.ch?et(t.line,"before"==t.sticky?t.ch-1:t.ch,"after"):t).sticky?et(t.line,t.ch+1,"before"):t);for(var s=0;s<5;s++){var o=!1,a=Gi(e,t),l=i&&i!=t?Gi(e,i):a,c=Lr(e,n={left:Math.min(a.left,l.left),top:Math.min(a.top,l.top)-r,right:Math.max(a.left,l.left),bottom:Math.max(a.bottom,l.bottom)+r}),u=e.doc.scrollTop,h=e.doc.scrollLeft;if(null!=c.scrollTop&&(Ir(e,c.scrollTop),Math.abs(e.doc.scrollTop-u)>1&&(o=!0)),null!=c.scrollLeft&&(Fr(e,c.scrollLeft),Math.abs(e.doc.scrollLeft-h)>1&&(o=!0)),!o)break}return n}(t,at(r,e.scrollToPos.from),at(r,e.scrollToPos.to),e.scrollToPos.margin));var n=e.maybeHiddenMarkers,s=e.maybeUnhiddenMarkers;if(n)for(var o=0;o=e.display.viewTo)){var i=+new Date+e.options.workTime,r=ft(e,t.highlightFrontier),n=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),(function(s){if(r.line>=e.display.viewFrom){var o=s.styles,a=s.text.length>e.options.maxHighlightLength?Ke(t.mode,r.state):null,l=ht(e,s,r,!0);a&&(r.state=a),s.styles=l.styles;var c=s.styleClasses,u=l.classes;u?s.styleClasses=u:c&&(s.styleClasses=null);for(var h=!o||o.length!=s.styles.length||c!=u&&(!c||!u||c.bgClass!=u.bgClass||c.textClass!=u.textClass),d=0;!h&&di)return rn(e,e.options.workDelay),!0})),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),n.length&&$r(e,(function(){for(var t=0;t=i.viewFrom&&t.visible.to<=i.viewTo&&(null==i.updateLineNumbers||i.updateLineNumbers>=i.viewTo)&&i.renderedView==i.view&&0==pr(e))return!1;dn(e)&&(dr(e),t.dims=nr(e));var n=r.first+r.size,s=Math.max(t.visible.from-e.options.viewportMargin,r.first),o=Math.min(n,t.visible.to+e.options.viewportMargin);i.viewFromo&&i.viewTo-o<20&&(o=Math.min(n,i.viewTo)),Ct&&(s=Ht(e.doc,s),o=jt(e.doc,o));var a=s!=i.viewFrom||o!=i.viewTo||i.lastWrapHeight!=t.wrapperHeight||i.lastWrapWidth!=t.wrapperWidth;!function(e,t,i){var r=e.display;0==r.view.length||t>=r.viewTo||i<=r.viewFrom?(r.view=ni(e,t,i),r.viewFrom=t):(r.viewFrom>t?r.view=ni(e,t,r.viewFrom).concat(r.view):r.viewFromi&&(r.view=r.view.slice(0,cr(e,i)))),r.viewTo=i}(e,s,o),i.viewOffset=Xt(Ge(e.doc,i.viewFrom)),e.display.mover.style.top=i.viewOffset+"px";var c=pr(e);if(!a&&0==c&&!t.force&&i.renderedView==i.view&&(null==i.updateLineNumbers||i.updateLineNumbers>=i.viewTo))return!1;var u=function(e){if(e.hasFocus())return null;var t=O();if(!t||!D(e.display.lineDiv,t))return null;var i={activeElt:t};if(window.getSelection){var r=window.getSelection();r.anchorNode&&r.extend&&D(e.display.lineDiv,r.anchorNode)&&(i.anchorNode=r.anchorNode,i.anchorOffset=r.anchorOffset,i.focusNode=r.focusNode,i.focusOffset=r.focusOffset)}return i}(e);return c>4&&(i.lineDiv.style.display="none"),function(e,t,i){var r=e.display,n=e.options.lineNumbers,s=r.lineDiv,o=s.firstChild;function a(t){var i=t.nextSibling;return l&&y&&e.display.currentWheelTarget==t?t.style.display="none":t.parentNode.removeChild(t),i}for(var c=r.view,u=r.viewFrom,h=0;h-1&&(f=!1),ci(e,d,u,i)),f&&(T(d.lineNumber),d.lineNumber.appendChild(document.createTextNode(Je(e.options,u)))),o=d.node.nextSibling}else{var p=vi(e,d,u,i);s.insertBefore(p,o)}u+=d.size}for(;o;)o=a(o)}(e,i.updateLineNumbers,t.dims),c>4&&(i.lineDiv.style.display=""),i.renderedView=i.view,function(e){if(e&&e.activeElt&&e.activeElt!=O()&&(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&D(document.body,e.anchorNode)&&D(document.body,e.focusNode))){var t=window.getSelection(),i=document.createRange();i.setEnd(e.anchorNode,e.anchorOffset),i.collapse(!1),t.removeAllRanges(),t.addRange(i),t.extend(e.focusNode,e.focusOffset)}}(u),T(i.cursorDiv),T(i.selectionDiv),i.gutters.style.height=i.sizer.style.minHeight=0,a&&(i.lastWrapHeight=t.wrapperHeight,i.lastWrapWidth=t.wrapperWidth,rn(e,400)),i.updateLineNumbers=null,!0}function an(e,t){for(var i=t.viewport,r=!0;;r=!1){if(r&&e.options.lineWrapping&&t.oldDisplayWidth!=Ei(e))r&&(t.visible=Tr(e.display,e.doc,i));else if(i&&null!=i.top&&(i={top:Math.min(e.doc.height+wi(e.display)-Ti(e),i.top)}),t.visible=Tr(e.display,e.doc,i),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break;if(!on(e,t))break;xr(e);var n=Br(e);gr(e),jr(e,n),un(e,n),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 ln(e,t){var i=new sn(e,t);if(on(e,i)){xr(e),an(e,i);var r=Br(e);gr(e),jr(e,r),un(e,r),i.finish()}}function cn(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function un(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+xi(e)+"px"}function hn(e){var t=e.display,i=t.view;if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var r=sr(t)-t.scroller.scrollLeft+e.doc.scrollLeft,n=t.gutters.offsetWidth,s=r+"px",o=0;oa.clientWidth,u=a.scrollHeight>a.clientHeight;if(n&&c||s&&u){if(s&&y&&l)e:for(var d=t.target,f=o.view;d!=a;d=d.parentNode)for(var p=0;p=0&&tt(e,r.to())<=0)return i}return-1};var wn=function(e,t){this.anchor=e,this.head=t};function kn(e,t,i){var r=e&&e.options.selectionsMayTouch,n=t[i];t.sort((function(e,t){return tt(e.from(),t.from())})),i=j(t,n);for(var s=1;s0:l>=0){var c=st(a.from(),o.from()),u=nt(a.to(),o.to()),h=a.empty()?o.from()==o.head:a.from()==a.head;s<=i&&--i,t.splice(--s,2,new wn(h?u:c,h?c:u))}}return new Cn(t,i)}function xn(e,t){return new Cn([new wn(e,t||e)],0)}function En(e){return e.text?et(e.from.line+e.text.length-1,q(e.text).length+(1==e.text.length?e.from.ch:0)):e.to}function Tn(e,t){if(tt(e,t.from)<0)return e;if(tt(e,t.to)<=0)return En(t);var i=e.line+t.text.length-(t.to.line-t.from.line)-1,r=e.ch;return e.line==t.to.line&&(r+=En(t).ch-t.to.ch),et(i,r)}function Ln(e,t){for(var i=[],r=0;r1&&e.remove(a.line+1,p-1),e.insert(a.line+1,m)}ai(e,"change",e,t)}function In(e,t,i){!function e(r,n,s){if(r.linked)for(var o=0;oa-(e.cm?e.cm.options.historyEventDelay:500)||"*"==t.origin.charAt(0)))&&(s=function(e,t){return t?(Hn(e.done),q(e.done)):e.done.length&&!q(e.done).ranges?q(e.done):e.done.length>1&&!e.done[e.done.length-2].ranges?(e.done.pop(),q(e.done)):void 0}(n,n.lastOp==r)))o=q(s.changes),0==tt(t.from,t.to)&&0==tt(t.from,o.to)?o.to=En(t):s.changes.push(Nn(e,t));else{var l=q(n.done);for(l&&l.ranges||Kn(e.sel,n.done),s={changes:[Nn(e,t)],generation:n.generation},n.done.push(s);n.done.length>n.undoDepth;)n.done.shift(),n.done[0].ranges||n.done.shift()}n.done.push(i),n.generation=++n.maxGeneration,n.lastModTime=n.lastSelTime=a,n.lastOp=n.lastSelOp=r,n.lastOrigin=n.lastSelOrigin=t.origin,o||pe(e,"historyAdded")}function Un(e,t,i,r){var n=e.history,s=r&&r.origin;i==n.lastSelOp||s&&n.lastSelOrigin==s&&(n.lastModTime==n.lastSelTime&&n.lastOrigin==s||function(e,t,i,r){var n=t.charAt(0);return"*"==n||"+"==n&&i.ranges.length==r.ranges.length&&i.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}(e,s,q(n.done),t))?n.done[n.done.length-1]=t:Kn(t,n.done),n.lastSelTime=+new Date,n.lastSelOrigin=s,n.lastSelOp=i,r&&!1!==r.clearRedo&&Hn(n.undone)}function Kn(e,t){var i=q(t);i&&i.ranges&&i.equals(e)||t.push(e)}function Xn(e,t,i,r){var n=t["spans_"+e.id],s=0;e.iter(Math.max(e.first,i),Math.min(e.first+e.size,r),(function(i){i.markedSpans&&((n||(n=t["spans_"+e.id]={}))[s]=i.markedSpans),++s}))}function Wn(e){if(!e)return null;for(var t,i=0;i-1&&(q(a)[h]=c[h],delete c[h])}}}return r}function Vn(e,t,i,r){if(r){var n=e.anchor;if(i){var s=tt(t,n)<0;s!=tt(i,n)<0?(n=t,t=i):s!=tt(t,i)<0&&(t=i)}return new wn(n,t)}return new wn(i||t,t)}function qn(e,t,i,r,n){null==n&&(n=e.cm&&(e.cm.display.shift||e.extend)),Jn(e,new Cn([Vn(e.sel.primary(),t,i,n)],0),r)}function Qn(e,t,i){for(var r=[],n=e.cm&&(e.cm.display.shift||e.extend),s=0;s=t.ch:a.to>t.ch))){if(n&&(pe(l,"beforeCursorEnter"),l.explicitlyCleared)){if(s.markedSpans){--o;continue}break}if(!l.atomic)continue;if(i){var h=l.find(r<0?1:-1),d=void 0;if((r<0?u:c)&&(h=os(e,h,-r,h&&h.line==t.line?s:null)),h&&h.line==t.line&&(d=tt(h,i))&&(r<0?d<0:d>0))return ns(e,h,t,r,n)}var f=l.find(r<0?-1:1);return(r<0?c:u)&&(f=os(e,f,r,f.line==t.line?s:null)),f?ns(e,f,t,r,n):null}}return t}function ss(e,t,i,r,n){var s=r||1,o=ns(e,t,i,s,n)||!n&&ns(e,t,i,s,!0)||ns(e,t,i,-s,n)||!n&&ns(e,t,i,-s,!0);return o||(e.cantEdit=!0,et(e.first,0))}function os(e,t,i,r){return i<0&&0==t.ch?t.line>e.first?at(e,et(t.line-1)):null:i>0&&t.ch==(r||Ge(e,t.line)).text.length?t.line0)){var u=[l,1],h=tt(c.from,a.from),d=tt(c.to,a.to);(h<0||!o.inclusiveLeft&&!h)&&u.push({from:c.from,to:a.from}),(d>0||!o.inclusiveRight&&!d)&&u.push({from:a.to,to:c.to}),n.splice.apply(n,u),l+=u.length-3}}return n}(e,t.from,t.to);if(r)for(var n=r.length-1;n>=0;--n)us(e,{from:r[n].from,to:r[n].to,text:n?[""]:t.text,origin:t.origin});else us(e,t)}}function us(e,t){if(1!=t.text.length||""!=t.text[0]||0!=tt(t.from,t.to)){var i=Ln(e,t);jn(e,t,i,e.cm?e.cm.curOp.id:NaN),fs(e,t,i,Et(e,t));var r=[];In(e,(function(e,i){i||-1!=j(r,e.history)||(ms(e.history,t),r.push(e.history)),fs(e,t,null,Et(e,t))}))}}function hs(e,t,i){var r=e.cm&&e.cm.state.suppressEdits;if(!r||i){for(var n,s=e.history,o=e.sel,a="undo"==t?s.done:s.undone,l="undo"==t?s.undone:s.done,c=0;c=0;--f){var p=d(f);if(p)return p.v}}}}function ds(e,t){if(0!=t&&(e.first+=t,e.sel=new Cn(Q(e.sel.ranges,(function(e){return new wn(et(e.anchor.line+t,e.anchor.ch),et(e.head.line+t,e.head.ch))})),e.sel.primIndex),e.cm)){ur(e.cm,e.first,e.first-t,t);for(var i=e.cm.display,r=i.viewFrom;re.lastLine())){if(t.from.lines&&(t={from:t.from,to:et(s,Ge(e,s).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Ve(e,t.from,t.to),i||(i=Ln(e,t)),e.cm?function(e,t,i){var r=e.doc,n=e.display,s=t.from,o=t.to,a=!1,l=s.line;e.options.lineWrapping||(l=Ye(Nt(Ge(r,s.line))),r.iter(l,o.line+1,(function(e){if(e==n.maxLine)return a=!0,!0}))),r.sel.contains(t.from,t.to)>-1&&ve(e),Mn(r,t,i,or(e)),e.options.lineWrapping||(r.iter(l,s.line+t.text.length,(function(e){var t=Wt(e);t>n.maxLineLength&&(n.maxLine=e,n.maxLineLength=t,n.maxLineChanged=!0,a=!1)})),a&&(e.curOp.updateMaxLine=!0)),function(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),!(e.highlightFrontieri;r--){var n=Ge(e,r).stateAfter;if(n&&(!(n instanceof ct)||r+n.lookAhead1||!(this.children[0]instanceof _s))){var a=[];this.collapse(a),this.children=[new _s(a)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t50){for(var o=n.lines.length%25+25,a=o;a10);e.parent.maybeSpill()}},iterN:function(e,t,i){for(var r=0;r0||0==o&&!1!==s.clearWhenEmpty)return s;if(s.replacedWith&&(s.collapsed=!0,s.widgetNode=R("span",[s.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||s.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(s.widgetNode.insertLeft=!0)),s.collapsed){if(Bt(e,t.line,t,i,s)||t.line!=i.line&&Bt(e,i.line,t,i,s))throw new Error("Inserting collapsed marker partially overlapping an existing one");Ct=!0}s.addToHistory&&jn(e,{from:t,to:i,origin:"markText"},e.sel,NaN);var a,l=t.line,c=e.cm;if(e.iter(l,i.line+1,(function(e){c&&s.collapsed&&!c.options.lineWrapping&&Nt(e)==c.display.maxLine&&(a=!0),s.collapsed&&l!=t.line&&Qe(e,0),function(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}(e,new wt(s,l==t.line?t.ch:null,l==i.line?i.ch:null)),++l})),s.collapsed&&e.iter(t.line,i.line+1,(function(t){Ut(e,t)&&Qe(t,0)})),s.clearOnEnter&&he(s,"beforeCursorEnter",(function(){return s.clear()})),s.readOnly&&(St=!0,(e.history.done.length||e.history.undone.length)&&e.clearHistory()),s.collapsed&&(s.id=++ws,s.atomic=!0),c){if(a&&(c.curOp.updateMaxLine=!0),s.collapsed)ur(c,t.line,i.line+1);else if(s.className||s.startStyle||s.endStyle||s.css||s.attributes||s.title)for(var u=t.line;u<=i.line;u++)hr(c,u,"text");s.atomic&&is(c.doc),ai(c,"markerAdded",c,s)}return s}ks.prototype.clear=function(){if(!this.explicitlyCleared){var e=this.doc.cm,t=e&&!e.curOp;if(t&&zr(e),me(this,"clear")){var i=this.find();i&&ai(this,"clear",i.from,i.to)}for(var r=null,n=null,s=0;se.display.maxLineLength&&(e.display.maxLine=c,e.display.maxLineLength=u,e.display.maxLineChanged=!0)}null!=r&&e&&this.collapsed&&ur(e,r,n+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&is(e.doc)),e&&ai(e,"markerCleared",e,this,r,n),t&&Gr(e),this.parent&&this.parent.clear()}},ks.prototype.find=function(e,t){var i,r;null==e&&"bookmark"==this.type&&(e=1);for(var n=0;n=0;l--)cs(this,r[l]);a?$n(this,a):this.cm&&Rr(this.cm)})),undo:tn((function(){hs(this,"undo")})),redo:tn((function(){hs(this,"redo")})),undoSelection:tn((function(){hs(this,"undo",!0)})),redoSelection:tn((function(){hs(this,"redo",!0)})),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,i=0,r=0;r=e.ch)&&t.push(n.marker.parent||n.marker)}return t},findMarks:function(e,t,i){e=at(this,e),t=at(this,t);var r=[],n=e.line;return this.iter(e.line,t.line+1,(function(s){var o=s.markedSpans;if(o)for(var a=0;a=l.to||null==l.from&&n!=e.line||null!=l.from&&n==t.line&&l.from>=t.ch||i&&!i(l.marker)||r.push(l.marker.parent||l.marker)}++n})),r},getAllMarks:function(){var e=[];return this.iter((function(t){var i=t.markedSpans;if(i)for(var r=0;re)return t=e,!0;e-=s,++i})),at(this,et(i,t))},indexFromPos:function(e){var t=(e=at(this,e)).ch;if(e.linet&&(t=e.from),null!=e.to&&e.to-1)return t.state.draggingText(e),void setTimeout((function(){return t.display.input.focus()}),20);try{var h=e.dataTransfer.getData("Text");if(h){var d;if(t.state.draggingText&&!t.state.draggingText.copy&&(d=t.listSelections()),es(t.doc,xn(i,i)),d)for(var f=0;f=0;t--)ps(e.doc,"",r[t].from,r[t].to,"+delete");Rr(e)}))}function Zs(e,t,i){var r=ne(e.text,t+i,i);return r<0||r>e.text.length?null:r}function $s(e,t,i){var r=Zs(e,t.ch,i);return null==r?null:new et(t.line,r,i<0?"after":"before")}function Js(e,t,i,r,n){if(e){"rtl"==t.doc.direction&&(n=-n);var s=ce(i,t.doc.direction);if(s){var o,a=n<0?q(s):s[0],l=n<0==(1==a.level)?"after":"before";if(a.level>0||"rtl"==t.doc.direction){var c=Di(t,i);o=n<0?i.text.length-1:0;var u=Oi(t,c,o).top;o=se((function(e){return Oi(t,c,e).top==u}),n<0==(1==a.level)?a.from:a.to-1,o),"before"==l&&(o=Zs(i,o,1))}else o=n<0?a.to:a.from;return new et(r,o,l)}}return new et(r,n<0?i.text.length:0,n<0?"before":"after")}Ks.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"},Ks.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"},Ks.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"},Ks.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"]},Ks.default=y?Ks.macDefault:Ks.pcDefault;var eo={selectAll:as,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),K)},killLine:function(e){return Ys(e,(function(t){if(t.empty()){var i=Ge(e.doc,t.head.line).text.length;return t.head.ch==i&&t.head.line0)n=new et(n.line,n.ch+1),e.replaceRange(s.charAt(n.ch-1)+s.charAt(n.ch-2),et(n.line,n.ch-2),n,"+transpose");else if(n.line>e.doc.first){var o=Ge(e.doc,n.line-1).text;o&&(n=new et(n.line,1),e.replaceRange(s.charAt(0)+e.doc.lineSeparator()+o.charAt(o.length-1),et(n.line-1,o.length-1),n,"+transpose"))}i.push(new wn(n,n))}e.setSelections(i)}))},newlineAndIndent:function(e){return $r(e,(function(){for(var t=e.listSelections(),i=t.length-1;i>=0;i--)e.replaceRange(e.doc.lineSeparator(),t[i].anchor,t[i].head,"+input");t=e.listSelections();for(var r=0;r-1&&(tt((n=c.ranges[n]).from(),t)<0||t.xRel>0)&&(tt(n.to(),t)>0||t.xRel<0)?function(e,t,i,r){var n=e.display,s=!1,c=Jr(e,(function(t){l&&(n.scroller.draggable=!1),e.state.draggingText=!1,fe(n.wrapper.ownerDocument,"mouseup",c),fe(n.wrapper.ownerDocument,"mousemove",u),fe(n.scroller,"dragstart",h),fe(n.scroller,"drop",c),s||(_e(t),r.addNew||qn(e.doc,i,null,null,r.extend),l&&!d||o&&9==a?setTimeout((function(){n.wrapper.ownerDocument.body.focus({preventScroll:!0}),n.input.focus()}),20):n.input.focus())})),u=function(e){s=s||Math.abs(t.clientX-e.clientX)+Math.abs(t.clientY-e.clientY)>=10},h=function(){return s=!0};l&&(n.scroller.draggable=!0),e.state.draggingText=c,c.copy=!r.moveOnDrag,n.scroller.dragDrop&&n.scroller.dragDrop(),he(n.wrapper.ownerDocument,"mouseup",c),he(n.wrapper.ownerDocument,"mousemove",u),he(n.scroller,"dragstart",h),he(n.scroller,"drop",c),Cr(e),setTimeout((function(){return n.input.focus()}),20)}(e,r,t,s):function(e,t,i,r){var n=e.display,s=e.doc;_e(t);var o,a,l=s.sel,c=l.ranges;if(r.addNew&&!r.extend?(a=s.sel.contains(i),o=a>-1?c[a]:new wn(i,i)):(o=s.sel.primary(),a=s.sel.primIndex),"rectangle"==r.unit)r.addNew||(o=new wn(i,i)),i=lr(e,t,!0,!0),a=-1;else{var u=mo(e,i,r.unit);o=r.extend?Vn(o,u.anchor,u.head,r.extend):u}r.addNew?-1==a?(a=c.length,Jn(s,kn(e,c.concat([o]),a),{scroll:!1,origin:"*mouse"})):c.length>1&&c[a].empty()&&"char"==r.unit&&!r.extend?(Jn(s,kn(e,c.slice(0,a).concat(c.slice(a+1)),0),{scroll:!1,origin:"*mouse"}),l=s.sel):Yn(s,a,o,X):(a=0,Jn(s,new Cn([o],0),X),l=s.sel);var h=i;function d(t){if(0!=tt(h,t))if(h=t,"rectangle"==r.unit){for(var n=[],c=e.options.tabSize,u=N(Ge(s,i.line).text,i.ch,c),d=N(Ge(s,t.line).text,t.ch,c),f=Math.min(u,d),p=Math.max(u,d),g=Math.min(i.line,t.line),v=Math.min(e.lastLine(),Math.max(i.line,t.line));g<=v;g++){var m=Ge(s,g).text,y=z(m,f,c);f==p?n.push(new wn(et(g,y),et(g,y))):m.length>y&&n.push(new wn(et(g,y),et(g,z(m,p,c))))}n.length||n.push(new wn(i,i)),Jn(s,kn(e,l.ranges.slice(0,a).concat(n),a),{origin:"*mouse",scroll:!1}),e.scrollIntoView(t)}else{var _,b=o,S=mo(e,t,r.unit),C=b.anchor;tt(S.anchor,C)>0?(_=S.head,C=st(b.from(),S.anchor)):(_=S.anchor,C=nt(b.to(),S.head));var w=l.ranges.slice(0);w[a]=function(e,t){var i=t.anchor,r=t.head,n=Ge(e.doc,i.line);if(0==tt(i,r)&&i.sticky==r.sticky)return t;var s=ce(n);if(!s)return t;var o=ae(s,i.ch,i.sticky),a=s[o];if(a.from!=i.ch&&a.to!=i.ch)return t;var l,c=o+(a.from==i.ch==(1!=a.level)?0:1);if(0==c||c==s.length)return t;if(r.line!=i.line)l=(r.line-i.line)*("ltr"==e.doc.direction?1:-1)>0;else{var u=ae(s,r.ch,r.sticky),h=u-o||(r.ch-i.ch)*(1==a.level?-1:1);l=u==c-1||u==c?h<0:h>0}var d=s[c+(l?-1:0)],f=l==(1==d.level),p=f?d.from:d.to,g=f?"after":"before";return i.ch==p&&i.sticky==g?t:new wn(new et(i.line,p,g),r)}(e,new wn(at(s,C),_)),Jn(s,kn(e,w,a),X)}}var f=n.wrapper.getBoundingClientRect(),p=0;function g(t){e.state.selectingText=!1,p=1/0,t&&(_e(t),n.input.focus()),fe(n.wrapper.ownerDocument,"mousemove",v),fe(n.wrapper.ownerDocument,"mouseup",m),s.history.lastSelOrigin=null}var v=Jr(e,(function(t){0!==t.buttons&&ke(t)?function t(i){var o=++p,a=lr(e,i,!0,"rectangle"==r.unit);if(a)if(0!=tt(a,h)){e.curOp.focus=O(),d(a);var l=Tr(n,s);(a.line>=l.to||a.linef.bottom?20:0;c&&setTimeout(Jr(e,(function(){p==o&&(n.scroller.scrollTop+=c,t(i))})),50)}}(t):g(t)})),m=Jr(e,g);e.state.selectingText=m,he(n.wrapper.ownerDocument,"mousemove",v),he(n.wrapper.ownerDocument,"mouseup",m)}(e,r,t,s)}(t,r,s,e):we(e)==i.scroller&&_e(e):2==n?(r&&qn(t.doc,r),setTimeout((function(){return i.input.focus()}),20)):3==n&&(w?t.display.input.onContextMenu(e):Cr(t)))}}function mo(e,t,i){if("char"==i)return new wn(t,t);if("word"==i)return e.findWordAt(t);if("line"==i)return new wn(et(t.line,0),at(e.doc,et(t.line+1,0)));var r=i(e,t);return new wn(r.from,r.to)}function yo(e,t,i,r){var n,s;if(t.touches)n=t.touches[0].clientX,s=t.touches[0].clientY;else try{n=t.clientX,s=t.clientY}catch(e){return!1}if(n>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&_e(t);var o=e.display,a=o.lineDiv.getBoundingClientRect();if(s>a.bottom||!me(e,i))return Se(t);s-=a.top-o.viewOffset;for(var l=0;l=n)return pe(e,i,e,Ze(e.doc,s),e.display.gutterSpecs[l].className,t),Se(t)}}function _o(e,t){return yo(e,t,"gutterClick",!0)}function bo(e,t){Si(e.display,t)||function(e,t){return!!me(e,"gutterContextMenu")&&yo(e,t,"gutterContextMenu",!1)}(e,t)||ge(e,t,"contextmenu")||w||e.display.input.onContextMenu(t)}function So(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),Hi(e)}go.prototype.compare=function(e,t,i){return this.time+400>e&&0==tt(t,this.pos)&&i==this.button};var Co={toString:function(){return"CodeMirror.Init"}},wo={},ko={};function xo(e,t,i){if(!t!=!(i&&i!=Co)){var r=e.display.dragFunctions,n=t?he:fe;n(e.display.scroller,"dragstart",r.start),n(e.display.scroller,"dragenter",r.enter),n(e.display.scroller,"dragover",r.over),n(e.display.scroller,"dragleave",r.leave),n(e.display.scroller,"drop",r.drop)}}function Eo(e){e.options.lineWrapping?(M(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(E(e.display.wrapper,"CodeMirror-wrap"),zt(e)),ar(e),ur(e),Hi(e),setTimeout((function(){return jr(e)}),100)}function To(e,t){var i=this;if(!(this instanceof To))return new To(e,t);this.options=t=t?B(t):{},B(wo,t,!1);var r=t.value;"string"==typeof r?r=new Rs(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var n=new To.inputStyles[t.inputStyle](this),s=this.display=new vn(e,r,n,t);for(var c in s.wrapper.CodeMirror=this,So(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Xr(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 H,keySeq:null,specialChars:null},t.autofocus&&!m&&s.input.focus(),o&&a<11&&setTimeout((function(){return i.display.input.reset(!0)}),20),function(e){var t=e.display;he(t.scroller,"mousedown",Jr(e,vo)),he(t.scroller,"dblclick",o&&a<11?Jr(e,(function(t){if(!ge(e,t)){var i=lr(e,t);if(i&&!_o(e,t)&&!Si(e.display,t)){_e(t);var r=e.findWordAt(i);qn(e.doc,r.anchor,r.head)}}})):function(t){return ge(e,t)||_e(t)}),he(t.scroller,"contextmenu",(function(t){return bo(e,t)})),he(t.input.getField(),"contextmenu",(function(i){t.scroller.contains(i.target)||bo(e,i)}));var i,r={end:0};function n(){t.activeTouch&&(i=setTimeout((function(){return t.activeTouch=null}),1e3),(r=t.activeTouch).end=+new Date)}function s(e,t){if(null==t.left)return!0;var i=t.left-e.left,r=t.top-e.top;return i*i+r*r>400}he(t.scroller,"touchstart",(function(n){if(!ge(e,n)&&!function(e){if(1!=e.touches.length)return!1;var t=e.touches[0];return t.radiusX<=1&&t.radiusY<=1}(n)&&!_o(e,n)){t.input.ensurePolled(),clearTimeout(i);var s=+new Date;t.activeTouch={start:s,moved:!1,prev:s-r.end<=300?r:null},1==n.touches.length&&(t.activeTouch.left=n.touches[0].pageX,t.activeTouch.top=n.touches[0].pageY)}})),he(t.scroller,"touchmove",(function(){t.activeTouch&&(t.activeTouch.moved=!0)})),he(t.scroller,"touchend",(function(i){var r=t.activeTouch;if(r&&!Si(t,i)&&null!=r.left&&!r.moved&&new Date-r.start<300){var o,a=e.coordsChar(t.activeTouch,"page");o=!r.prev||s(r,r.prev)?new wn(a,a):!r.prev.prev||s(r,r.prev.prev)?e.findWordAt(a):new wn(et(a.line,0),at(e.doc,et(a.line+1,0))),e.setSelection(o.anchor,o.head),e.focus(),_e(i)}n()})),he(t.scroller,"touchcancel",n),he(t.scroller,"scroll",(function(){t.scroller.clientHeight&&(Ir(e,t.scroller.scrollTop),Fr(e,t.scroller.scrollLeft,!0),pe(e,"scroll",e))})),he(t.scroller,"mousewheel",(function(t){return Sn(e,t)})),he(t.scroller,"DOMMouseScroll",(function(t){return Sn(e,t)})),he(t.wrapper,"scroll",(function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0})),t.dragFunctions={enter:function(t){ge(e,t)||Ce(t)},over:function(t){ge(e,t)||(function(e,t){var i=lr(e,t);if(i){var r=document.createDocumentFragment();mr(e,i,r),e.display.dragCursor||(e.display.dragCursor=A("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),L(e.display.dragCursor,r)}}(e,t),Ce(t))},start:function(t){return function(e,t){if(o&&(!e.state.draggingText||+new Date-Ds<100))Ce(t);else if(!ge(e,t)&&!Si(e.display,t)&&(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!d)){var i=A("img",null,null,"position: fixed; left: 0; top: 0;");i.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",h&&(i.width=i.height=1,e.display.wrapper.appendChild(i),i._top=i.offsetTop),t.dataTransfer.setDragImage(i,0,0),h&&i.parentNode.removeChild(i)}}(e,t)},drop:Jr(e,Os),leave:function(t){ge(e,t)||Ms(e)}};var l=t.input.getField();he(l,"keyup",(function(t){return uo.call(e,t)})),he(l,"keydown",Jr(e,co)),he(l,"keypress",Jr(e,ho)),he(l,"focus",(function(t){return wr(e,t)})),he(l,"blur",(function(t){return kr(e,t)}))}(this),Fs(),zr(this),this.curOp.forceUpdate=!0,Pn(this,r),t.autofocus&&!m||this.hasFocus()?setTimeout((function(){i.hasFocus()&&!i.state.focused&&wr(i)}),20):kr(this),ko)ko.hasOwnProperty(c)&&ko[c](this,t[c],Co);dn(this),t.finishInit&&t.finishInit(this);for(var u=0;u150)){if(!r)return;i="prev"}}else c=0,i="not";"prev"==i?c=t>s.first?N(Ge(s,t-1).text,null,o):0:"add"==i?c=l+e.options.indentUnit:"subtract"==i?c=l-e.options.indentUnit:"number"==typeof i&&(c=l+i),c=Math.max(0,c);var h="",d=0;if(e.options.indentWithTabs)for(var f=Math.floor(c/o);f;--f)d+=o,h+="\t";if(do,l=De(t),c=null;if(a&&r.ranges.length>1)if(Ro&&Ro.text.join("\n")==t){if(r.ranges.length%Ro.text.length==0){c=[];for(var u=0;u=0;d--){var f=r.ranges[d],p=f.from(),g=f.to();f.empty()&&(i&&i>0?p=et(p.line,p.ch-i):e.state.overwrite&&!a?g=et(g.line,Math.min(Ge(s,g.line).text.length,g.ch+q(l).length)):a&&Ro&&Ro.lineWise&&Ro.text.join("\n")==l.join("\n")&&(p=g=et(p.line,0)));var v={from:p,to:g,text:c?c[d%c.length]:l,origin:n||(a?"paste":e.state.cutIncoming>o?"cut":"+input")};cs(e.doc,v),ai(e,"inputRead",e,v)}t&&!a&&Io(e,t),Rr(e),e.curOp.updateInput<2&&(e.curOp.updateInput=h),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function Mo(e,t){var i=e.clipboardData&&e.clipboardData.getData("Text");if(i)return e.preventDefault(),t.isReadOnly()||t.options.disableInput||$r(t,(function(){return Oo(t,i,0,null,"paste")})),!0}function Io(e,t){if(e.options.electricChars&&e.options.smartIndent)for(var i=e.doc.sel,r=i.ranges.length-1;r>=0;r--){var n=i.ranges[r];if(!(n.head.ch>100||r&&i.ranges[r-1].head.line==n.head.line)){var s=e.getModeAt(n.head),o=!1;if(s.electricChars){for(var a=0;a-1){o=Ao(e,n.head.line,"smart");break}}else s.electricInput&&s.electricInput.test(Ge(e.doc,n.head.line).text.slice(0,n.head.ch))&&(o=Ao(e,n.head.line,"smart"));o&&ai(e,"electricInput",e,n.head.line)}}}function Po(e){for(var t=[],i=[],r=0;r0?0:-1));o=isNaN(u)?null:new et(t.line,Math.max(0,Math.min(a.text.length,t.ch+i*(u>=55296&&u<56320?2:1))),-i)}else o=n?function(e,t,i,r){var n=ce(t,e.doc.direction);if(!n)return $s(t,i,r);i.ch>=t.text.length?(i.ch=t.text.length,i.sticky="before"):i.ch<=0&&(i.ch=0,i.sticky="after");var s=ae(n,i.ch,i.sticky),o=n[s];if("ltr"==e.doc.direction&&o.level%2==0&&(r>0?o.to>i.ch:o.from=o.from&&d>=u.begin)){var f=h?"before":"after";return new et(i.line,d,f)}}var p=function(e,t,r){for(var s=function(e,t){return t?new et(i.line,l(e,1),"before"):new et(i.line,e,"after")};e>=0&&e0==(1!=o.level),c=a?r.begin:l(r.end,-1);if(o.from<=c&&c0?u.end:l(u.begin,-1);return null==v||r>0&&v==t.text.length||!(g=p(r>0?0:n.length-1,r,c(v)))?null:g}(e.cm,a,t,i):$s(a,t,i);if(null==o){if(s||(c=t.line+l)=e.first+e.size||(t=new et(c,t.ch,t.sticky),!(a=Ge(e,c))))return!1;t=Js(n,e.cm,a,t.line,l)}else t=o;return!0}if("char"==r||"codepoint"==r)c();else if("column"==r)c(!0);else if("word"==r||"group"==r)for(var u=null,h="group"==r,d=e.cm&&e.cm.getHelper(t,"wordChars"),f=!0;!(i<0)||c(!f);f=!1){var p=a.text.charAt(t.ch)||"\n",g=ee(p,d)?"w":h&&"\n"==p?"n":!h||/\s/.test(p)?null:"p";if(!h||f||g||(g="s"),u&&u!=g){i<0&&(i=1,c(),t.sticky="after");break}if(g&&(u=g),i>0&&!c(!f))break}var v=ss(e,t,s,o,!0);return it(s,v)&&(v.hitSide=!0),v}function Ho(e,t,i,r){var n,s,o=e.doc,a=t.left;if("page"==r){var l=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),c=Math.max(l-.5*ir(e.display),3);n=(i>0?t.bottom:t.top)+i*c}else"line"==r&&(n=i>0?t.bottom+3:t.top-3);for(;(s=Qi(e,a,n)).outside;){if(i<0?n<=0:n>=o.height){s.hitSide=!0;break}n+=5*i}return s}var jo=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new H,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};function Uo(e,t){var i=Ri(e,t.line);if(!i||i.hidden)return null;var r=Ge(e.doc,t.line),n=Li(i,r,t.line),s=ce(r,e.doc.direction),o="left";s&&(o=ae(s,t.ch)%2?"right":"left");var a=Pi(n.map,t.ch,o);return a.offset="right"==a.collapse?a.end:a.start,a}function Ko(e,t){return t&&(e.bad=!0),e}function Xo(e,t,i){var r;if(t==e.display.lineDiv){if(!(r=e.display.lineDiv.childNodes[i]))return Ko(e.clipPos(et(e.display.viewTo-1)),!0);t=null,i=0}else for(r=t;;r=r.parentNode){if(!r||r==e.display.lineDiv)return null;if(r.parentNode&&r.parentNode==e.display.lineDiv)break}for(var n=0;n=t.display.viewTo||s.line=t.display.viewFrom&&Uo(t,n)||{node:l[0].measure.map[2],offset:0},u=s.liner.firstLine()&&(o=et(o.line-1,Ge(r.doc,o.line-1).length)),a.ch==Ge(r.doc,a.line).text.length&&a.linen.viewTo-1)return!1;o.line==n.viewFrom||0==(e=cr(r,o.line))?(t=Ye(n.view[0].line),i=n.view[0].node):(t=Ye(n.view[e].line),i=n.view[e-1].node.nextSibling);var l,c,u=cr(r,a.line);if(u==n.view.length-1?(l=n.viewTo-1,c=n.lineDiv.lastChild):(l=Ye(n.view[u+1].line)-1,c=n.view[u+1].node.previousSibling),!i)return!1;for(var h=r.doc.splitLines(function(e,t,i,r,n){var s="",o=!1,a=e.doc.lineSeparator(),l=!1;function c(){o&&(s+=a,l&&(s+=a),o=l=!1)}function u(e){e&&(c(),s+=e)}function h(t){if(1==t.nodeType){var i=t.getAttribute("cm-text");if(i)return void u(i);var s,d=t.getAttribute("cm-marker");if(d){var f=e.findMarks(et(r,0),et(n+1,0),(v=+d,function(e){return e.id==v}));return void(f.length&&(s=f[0].find(0))&&u(Ve(e.doc,s.from,s.to).join(a)))}if("false"==t.getAttribute("contenteditable"))return;var p=/^(pre|div|p|li|table|br)$/i.test(t.nodeName);if(!/^br$/i.test(t.nodeName)&&0==t.textContent.length)return;p&&c();for(var g=0;g1&&d.length>1;)if(q(h)==q(d))h.pop(),d.pop(),l--;else{if(h[0]!=d[0])break;h.shift(),d.shift(),t++}for(var f=0,p=0,g=h[0],v=d[0],m=Math.min(g.length,v.length);fo.ch&&y.charCodeAt(y.length-p-1)==_.charCodeAt(_.length-p-1);)f--,p++;h[h.length-1]=y.slice(0,y.length-p).replace(/^\u200b+/,""),h[0]=h[0].slice(f).replace(/\u200b+$/,"");var S=et(t,f),C=et(l,d.length?q(d).length-p:0);return h.length>1||h[0]||tt(S,C)?(ps(r.doc,h,S,C,"+input"),!0):void 0},jo.prototype.ensurePolled=function(){this.forceCompositionEnd()},jo.prototype.reset=function(){this.forceCompositionEnd()},jo.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},jo.prototype.readFromDOMSoon=function(){var e=this;null==this.readDOMTimeout&&(this.readDOMTimeout=setTimeout((function(){if(e.readDOMTimeout=null,e.composing){if(!e.composing.done)return;e.composing=null}e.updateFromDOM()}),80))},jo.prototype.updateFromDOM=function(){var e=this;!this.cm.isReadOnly()&&this.pollContent()||$r(this.cm,(function(){return ur(e.cm)}))},jo.prototype.setUneditable=function(e){e.contentEditable="false"},jo.prototype.onKeyPress=function(e){0==e.charCode||this.composing||(e.preventDefault(),this.cm.isReadOnly()||Jr(this.cm,Oo)(this.cm,String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),0))},jo.prototype.readOnlyChanged=function(e){this.div.contentEditable=String("nocursor"!=e)},jo.prototype.onContextMenu=function(){},jo.prototype.resetPosition=function(){},jo.prototype.needsContentAttribute=!0;var zo=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new H,this.hasSelection=!1,this.composing=null};zo.prototype.init=function(e){var t=this,i=this,r=this.cm;this.createField(e);var n=this.textarea;function s(e){if(!ge(r,e)){if(r.somethingSelected())Do({lineWise:!1,text:r.getSelections()});else{if(!r.options.lineWiseCopyCut)return;var t=Po(r);Do({lineWise:!0,text:t.text}),"cut"==e.type?r.setSelections(t.ranges,null,K):(i.prevInput="",n.value=t.text.join("\n"),P(n))}"cut"==e.type&&(r.state.cutIncoming=+new Date)}}e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),g&&(n.style.width="0px"),he(n,"input",(function(){o&&a>=9&&t.hasSelection&&(t.hasSelection=null),i.poll()})),he(n,"paste",(function(e){ge(r,e)||Mo(e,r)||(r.state.pasteIncoming=+new Date,i.fastPoll())})),he(n,"cut",s),he(n,"copy",s),he(e.scroller,"paste",(function(t){if(!Si(e,t)&&!ge(r,t)){if(!n.dispatchEvent)return r.state.pasteIncoming=+new Date,void i.focus();var s=new Event("paste");s.clipboardData=t.clipboardData,n.dispatchEvent(s)}})),he(e.lineSpace,"selectstart",(function(t){Si(e,t)||_e(t)})),he(n,"compositionstart",(function(){var e=r.getCursor("from");i.composing&&i.composing.range.clear(),i.composing={start:e,range:r.markText(e,r.getCursor("to"),{className:"CodeMirror-composing"})}})),he(n,"compositionend",(function(){i.composing&&(i.poll(),i.composing.range.clear(),i.composing=null)}))},zo.prototype.createField=function(e){this.wrapper=Bo(),this.textarea=this.wrapper.firstChild},zo.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},zo.prototype.prepareSelection=function(){var e=this.cm,t=e.display,i=e.doc,r=vr(e);if(e.options.moveInputWithCursor){var n=Gi(e,i.sel.primary().head,"div"),s=t.wrapper.getBoundingClientRect(),o=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,n.top+o.top-s.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,n.left+o.left-s.left))}return r},zo.prototype.showSelection=function(e){var t=this.cm.display;L(t.cursorDiv,e.cursors),L(t.selectionDiv,e.selection),null!=e.teTop&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},zo.prototype.reset=function(e){if(!this.contextMenuPending&&!this.composing){var t=this.cm;if(t.somethingSelected()){this.prevInput="";var i=t.getSelection();this.textarea.value=i,t.state.focused&&P(this.textarea),o&&a>=9&&(this.hasSelection=i)}else e||(this.prevInput=this.textarea.value="",o&&a>=9&&(this.hasSelection=null))}},zo.prototype.getField=function(){return this.textarea},zo.prototype.supportsTouch=function(){return!1},zo.prototype.focus=function(){if("nocursor"!=this.cm.options.readOnly&&(!m||O()!=this.textarea))try{this.textarea.focus()}catch(e){}},zo.prototype.blur=function(){this.textarea.blur()},zo.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},zo.prototype.receivedFocus=function(){this.slowPoll()},zo.prototype.slowPoll=function(){var e=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,(function(){e.poll(),e.cm.state.focused&&e.slowPoll()}))},zo.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0,t.polling.set(20,(function i(){t.poll()||e?(t.pollingFast=!1,t.slowPoll()):(e=!0,t.polling.set(60,i))}))},zo.prototype.poll=function(){var e=this,t=this.cm,i=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||Oe(i)&&!r&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var n=i.value;if(n==r&&!t.somethingSelected())return!1;if(o&&a>=9&&this.hasSelection===n||y&&/[\uf700-\uf7ff]/.test(n))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var s=n.charCodeAt(0);if(8203!=s||r||(r="​"),8666==s)return this.reset(),this.cm.execCommand("undo")}for(var l=0,c=Math.min(r.length,n.length);l1e3||n.indexOf("\n")>-1?i.value=e.prevInput="":e.prevInput=n,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))})),!0},zo.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},zo.prototype.onKeyPress=function(){o&&a>=9&&(this.hasSelection=null),this.fastPoll()},zo.prototype.onContextMenu=function(e){var t=this,i=t.cm,r=i.display,n=t.textarea;t.contextMenuPending&&t.contextMenuPending();var s=lr(i,e),c=r.scroller.scrollTop;if(s&&!h){i.options.resetSelectionOnContextMenu&&-1==i.doc.sel.contains(s)&&Jr(i,Jn)(i.doc,xn(s),K);var u,d=n.style.cssText,f=t.wrapper.style.cssText,p=t.wrapper.offsetParent.getBoundingClientRect();if(t.wrapper.style.cssText="position: static",n.style.cssText="position: absolute; width: 30px; height: 30px;\n top: "+(e.clientY-p.top-5)+"px; left: "+(e.clientX-p.left-5)+"px;\n z-index: 1000; background: "+(o?"rgba(255, 255, 255, .05)":"transparent")+";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",l&&(u=window.scrollY),r.input.focus(),l&&window.scrollTo(null,u),r.input.reset(),i.somethingSelected()||(n.value=t.prevInput=" "),t.contextMenuPending=m,r.selForContextMenu=i.doc.sel,clearTimeout(r.detectingSelectAll),o&&a>=9&&v(),w){Ce(e);var g=function(){fe(window,"mouseup",g),setTimeout(m,20)};he(window,"mouseup",g)}else setTimeout(m,50)}function v(){if(null!=n.selectionStart){var e=i.somethingSelected(),s="​"+(e?n.value:"");n.value="⇚",n.value=s,t.prevInput=e?"":"​",n.selectionStart=1,n.selectionEnd=s.length,r.selForContextMenu=i.doc.sel}}function m(){if(t.contextMenuPending==m&&(t.contextMenuPending=!1,t.wrapper.style.cssText=f,n.style.cssText=d,o&&a<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=c),null!=n.selectionStart)){(!o||o&&a<9)&&v();var e=0,s=function(){r.selForContextMenu==i.doc.sel&&0==n.selectionStart&&n.selectionEnd>0&&"​"==t.prevInput?Jr(i,as)(i):e++<10?r.detectingSelectAll=setTimeout(s,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(s,200)}}},zo.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled="nocursor"==e,this.textarea.readOnly=!!e},zo.prototype.setUneditable=function(){},zo.prototype.needsContentAttribute=!1,function(e){var t=e.optionHandlers;function i(i,r,n,s){e.defaults[i]=r,n&&(t[i]=s?function(e,t,i){i!=Co&&n(e,t,i)}:n)}e.defineOption=i,e.Init=Co,i("value","",(function(e,t){return e.setValue(t)}),!0),i("mode",null,(function(e,t){e.doc.modeOption=t,Rn(e)}),!0),i("indentUnit",2,Rn,!0),i("indentWithTabs",!1),i("smartIndent",!0),i("tabSize",4,(function(e){Dn(e),Hi(e),ur(e)}),!0),i("lineSeparator",null,(function(e,t){if(e.doc.lineSep=t,t){var i=[],r=e.doc.first;e.doc.iter((function(e){for(var n=0;;){var s=e.text.indexOf(t,n);if(-1==s)break;n=s+t.length,i.push(et(r,s))}r++}));for(var n=i.length-1;n>=0;n--)ps(e.doc,t,i[n],et(i[n].line,i[n].ch+t.length))}})),i("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,(function(e,t,i){e.state.specialChars=new RegExp(t.source+(t.test("\t")?"":"|\t"),"g"),i!=Co&&e.refresh()})),i("specialCharPlaceholder",$t,(function(e){return e.refresh()}),!0),i("electricChars",!0),i("inputStyle",m?"contenteditable":"textarea",(function(){throw new Error("inputStyle can not (yet) be changed in a running editor")}),!0),i("spellcheck",!1,(function(e,t){return e.getInputField().spellcheck=t}),!0),i("autocorrect",!1,(function(e,t){return e.getInputField().autocorrect=t}),!0),i("autocapitalize",!1,(function(e,t){return e.getInputField().autocapitalize=t}),!0),i("rtlMoveVisually",!b),i("wholeLineUpdateBefore",!0),i("theme","default",(function(e){So(e),gn(e)}),!0),i("keyMap","default",(function(e,t,i){var r=Qs(t),n=i!=Co&&Qs(i);n&&n.detach&&n.detach(e,r),r.attach&&r.attach(e,n||null)})),i("extraKeys",null),i("configureMouse",null),i("lineWrapping",!1,Eo,!0),i("gutters",[],(function(e,t){e.display.gutterSpecs=fn(t,e.options.lineNumbers),gn(e)}),!0),i("fixedGutter",!0,(function(e,t){e.display.gutters.style.left=t?sr(e.display)+"px":"0",e.refresh()}),!0),i("coverGutterNextToScrollbar",!1,(function(e){return jr(e)}),!0),i("scrollbarStyle","native",(function(e){Xr(e),jr(e),e.display.scrollbars.setScrollTop(e.doc.scrollTop),e.display.scrollbars.setScrollLeft(e.doc.scrollLeft)}),!0),i("lineNumbers",!1,(function(e,t){e.display.gutterSpecs=fn(e.options.gutters,t),gn(e)}),!0),i("firstLineNumber",1,gn,!0),i("lineNumberFormatter",(function(e){return e}),gn,!0),i("showCursorWhenSelecting",!1,gr,!0),i("resetSelectionOnContextMenu",!0),i("lineWiseCopyCut",!0),i("pasteLinesPerSelection",!0),i("selectionsMayTouch",!1),i("readOnly",!1,(function(e,t){"nocursor"==t&&(kr(e),e.display.input.blur()),e.display.input.readOnlyChanged(t)})),i("screenReaderLabel",null,(function(e,t){t=""===t?null:t,e.display.input.screenReaderLabelChanged(t)})),i("disableInput",!1,(function(e,t){t||e.display.input.reset()}),!0),i("dragDrop",!0,xo),i("allowDropFileTypes",null),i("cursorBlinkRate",530),i("cursorScrollMargin",0),i("cursorHeight",1,gr,!0),i("singleCursorHeightPerLine",!0,gr,!0),i("workTime",100),i("workDelay",100),i("flattenSpans",!0,Dn,!0),i("addModeClass",!1,Dn,!0),i("pollInterval",100),i("undoDepth",200,(function(e,t){return e.doc.history.undoDepth=t})),i("historyEventDelay",1250),i("viewportMargin",10,(function(e){return e.refresh()}),!0),i("maxHighlightLength",1e4,Dn,!0),i("moveInputWithCursor",!0,(function(e,t){t||e.display.input.resetPosition()})),i("tabindex",null,(function(e,t){return e.display.input.getField().tabIndex=t||""})),i("autofocus",null),i("direction","ltr",(function(e,t){return e.doc.setDirection(t)}),!0),i("phrases",null)}(To),function(e){var t=e.optionHandlers,i=e.helpers={};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(e,i){var r=this.options,n=r[e];r[e]==i&&"mode"!=e||(r[e]=i,t.hasOwnProperty(e)&&Jr(this,t[e])(this,i,n),pe(this,"optionChange",this,e))},getOption:function(e){return this.options[e]},getDoc:function(){return this.doc},addKeyMap:function(e,t){this.state.keyMaps[t?"push":"unshift"](Qs(e))},removeKeyMap:function(e){for(var t=this.state.keyMaps,i=0;ii&&(Ao(this,n.head.line,e,!0),i=n.head.line,r==this.doc.sel.primIndex&&Rr(this));else{var s=n.from(),o=n.to(),a=Math.max(i,s.line);i=Math.min(this.lastLine(),o.line-(o.ch?0:1))+1;for(var l=a;l0&&Yn(this.doc,r,new wn(s,c[r].to()),K)}}})),getTokenAt:function(e,t){return yt(this,e,t)},getLineTokens:function(e,t){return yt(this,et(e),t,!0)},getTokenTypeAt:function(e){e=at(this.doc,e);var t,i=dt(this,Ge(this.doc,e.line)),r=0,n=(i.length-1)/2,s=e.ch;if(0==s)t=i[2];else for(;;){var o=r+n>>1;if((o?i[2*o-1]:0)>=s)n=o;else{if(!(i[2*o+1]s&&(e=s,n=!0),r=Ge(this.doc,e)}else r=e;return Xi(this,r,{top:0,left:0},t||"page",i||n).top+(n?this.doc.height-Xt(r):0)},defaultTextHeight:function(){return ir(this.display)},defaultCharWidth:function(){return rr(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(e,t,i,r,n){var s,o,a,l=this.display,c=(e=Gi(this,at(this.doc,e))).bottom,u=e.left;if(t.style.position="absolute",t.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(t),l.sizer.appendChild(t),"over"==r)c=e.top;else if("above"==r||"near"==r){var h=Math.max(l.wrapper.clientHeight,this.doc.height),d=Math.max(l.sizer.clientWidth,l.lineSpace.clientWidth);("above"==r||e.bottom+t.offsetHeight>h)&&e.top>t.offsetHeight?c=e.top-t.offsetHeight:e.bottom+t.offsetHeight<=h&&(c=e.bottom),u+t.offsetWidth>d&&(u=d-t.offsetWidth)}t.style.top=c+"px",t.style.left=t.style.right="","right"==n?(u=l.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):("left"==n?u=0:"middle"==n&&(u=(l.sizer.clientWidth-t.offsetWidth)/2),t.style.left=u+"px"),i&&(s=this,o={left:u,top:c,right:u+t.offsetWidth,bottom:c+t.offsetHeight},null!=(a=Lr(s,o)).scrollTop&&Ir(s,a.scrollTop),null!=a.scrollLeft&&Fr(s,a.scrollLeft))},triggerOnKeyDown:en(co),triggerOnKeyPress:en(ho),triggerOnKeyUp:uo,triggerOnMouseDown:en(vo),execCommand:function(e){if(eo.hasOwnProperty(e))return eo[e].call(null,this)},triggerElectric:en((function(e){Io(this,e)})),findPosH:function(e,t,i,r){var n=1;t<0&&(n=-1,t=-t);for(var s=at(this.doc,e),o=0;o0&&o(t.charAt(i-1));)--i;for(;r.5||this.options.lineWrapping)&&ar(this),pe(this,"refresh",this)})),swapDoc:en((function(e){var t=this.doc;return t.cm=null,this.state.selectingText&&this.state.selectingText(),Pn(this,e),Hi(this),this.display.input.reset(),Dr(this,e.scrollLeft,e.scrollTop),this.curOp.forceScroll=!0,ai(this,"swapDoc",this,t),t})),phrase:function(e){var t=this.options.phrases;return t&&Object.prototype.hasOwnProperty.call(t,e)?t[e]:e},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}},ye(e),e.registerHelper=function(t,r,n){i.hasOwnProperty(t)||(i[t]=e[t]={_global:[]}),i[t][r]=n},e.registerGlobalHelper=function(t,r,n,s){e.registerHelper(t,r,s),i[t]._global.push({pred:n,val:s})}}(To);var Go="iter insert remove copy getEditor constructor".split(" ");for(var Vo in Rs.prototype)Rs.prototype.hasOwnProperty(Vo)&&j(Go,Vo)<0&&(To.prototype[Vo]=function(e){return function(){return e.apply(this.doc,arguments)}}(Rs.prototype[Vo]));return ye(Rs),To.inputStyles={textarea:zo,contenteditable:jo},To.defineMode=function(e){To.defaults.mode||"null"==e||(To.defaults.mode=e),Be.apply(this,arguments)},To.defineMIME=function(e,t){Fe[e]=t},To.defineMode("null",(function(){return{token:function(e){return e.skipToEnd()}}})),To.defineMIME("text/plain","null"),To.defineExtension=function(e,t){To.prototype[e]=t},To.defineDocExtension=function(e,t){Rs.prototype[e]=t},To.fromTextArea=function(e,t){if((t=t?B(t):{}).value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),null==t.autofocus){var i=O();t.autofocus=i==e||null!=e.getAttribute("autofocus")&&i==document.body}function r(){e.value=a.getValue()}var n;if(e.form&&(he(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var s=e.form;n=s.submit;try{var o=s.submit=function(){r(),s.submit=n,s.submit(),s.submit=o}}catch(e){}}t.finishInit=function(i){i.save=r,i.getTextArea=function(){return e},i.toTextArea=function(){i.toTextArea=isNaN,r(),e.parentNode.removeChild(i.getWrapperElement()),e.style.display="",e.form&&(fe(e.form,"submit",r),t.leaveSubmitMethodAlone||"function"!=typeof e.form.submit||(e.form.submit=n))}},e.style.display="none";var a=To((function(t){return e.parentNode.insertBefore(t,e.nextSibling)}),t);return a},function(e){e.off=fe,e.on=he,e.wheelEventPixels=bn,e.Doc=Rs,e.splitLines=De,e.countColumn=N,e.findColumn=z,e.isWordChar=J,e.Pass=U,e.signal=pe,e.Line=Gt,e.changeEnd=En,e.scrollbarModel=Kr,e.Pos=et,e.cmpPos=tt,e.modes=Pe,e.mimeModes=Fe,e.resolveMode=Ne,e.getMode=He,e.modeExtensions=je,e.extendMode=Ue,e.copyState=Ke,e.startState=We,e.innerMode=Xe,e.commands=eo,e.keyMap=Ks,e.keyName=qs,e.isModifierKey=Gs,e.lookupKey=zs,e.normalizeKeyMap=Ws,e.StringStream=ze,e.SharedTextMarker=Es,e.TextMarker=ks,e.LineWidget=Ss,e.e_preventDefault=_e,e.e_stopPropagation=be,e.e_stop=Ce,e.addClass=M,e.contains=D,e.rmClass=E,e.keyNames=Ns}(To),To.version="5.58.2",To}()},Y1PL: /*!**********************************************************!*\ !*** ./node_modules/rc-textarea/es/index.js + 7 modules ***! \**********************************************************/ /*! exports provided: ResizableTextArea, default */ /*! all exports used */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/classCallCheck.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/createClass.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/createSuper.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/defineProperty.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/extends.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/inherits.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/objectSpread2.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/classnames/index.js (<- Module is not an ECMAScript module) */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/Children/toArray.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/Dom/findDOMNode.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/omit.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/ref.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/warning.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/react/index.js (<- Module is not an ECMAScript module) */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/resize-observer-polyfill/dist/ResizeObserver.es.js (<- Module uses injected variables (global)) */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/shallowequal/index.js (<- Module is not an ECMAScript module) */function(e,t,i){"use strict";i.r(t),i.d(t,"ResizableTextArea",(function(){return M}));var r=i("wx14"),n=i("1OyB"),s=i("vuIU"),o=i("Ji7U"),a=i("LK+K"),l=i("q1tI"),c=i("VTBJ"),u=i("rePB"),h=i("Zm9Q"),d=(i("Kwbf"),i("c+Xe")),f=i("m+aA"),p=i("bdgK"),g=new Map;var v=new p.default((function(e){e.forEach((function(e){var t,i=e.target;null===(t=g.get(i))||void 0===t||t.forEach((function(e){return e(i)}))}))}));var m=function(e){Object(o.a)(i,e);var t=Object(a.a)(i);function i(){return Object(n.a)(this,i),t.apply(this,arguments)}return Object(s.a)(i,[{key:"render",value:function(){return this.props.children}}]),i}(l.Component),y=l.createContext(null);function _(e){var t=e.children,i=e.disabled,r=l.useRef(null),n=l.useRef(null),s=l.useContext(y),o=l.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),a=l.isValidElement(t)&&Object(d.c)(t),u=a?t.ref:null,h=l.useMemo((function(){return Object(d.a)(u,r)}),[u,r]),p=l.useRef(e);p.current=e;var _=l.useCallback((function(e){var t=p.current,i=t.onResize,r=t.data,n=e.getBoundingClientRect(),a=n.width,l=n.height,u=e.offsetWidth,h=e.offsetHeight,d=Math.floor(a),f=Math.floor(l);if(o.current.width!==d||o.current.height!==f||o.current.offsetWidth!==u||o.current.offsetHeight!==h){var g={width:d,height:f,offsetWidth:u,offsetHeight:h};o.current=g;var v=u===Math.round(a)?a:u,m=h===Math.round(l)?l:h,y=Object(c.a)(Object(c.a)({},g),{},{offsetWidth:v,offsetHeight:m});null==s||s(y,e,r),i&&Promise.resolve().then((function(){i(y,e)}))}}),[]);return l.useEffect((function(){var e,t,s=Object(f.a)(r.current)||Object(f.a)(n.current);return s&&!i&&(e=s,t=_,g.has(e)||(g.set(e,new Set),v.observe(e)),g.get(e).add(t)),function(){return function(e,t){g.has(e)&&(g.get(e).delete(t),g.get(e).size||(v.unobserve(e),g.delete(e)))}(s,_)}}),[r.current,i]),l.createElement(m,{ref:n},a?l.cloneElement(t,{ref:h}):t)}function b(e){var t=e.children;return Object(h.a)(t).map((function(t,i){var n=(null==t?void 0:t.key)||"".concat("rc-observer-key","-").concat(i);return l.createElement(_,Object(r.a)({},e,{key:n}),t)}))}b.Collection=function(e){var t=e.children,i=e.onBatchResize,r=l.useRef(0),n=l.useRef([]),s=l.useContext(y),o=l.useCallback((function(e,t,o){r.current+=1;var a=r.current;n.current.push({size:e,element:t,data:o}),Promise.resolve().then((function(){a===r.current&&(null==i||i(n.current),n.current=[])})),null==s||s(e,t,o)}),[i,s]);return l.createElement(y.Provider,{value:o},t)};var S,C=b,w=i("bT9E"),k=i("TSYQ"),x=i.n(k),E="\n min-height:0 !important;\n max-height:none !important;\n height:0 !important;\n visibility:hidden !important;\n overflow:hidden !important;\n position:absolute !important;\n z-index:-1000 !important;\n top:0 !important;\n right:0 !important\n",T=["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"],L={};function A(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=e.getAttribute("id")||e.getAttribute("data-reactid")||e.getAttribute("name");if(t&&L[i])return L[i];var r=window.getComputedStyle(e),n=r.getPropertyValue("box-sizing")||r.getPropertyValue("-moz-box-sizing")||r.getPropertyValue("-webkit-box-sizing"),s=parseFloat(r.getPropertyValue("padding-bottom"))+parseFloat(r.getPropertyValue("padding-top")),o=parseFloat(r.getPropertyValue("border-bottom-width"))+parseFloat(r.getPropertyValue("border-top-width")),a=T.map((function(e){return"".concat(e,":").concat(r.getPropertyValue(e))})).join(";"),l={sizingStyle:a,paddingSize:s,borderSize:o,boxSizing:n};return t&&i&&(L[i]=l),l}var R,D=i("Gytx"),O=i.n(D);!function(e){e[e.NONE=0]="NONE",e[e.RESIZING=1]="RESIZING",e[e.RESIZED=2]="RESIZED"}(R||(R={}));var M=function(e){Object(o.a)(i,e);var t=Object(a.a)(i);function i(e){var s;return Object(n.a)(this,i),(s=t.call(this,e)).nextFrameActionId=void 0,s.resizeFrameId=void 0,s.textArea=void 0,s.saveTextArea=function(e){s.textArea=e},s.handleResize=function(e){var t=s.state.resizeStatus,i=s.props,r=i.autoSize,n=i.onResize;t===R.NONE&&("function"==typeof n&&n(e),r&&s.resizeOnNextFrame())},s.resizeOnNextFrame=function(){cancelAnimationFrame(s.nextFrameActionId),s.nextFrameActionId=requestAnimationFrame(s.resizeTextarea)},s.resizeTextarea=function(){var e=s.props.autoSize;if(e&&s.textArea){var t=e.minRows,i=e.maxRows,r=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;S||((S=document.createElement("textarea")).setAttribute("tab-index","-1"),S.setAttribute("aria-hidden","true"),document.body.appendChild(S)),e.getAttribute("wrap")?S.setAttribute("wrap",e.getAttribute("wrap")):S.removeAttribute("wrap");var n=A(e,t),s=n.paddingSize,o=n.borderSize,a=n.boxSizing,l=n.sizingStyle;S.setAttribute("style","".concat(l,";").concat(E)),S.value=e.value||e.placeholder||"";var c,u=Number.MIN_SAFE_INTEGER,h=Number.MAX_SAFE_INTEGER,d=S.scrollHeight;if("border-box"===a?d+=o:"content-box"===a&&(d-=s),null!==i||null!==r){S.value=" ";var f=S.scrollHeight-s;null!==i&&(u=f*i,"border-box"===a&&(u=u+s+o),d=Math.max(u,d)),null!==r&&(h=f*r,"border-box"===a&&(h=h+s+o),c=d>h?"":"hidden",d=Math.min(h,d))}return{height:d,minHeight:u,maxHeight:h,overflowY:c,resize:"none"}}(s.textArea,!1,t,i);s.setState({textareaStyles:r,resizeStatus:R.RESIZING},(function(){cancelAnimationFrame(s.resizeFrameId),s.resizeFrameId=requestAnimationFrame((function(){s.setState({resizeStatus:R.RESIZED},(function(){s.resizeFrameId=requestAnimationFrame((function(){s.setState({resizeStatus:R.NONE}),s.fixFirefoxAutoScroll()}))}))}))}))}},s.renderTextArea=function(){var e=s.props,t=e.prefixCls,i=void 0===t?"rc-textarea":t,n=e.autoSize,o=e.onResize,a=e.className,h=e.disabled,d=s.state,f=d.textareaStyles,p=d.resizeStatus,g=Object(w.a)(s.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),v=x()(i,a,Object(u.a)({},"".concat(i,"-disabled"),h));"value"in g&&(g.value=g.value||"");var m=Object(c.a)(Object(c.a)(Object(c.a)({},s.props.style),f),p===R.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return l.createElement(C,{onResize:s.handleResize,disabled:!(n||o)},l.createElement("textarea",Object(r.a)({},g,{className:v,style:m,ref:s.saveTextArea})))},s.state={textareaStyles:{},resizeStatus:R.NONE},s}return Object(s.a)(i,[{key:"componentDidUpdate",value:function(e){e.value===this.props.value&&O()(e.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 e=this.textArea.selectionStart,t=this.textArea.selectionEnd;this.textArea.setSelectionRange(e,t)}}catch(e){}}},{key:"render",value:function(){return this.renderTextArea()}}]),i}(l.Component),I=function(e){Object(o.a)(i,e);var t=Object(a.a)(i);function i(e){var r;Object(n.a)(this,i),(r=t.call(this,e)).resizableTextArea=void 0,r.focus=function(){r.resizableTextArea.textArea.focus()},r.saveTextArea=function(e){r.resizableTextArea=e},r.handleChange=function(e){var t=r.props.onChange;r.setValue(e.target.value,(function(){r.resizableTextArea.resizeTextarea()})),t&&t(e)},r.handleKeyDown=function(e){var t=r.props,i=t.onPressEnter,n=t.onKeyDown;13===e.keyCode&&i&&i(e),n&&n(e)};var s=void 0===e.value||null===e.value?e.defaultValue:e.value;return r.state={value:s},r}return Object(s.a)(i,[{key:"setValue",value:function(e,t){"value"in this.props||this.setState({value:e},t)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return l.createElement(M,Object(r.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(e){return"value"in e?{value:e.value}:null}}]),i}(l.Component);t.default=I},YJ9k: /*!***********************************************************!*\ !*** ./node_modules/@novnc/novnc/lib/util/eventtarget.js ***! \***********************************************************/ /*! no static exports found */ /*! all exports used */ /*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,i){"use strict";function r(e,t){for(var i=0;i0&&void 0!==arguments[0]?arguments[0]:[],t=e;if(Array.isArray(e)){for(var i=0;i0||r.target.offsetWidth>0)&&z.current.instance.layout()}}catch(e){i.e(e)}finally{i.f()}}))).observe(W.current),e}();return $(!0),function(){var e=z.current.instance;e.dispose();var t=e.getModel();t&&t.dispose(),z.current.subscription&&z.current.subscription.dispose(),P&&window.removeEventListener("paste",ee),i.unobserve(W.current)}}catch(e){}}))}),[]),Object(l.useEffect)((function(){if(z.current.instance&&Z)return document.addEventListener("keydown",te,!1),function(){document.removeEventListener("keydown",te)}}),[D,Z]),Object(l.useEffect)((function(){var e=z.current.instance;if(e&&Z){var t=g(S);v.editor.setModelLanguage(e.getModel(),t),console.log("language:",S,e.getModel(),t)}}),[S,Z]),Object(l.useEffect)((function(){z.current.instance&&Z&&v.editor.setTheme(A)}),[A,Z]),Object(l.useEffect)((function(){var e=z.current.instance;e&&Z&&(e.updateOptions(Object(r.a)({},x)),setTimeout((function(){e.getModel().updateOptions(Object(r.a)({},x))}),200))}),[JSON.stringify(x),Z]),Object(l.useEffect)((function(){var e=z.current.instance;e&&Z&&e.layout()}),[p,y,Z]);var ne=Object(l.useState)(d(p)),se=Object(o.a)(ne,2),oe=se[0],ae=(se[1],Object(l.useState)(d(y))),le=Object(o.a)(ae,2),ce=le[0],ue=le[1],he=Object(r.a)(Object(r.a)({},w),{},{width:oe,height:ce});return c.a.createElement("div",{className:"my-monaco-editor",ref:W,style:he})};function m(e){var t=e.width,n=void 0===t?"100%":t,a=e.height,h=void 0===a?"100%":a,f=e.original,p=e.modified,g=e.language,m=e.options,y=void 0===m?{}:m,_=Object(l.useRef)(),b=Object(l.useState)(null),S=Object(o.a)(b,2),C=S[0],w=S[1];Object(l.useEffect)((function(){_.current&&i.e(/*! import() | monaco-editor */27).then(i.t.bind(null,/*! monaco-editor/esm/vs/editor/editor.api.js */"M/lh",7)).then((function(e){var t=(v=e).editor.createDiffEditor(_.current,Object(r.a)(Object(r.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},y),{},{wordWrap:!0}));w(t);var i=function(e){var t;return _.current&&(t=new u.default((function(t){var i,r=Object(s.a)(t);try{for(r.s();!(i=r.n()).done;){var n=i.value;(n.target.offsetHeight>0||n.target.offsetWidth>0)&&e.layout()}}catch(e){r.e(e)}finally{r.f()}}))).observe(_.current),t}(t);return function(){t.dispose();var e=t.getModel();e&&e.dispose(),i.unobserve(_.current)}}))}),[]),Object(l.useEffect)((function(){C&&C.setModel({original:v.editor.createModel(f,g),modified:v.editor.createModel(p,g)})}),[f,p,g,C]);var k={width:d(n),height:d(h)};return c.a.createElement("div",{className:"my-diff-editor",ref:_,style:k})}},ZpRC: /*!*************************************************************************!*\ !*** ./node_modules/scroll-into-view-if-needed/es/index.js + 1 modules ***! \*************************************************************************/ /*! exports provided: default */ /*! exports used: default */function(e,t,i){"use strict";function r(e){return"object"==typeof e&&null!=e&&1===e.nodeType}function n(e,t){return(!t||"hidden"!==e)&&"visible"!==e&&"clip"!==e}function s(e,t){if(e.clientHeightt||s>e&&o=t&&a>=i?s-e-r:o>t&&ai?o-t+n:0}var a=function(e,t){var i=window,n=t.scrollMode,a=t.block,l=t.inline,c=t.boundary,u=t.skipOverflowHiddenElements,h="function"==typeof c?c:function(e){return e!==c};if(!r(e))throw new TypeError("Invalid target");for(var d=document.scrollingElement||document.documentElement,f=[],p=e;r(p)&&h(p);){if((p=p.parentElement)===d){f.push(p);break}null!=p&&p===document.body&&s(p)&&!s(document.documentElement)||null!=p&&s(p,u)&&f.push(p)}for(var g=i.visualViewport?i.visualViewport.width:innerWidth,v=i.visualViewport?i.visualViewport.height:innerHeight,m=window.scrollX||pageXOffset,y=window.scrollY||pageYOffset,_=e.getBoundingClientRect(),b=_.height,S=_.width,C=_.top,w=_.right,k=_.bottom,x=_.left,E="start"===a||"nearest"===a?C:"end"===a?k:C+b/2,T="center"===l?x+S/2:"end"===l?w:x,L=[],A=0;A=0&&x>=0&&k<=v&&w<=g&&C>=I&&k<=F&&x>=B&&w<=P)return L;var N=getComputedStyle(R),H=parseInt(N.borderLeftWidth,10),j=parseInt(N.borderTopWidth,10),U=parseInt(N.borderRightWidth,10),K=parseInt(N.borderBottomWidth,10),X=0,W=0,z="offsetWidth"in R?R.offsetWidth-R.clientWidth-H-U:0,G="offsetHeight"in R?R.offsetHeight-R.clientHeight-j-K:0;if(d===R)X="start"===a?E:"end"===a?E-v:"nearest"===a?o(y,y+v,v,j,K,y+E,y+E+b,b):E-v/2,W="start"===l?T:"center"===l?T-g/2:"end"===l?T-g:o(m,m+g,g,H,U,m+T,m+T+S,S),X=Math.max(0,X+y),W=Math.max(0,W+m);else{X="start"===a?E-I-j:"end"===a?E-F+K+G:"nearest"===a?o(I,F,O,j,K+G,E,E+b,b):E-(I+O/2)+G/2,W="start"===l?T-B-H:"center"===l?T-(B+M/2)+z/2:"end"===l?T-P+U+z:o(B,P,M,H,U+z,T,T+S,S);var V=R.scrollLeft,q=R.scrollTop;E+=q-(X=Math.max(0,Math.min(q+X,R.scrollHeight-O+G))),T+=V-(W=Math.max(0,Math.min(V+W,R.scrollWidth-M+z)))}L.push({el:R,top:X,left:W})}return L};function l(e){return e===Object(e)&&0!==Object.keys(e).length}t.a=function(e,t){var i=!e.ownerDocument.documentElement.contains(e);if(l(t)&&"function"==typeof t.behavior)return t.behavior(i?[]:a(e,t));if(!i){var r=function(e){return!1===e?{block:"end",inline:"nearest"}:l(e)?e:{block:"start",inline:"nearest"}}(t);return function(e,t){void 0===t&&(t="auto");var i="scrollBehavior"in document.body.style;e.forEach((function(e){var r=e.el,n=e.top,s=e.left;r.scroll&&i?r.scroll({top:n,left:s,behavior:t}):(r.scrollTop=n,r.scrollLeft=s)}))}(a(e,r),r.behavior)}}},Zss7: /*!**********************************************!*\ !*** ./node_modules/tinycolor2/tinycolor.js ***! \**********************************************/ /*! no static exports found */ /*! exports used: default */ /*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,i){var r;!function(n){var s=/^\s+/,o=/\s+$/,a=0,l=n.round,c=n.min,u=n.max,h=n.random;function d(e,t){if(t=t||{},(e=e||"")instanceof d)return e;if(!(this instanceof d))return new d(e,t);var i=function(e){var t={r:0,g:0,b:0},i=1,r=null,a=null,l=null,h=!1,d=!1;"string"==typeof e&&(e=function(e){e=e.replace(s,"").replace(o,"").toLowerCase();var t,i=!1;if(R[e])e=R[e],i=!0;else if("transparent"==e)return{r:0,g:0,b:0,a:0,format:"name"};if(t=X.rgb.exec(e))return{r:t[1],g:t[2],b:t[3]};if(t=X.rgba.exec(e))return{r:t[1],g:t[2],b:t[3],a:t[4]};if(t=X.hsl.exec(e))return{h:t[1],s:t[2],l:t[3]};if(t=X.hsla.exec(e))return{h:t[1],s:t[2],l:t[3],a:t[4]};if(t=X.hsv.exec(e))return{h:t[1],s:t[2],v:t[3]};if(t=X.hsva.exec(e))return{h:t[1],s:t[2],v:t[3],a:t[4]};if(t=X.hex8.exec(e))return{r:P(t[1]),g:P(t[2]),b:P(t[3]),a:H(t[4]),format:i?"name":"hex8"};if(t=X.hex6.exec(e))return{r:P(t[1]),g:P(t[2]),b:P(t[3]),format:i?"name":"hex"};if(t=X.hex4.exec(e))return{r:P(t[1]+""+t[1]),g:P(t[2]+""+t[2]),b:P(t[3]+""+t[3]),a:H(t[4]+""+t[4]),format:i?"name":"hex8"};if(t=X.hex3.exec(e))return{r:P(t[1]+""+t[1]),g:P(t[2]+""+t[2]),b:P(t[3]+""+t[3]),format:i?"name":"hex"};return!1}(e));"object"==typeof e&&(W(e.r)&&W(e.g)&&W(e.b)?(f=e.r,p=e.g,g=e.b,t={r:255*M(f,255),g:255*M(p,255),b:255*M(g,255)},h=!0,d="%"===String(e.r).substr(-1)?"prgb":"rgb"):W(e.h)&&W(e.s)&&W(e.v)?(r=B(e.s),a=B(e.v),t=function(e,t,i){e=6*M(e,360),t=M(t,100),i=M(i,100);var r=n.floor(e),s=e-r,o=i*(1-t),a=i*(1-s*t),l=i*(1-(1-s)*t),c=r%6;return{r:255*[i,a,o,o,l,i][c],g:255*[l,i,i,a,o,o][c],b:255*[o,o,l,i,i,a][c]}}(e.h,r,a),h=!0,d="hsv"):W(e.h)&&W(e.s)&&W(e.l)&&(r=B(e.s),l=B(e.l),t=function(e,t,i){var r,n,s;function o(e,t,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?e+6*(t-e)*i:i<.5?t:i<2/3?e+(t-e)*(2/3-i)*6:e}if(e=M(e,360),t=M(t,100),i=M(i,100),0===t)r=n=s=i;else{var a=i<.5?i*(1+t):i+t-i*t,l=2*i-a;r=o(l,a,e+1/3),n=o(l,a,e),s=o(l,a,e-1/3)}return{r:255*r,g:255*n,b:255*s}}(e.h,r,l),h=!0,d="hsl"),e.hasOwnProperty("a")&&(i=e.a));var f,p,g;return i=O(i),{ok:h,format:e.format||d,r:c(255,u(t.r,0)),g:c(255,u(t.g,0)),b:c(255,u(t.b,0)),a:i}}(e);this._originalInput=e,this._r=i.r,this._g=i.g,this._b=i.b,this._a=i.a,this._roundA=l(100*this._a)/100,this._format=t.format||i.format,this._gradientType=t.gradientType,this._r<1&&(this._r=l(this._r)),this._g<1&&(this._g=l(this._g)),this._b<1&&(this._b=l(this._b)),this._ok=i.ok,this._tc_id=a++}function f(e,t,i){e=M(e,255),t=M(t,255),i=M(i,255);var r,n,s=u(e,t,i),o=c(e,t,i),a=(s+o)/2;if(s==o)r=n=0;else{var l=s-o;switch(n=a>.5?l/(2-s-o):l/(s+o),s){case e:r=(t-i)/l+(t>1)+720)%360;--t;)r.h=(r.h+n)%360,s.push(d(r));return s}function A(e,t){t=t||6;for(var i=d(e).toHsv(),r=i.h,n=i.s,s=i.v,o=[],a=1/t;t--;)o.push(d({h:r,s:n,v:s})),s=(s+a)%1;return o}d.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var e=this.toRgb();return(299*e.r+587*e.g+114*e.b)/1e3},getLuminance:function(){var e,t,i,r=this.toRgb();return e=r.r/255,t=r.g/255,i=r.b/255,.2126*(e<=.03928?e/12.92:n.pow((e+.055)/1.055,2.4))+.7152*(t<=.03928?t/12.92:n.pow((t+.055)/1.055,2.4))+.0722*(i<=.03928?i/12.92:n.pow((i+.055)/1.055,2.4))},setAlpha:function(e){return this._a=O(e),this._roundA=l(100*this._a)/100,this},toHsv:function(){var e=p(this._r,this._g,this._b);return{h:360*e.h,s:e.s,v:e.v,a:this._a}},toHsvString:function(){var e=p(this._r,this._g,this._b),t=l(360*e.h),i=l(100*e.s),r=l(100*e.v);return 1==this._a?"hsv("+t+", "+i+"%, "+r+"%)":"hsva("+t+", "+i+"%, "+r+"%, "+this._roundA+")"},toHsl:function(){var e=f(this._r,this._g,this._b);return{h:360*e.h,s:e.s,l:e.l,a:this._a}},toHslString:function(){var e=f(this._r,this._g,this._b),t=l(360*e.h),i=l(100*e.s),r=l(100*e.l);return 1==this._a?"hsl("+t+", "+i+"%, "+r+"%)":"hsla("+t+", "+i+"%, "+r+"%, "+this._roundA+")"},toHex:function(e){return g(this._r,this._g,this._b,e)},toHexString:function(e){return"#"+this.toHex(e)},toHex8:function(e){return function(e,t,i,r,n){var s=[F(l(e).toString(16)),F(l(t).toString(16)),F(l(i).toString(16)),F(N(r))];if(n&&s[0].charAt(0)==s[0].charAt(1)&&s[1].charAt(0)==s[1].charAt(1)&&s[2].charAt(0)==s[2].charAt(1)&&s[3].charAt(0)==s[3].charAt(1))return s[0].charAt(0)+s[1].charAt(0)+s[2].charAt(0)+s[3].charAt(0);return s.join("")}(this._r,this._g,this._b,this._a,e)},toHex8String:function(e){return"#"+this.toHex8(e)},toRgb:function(){return{r:l(this._r),g:l(this._g),b:l(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+l(this._r)+", "+l(this._g)+", "+l(this._b)+")":"rgba("+l(this._r)+", "+l(this._g)+", "+l(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:l(100*M(this._r,255))+"%",g:l(100*M(this._g,255))+"%",b:l(100*M(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+l(100*M(this._r,255))+"%, "+l(100*M(this._g,255))+"%, "+l(100*M(this._b,255))+"%)":"rgba("+l(100*M(this._r,255))+"%, "+l(100*M(this._g,255))+"%, "+l(100*M(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(D[g(this._r,this._g,this._b,!0)]||!1)},toFilter:function(e){var t="#"+v(this._r,this._g,this._b,this._a),i=t,r=this._gradientType?"GradientType = 1, ":"";if(e){var n=d(e);i="#"+v(n._r,n._g,n._b,n._a)}return"progid:DXImageTransform.Microsoft.gradient("+r+"startColorstr="+t+",endColorstr="+i+")"},toString:function(e){var t=!!e;e=e||this._format;var i=!1,r=this._a<1&&this._a>=0;return t||!r||"hex"!==e&&"hex6"!==e&&"hex3"!==e&&"hex4"!==e&&"hex8"!==e&&"name"!==e?("rgb"===e&&(i=this.toRgbString()),"prgb"===e&&(i=this.toPercentageRgbString()),"hex"!==e&&"hex6"!==e||(i=this.toHexString()),"hex3"===e&&(i=this.toHexString(!0)),"hex4"===e&&(i=this.toHex8String(!0)),"hex8"===e&&(i=this.toHex8String()),"name"===e&&(i=this.toName()),"hsl"===e&&(i=this.toHslString()),"hsv"===e&&(i=this.toHsvString()),i||this.toHexString()):"name"===e&&0===this._a?this.toName():this.toRgbString()},clone:function(){return d(this.toString())},_applyModification:function(e,t){var i=e.apply(null,[this].concat([].slice.call(t)));return this._r=i._r,this._g=i._g,this._b=i._b,this.setAlpha(i._a),this},lighten:function(){return this._applyModification(b,arguments)},brighten:function(){return this._applyModification(S,arguments)},darken:function(){return this._applyModification(C,arguments)},desaturate:function(){return this._applyModification(m,arguments)},saturate:function(){return this._applyModification(y,arguments)},greyscale:function(){return this._applyModification(_,arguments)},spin:function(){return this._applyModification(w,arguments)},_applyCombination:function(e,t){return e.apply(null,[this].concat([].slice.call(t)))},analogous:function(){return this._applyCombination(L,arguments)},complement:function(){return this._applyCombination(k,arguments)},monochromatic:function(){return this._applyCombination(A,arguments)},splitcomplement:function(){return this._applyCombination(T,arguments)},triad:function(){return this._applyCombination(x,arguments)},tetrad:function(){return this._applyCombination(E,arguments)}},d.fromRatio=function(e,t){if("object"==typeof e){var i={};for(var r in e)e.hasOwnProperty(r)&&(i[r]="a"===r?e[r]:B(e[r]));e=i}return d(e,t)},d.equals=function(e,t){return!(!e||!t)&&d(e).toRgbString()==d(t).toRgbString()},d.random=function(){return d.fromRatio({r:h(),g:h(),b:h()})},d.mix=function(e,t,i){i=0===i?0:i||50;var r=d(e).toRgb(),n=d(t).toRgb(),s=i/100;return d({r:(n.r-r.r)*s+r.r,g:(n.g-r.g)*s+r.g,b:(n.b-r.b)*s+r.b,a:(n.a-r.a)*s+r.a})},d.readability=function(e,t){var i=d(e),r=d(t);return(n.max(i.getLuminance(),r.getLuminance())+.05)/(n.min(i.getLuminance(),r.getLuminance())+.05)},d.isReadable=function(e,t,i){var r,n,s=d.readability(e,t);switch(n=!1,(r=function(e){var t,i;t=((e=e||{level:"AA",size:"small"}).level||"AA").toUpperCase(),i=(e.size||"small").toLowerCase(),"AA"!==t&&"AAA"!==t&&(t="AA");"small"!==i&&"large"!==i&&(i="small");return{level:t,size:i}}(i)).level+r.size){case"AAsmall":case"AAAlarge":n=s>=4.5;break;case"AAlarge":n=s>=3;break;case"AAAsmall":n=s>=7}return n},d.mostReadable=function(e,t,i){var r,n,s,o,a=null,l=0;n=(i=i||{}).includeFallbackColors,s=i.level,o=i.size;for(var c=0;cl&&(l=r,a=d(t[c]));return d.isReadable(e,a,{level:s,size:o})||!n?a:(i.includeFallbackColors=!1,d.mostReadable(e,["#fff","#000"],i))};var R=d.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},D=d.hexNames=function(e){var t={};for(var i in e)e.hasOwnProperty(i)&&(t[e[i]]=i);return t}(R);function O(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function M(e,t){(function(e){return"string"==typeof e&&-1!=e.indexOf(".")&&1===parseFloat(e)})(e)&&(e="100%");var i=function(e){return"string"==typeof e&&-1!=e.indexOf("%")}(e);return e=c(t,u(0,parseFloat(e))),i&&(e=parseInt(e*t,10)/100),n.abs(e-t)<1e-6?1:e%t/parseFloat(t)}function I(e){return c(1,u(0,e))}function P(e){return parseInt(e,16)}function F(e){return 1==e.length?"0"+e:""+e}function B(e){return e<=1&&(e=100*e+"%"),e}function N(e){return n.round(255*parseFloat(e)).toString(16)}function H(e){return P(e)/255}var j,U,K,X=(U="[\\s|\\(]+("+(j="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)")+")[,|\\s]+("+j+")[,|\\s]+("+j+")\\s*\\)?",K="[\\s|\\(]+("+j+")[,|\\s]+("+j+")[,|\\s]+("+j+")[,|\\s]+("+j+")\\s*\\)?",{CSS_UNIT:new RegExp(j),rgb:new RegExp("rgb"+U),rgba:new RegExp("rgba"+K),hsl:new RegExp("hsl"+U),hsla:new RegExp("hsla"+K),hsv:new RegExp("hsv"+U),hsva:new RegExp("hsva"+K),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/});function W(e){return!!X.CSS_UNIT.exec(e)}e.exports?e.exports=d:void 0===(r=function(){return d}.call(t,i,t,e))||(e.exports=r)}(Math)},bT9E: /*!*****************************************!*\ !*** ./node_modules/rc-util/es/omit.js ***! \*****************************************/ /*! exports provided: default */ /*! exports used: default */function(e,t,i){"use strict";i.d(t,"a",(function(){return n}));var r=i(/*! @babel/runtime/helpers/esm/objectSpread2 */"VTBJ");function n(e,t){var i=Object(r.a)({},e);return Array.isArray(t)&&t.forEach((function(e){delete i[e]})),i}},c5Ni: /*!******************************************************!*\ !*** ./node_modules/codemirror/theme/blackboard.css ***! \******************************************************/ /*! no static exports found */ /*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,i){},c5fP: /*!*********************************************************************!*\ !*** ./node_modules/@novnc/novnc/lib/vendor/pako/lib/zlib/trees.js ***! \*********************************************************************/ /*! no static exports found */ /*! all exports used */ /*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,i){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(t,"__esModule",{value:!0}),t._tr_init=function(e){F||(!function(){var e,t,i,r,n,s=new Array(16);for(i=0,r=0;r<28;r++)for(g[r]=i,e=0;e<1<>=7;r<30;r++)for(_[r]=n<<7,e=0;e<1<0?(2===e.strm.data_type&&(e.strm.data_type=function(e){var t,i=4093624447;for(t=0;t<=31;t++,i>>>=1)if(1&i&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t<256;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0}(e)),M(e,e.l_desc),M(e,e.d_desc),o=function(e){var t;for(I(e,e.dyn_ltree,e.l_desc.max_code),I(e,e.dyn_dtree,e.d_desc.max_code),M(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*u[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t}(e),n=e.opt_len+3+7>>>3,(s=e.static_len+3+7>>>3)<=n&&(n=s)):n=s=i+5;i+4<=n&&-1!==t?B(e,t,i,r):4===e.strategy||s===n?(k(e,2+(r?1:0),3),O(e,h,d)):(k(e,4+(r?1:0),3),function(e,t,i,r){var n;for(k(e,t-257,5),k(e,i-1,5),k(e,r-4,4),n=0;n>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&i,e.last_lit++,0===t?e.dyn_ltree[2*i]++:(e.matches++,t--,e.dyn_ltree[2*(p[i]+256+1)]++,e.dyn_dtree[2*C(t)]++);return e.last_lit===e.lit_bufsize-1},t._tr_align=function(e){k(e,2,3),x(e,256,h),function(e){16===e.bi_valid?(w(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}(e)};var n=function(e){if(e&&e.__esModule)return e;if(null===e||"object"!==r(e)&&"function"!=typeof e)return{default:e};var t=s();if(t&&t.has(e))return t.get(e);var i={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if(Object.prototype.hasOwnProperty.call(e,o)){var a=n?Object.getOwnPropertyDescriptor(e,o):null;a&&(a.get||a.set)?Object.defineProperty(i,o,a):i[o]=e[o]}i.default=e,t&&t.set(e,i);return i}(i(/*! ../utils/common.js */"6BzB"));function s(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return s=function(){return e},e}function o(e){for(var t=e.length;--t>=0;)e[t]=0}var a=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],l=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],c=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],u=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],h=new Array(576);o(h);var d=new Array(60);o(d);var f=new Array(512);o(f);var p=new Array(256);o(p);var g=new Array(29);o(g);var v,m,y,_=new Array(30);function b(e,t,i,r,n){this.static_tree=e,this.extra_bits=t,this.extra_base=i,this.elems=r,this.max_length=n,this.has_stree=e&&e.length}function S(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function C(e){return e<256?f[e]:f[256+(e>>>7)]}function w(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function k(e,t,i){e.bi_valid>16-i?(e.bi_buf|=t<>16-e.bi_valid,e.bi_valid+=i-16):(e.bi_buf|=t<>>=1,i<<=1}while(--t>0);return i>>>1}function T(e,t,i){var r,n,s=new Array(16),o=0;for(r=1;r<=15;r++)s[r]=o=o+i[r-1]<<1;for(n=0;n<=t;n++){var a=e[2*n+1];0!==a&&(e[2*n]=E(s[a]++,a))}}function L(e){var t;for(t=0;t<286;t++)e.dyn_ltree[2*t]=0;for(t=0;t<30;t++)e.dyn_dtree[2*t]=0;for(t=0;t<19;t++)e.bl_tree[2*t]=0;e.dyn_ltree[512]=1,e.opt_len=e.static_len=0,e.last_lit=e.matches=0}function A(e){e.bi_valid>8?w(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function R(e,t,i,r){var n=2*t,s=2*i;return e[n]>1;i>=1;i--)D(e,s,i);n=l;do{i=e.heap[1],e.heap[1]=e.heap[e.heap_len--],D(e,s,1),r=e.heap[1],e.heap[--e.heap_max]=i,e.heap[--e.heap_max]=r,s[2*n]=s[2*i]+s[2*r],e.depth[n]=(e.depth[i]>=e.depth[r]?e.depth[i]:e.depth[r])+1,s[2*i+1]=s[2*r+1]=n,e.heap[1]=n++,D(e,s,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],function(e,t){var i,r,n,s,o,a,l=t.dyn_tree,c=t.max_code,u=t.stat_desc.static_tree,h=t.stat_desc.has_stree,d=t.stat_desc.extra_bits,f=t.stat_desc.extra_base,p=t.stat_desc.max_length,g=0;for(s=0;s<=15;s++)e.bl_count[s]=0;for(l[2*e.heap[e.heap_max]+1]=0,i=e.heap_max+1;i<573;i++)(s=l[2*l[2*(r=e.heap[i])+1]+1]+1)>p&&(s=p,g++),l[2*r+1]=s,r>c||(e.bl_count[s]++,o=0,r>=f&&(o=d[r-f]),a=l[2*r],e.opt_len+=a*(s+o),h&&(e.static_len+=a*(u[2*r+1]+o)));if(0!==g){do{for(s=p-1;0===e.bl_count[s];)s--;e.bl_count[s]--,e.bl_count[s+1]+=2,e.bl_count[p]--,g-=2}while(g>0);for(s=p;0!==s;s--)for(r=e.bl_count[s];0!==r;)(n=e.heap[--i])>c||(l[2*n+1]!==s&&(e.opt_len+=(s-l[2*n+1])*l[2*n],l[2*n+1]=s),r--)}}(e,t),T(s,c,e.bl_count)}function I(e,t,i){var r,n,s=-1,o=t[1],a=0,l=7,c=4;for(0===o&&(l=138,c=3),t[2*(i+1)+1]=65535,r=0;r<=i;r++)n=o,o=t[2*(r+1)+1],++a1?a-1:0),c=1;c1?i-1:0),s=1;s=0)return parseInt(t.slice(t.indexOf("e-")+2),10);var i=0;return t.indexOf(".")>=0&&(i=t.length-t.indexOf(".")-1),i},r.getInputDisplayValue=function(e){var t,i=e||r.state,n=i.focused,s=i.inputValue,o=i.value;null==(t=n?s:r.toPrecisionAsStep(o))&&(t="");var a=r.formatWrapper(t);return S(r.props.decimalSeparator)&&(a=a.toString().replace(".",r.props.decimalSeparator)),a},r.recordCursorPosition=function(){try{r.cursorStart=r.input.selectionStart,r.cursorEnd=r.input.selectionEnd,r.currentValue=r.input.value,r.cursorBefore=r.input.value.substring(0,r.cursorStart),r.cursorAfter=r.input.value.substring(r.cursorEnd)}catch(e){}},r.restoreByAfter=function(e){if(void 0===e)return!1;var t=r.input.value,i=t.lastIndexOf(e);if(-1===i)return!1;var n=r.cursorBefore.length;return r.lastKeyCode===p.a.DELETE&&r.cursorBefore.charAt(n-1)===e[0]?(r.fixCaret(n,n),!0):i+e.length===t.length&&(r.fixCaret(i,i),!0)},r.partRestoreByAfter=function(e){return void 0!==e&&Array.prototype.some.call(e,(function(t,i){var n=e.substring(i);return r.restoreByAfter(n)}))},r.isNotCompleteNumber=function(e){return isNaN(e)||""===e||null===e||e&&e.toString().indexOf(".")===e.toString().length-1},r.stop=function(){r.autoStepTimer&&clearTimeout(r.autoStepTimer)},r.down=function(e,t,i){r.pressingUpOrDown=!0,r.step("down",e,t,i)},r.up=function(e,t,i){r.pressingUpOrDown=!0,r.step("up",e,t,i)},r.saveInput=function(e){r.input=e};var n=e.value;void 0===n&&(n=e.defaultValue),r.state={focused:e.autoFocus};var o=r.getValidValue(r.toNumber(n));return r.state=v(v({},r.state),{},{inputValue:r.toPrecisionAsStep(o),value:o}),r}return Object(o.a)(i,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(e){var t=this.props,i=t.value,r=t.onChange,n=t.max,s=t.min,o=this.state.focused;if(e){if(!C(e.value,i)||!C(e.max,n)||!C(e.min,s)){var a,l=o?i:this.getValidValue(i);a=this.pressingUpOrDown?l:this.inputting?this.rawInput:this.toPrecisionAsStep(l),this.setState({value:l,inputValue:a})}var c="value"in this.props?i:this.state.value;"max"in this.props&&e.max!==n&&"number"==typeof c&&c>n&&r&&r(n),"min"in this.props&&e.min!==s&&"number"==typeof c&&c1&&void 0!==arguments[1]?arguments[1]:this.props.min,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.props.max,r=parseFloat(e);return isNaN(r)?e:(ri&&(r=i),r)}},{key:"setValue",value:function(e,t){var i=this.props.precision,r=this.isNotCompleteNumber(parseFloat(e))?null:parseFloat(e),n=this.state.value,s=void 0===n?null:n,o=this.state.inputValue,a=void 0===o?null:o,l="number"==typeof r?r.toFixed(i):"".concat(r),c=r!==s||l!=="".concat(a);return"value"in this.props?(a=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:a},t)):this.setState({value:r,inputValue:this.toPrecisionAsStep(e)},t),c&&this.props.onChange(r),r}},{key:"getMaxPrecision",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,i=this.props,r=i.precision,n=i.step;if(S(r))return r;var s=this.getPrecision(t),o=this.getPrecision(n),a=this.getPrecision(e);return e?Math.max(a,s+o):s+o}},{key:"getPrecisionFactor",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,i=this.getMaxPrecision(e,t);return Math.pow(10,i)}},{key:"focus",value:function(){this.input.focus(),this.recordCursorPosition()}},{key:"blur",value:function(){this.input.blur()}},{key:"select",value:function(){this.input.select()}},{key:"formatWrapper",value:function(e){return this.props.formatter?this.props.formatter(e):e}},{key:"toPrecisionAsStep",value:function(e){if(this.isNotCompleteNumber(e)||""===e)return e;var t=Math.abs(this.getMaxPrecision(e));return isNaN(t)?e.toString():Number(e).toFixed(t)}},{key:"toNumber",value:function(e){var t=this.props.precision,i=this.state.focused,r=e&&e.length>16&&i;return this.isNotCompleteNumber(e)||r?e:S(t)?Math.round(e*Math.pow(10,t))/Math.pow(10,t):Number(e)}},{key:"upStep",value:function(e,t){var i=this.props.step,r=this.getPrecisionFactor(e,t),n=Math.abs(this.getMaxPrecision(e,t)),s=((r*e+r*i*t)/r).toFixed(n);return this.toNumber(s)}},{key:"downStep",value:function(e,t){var i=this.props.step,r=this.getPrecisionFactor(e,t),n=Math.abs(this.getMaxPrecision(e,t)),s=((r*e-r*i*t)/r).toFixed(n);return this.toNumber(s)}},{key:"step",value:function(e,t){var i=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,n=arguments.length>3?arguments[3]:void 0;this.stop(),t&&(t.persist(),t.preventDefault());var s=this.props;if(!s.disabled){var o=this.getCurrentValidValue(this.state.inputValue)||0;if(!this.isNotCompleteNumber(o)){var a=this["".concat(e,"Step")](o,r),l=a>s.max||as.max?a=s.max:a=p)||s||o,V=(j||0===j)&&(isNaN(j)||Number(j)<=g)||s||o,q=f()("".concat(i,"-handler"),"".concat(i,"-handler-up"),Object(n.a)({},"".concat(i,"-handler-up-disabled"),G)),Q=f()("".concat(i,"-handler"),"".concat(i,"-handler-down"),Object(n.a)({},"".concat(i,"-handler-down-disabled"),V)),Y=a?{onTouchStart:G?y:this.up,onTouchEnd:this.stop}:{onMouseDown:G?y:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},Z=a?{onTouchStart:V?y:this.down,onTouchEnd:this.stop}:{onMouseDown:V?y:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return h.a.createElement("div",{className:K,style:v,title:m,onMouseEnter:b,onMouseLeave:S,onMouseOver:C,onMouseOut:w,onFocus:function(){return null},onBlur:function(){return null}},h.a.createElement("div",{className:"".concat(i,"-handler-wrap")},h.a.createElement("span",Object.assign({unselectable:"on"},Y,{role:"button","aria-label":"Increase Value","aria-disabled":G,className:q}),c||h.a.createElement("span",{unselectable:"on",className:"".concat(i,"-handler-up-inner"),onClick:_})),h.a.createElement("span",Object.assign({unselectable:"on"},Z,{role:"button","aria-label":"Decrease Value","aria-disabled":V,className:Q}),u||h.a.createElement("span",{unselectable:"on",className:"".concat(i,"-handler-down-inner"),onClick:_}))),h.a.createElement("div",{className:"".concat(i,"-input-wrap")},h.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":g,"aria-valuemax":p,"aria-valuenow":j,required:k,type:T,placeholder:L,onPaste:F,onClick:x,onMouseUp:this.onMouseUp,className:"".concat(i,"-input"),tabIndex:E,autoComplete:l,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:W?this.onKeyDown:y,onKeyUp:W?this.onKeyUp:y,autoFocus:I,maxLength:M,readOnly:o,disabled:s,max:p,min:g,step:O,name:P,title:m,id:A,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(z),pattern:D,inputMode:R,onInput:B},X))))}}]),i}(h.a.Component);w.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:b,min:-b,step:1,style:{},onChange:y,onKeyDown:y,onPressEnter:y,onFocus:y,onBlur:y,parser:function(e){return e.replace(/[^\w.-]+/g,"")},required:!1,autoComplete:"off"};var k=w;t.a=k},eP3c: /*!***********************************************************************!*\ !*** ./node_modules/@novnc/novnc/lib/vendor/pako/lib/zlib/inflate.js ***! \***********************************************************************/ /*! no static exports found */ /*! all exports used */ /*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,i){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.inflateReset=p,t.inflateReset2=g,t.inflateResetKeep=f,t.inflateInit=function(e){return v(e,15)},t.inflateInit2=v,t.inflate=function(e,t){var i,r,c,u,d,f,p,g,v,m,y,_,C,w,k,x,E,T,L,A,R,D,O,M,I=0,P=new n.Buf8(4),F=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&0!==e.avail_in)return-2;12===(i=e.state).mode&&(i.mode=13);d=e.next_out,c=e.output,p=e.avail_out,u=e.next_in,r=e.input,f=e.avail_in,g=i.hold,v=i.bits,m=f,y=p,D=0;e:for(;;)switch(i.mode){case 1:if(0===i.wrap){i.mode=13;break}for(;v<16;){if(0===f)break e;f--,g+=r[u++]<>>8&255,i.check=(0,o.default)(i.check,P,2,0),g=0,v=0,i.mode=2;break}if(i.flags=0,i.head&&(i.head.done=!1),!(1&i.wrap)||(((255&g)<<8)+(g>>8))%31){e.msg="incorrect header check",i.mode=30;break}if(8!=(15&g)){e.msg="unknown compression method",i.mode=30;break}if(v-=4,R=8+(15&(g>>>=4)),0===i.wbits)i.wbits=R;else if(R>i.wbits){e.msg="invalid window size",i.mode=30;break}i.dmax=1<>8&1),512&i.flags&&(P[0]=255&g,P[1]=g>>>8&255,i.check=(0,o.default)(i.check,P,2,0)),g=0,v=0,i.mode=3;case 3:for(;v<32;){if(0===f)break e;f--,g+=r[u++]<>>8&255,P[2]=g>>>16&255,P[3]=g>>>24&255,i.check=(0,o.default)(i.check,P,4,0)),g=0,v=0,i.mode=4;case 4:for(;v<16;){if(0===f)break e;f--,g+=r[u++]<>8),512&i.flags&&(P[0]=255&g,P[1]=g>>>8&255,i.check=(0,o.default)(i.check,P,2,0)),g=0,v=0,i.mode=5;case 5:if(1024&i.flags){for(;v<16;){if(0===f)break e;f--,g+=r[u++]<>>8&255,i.check=(0,o.default)(i.check,P,2,0)),g=0,v=0}else i.head&&(i.head.extra=null);i.mode=6;case 6:if(1024&i.flags&&((_=i.length)>f&&(_=f),_&&(i.head&&(R=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Array(i.head.extra_len)),n.arraySet(i.head.extra,r,u,_,R)),512&i.flags&&(i.check=(0,o.default)(i.check,r,_,u)),f-=_,u+=_,i.length-=_),i.length))break e;i.length=0,i.mode=7;case 7:if(2048&i.flags){if(0===f)break e;_=0;do{R=r[u+_++],i.head&&R&&i.length<65536&&(i.head.name+=String.fromCharCode(R))}while(R&&_>9&1,i.head.done=!0),e.adler=i.check=0,i.mode=12;break;case 10:for(;v<32;){if(0===f)break e;f--,g+=r[u++]<>>=7&v,v-=7&v,i.mode=27;break}for(;v<3;){if(0===f)break e;f--,g+=r[u++]<>>=1)){case 0:i.mode=14;break;case 1:if(b(i),i.mode=20,6===t){g>>>=2,v-=2;break e}break;case 2:i.mode=17;break;case 3:e.msg="invalid block type",i.mode=30}g>>>=2,v-=2;break;case 14:for(g>>>=7&v,v-=7&v;v<32;){if(0===f)break e;f--,g+=r[u++]<>>16^65535)){e.msg="invalid stored block lengths",i.mode=30;break}if(i.length=65535&g,g=0,v=0,i.mode=15,6===t)break e;case 15:i.mode=16;case 16:if(_=i.length){if(_>f&&(_=f),_>p&&(_=p),0===_)break e;n.arraySet(c,r,u,_,d),f-=_,u+=_,p-=_,d+=_,i.length-=_;break}i.mode=12;break;case 17:for(;v<14;){if(0===f)break e;f--,g+=r[u++]<>>=5,v-=5,i.ndist=1+(31&g),g>>>=5,v-=5,i.ncode=4+(15&g),g>>>=4,v-=4,i.nlen>286||i.ndist>30){e.msg="too many length or distance symbols",i.mode=30;break}i.have=0,i.mode=18;case 18:for(;i.have>>=3,v-=3}for(;i.have<19;)i.lens[F[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,O={bits:i.lenbits},D=(0,l.default)(0,i.lens,0,19,i.lencode,0,i.work,O),i.lenbits=O.bits,D){e.msg="invalid code lengths set",i.mode=30;break}i.have=0,i.mode=19;case 19:for(;i.have>>16&255,E=65535&I,!((k=I>>>24)<=v);){if(0===f)break e;f--,g+=r[u++]<>>=k,v-=k,i.lens[i.have++]=E;else{if(16===E){for(M=k+2;v>>=k,v-=k,0===i.have){e.msg="invalid bit length repeat",i.mode=30;break}R=i.lens[i.have-1],_=3+(3&g),g>>>=2,v-=2}else if(17===E){for(M=k+3;v>>=k)),g>>>=3,v-=3}else{for(M=k+7;v>>=k)),g>>>=7,v-=7}if(i.have+_>i.nlen+i.ndist){e.msg="invalid bit length repeat",i.mode=30;break}for(;_--;)i.lens[i.have++]=R}}if(30===i.mode)break;if(0===i.lens[256]){e.msg="invalid code -- missing end-of-block",i.mode=30;break}if(i.lenbits=9,O={bits:i.lenbits},D=(0,l.default)(1,i.lens,0,i.nlen,i.lencode,0,i.work,O),i.lenbits=O.bits,D){e.msg="invalid literal/lengths set",i.mode=30;break}if(i.distbits=6,i.distcode=i.distdyn,O={bits:i.distbits},D=(0,l.default)(2,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,O),i.distbits=O.bits,D){e.msg="invalid distances set",i.mode=30;break}if(i.mode=20,6===t)break e;case 20:i.mode=21;case 21:if(f>=6&&p>=258){e.next_out=d,e.avail_out=p,e.next_in=u,e.avail_in=f,i.hold=g,i.bits=v,(0,a.default)(e,y),d=e.next_out,c=e.output,p=e.avail_out,u=e.next_in,r=e.input,f=e.avail_in,g=i.hold,v=i.bits,12===i.mode&&(i.back=-1);break}for(i.back=0;I=i.lencode[g&(1<>>16&255,E=65535&I,!((k=I>>>24)<=v);){if(0===f)break e;f--,g+=r[u++]<>T)],x=I>>>16&255,E=65535&I,!(T+(k=I>>>24)<=v);){if(0===f)break e;f--,g+=r[u++]<>>=T,v-=T,i.back+=T}if(g>>>=k,v-=k,i.back+=k,i.length=E,0===x){i.mode=26;break}if(32&x){i.back=-1,i.mode=12;break}if(64&x){e.msg="invalid literal/length code",i.mode=30;break}i.extra=15&x,i.mode=22;case 22:if(i.extra){for(M=i.extra;v>>=i.extra,v-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=23;case 23:for(;I=i.distcode[g&(1<>>16&255,E=65535&I,!((k=I>>>24)<=v);){if(0===f)break e;f--,g+=r[u++]<>T)],x=I>>>16&255,E=65535&I,!(T+(k=I>>>24)<=v);){if(0===f)break e;f--,g+=r[u++]<>>=T,v-=T,i.back+=T}if(g>>>=k,v-=k,i.back+=k,64&x){e.msg="invalid distance code",i.mode=30;break}i.offset=E,i.extra=15&x,i.mode=24;case 24:if(i.extra){for(M=i.extra;v>>=i.extra,v-=i.extra,i.back+=i.extra}if(i.offset>i.dmax){e.msg="invalid distance too far back",i.mode=30;break}i.mode=25;case 25:if(0===p)break e;if(_=y-p,i.offset>_){if((_=i.offset-_)>i.whave&&i.sane){e.msg="invalid distance too far back",i.mode=30;break}_>i.wnext?(_-=i.wnext,C=i.wsize-_):C=i.wnext-_,_>i.length&&(_=i.length),w=i.window}else w=c,C=d-i.offset,_=i.length;_>p&&(_=p),p-=_,i.length-=_;do{c[d++]=w[C++]}while(--_);0===i.length&&(i.mode=21);break;case 26:if(0===p)break e;c[d++]=i.length,p--,i.mode=21;break;case 27:if(i.wrap){for(;v<32;){if(0===f)break e;f--,g|=r[u++]<>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function d(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new n.Buf16(320),this.work=new n.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function f(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=1,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new n.Buf32(852),t.distcode=t.distdyn=new n.Buf32(592),t.sane=1,t.back=-1,0):-2}function p(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,f(e)):-2}function g(e,t){var i,r;return e&&e.state?(r=e.state,t<0?(i=0,t=-t):(i=1+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?-2:(null!==r.window&&r.wbits!==t&&(r.window=null),r.wrap=i,r.wbits=t,p(e))):-2}function v(e,t){var i,r;return e?(r=new d,e.state=r,r.window=null,0!==(i=g(e,t))&&(e.state=null),i):-2}var m,y,_=!0;function b(e){if(_){var t;for(m=new n.Buf32(512),y=new n.Buf32(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for((0,l.default)(1,e.lens,0,288,m,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;(0,l.default)(2,e.lens,0,32,y,0,e.work,{bits:5}),_=!1}e.lencode=m,e.lenbits=9,e.distcode=y,e.distbits=5}function S(e,t,i,r){var s,o=e.state;return null===o.window&&(o.wsize=1<=o.wsize?(n.arraySet(o.window,t,i-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):((s=o.wsize-o.wnext)>r&&(s=r),n.arraySet(o.window,t,i-r,s,o.wnext),(r-=s)?(n.arraySet(o.window,t,i-r,r,0),o.wnext=r,o.whave=o.wsize):(o.wnext+=s,o.wnext===o.wsize&&(o.wnext=0),o.whavee.length)&&(t=e.length);for(var i=0,r=new Array(t);i=0||(n[i]=e[i]);return n}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,i)&&(n[i]=e[i])}return n}var f=function(e){var t=e.className,i=e.percent,r=e.prefixCls,s=e.strokeColor,a=e.strokeLinecap,h=e.strokeWidth,f=e.style,p=e.trailColor,g=e.trailWidth,v=e.transition,m=d(e,["className","percent","prefixCls","strokeColor","strokeLinecap","strokeWidth","style","trailColor","trailWidth","transition"]);delete m.gapPosition;var y=Array.isArray(i)?i:[i],_=Array.isArray(s)?s:[s],b=u(l(y),1)[0],S=h/2,C=100-h/2,w="M ".concat("round"===a?S:0,",").concat(S,"\n L ").concat("round"===a?C:100,",").concat(S),k="0 0 100 ".concat(h),x=0;return n.a.createElement("svg",c({className:o()("".concat(r,"-line"),t),viewBox:k,preserveAspectRatio:"none",style:f},m),n.a.createElement("path",{className:"".concat(r,"-line-trail"),d:w,strokeLinecap:a,stroke:p,strokeWidth:g||h,fillOpacity:"0"}),y.map((function(e,t){var i={strokeDasharray:"".concat(e,"px, 100px"),strokeDashoffset:"-".concat(x,"px"),transition:v||"stroke-dashoffset 0.3s ease 0s, stroke-dasharray .3s ease 0s, stroke 0.3s linear"},s=_[t]||_[_.length-1];return x+=e,n.a.createElement("path",{key:t,className:"".concat(r,"-line-path"),d:w,strokeLinecap:a,stroke:s,strokeWidth:h,fillOpacity:"0",ref:b[t],style:i})})))};f.defaultProps=a;function p(){return(p=Object.assign||function(e){for(var t=1;te.length)&&(t=e.length);for(var i=0,r=new Array(t);i=0||(n[i]=e[i]);return n}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,i)&&(n[i]=e[i])}return n}var y=0;function _(e){return+e.replace("%","")}function b(e){return Array.isArray(e)?e:[e]}function S(e,t,i,r){var n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,s=arguments.length>5?arguments[5]:void 0,o=50-r/2,a=0,l=-o,c=0,u=-2*o;switch(s){case"left":a=-o,l=0,c=2*o,u=0;break;case"right":a=o,l=0,c=-2*o,u=0;break;case"bottom":l=o,u=2*o}var h="M 50,50 m ".concat(a,",").concat(l,"\n a ").concat(o,",").concat(o," 0 1 1 ").concat(c,",").concat(-u,"\n a ").concat(o,",").concat(o," 0 1 1 ").concat(-c,",").concat(u),d=2*Math.PI*o,f={stroke:i,strokeDasharray:"".concat(t/100*(d-n),"px ").concat(d,"px"),strokeDashoffset:"-".concat(n/2+e/100*(d-n),"px"),transition:"stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s"};return{pathString:h,pathStyle:f}}var C=function(e){var t,i=e.prefixCls,s=e.strokeWidth,a=e.trailWidth,c=e.gapDegree,u=e.gapPosition,h=e.trailColor,d=e.strokeLinecap,f=e.style,v=e.className,C=e.strokeColor,w=e.percent,k=m(e,["prefixCls","strokeWidth","trailWidth","gapDegree","gapPosition","trailColor","strokeLinecap","style","className","strokeColor","percent"]),x=Object(r.useMemo)((function(){return y+=1}),[]),E=S(0,100,h,s,c,u),T=E.pathString,L=E.pathStyle,A=b(w),R=b(C),D=R.find((function(e){return"[object Object]"===Object.prototype.toString.call(e)})),O=g(l(A),1)[0];return n.a.createElement("svg",p({className:o()("".concat(i,"-circle"),v),viewBox:"0 0 100 100",style:f},k),D&&n.a.createElement("defs",null,n.a.createElement("linearGradient",{id:"".concat(i,"-gradient-").concat(x),x1:"100%",y1:"0%",x2:"0%",y2:"0%"},Object.keys(D).sort((function(e,t){return _(e)-_(t)})).map((function(e,t){return n.a.createElement("stop",{key:t,offset:e,stopColor:D[e]})})))),n.a.createElement("path",{className:"".concat(i,"-circle-trail"),d:T,stroke:h,strokeLinecap:d,strokeWidth:a||s,fillOpacity:"0",style:L}),(t=0,A.map((function(e,r){var o=R[r]||R[R.length-1],a="[object Object]"===Object.prototype.toString.call(o)?"url(#".concat(i,"-gradient-").concat(x,")"):"",l=S(t,e,o,s,c,u);return t+=e,n.a.createElement("path",{key:r,className:"".concat(i,"-circle-path"),d:l.pathString,stroke:a,strokeLinecap:d,strokeWidth:s,opacity:0===e?0:1,fillOpacity:"0",style:l.pathStyle,ref:O[r]})}))).reverse())};C.defaultProps=a;var w=C},hXwI: /*!************************************************************!*\ !*** ./node_modules/@novnc/novnc/lib/decoders/copyrect.js ***! \************************************************************/ /*! no static exports found */ /*! all exports used */ /*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,i){"use strict";function r(e,t){for(var i=0;i0||n.target.offsetWidth>0)&&e._eventHandlers.windowResize()}}catch(e){r.e(e)}finally{r.f()}}))).observe(s.current),t}var G=function(){var e=Object(l.a)(p.a.mark((function e(){var i;return p.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Object(A.rb)(Object(a.a)({},W));case 2:if(-3!==(null==(i=e.sent)?void 0:i.status)){e.next=5;break}return e.abrupt("return",new Promise(function(){var e=Object(l.a)(p.a.mark((function e(i,r){return p.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:c.a.confirm({content:"检测到您已经开启了其他windows环境,请先关闭环境后,再连接",okText:"立即关闭",cancelText:"稍后关闭",onOk:function(){var e=Object(l.a)(p.a.mark((function e(){return p.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return clearTimeout(t),K(0),G(),e.abrupt("return");case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}()});case 1:case"end":return e.stop()}}),e)})));return function(t,i){return e.apply(this,arguments)}}()));case 5:if(-1!==(null==i?void 0:i.status)){e.next=7;break}throw new String(null==i?void 0:i.message);case 7:return b.a.publish("update-windows-time",null==i?void 0:i.data),e.abrupt("return",i);case 9:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();Object(g.useEffect)((function(){return X.current=setTimeout((function(){c.a.confirm({title:v.a.createElement(v.a.Fragment,null,"实验环境延时提醒"),content:"当前实验环境将于 5 分钟后关闭,需要延长使用时间吗?",okText:"立即延长",cancelText:"不需要",onOk:function(){b.a.publish("delayed-time",1),R(T+1)}})}),36e5),function(){clearTimeout(X.current)}}),[]),Object(g.useEffect)((function(){var e,a;function c(e){r&&(n.b.warn("由于长时间未操作,连接失效,正在重新连接Windows VNC服务"),m({type:I.SET_LOADING,payload:!0}),R(T+1))}function u(){clearTimeout(t),K(100),setTimeout((function(){m({type:I.SET_LOADING,payload:!1})}),1300),b.a.subscribe("send-ctrl-alt-delete",(function(){var t;null===(t=e)||void 0===t||t.sendCtrlAltDel()}))}function h(e){var t=e.detail.text.replace(/\\u([\dA-Za-z]{4})/g,(function(e,t){return String.fromCharCode(parseInt("0x"+t))}));m({type:I.SET_TRANSFER_CONTENT,payload:t})}if((r||i)&&s.current){new Promise(Object(l.a)(p.a.mark((function t(){var i,n,l,d,f,g,v,m,y,_;return p.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=M(),n="",t.next=4,G();case 4:d=t.sent,r?(l="Edu123",n=decodeURIComponent(null==d||null===(f=d.data)||void 0===f?void 0:f.vnc_url)):(v=new URL(null==d||null===(g=d.data)||void 0===g?void 0:g.vnc_url),m=v.protocol,y=v.searchParams,_=v.host,l=y.get("password"),n="".concat("https:"===m?"wss":"ws","://").concat(_,"/").concat(i.path||"websockify")),e=new L.a(s.current,n,{credentials:{password:l},wsProtocols:["binary"]}),a=z(e),e.viewOnly=i.view_only||!1,e.scaleViewport=!!r||(i.scale||!1),e.scaleViewport=i.scale||!0,e.resizeSession=!0,o.current=e,e.addEventListener("disconnect",c),e.addEventListener("connect",u),e.addEventListener("clipboard",h);case 16:case"end":return t.stop()}}),t)}))));var d=b.a.subscribe("vnc-reseting",(function(){m({type:I.SET_STATE,payload:{loading:!0,mes:"实验环境重置中"}})})),f=b.a.subscribe("vnc-enlarge",(function(){m({type:I.SET_IS_LARGE,payload:!0})})),g=b.a.subscribe("show-clipboard-box",(function(){m({type:I.SHOW_CLIPBOARD_BOX,payload:!0})}));return K(0),function(){var t,i,r,n;null===(t=e)||void 0===t||t.removeEventListener("disconnect",c),null===(i=e)||void 0===i||i.removeEventListener("connect",u),null===(r=e)||void 0===r||r.removeEventListener("clipboard",h),d(),f(),g(),null===(n=a)||void 0===n||n.unobserve(s.current)}}}),[i,r,T]),Object(g.useEffect)((function(){0==U&&V()}),[U]);var V=function e(){U>99?U=99:(U+=1,t=setTimeout((function(){e()}),1500)),U<100&&K(U)};return v.a.createElement(g.Fragment,null,v.a.createElement("div",{style:{backgroundColor:"#000"},className:"".concat(r?"vnc-panel-wrapper-windows":"vnc-panel-wrapper"," ").concat(N?"full-screen":"")},v.a.createElement("a",{className:"btn-vnc-resize",onClick:function(){m({type:I.SET_IS_LARGE,payload:!N})}},v.a.createElement("i",{className:"iconfont ".concat(N?"icon-tuichuquanping1":"icon-quanping1")})),B?v.a.createElement(w.a,{className:D.a.spin,message:O,style:{color:"#0152d9"}},v.a.createElement("div",{className:"tc",style:{width:500,margin:"0 auto",color:"#FFF"}},v.a.createElement(S.a,{percent:U,format:function(e){return v.a.createElement("span",{className:"c-white"},e,"%")}}))):null,v.a.createElement("div",{ref:s,className:"vnc-panel ".concat(B?"hide":"animated fadeIn")})),v.a.createElement(x.a,null))},N=i("m3rI"),H=d.a.Countdown;t.default=Object(m.a)((function(e){var t=e.shixunsDetail,i=e.loading,r=e.user;return{shixunsDetail:t,globalSetting:e.globalSetting,user:r,loading:i.models.shixunsDetail}}))((function(e){var t,i,d=e.shixunsDetail,f=(e.globalSetting,e.loading,e.dispatch),m=e.user,S=e.history,C=Object(h.a)(e,["shixunsDetail","globalSetting","loading","dispatch","user","history"]),w=Object(g.useState)({}),k=Object(u.a)(w,2),x=k[0],E=k[1],T=Object(g.useState)(400),L=Object(u.a)(T,2),R=L[0],O=L[1],M=Object(g.useState)(!1),I=Object(u.a)(M,2),P=I[0],F=I[1],j=Object(g.useState)(""),U=Object(u.a)(j,2),K=U[0],X=U[1],W=Object(g.useState)(Date.now()+36e5),z=Object(u.a)(W,2),G=z[0],V=z[1],q=C.match.params,Q=(C.location.query,Object(g.useState)(!1)),Y=Object(u.a)(Q,2),Z=Y[0],$=Y[1],J=d.mirrorApplies,ee=Object(g.useRef)();Object(g.useEffect)((function(){return f({type:"globalSetting/headerFooterToggle",payload:!1}),ie(),re(),window.addEventListener("resize",ie),b.a.subscribe("delayed-time",(function(){V(Date.now()+36e5)})),function(){window.removeEventListener("resize",ie),clearTimeout(ee.current),f({type:"globalSetting/headerFooterToggle",payload:!0})}}),[]),Object(g.useEffect)((function(){x.host&&setTimeout((function(){b.a.publish("create-socket",1)}),1500)}),[x]),Object(g.useEffect)((function(){J.webssh&&(te(),ee.current=setTimeout((function(){c.a.confirm({title:v.a.createElement(v.a.Fragment,null,"实验环境延时提醒"),content:"当前实验环境将于 15 分钟后关闭,需要延长使用时间吗?",okText:"立即延长",cancelText:"不需要",onOk:function(){b.a.publish("ssh-add-connect-time",{}),b.a.publish("delayed-time",1)}})}),36e5)),J.id&&ie()}),[J]);var te=function(){var e=Object(l.a)(p.a.mark((function e(){var t;return p.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Object(A.sb)(Object(a.a)({},q));case 2:t=e.sent,E(Object(a.a)({},t));case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),ie=function(){var e=window.innerHeight;O(e-(J.audit_remark?400:270))},re=function(){var e=Object(l.a)(p.a.mark((function e(){return p.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:f({type:"shixunsDetail/getMirrorApplies",payload:Object(a.a)({},q)});case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return console.log(null==m?void 0:m.userInfo),v.a.createElement("section",{className:D.a.wrp},v.a.createElement("header",{className:D.a.header},v.a.createElement(s.a,{align:"middle"},v.a.createElement(o.a,{flex:"1"},v.a.createElement("img",{alt:"用户头像",height:"40",src:"".concat(N.a.IMG_SERVER,"/images/").concat(null==m||null===(t=m.userInfo)||void 0===t?void 0:t.image_url),width:"40",style:{borderRadius:"50%"}}),v.a.createElement("span",{className:"ml10"},null==m||null===(i=m.userInfo)||void 0===i?void 0:i.real_name)),v.a.createElement(o.a,{flex:"1"},v.a.createElement("span",{className:"mr10 font18"},J.name)),v.a.createElement(o.a,null,v.a.createElement("span",null,"剩余时长:",v.a.createElement(H,{className:D.a.cuttDown,value:G,format:"mm:ss",valueStyle:{color:"#FFF"}})),v.a.createElement("span",{className:"icon-kaiguan font20 current ml60",onClick:function(){c.a.confirm({title:"退出镜像",content:"你确定要退出镜像吗?",okText:"确定",cancelText:"取消",onOk:function(){var e;S.push("/users/".concat(null===(e=m.userInfo)||void 0===e?void 0:e.login,"/experiment-img"))}})}})))),v.a.createElement("aside",{className:D.a.container},v.a.createElement(s.a,null,v.a.createElement(o.a,{style:{position:"relative",width:Z?"0%":"40%"}},v.a.createElement("section",{className:"".concat(D.a.info," ml40 mr40"),style:{display:Z?"none":"flex"}},v.a.createElement("aside",null,v.a.createElement(s.a,{align:"middle",style:{height:68,borderBottom:"1px solid #f1f1f1"}},v.a.createElement(o.a,{className:"font18"},"实验环境说明 ",v.a.createElement("span",{className:"font16 ml20 c-grey-999"},"请按模板填写实验环境说明"))),v.a.createElement("aside",{className:"mt30 flex1"},v.a.createElement(y.a,{height:R,defaultValue:J.description||"",onChange:function(e){return X(e)}}),J.audit_remark&&v.a.createElement("aside",{className:"mt10 font16 c-grey-999 mb10"},"审核不通过原因:",v.a.createElement("span",{className:"c-red"},J.audit_remark))),v.a.createElement("aside",{className:"mb20"},v.a.createElement(s.a,{justify:"center",gutter:[20,20],className:D.a.buttons},v.a.createElement(o.a,null,v.a.createElement(r.a,{type:"primary",size:"large",loading:P,onClick:Object(l.a)(p.a.mark((function e(){var t;return p.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return F(!0),c.a.info({title:"保存镜像",centered:!0,content:"临时镜像系统默认只保存30天,过期将会自动清理。请尽快申请发布。",okText:"我知道了",onOk:function(){}}),e.next=4,Object(A.ub)(Object(a.a)(Object(a.a)({},q),{},{description:K}));case 4:0===(null==(t=e.sent)?void 0:t.status)&&n.b.success("保存成功"),F(!1);case 7:case"end":return e.stop()}}),e)})))},"保存")),v.a.createElement(o.a,null,v.a.createElement(r.a,{type:"primary",ghost:!0,size:"large",onClick:Object(l.a)(p.a.mark((function e(){return p.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:c.a.confirm({title:"申请发布",centered:!0,content:"你确定要申请发布该镜像?",okText:"确定",cancelText:"取消",onOk:function(){var e=Object(l.a)(p.a.mark((function e(){var t,i;return p.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Object(A.tb)(Object(a.a)(Object(a.a)({},q),{},{description:K}));case 2:0===(null==(t=e.sent)?void 0:t.status)&&(S.push("/users/".concat(null===(i=m.userInfo)||void 0===i?void 0:i.login,"/experiment-img")),n.b.success("申请发布成功"));case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}()});case 1:case"end":return e.stop()}}),e)})))},"申请发布")))))),v.a.createElement("div",{className:Z?D.a.elseShrink:D.a.shrink,onClick:function(){return $(!Z)}},v.a.createElement("i",{className:"iconfont icon-cela"}))),v.a.createElement(o.a,{style:{background:"#000",width:Z?"100%":"60%"}},v.a.createElement("div",null,v.a.createElement("aside",{className:D.a.fullBtn},v.a.createElement("span",{className:"icon-quanping"})),J.webssh&&v.a.createElement(_.a,{sshConfigData:x,sid:1}),((null==J?void 0:J.vnc)||(null==J?void 0:J.windows))&&v.a.createElement(B,{taskId:"windows"===J.type?"pcf9t4w6vrnz":"ijby95c82nsh",vnc_url:J.vnc,window_vnc_url:J.windows}))))))}))},iUHT: /*!**********************************************!*\ !*** ./node_modules/@novnc/novnc/lib/des.js ***! \**********************************************/ /*! no static exports found */ /*! all exports used */ /*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,i){"use strict";function r(e,t){for(var i=0;i>>3]&1<>>10,this.keys[_]|=(4032&S)>>>6,++_,this.keys[_]=(258048&b)<<12,this.keys[_]|=(63&b)<<16,this.keys[_]|=(258048&S)>>>4,this.keys[_]|=63&S,++_}}var t,i,n;return t=e,(i=[{key:"enc8",value:function(e){var t,i,r,n=e.slice(),s=0;t=n[s++]<<24|n[s++]<<16|n[s++]<<8|n[s++],i=n[s++]<<24|n[s++]<<16|n[s++]<<8|n[s++],i^=r=252645135&(t>>>4^i),i^=r=65535&((t^=r<<4)>>>16^i),i^=(r=858993459&(i>>>2^(t^=r<<16)))<<2,i=(i^=(r=16711935&(i>>>8^(t^=r)))<<8)<<1|i>>>31&1,i^=r=2863311530&((t^=r)^i),t=(t^=r)<<1|t>>>31&1;for(var o=0,a=0;o<8;++o){r=i<<28|i>>>4,r^=this.keys[a++];var l=y[63&r];l|=v[r>>>8&63],l|=p[r>>>16&63],l|=d[r>>>24&63],r=i^this.keys[a++],l|=_[63&r],l|=m[r>>>8&63],l|=g[r>>>16&63],r=(t^=l|=f[r>>>24&63])<<28|t>>>4,r^=this.keys[a++],l=y[63&r],l|=v[r>>>8&63],l|=p[r>>>16&63],l|=d[r>>>24&63],r=t^this.keys[a++],l|=_[63&r],l|=m[r>>>8&63],l|=g[r>>>16&63],i^=l|=f[r>>>24&63]}for(i=i<<31|i>>>1,i^=r=2863311530&(t^i),i^=r=16711935&((t=(t^=r)<<31|t>>>1)>>>8^i),i^=r=858993459&((t^=r<<8)>>>2^i),i^=(r=65535&(i>>>16^(t^=r<<2)))<<16,r=[i^=(r=252645135&(i>>>4^(t^=r)))<<4,t^=r],s=0;s<8;s++)n[s]=(r[s>>>2]>>>8*(3-s%4))%256,n[s]<0&&(n[s]+=256);return n}},{key:"encrypt",value:function(e){return this.enc8(e.slice(0,8)).concat(this.enc8(e.slice(8,16)))}}])&&r(t.prototype,i),n&&r(t,n),e}();t.default=b},kSUc: /*!***************************************************!*\ !*** ./src/components/markdown-editor/index.less ***! \***************************************************/ /*! no static exports found */ /*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,i){},lNSK: /*!***********************************************************************!*\ !*** ./node_modules/@novnc/novnc/lib/vendor/pako/lib/zlib/deflate.js ***! \***********************************************************************/ /*! no static exports found */ /*! all exports used */ /*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,i){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.deflateInit=function(e,t){return L(e,t,8,15,8,0)},t.deflateInit2=L,t.deflateReset=T,t.deflateResetKeep=E,t.deflateSetHeader=function(e,t){if(!e||!e.state)return-2;if(2!==e.state.wrap)return-2;return e.state.gzhead=t,0},t.deflate=function(e,t){var i,r,n,o;if(!e||!e.state||t>5||t<0)return e?f(e,-2):-2;if(r=e.state,!e.output||!e.input&&0!==e.avail_in||666===r.status&&4!==t)return f(e,0===e.avail_out?-5:-2);if(r.strm=e,i=r.last_flush,r.last_flush=t,42===r.status)if(2===r.wrap)e.adler=0,y(r,31),y(r,139),y(r,8),r.gzhead?(y(r,(r.gzhead.text?1:0)+(r.gzhead.hcrc?2:0)+(r.gzhead.extra?4:0)+(r.gzhead.name?8:0)+(r.gzhead.comment?16:0)),y(r,255&r.gzhead.time),y(r,r.gzhead.time>>8&255),y(r,r.gzhead.time>>16&255),y(r,r.gzhead.time>>24&255),y(r,9===r.level?2:r.strategy>=2||r.level<2?4:0),y(r,255&r.gzhead.os),r.gzhead.extra&&r.gzhead.extra.length&&(y(r,255&r.gzhead.extra.length),y(r,r.gzhead.extra.length>>8&255)),r.gzhead.hcrc&&(e.adler=(0,a.default)(e.adler,r.pending_buf,r.pending,0)),r.gzindex=0,r.status=69):(y(r,0),y(r,0),y(r,0),y(r,0),y(r,0),y(r,9===r.level?2:r.strategy>=2||r.level<2?4:0),y(r,3),r.status=113);else{var l=8+(r.w_bits-8<<4)<<8,c=-1;c=r.strategy>=2||r.level<2?0:r.level<6?1:6===r.level?2:3,l|=c<<6,0!==r.strstart&&(l|=32),l+=31-l%31,r.status=113,_(r,l),0!==r.strstart&&(_(r,e.adler>>>16),_(r,65535&e.adler)),e.adler=1}if(69===r.status)if(r.gzhead.extra){for(n=r.pending;r.gzindex<(65535&r.gzhead.extra.length)&&(r.pending!==r.pending_buf_size||(r.gzhead.hcrc&&r.pending>n&&(e.adler=(0,a.default)(e.adler,r.pending_buf,r.pending-n,n)),v(e),n=r.pending,r.pending!==r.pending_buf_size));)y(r,255&r.gzhead.extra[r.gzindex]),r.gzindex++;r.gzhead.hcrc&&r.pending>n&&(e.adler=(0,a.default)(e.adler,r.pending_buf,r.pending-n,n)),r.gzindex===r.gzhead.extra.length&&(r.gzindex=0,r.status=73)}else r.status=73;if(73===r.status)if(r.gzhead.name){n=r.pending;do{if(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>n&&(e.adler=(0,a.default)(e.adler,r.pending_buf,r.pending-n,n)),v(e),n=r.pending,r.pending===r.pending_buf_size)){o=1;break}o=r.gzindexn&&(e.adler=(0,a.default)(e.adler,r.pending_buf,r.pending-n,n)),0===o&&(r.gzindex=0,r.status=91)}else r.status=91;if(91===r.status)if(r.gzhead.comment){n=r.pending;do{if(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>n&&(e.adler=(0,a.default)(e.adler,r.pending_buf,r.pending-n,n)),v(e),n=r.pending,r.pending===r.pending_buf_size)){o=1;break}o=r.gzindexn&&(e.adler=(0,a.default)(e.adler,r.pending_buf,r.pending-n,n)),0===o&&(r.status=103)}else r.status=103;103===r.status&&(r.gzhead.hcrc?(r.pending+2>r.pending_buf_size&&v(e),r.pending+2<=r.pending_buf_size&&(y(r,255&e.adler),y(r,e.adler>>8&255),e.adler=0,r.status=113)):r.status=113);if(0!==r.pending){if(v(e),0===e.avail_out)return r.last_flush=-1,0}else if(0===e.avail_in&&p(t)<=p(i)&&4!==t)return f(e,-5);if(666===r.status&&0!==e.avail_in)return f(e,-5);if(0!==e.avail_in||0!==r.lookahead||0!==t&&666!==r.status){var u=2===r.strategy?function(e,t){for(var i;;){if(0===e.lookahead&&(S(e),0===e.lookahead)){if(0===t)return 1;break}if(e.match_length=0,i=s._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,i&&(m(e,!1),0===e.strm.avail_out))return 1}if(e.insert=0,4===t)return m(e,!0),0===e.strm.avail_out?3:4;if(e.last_lit&&(m(e,!1),0===e.strm.avail_out))return 1;return 2}(r,t):3===r.strategy?function(e,t){for(var i,r,n,o,a=e.window;;){if(e.lookahead<=258){if(S(e),e.lookahead<=258&&0===t)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&(n=e.strstart-1,(r=a[n])===a[++n]&&r===a[++n]&&r===a[++n])){o=e.strstart+258;do{}while(r===a[++n]&&r===a[++n]&&r===a[++n]&&r===a[++n]&&r===a[++n]&&r===a[++n]&&r===a[++n]&&r===a[++n]&&ne.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(i=s._tr_tally(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(i=s._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),i&&(m(e,!1),0===e.strm.avail_out))return 1}if(e.insert=0,4===t)return m(e,!0),0===e.strm.avail_out?3:4;if(e.last_lit&&(m(e,!1),0===e.strm.avail_out))return 1;return 2}(r,t):d[r.level].func(r,t);if(3!==u&&4!==u||(r.status=666),1===u||3===u)return 0===e.avail_out&&(r.last_flush=-1),0;if(2===u&&(1===t?s._tr_align(r):5!==t&&(s._tr_stored_block(r,0,0,!1),3===t&&(g(r.head),0===r.lookahead&&(r.strstart=0,r.block_start=0,r.insert=0))),v(e),0===e.avail_out))return r.last_flush=-1,0}if(4!==t)return 0;if(r.wrap<=0)return 1;2===r.wrap?(y(r,255&e.adler),y(r,e.adler>>8&255),y(r,e.adler>>16&255),y(r,e.adler>>24&255),y(r,255&e.total_in),y(r,e.total_in>>8&255),y(r,e.total_in>>16&255),y(r,e.total_in>>24&255)):(_(r,e.adler>>>16),_(r,65535&e.adler));v(e),r.wrap>0&&(r.wrap=-r.wrap);return 0!==r.pending?0:1},t.deflateEnd=function(e){var t;if(!e||!e.state)return-2;if(42!==(t=e.state.status)&&69!==t&&73!==t&&91!==t&&103!==t&&113!==t&&666!==t)return f(e,-2);return e.state=null,113===t?f(e,-3):0},t.deflateSetDictionary=function(e,t){var i,r,s,a,l,c,u,h,d=t.length;if(!e||!e.state)return-2;if(i=e.state,2===(a=i.wrap)||1===a&&42!==i.status||i.lookahead)return-2;1===a&&(e.adler=(0,o.default)(e.adler,t,d,0));i.wrap=0,d>=i.w_size&&(0===a&&(g(i.head),i.strstart=0,i.block_start=0,i.insert=0),h=new n.Buf8(i.w_size),n.arraySet(h,t,d-i.w_size,i.w_size,0),t=h,d=i.w_size);l=e.avail_in,c=e.next_in,u=e.input,e.avail_in=d,e.next_in=0,e.input=t,S(i);for(;i.lookahead>=3;){r=i.strstart,s=i.lookahead-2;do{i.ins_h=(i.ins_h<4?9:0)}function g(e){for(var t=e.length;--t>=0;)e[t]=0}function v(e){var t=e.state,i=t.pending;i>e.avail_out&&(i=e.avail_out),0!==i&&(n.arraySet(e.output,t.pending_buf,t.pending_out,i,e.next_out),e.next_out+=i,t.pending_out+=i,e.total_out+=i,e.avail_out-=i,t.pending-=i,0===t.pending&&(t.pending_out=0))}function m(e,t){s._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,v(e.strm)}function y(e,t){e.pending_buf[e.pending++]=t}function _(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function b(e,t){var i,r,n=e.max_chain_length,s=e.strstart,o=e.prev_length,a=e.nice_match,l=e.strstart>e.w_size-262?e.strstart-(e.w_size-262):0,c=e.window,u=e.w_mask,h=e.prev,d=e.strstart+258,f=c[s+o-1],p=c[s+o];e.prev_length>=e.good_match&&(n>>=2),a>e.lookahead&&(a=e.lookahead);do{if(c[(i=t)+o]===p&&c[i+o-1]===f&&c[i]===c[s]&&c[++i]===c[s+1]){s+=2,i++;do{}while(c[++s]===c[++i]&&c[++s]===c[++i]&&c[++s]===c[++i]&&c[++s]===c[++i]&&c[++s]===c[++i]&&c[++s]===c[++i]&&c[++s]===c[++i]&&c[++s]===c[++i]&&so){if(e.match_start=t,o=r,r>=a)break;f=c[s+o-1],p=c[s+o]}}}while((t=h[t&u])>l&&0!=--n);return o<=e.lookahead?o:e.lookahead}function S(e){var t,i,r,s,l,c,u,h,d,f,p=e.w_size;do{if(s=e.window_size-e.lookahead-e.strstart,e.strstart>=p+(p-262)){n.arraySet(e.window,e.window,p,p,0),e.match_start-=p,e.strstart-=p,e.block_start-=p,t=i=e.hash_size;do{r=e.head[--t],e.head[t]=r>=p?r-p:0}while(--i);t=i=p;do{r=e.prev[--t],e.prev[t]=r>=p?r-p:0}while(--i);s+=p}if(0===e.strm.avail_in)break;if(c=e.strm,u=e.window,h=e.strstart+e.lookahead,d=s,f=void 0,(f=c.avail_in)>d&&(f=d),i=0===f?0:(c.avail_in-=f,n.arraySet(u,c.input,c.next_in,f,h),1===c.state.wrap?c.adler=(0,o.default)(c.adler,u,f,h):2===c.state.wrap&&(c.adler=(0,a.default)(c.adler,u,f,h)),c.next_in+=f,c.total_in+=f,f),e.lookahead+=i,e.lookahead+e.insert>=3)for(l=e.strstart-e.insert,e.ins_h=e.window[l],e.ins_h=(e.ins_h<=3&&(e.ins_h=(e.ins_h<=3)if(r=s._tr_tally(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){e.match_length--;do{e.strstart++,e.ins_h=(e.ins_h<=3&&(e.ins_h=(e.ins_h<4096)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){n=e.strstart+e.lookahead-3,r=s._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=n&&(e.ins_h=(e.ins_h<15&&(a=2,r-=16),s<1||s>9||8!==i||r<8||r>15||t<0||t>9||o<0||o>4)return f(e,-2);8===r&&(r=9);var l=new x;return e.state=l,l.strm=e,l.wrap=a,l.gzhead=null,l.w_bits=r,l.w_size=1<e.pending_buf_size-5&&(i=e.pending_buf_size-5);;){if(e.lookahead<=1){if(S(e),0===e.lookahead&&0===t)return 1;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var r=e.block_start+i;if((0===e.strstart||e.strstart>=r)&&(e.lookahead=e.strstart-r,e.strstart=r,m(e,!1),0===e.strm.avail_out))return 1;if(e.strstart-e.block_start>=e.w_size-262&&(m(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(m(e,!0),0===e.strm.avail_out?3:4):(e.strstart>e.block_start&&(m(e,!1),e.strm.avail_out),1)})),new k(4,4,8,4,C),new k(4,5,16,8,C),new k(4,6,32,32,C),new k(4,4,16,16,w),new k(8,16,32,32,w),new k(8,16,128,128,w),new k(8,32,128,256,w),new k(32,128,258,1024,w),new k(32,258,258,4096,w)];t.deflateInfo="pako deflate (from Nodeca project)"},lZu9: /*!***********************************************************!*\ !*** ./node_modules/codemirror/mode/markdown/markdown.js ***! \***********************************************************/ /*! no static exports found */ /*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,i){!function(e){"use strict";e.defineMode("markdown",(function(t,i){var r=e.getMode(t,"text/html"),n="null"==r.name;void 0===i.highlightFormatting&&(i.highlightFormatting=!1),void 0===i.maxBlockquoteDepth&&(i.maxBlockquoteDepth=0),void 0===i.taskLists&&(i.taskLists=!1),void 0===i.strikethrough&&(i.strikethrough=!1),void 0===i.emoji&&(i.emoji=!1),void 0===i.fencedCodeBlockHighlighting&&(i.fencedCodeBlockHighlighting=!0),void 0===i.fencedCodeBlockDefaultMode&&(i.fencedCodeBlockDefaultMode="text/plain"),void 0===i.xml&&(i.xml=!0),void 0===i.tokenTypeOverrides&&(i.tokenTypeOverrides={});var s={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 o in s)s.hasOwnProperty(o)&&i.tokenTypeOverrides[o]&&(s[o]=i.tokenTypeOverrides[o]);var a=/^([*\-_])(?:\s*\1){2,}\s*$/,l=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,c=/^\[(x| )\](?=\s)/i,u=i.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,h=/^ {0,3}(?:\={1,}|-{2,})\s*$/,d=/^[^#!\[\]*_\\<>` "'(~:]+/,f=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,p=/^\s*\[[^\]]+?\]:.*$/,g=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\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]/;function v(e,t,i){return t.f=t.inline=i,i(e,t)}function m(e,t,i){return t.f=t.block=i,i(e,t)}function y(t){if(t.linkTitle=!1,t.linkHref=!1,t.linkText=!1,t.em=!1,t.strong=!1,t.strikethrough=!1,t.quote=0,t.indentedCode=!1,t.f==b){var i=n;if(!i){var s=e.innerMode(r,t.htmlState);i="xml"==s.mode.name&&null===s.state.tagStart&&!s.state.context&&s.state.tokenize.isInText}i&&(t.f=k,t.block=_,t.htmlState=null)}return t.trailingSpace=0,t.trailingSpaceNewLine=!1,t.prevLine=t.thisLine,t.thisLine={stream:null},null}function _(r,n){var o,d=r.column()===n.indentation,g=!(o=n.prevLine.stream)||!/\S/.test(o.string),m=n.indentedCode,y=n.prevLine.hr,_=!1!==n.list,b=(n.listStack[n.listStack.length-1]||0)+3;n.indentedCode=!1;var w=n.indentation;if(null===n.indentationDiff&&(n.indentationDiff=n.indentation,_)){for(n.list=null;w=4&&(m||n.prevLine.fencedCodeEnd||n.prevLine.header||g))return r.skipToEnd(),n.indentedCode=!0,s.code;if(r.eatSpace())return null;if(d&&n.indentation<=b&&(E=r.match(u))&&E[1].length<=6)return n.quote=0,n.header=E[1].length,n.thisLine.header=!0,i.highlightFormatting&&(n.formatting="header"),n.f=n.inline,C(n);if(n.indentation<=b&&r.eat(">"))return n.quote=d?1:n.quote+1,i.highlightFormatting&&(n.formatting="quote"),r.eatSpace(),C(n);if(!x&&!n.setext&&d&&n.indentation<=b&&(E=r.match(l))){var T=E[1]?"ol":"ul";return n.indentation=w+r.current().length,n.list=!0,n.quote=0,n.listStack.push(n.indentation),n.em=!1,n.strong=!1,n.code=!1,n.strikethrough=!1,i.taskLists&&r.match(c,!1)&&(n.taskList=!0),n.f=n.inline,i.highlightFormatting&&(n.formatting=["list","list-"+T]),C(n)}return d&&n.indentation<=b&&(E=r.match(f,!0))?(n.quote=0,n.fencedEndRE=new RegExp(E[1]+"+ *$"),n.localMode=i.fencedCodeBlockHighlighting&&function(i){if(e.findModeByName){var r=e.findModeByName(i);r&&(i=r.mime||r.mimes[0])}var n=e.getMode(t,i);return"null"==n.name?null:n}(E[2]||i.fencedCodeBlockDefaultMode),n.localMode&&(n.localState=e.startState(n.localMode)),n.f=n.block=S,i.highlightFormatting&&(n.formatting="code-block"),n.code=-1,C(n)):n.setext||!(k&&_||n.quote||!1!==n.list||n.code||x||p.test(r.string))&&(E=r.lookAhead(1))&&(E=E.match(h))?(n.setext?(n.header=n.setext,n.setext=0,r.skipToEnd(),i.highlightFormatting&&(n.formatting="header")):(n.header="="==E[0].charAt(0)?1:2,n.setext=n.header),n.thisLine.header=!0,n.f=n.inline,C(n)):x?(r.skipToEnd(),n.hr=!0,n.thisLine.hr=!0,s.hr):"["===r.peek()?v(r,n,L):v(r,n,n.inline)}function b(t,i){var s=r.token(t,i.htmlState);if(!n){var o=e.innerMode(r,i.htmlState);("xml"==o.mode.name&&null===o.state.tagStart&&!o.state.context&&o.state.tokenize.isInText||i.md_inside&&t.current().indexOf(">")>-1)&&(i.f=k,i.block=_,i.htmlState=null)}return s}function S(e,t){var r,n=t.listStack[t.listStack.length-1]||0,o=t.indentation=e.quote?t.push(s.formatting+"-"+e.formatting[r]+"-"+e.quote):t.push("error"))}if(e.taskOpen)return t.push("meta"),t.length?t.join(" "):null;if(e.taskClosed)return t.push("property"),t.length?t.join(" "):null;if(e.linkHref?t.push(s.linkHref,"url"):(e.strong&&t.push(s.strong),e.em&&t.push(s.em),e.strikethrough&&t.push(s.strikethrough),e.emoji&&t.push(s.emoji),e.linkText&&t.push(s.linkText),e.code&&t.push(s.code),e.image&&t.push(s.image),e.imageAltText&&t.push(s.imageAltText,"link"),e.imageMarker&&t.push(s.imageMarker)),e.header&&t.push(s.header,s.header+"-"+e.header),e.quote&&(t.push(s.quote),!i.maxBlockquoteDepth||i.maxBlockquoteDepth>=e.quote?t.push(s.quote+"-"+e.quote):t.push(s.quote+"-"+i.maxBlockquoteDepth)),!1!==e.list){var n=(e.listStack.length-1)%3;n?1===n?t.push(s.list2):t.push(s.list3):t.push(s.list1)}return e.trailingSpaceNewLine?t.push("trailing-space-new-line"):e.trailingSpace&&t.push("trailing-space-"+(e.trailingSpace%2?"a":"b")),t.length?t.join(" "):null}function w(e,t){if(e.match(d,!0))return C(t)}function k(t,n){var o=n.text(t,n);if(void 0!==o)return o;if(n.list)return n.list=null,C(n);if(n.taskList)return" "===t.match(c,!0)[1]?n.taskOpen=!0:n.taskClosed=!0,i.highlightFormatting&&(n.formatting="task"),n.taskList=!1,C(n);if(n.taskOpen=!1,n.taskClosed=!1,n.header&&t.match(/^#+$/,!0))return i.highlightFormatting&&(n.formatting="header"),C(n);var a=t.next();if(n.linkTitle){n.linkTitle=!1;var l=a;"("===a&&(l=")");var u="^\\s*(?:[^"+(l=(l+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1"))+"\\\\]+|\\\\\\\\|\\\\.)"+l;if(t.match(new RegExp(u),!0))return s.linkHref}if("`"===a){var h=n.formatting;i.highlightFormatting&&(n.formatting="code"),t.eatWhile("`");var d=t.current().length;if(0!=n.code||n.quote&&1!=d){if(d==n.code){var f=C(n);return n.code=0,f}return n.formatting=h,C(n)}return n.code=d,C(n)}if(n.code)return C(n);if("\\"===a&&(t.next(),i.highlightFormatting)){var p=C(n),v=s.formatting+"-escape";return p?p+" "+v:v}if("!"===a&&t.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return n.imageMarker=!0,n.image=!0,i.highlightFormatting&&(n.formatting="image"),C(n);if("["===a&&n.imageMarker&&t.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return n.imageMarker=!1,n.imageAltText=!0,i.highlightFormatting&&(n.formatting="image"),C(n);if("]"===a&&n.imageAltText){i.highlightFormatting&&(n.formatting="image");var p=C(n);return n.imageAltText=!1,n.image=!1,n.inline=n.f=E,p}if("["===a&&!n.image)return n.linkText&&t.match(/^.*?\]/)||(n.linkText=!0,i.highlightFormatting&&(n.formatting="link")),C(n);if("]"===a&&n.linkText){i.highlightFormatting&&(n.formatting="link");var p=C(n);return n.linkText=!1,n.inline=n.f=t.match(/\(.*?\)| ?\[.*?\]/,!1)?E:k,p}if("<"===a&&t.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1))return n.f=n.inline=x,i.highlightFormatting&&(n.formatting="link"),(p=C(n))?p+=" ":p="",p+s.linkInline;if("<"===a&&t.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1))return n.f=n.inline=x,i.highlightFormatting&&(n.formatting="link"),(p=C(n))?p+=" ":p="",p+s.linkEmail;if(i.xml&&"<"===a&&t.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var y=t.string.indexOf(">",t.pos);if(-1!=y){var _=t.string.substring(t.start,y);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(_)&&(n.md_inside=!0)}return t.backUp(1),n.htmlState=e.startState(r),m(t,n,b)}if(i.xml&&"<"===a&&t.match(/^\/\w*?>/))return n.md_inside=!1,"tag";if("*"===a||"_"===a){for(var S=1,w=1==t.pos?" ":t.string.charAt(t.pos-2);S<3&&t.eat(a);)S++;var T=t.peek()||" ",L=!/\s/.test(T)&&(!g.test(T)||/\s/.test(w)||g.test(w)),A=!/\s/.test(w)&&(!g.test(w)||/\s/.test(T)||g.test(T)),R=null,D=null;if(S%2&&(n.em||!L||"*"!==a&&A&&!g.test(w)?n.em!=a||!A||"*"!==a&&L&&!g.test(T)||(R=!1):R=!0),S>1&&(n.strong||!L||"*"!==a&&A&&!g.test(w)?n.strong!=a||!A||"*"!==a&&L&&!g.test(T)||(D=!1):D=!0),null!=D||null!=R)return i.highlightFormatting&&(n.formatting=null==R?"strong":null==D?"em":"strong em"),!0===R&&(n.em=a),!0===D&&(n.strong=a),f=C(n),!1===R&&(n.em=!1),!1===D&&(n.strong=!1),f}else if(" "===a&&(t.eat("*")||t.eat("_"))){if(" "===t.peek())return C(n);t.backUp(1)}if(i.strikethrough)if("~"===a&&t.eatWhile(a)){if(n.strikethrough)return i.highlightFormatting&&(n.formatting="strikethrough"),f=C(n),n.strikethrough=!1,f;if(t.match(/^[^\s]/,!1))return n.strikethrough=!0,i.highlightFormatting&&(n.formatting="strikethrough"),C(n)}else if(" "===a&&t.match(/^~~/,!0)){if(" "===t.peek())return C(n);t.backUp(2)}if(i.emoji&&":"===a&&t.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){n.emoji=!0,i.highlightFormatting&&(n.formatting="emoji");var O=C(n);return n.emoji=!1,O}return" "===a&&(t.match(/^ +$/,!1)?n.trailingSpace++:n.trailingSpace&&(n.trailingSpaceNewLine=!0)),C(n)}function x(e,t){if(">"===e.next()){t.f=t.inline=k,i.highlightFormatting&&(t.formatting="link");var r=C(t);return r?r+=" ":r="",r+s.linkInline}return e.match(/^[^>]+/,!0),s.linkInline}function E(e,t){if(e.eatSpace())return null;var r,n=e.next();return"("===n||"["===n?(t.f=t.inline=(r="("===n?")":"]",function(e,t){if(e.next()===r){t.f=t.inline=k,i.highlightFormatting&&(t.formatting="link-string");var n=C(t);return t.linkHref=!1,n}return e.match(T[r]),t.linkHref=!0,C(t)}),i.highlightFormatting&&(t.formatting="link-string"),t.linkHref=!0,C(t)):"error"}var T={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function L(e,t){return e.match(/^([^\]\\]|\\.)*\]:/,!1)?(t.f=A,e.next(),i.highlightFormatting&&(t.formatting="link"),t.linkText=!0,C(t)):v(e,t,k)}function A(e,t){if(e.match(/^\]:/,!0)){t.f=t.inline=R,i.highlightFormatting&&(t.formatting="link");var r=C(t);return t.linkText=!1,r}return e.match(/^([^\]\\]|\\.)+/,!0),s.linkText}function R(e,t){return e.eatSpace()?null:(e.match(/^[^\s]+/,!0),void 0===e.peek()?t.linkTitle=!0:e.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),t.f=t.inline=k,s.linkHref+" url")}var D={startState:function(){return{f:_,prevLine:{stream:null},thisLine:{stream:null},block:_,htmlState:null,indentation:0,inline:k,text:w,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(t){return{f:t.f,prevLine:t.prevLine,thisLine:t.thisLine,block:t.block,htmlState:t.htmlState&&e.copyState(r,t.htmlState),indentation:t.indentation,localMode:t.localMode,localState:t.localMode?e.copyState(t.localMode,t.localState):null,inline:t.inline,text:t.text,formatting:!1,linkText:t.linkText,linkTitle:t.linkTitle,linkHref:t.linkHref,code:t.code,em:t.em,strong:t.strong,strikethrough:t.strikethrough,emoji:t.emoji,header:t.header,setext:t.setext,hr:t.hr,taskList:t.taskList,list:t.list,listStack:t.listStack.slice(0),quote:t.quote,indentedCode:t.indentedCode,trailingSpace:t.trailingSpace,trailingSpaceNewLine:t.trailingSpaceNewLine,md_inside:t.md_inside,fencedEndRE:t.fencedEndRE}},token:function(e,t){if(t.formatting=!1,e!=t.thisLine.stream){if(t.header=0,t.hr=!1,e.match(/^\s*$/,!0))return y(t),null;if(t.prevLine=t.thisLine,t.thisLine={stream:e},t.taskList=!1,t.trailingSpace=0,t.trailingSpaceNewLine=!1,!t.localState&&(t.f=t.block,t.f!=b)){var i=e.match(/^\s*/,!0)[0].replace(/\t/g," ").length;if(t.indentation=i,t.indentationDiff=null,i>0)return null}}return t.f(e,t)},innerMode:function(e){return e.block==b?{state:e.htmlState,mode:r}:e.localState?{state:e.localState,mode:e.localMode}:{state:e,mode:D}},indent:function(t,i,n){return t.block==b&&r.indent?r.indent(t.htmlState,i,n):t.localState&&t.localMode.indent?t.localMode.indent(t.localState,i,n):e.Pass},blankLine:y,getType:C,blockCommentStart:"\x3c!--",blockCommentEnd:"--\x3e",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return D}),"xml"),e.defineMIME("text/markdown","markdown"),e.defineMIME("text/x-markdown","markdown")}(i(/*! ../../lib/codemirror */"VrN/"),i(/*! ../xml/xml */"1eCo"),i(/*! ../meta */"8EBN"))},mHUz: /*!*******************************************************!*\ !*** ./node_modules/@novnc/novnc/lib/input/keysym.js ***! \*******************************************************/ /*! no static exports found */ /*! all exports used */ /*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;t.default={XK_VoidSymbol:16777215,XK_BackSpace:65288,XK_Tab:65289,XK_Linefeed:65290,XK_Clear:65291,XK_Return:65293,XK_Pause:65299,XK_Scroll_Lock:65300,XK_Sys_Req:65301,XK_Escape:65307,XK_Delete:65535,XK_Multi_key:65312,XK_Codeinput:65335,XK_SingleCandidate:65340,XK_MultipleCandidate:65341,XK_PreviousCandidate:65342,XK_Kanji:65313,XK_Muhenkan:65314,XK_Henkan_Mode:65315,XK_Henkan:65315,XK_Romaji:65316,XK_Hiragana:65317,XK_Katakana:65318,XK_Hiragana_Katakana:65319,XK_Zenkaku:65320,XK_Hankaku:65321,XK_Zenkaku_Hankaku:65322,XK_Touroku:65323,XK_Massyo:65324,XK_Kana_Lock:65325,XK_Kana_Shift:65326,XK_Eisu_Shift:65327,XK_Eisu_toggle:65328,XK_Kanji_Bangou:65335,XK_Zen_Koho:65341,XK_Mae_Koho:65342,XK_Home:65360,XK_Left:65361,XK_Up:65362,XK_Right:65363,XK_Down:65364,XK_Prior:65365,XK_Page_Up:65365,XK_Next:65366,XK_Page_Down:65366,XK_End:65367,XK_Begin:65368,XK_Select:65376,XK_Print:65377,XK_Execute:65378,XK_Insert:65379,XK_Undo:65381,XK_Redo:65382,XK_Menu:65383,XK_Find:65384,XK_Cancel:65385,XK_Help:65386,XK_Break:65387,XK_Mode_switch:65406,XK_script_switch:65406,XK_Num_Lock:65407,XK_KP_Space:65408,XK_KP_Tab:65417,XK_KP_Enter:65421,XK_KP_F1:65425,XK_KP_F2:65426,XK_KP_F3:65427,XK_KP_F4:65428,XK_KP_Home:65429,XK_KP_Left:65430,XK_KP_Up:65431,XK_KP_Right:65432,XK_KP_Down:65433,XK_KP_Prior:65434,XK_KP_Page_Up:65434,XK_KP_Next:65435,XK_KP_Page_Down:65435,XK_KP_End:65436,XK_KP_Begin:65437,XK_KP_Insert:65438,XK_KP_Delete:65439,XK_KP_Equal:65469,XK_KP_Multiply:65450,XK_KP_Add:65451,XK_KP_Separator:65452,XK_KP_Subtract:65453,XK_KP_Decimal:65454,XK_KP_Divide:65455,XK_KP_0:65456,XK_KP_1:65457,XK_KP_2:65458,XK_KP_3:65459,XK_KP_4:65460,XK_KP_5:65461,XK_KP_6:65462,XK_KP_7:65463,XK_KP_8:65464,XK_KP_9:65465,XK_F1:65470,XK_F2:65471,XK_F3:65472,XK_F4:65473,XK_F5:65474,XK_F6:65475,XK_F7:65476,XK_F8:65477,XK_F9:65478,XK_F10:65479,XK_F11:65480,XK_L1:65480,XK_F12:65481,XK_L2:65481,XK_F13:65482,XK_L3:65482,XK_F14:65483,XK_L4:65483,XK_F15:65484,XK_L5:65484,XK_F16:65485,XK_L6:65485,XK_F17:65486,XK_L7:65486,XK_F18:65487,XK_L8:65487,XK_F19:65488,XK_L9:65488,XK_F20:65489,XK_L10:65489,XK_F21:65490,XK_R1:65490,XK_F22:65491,XK_R2:65491,XK_F23:65492,XK_R3:65492,XK_F24:65493,XK_R4:65493,XK_F25:65494,XK_R5:65494,XK_F26:65495,XK_R6:65495,XK_F27:65496,XK_R7:65496,XK_F28:65497,XK_R8:65497,XK_F29:65498,XK_R9:65498,XK_F30:65499,XK_R10:65499,XK_F31:65500,XK_R11:65500,XK_F32:65501,XK_R12:65501,XK_F33:65502,XK_R13:65502,XK_F34:65503,XK_R14:65503,XK_F35:65504,XK_R15:65504,XK_Shift_L:65505,XK_Shift_R:65506,XK_Control_L:65507,XK_Control_R:65508,XK_Caps_Lock:65509,XK_Shift_Lock:65510,XK_Meta_L:65511,XK_Meta_R:65512,XK_Alt_L:65513,XK_Alt_R:65514,XK_Super_L:65515,XK_Super_R:65516,XK_Hyper_L:65517,XK_Hyper_R:65518,XK_ISO_Level3_Shift:65027,XK_ISO_Next_Group:65032,XK_ISO_Prev_Group:65034,XK_ISO_First_Group:65036,XK_ISO_Last_Group:65038,XK_space:32,XK_exclam:33,XK_quotedbl:34,XK_numbersign:35,XK_dollar:36,XK_percent:37,XK_ampersand:38,XK_apostrophe:39,XK_quoteright:39,XK_parenleft:40,XK_parenright:41,XK_asterisk:42,XK_plus:43,XK_comma:44,XK_minus:45,XK_period:46,XK_slash:47,XK_0:48,XK_1:49,XK_2:50,XK_3:51,XK_4:52,XK_5:53,XK_6:54,XK_7:55,XK_8:56,XK_9:57,XK_colon:58,XK_semicolon:59,XK_less:60,XK_equal:61,XK_greater:62,XK_question:63,XK_at:64,XK_A:65,XK_B:66,XK_C:67,XK_D:68,XK_E:69,XK_F:70,XK_G:71,XK_H:72,XK_I:73,XK_J:74,XK_K:75,XK_L:76,XK_M:77,XK_N:78,XK_O:79,XK_P:80,XK_Q:81,XK_R:82,XK_S:83,XK_T:84,XK_U:85,XK_V:86,XK_W:87,XK_X:88,XK_Y:89,XK_Z:90,XK_bracketleft:91,XK_backslash:92,XK_bracketright:93,XK_asciicircum:94,XK_underscore:95,XK_grave:96,XK_quoteleft:96,XK_a:97,XK_b:98,XK_c:99,XK_d:100,XK_e:101,XK_f:102,XK_g:103,XK_h:104,XK_i:105,XK_j:106,XK_k:107,XK_l:108,XK_m:109,XK_n:110,XK_o:111,XK_p:112,XK_q:113,XK_r:114,XK_s:115,XK_t:116,XK_u:117,XK_v:118,XK_w:119,XK_x:120,XK_y:121,XK_z:122,XK_braceleft:123,XK_bar:124,XK_braceright:125,XK_asciitilde:126,XK_nobreakspace:160,XK_exclamdown:161,XK_cent:162,XK_sterling:163,XK_currency:164,XK_yen:165,XK_brokenbar:166,XK_section:167,XK_diaeresis:168,XK_copyright:169,XK_ordfeminine:170,XK_guillemotleft:171,XK_notsign:172,XK_hyphen:173,XK_registered:174,XK_macron:175,XK_degree:176,XK_plusminus:177,XK_twosuperior:178,XK_threesuperior:179,XK_acute:180,XK_mu:181,XK_paragraph:182,XK_periodcentered:183,XK_cedilla:184,XK_onesuperior:185,XK_masculine:186,XK_guillemotright:187,XK_onequarter:188,XK_onehalf:189,XK_threequarters:190,XK_questiondown:191,XK_Agrave:192,XK_Aacute:193,XK_Acircumflex:194,XK_Atilde:195,XK_Adiaeresis:196,XK_Aring:197,XK_AE:198,XK_Ccedilla:199,XK_Egrave:200,XK_Eacute:201,XK_Ecircumflex:202,XK_Ediaeresis:203,XK_Igrave:204,XK_Iacute:205,XK_Icircumflex:206,XK_Idiaeresis:207,XK_ETH:208,XK_Eth:208,XK_Ntilde:209,XK_Ograve:210,XK_Oacute:211,XK_Ocircumflex:212,XK_Otilde:213,XK_Odiaeresis:214,XK_multiply:215,XK_Oslash:216,XK_Ooblique:216,XK_Ugrave:217,XK_Uacute:218,XK_Ucircumflex:219,XK_Udiaeresis:220,XK_Yacute:221,XK_THORN:222,XK_Thorn:222,XK_ssharp:223,XK_agrave:224,XK_aacute:225,XK_acircumflex:226,XK_atilde:227,XK_adiaeresis:228,XK_aring:229,XK_ae:230,XK_ccedilla:231,XK_egrave:232,XK_eacute:233,XK_ecircumflex:234,XK_ediaeresis:235,XK_igrave:236,XK_iacute:237,XK_icircumflex:238,XK_idiaeresis:239,XK_eth:240,XK_ntilde:241,XK_ograve:242,XK_oacute:243,XK_ocircumflex:244,XK_otilde:245,XK_odiaeresis:246,XK_division:247,XK_oslash:248,XK_ooblique:248,XK_ugrave:249,XK_uacute:250,XK_ucircumflex:251,XK_udiaeresis:252,XK_yacute:253,XK_thorn:254,XK_ydiaeresis:255,XK_Hangul:65329,XK_Hangul_Hanja:65332,XK_Hangul_Jeonja:65336,XF86XK_ModeLock:269025025,XF86XK_MonBrightnessUp:269025026,XF86XK_MonBrightnessDown:269025027,XF86XK_KbdLightOnOff:269025028,XF86XK_KbdBrightnessUp:269025029,XF86XK_KbdBrightnessDown:269025030,XF86XK_Standby:269025040,XF86XK_AudioLowerVolume:269025041,XF86XK_AudioMute:269025042,XF86XK_AudioRaiseVolume:269025043,XF86XK_AudioPlay:269025044,XF86XK_AudioStop:269025045,XF86XK_AudioPrev:269025046,XF86XK_AudioNext:269025047,XF86XK_HomePage:269025048,XF86XK_Mail:269025049,XF86XK_Start:269025050,XF86XK_Search:269025051,XF86XK_AudioRecord:269025052,XF86XK_Calculator:269025053,XF86XK_Memo:269025054,XF86XK_ToDoList:269025055,XF86XK_Calendar:269025056,XF86XK_PowerDown:269025057,XF86XK_ContrastAdjust:269025058,XF86XK_RockerUp:269025059,XF86XK_RockerDown:269025060,XF86XK_RockerEnter:269025061,XF86XK_Back:269025062,XF86XK_Forward:269025063,XF86XK_Stop:269025064,XF86XK_Refresh:269025065,XF86XK_PowerOff:269025066,XF86XK_WakeUp:269025067,XF86XK_Eject:269025068,XF86XK_ScreenSaver:269025069,XF86XK_WWW:269025070,XF86XK_Sleep:269025071,XF86XK_Favorites:269025072,XF86XK_AudioPause:269025073,XF86XK_AudioMedia:269025074,XF86XK_MyComputer:269025075,XF86XK_VendorHome:269025076,XF86XK_LightBulb:269025077,XF86XK_Shop:269025078,XF86XK_History:269025079,XF86XK_OpenURL:269025080,XF86XK_AddFavorite:269025081,XF86XK_HotLinks:269025082,XF86XK_BrightnessAdjust:269025083,XF86XK_Finance:269025084,XF86XK_Community:269025085,XF86XK_AudioRewind:269025086,XF86XK_BackForward:269025087,XF86XK_Launch0:269025088,XF86XK_Launch1:269025089,XF86XK_Launch2:269025090,XF86XK_Launch3:269025091,XF86XK_Launch4:269025092,XF86XK_Launch5:269025093,XF86XK_Launch6:269025094,XF86XK_Launch7:269025095,XF86XK_Launch8:269025096,XF86XK_Launch9:269025097,XF86XK_LaunchA:269025098,XF86XK_LaunchB:269025099,XF86XK_LaunchC:269025100,XF86XK_LaunchD:269025101,XF86XK_LaunchE:269025102,XF86XK_LaunchF:269025103,XF86XK_ApplicationLeft:269025104,XF86XK_ApplicationRight:269025105,XF86XK_Book:269025106,XF86XK_CD:269025107,XF86XK_Calculater:269025108,XF86XK_Clear:269025109,XF86XK_Close:269025110,XF86XK_Copy:269025111,XF86XK_Cut:269025112,XF86XK_Display:269025113,XF86XK_DOS:269025114,XF86XK_Documents:269025115,XF86XK_Excel:269025116,XF86XK_Explorer:269025117,XF86XK_Game:269025118,XF86XK_Go:269025119,XF86XK_iTouch:269025120,XF86XK_LogOff:269025121,XF86XK_Market:269025122,XF86XK_Meeting:269025123,XF86XK_MenuKB:269025125,XF86XK_MenuPB:269025126,XF86XK_MySites:269025127,XF86XK_New:269025128,XF86XK_News:269025129,XF86XK_OfficeHome:269025130,XF86XK_Open:269025131,XF86XK_Option:269025132,XF86XK_Paste:269025133,XF86XK_Phone:269025134,XF86XK_Q:269025136,XF86XK_Reply:269025138,XF86XK_Reload:269025139,XF86XK_RotateWindows:269025140,XF86XK_RotationPB:269025141,XF86XK_RotationKB:269025142,XF86XK_Save:269025143,XF86XK_ScrollUp:269025144,XF86XK_ScrollDown:269025145,XF86XK_ScrollClick:269025146,XF86XK_Send:269025147,XF86XK_Spell:269025148,XF86XK_SplitScreen:269025149,XF86XK_Support:269025150,XF86XK_TaskPane:269025151,XF86XK_Terminal:269025152,XF86XK_Tools:269025153,XF86XK_Travel:269025154,XF86XK_UserPB:269025156,XF86XK_User1KB:269025157,XF86XK_User2KB:269025158,XF86XK_Video:269025159,XF86XK_WheelButton:269025160,XF86XK_Word:269025161,XF86XK_Xfer:269025162,XF86XK_ZoomIn:269025163,XF86XK_ZoomOut:269025164,XF86XK_Away:269025165,XF86XK_Messenger:269025166,XF86XK_WebCam:269025167,XF86XK_MailForward:269025168,XF86XK_Pictures:269025169,XF86XK_Music:269025170,XF86XK_Battery:269025171,XF86XK_Bluetooth:269025172,XF86XK_WLAN:269025173,XF86XK_UWB:269025174,XF86XK_AudioForward:269025175,XF86XK_AudioRepeat:269025176,XF86XK_AudioRandomPlay:269025177,XF86XK_Subtitle:269025178,XF86XK_AudioCycleTrack:269025179,XF86XK_CycleAngle:269025180,XF86XK_FrameBack:269025181,XF86XK_FrameForward:269025182,XF86XK_Time:269025183,XF86XK_Select:269025184,XF86XK_View:269025185,XF86XK_TopMenu:269025186,XF86XK_Red:269025187,XF86XK_Green:269025188,XF86XK_Yellow:269025189,XF86XK_Blue:269025190,XF86XK_Suspend:269025191,XF86XK_Hibernate:269025192,XF86XK_TouchpadToggle:269025193,XF86XK_TouchpadOn:269025200,XF86XK_TouchpadOff:269025201,XF86XK_AudioMicMute:269025202,XF86XK_Switch_VT_1:269024769,XF86XK_Switch_VT_2:269024770,XF86XK_Switch_VT_3:269024771,XF86XK_Switch_VT_4:269024772,XF86XK_Switch_VT_5:269024773,XF86XK_Switch_VT_6:269024774,XF86XK_Switch_VT_7:269024775,XF86XK_Switch_VT_8:269024776,XF86XK_Switch_VT_9:269024777,XF86XK_Switch_VT_10:269024778,XF86XK_Switch_VT_11:269024779,XF86XK_Switch_VT_12:269024780,XF86XK_Ungrab:269024800,XF86XK_ClearGrab:269024801,XF86XK_Next_VMode:269024802,XF86XK_Prev_VMode:269024803,XF86XK_LogWindowTree:269024804,XF86XK_LogGrabInfo:269024805}},mTgk: /*!************************************************************!*\ !*** ./node_modules/@novnc/novnc/lib/input/domkeytable.js ***! \************************************************************/ /*! no static exports found */ /*! all exports used */ /*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r,n=(r=i(/*! ./keysym.js */"mHUz"))&&r.__esModule?r:{default:r};var s={};function o(e,t){if(void 0===t)throw new Error('Undefined keysym for key "'+e+'"');if(e in s)throw new Error('Duplicate entry for key "'+e+'"');s[e]=[t,t,t,t]}function a(e,t,i){if(void 0===t)throw new Error('Undefined keysym for key "'+e+'"');if(void 0===i)throw new Error('Undefined keysym for key "'+e+'"');if(e in s)throw new Error('Duplicate entry for key "'+e+'"');s[e]=[t,t,i,t]}function l(e,t,i){if(void 0===t)throw new Error('Undefined keysym for key "'+e+'"');if(void 0===i)throw new Error('Undefined keysym for key "'+e+'"');if(e in s)throw new Error('Duplicate entry for key "'+e+'"');s[e]=[t,t,t,i]}a("Alt",n.default.XK_Alt_L,n.default.XK_Alt_R),o("AltGraph",n.default.XK_ISO_Level3_Shift),o("CapsLock",n.default.XK_Caps_Lock),a("Control",n.default.XK_Control_L,n.default.XK_Control_R),a("Meta",n.default.XK_Super_L,n.default.XK_Super_R),o("NumLock",n.default.XK_Num_Lock),o("ScrollLock",n.default.XK_Scroll_Lock),a("Shift",n.default.XK_Shift_L,n.default.XK_Shift_R),l("Enter",n.default.XK_Return,n.default.XK_KP_Enter),o("Tab",n.default.XK_Tab),l(" ",n.default.XK_space,n.default.XK_KP_Space),l("ArrowDown",n.default.XK_Down,n.default.XK_KP_Down),l("ArrowUp",n.default.XK_Up,n.default.XK_KP_Up),l("ArrowLeft",n.default.XK_Left,n.default.XK_KP_Left),l("ArrowRight",n.default.XK_Right,n.default.XK_KP_Right),l("End",n.default.XK_End,n.default.XK_KP_End),l("Home",n.default.XK_Home,n.default.XK_KP_Home),l("PageDown",n.default.XK_Next,n.default.XK_KP_Next),l("PageUp",n.default.XK_Prior,n.default.XK_KP_Prior),o("Backspace",n.default.XK_BackSpace),l("Clear",n.default.XK_Clear,n.default.XK_KP_Begin),o("Copy",n.default.XF86XK_Copy),o("Cut",n.default.XF86XK_Cut),l("Delete",n.default.XK_Delete,n.default.XK_KP_Delete),l("Insert",n.default.XK_Insert,n.default.XK_KP_Insert),o("Paste",n.default.XF86XK_Paste),o("Redo",n.default.XK_Redo),o("Undo",n.default.XK_Undo),o("Cancel",n.default.XK_Cancel),o("ContextMenu",n.default.XK_Menu),o("Escape",n.default.XK_Escape),o("Execute",n.default.XK_Execute),o("Find",n.default.XK_Find),o("Help",n.default.XK_Help),o("Pause",n.default.XK_Pause),o("Select",n.default.XK_Select),o("ZoomIn",n.default.XF86XK_ZoomIn),o("ZoomOut",n.default.XF86XK_ZoomOut),o("BrightnessDown",n.default.XF86XK_MonBrightnessDown),o("BrightnessUp",n.default.XF86XK_MonBrightnessUp),o("Eject",n.default.XF86XK_Eject),o("LogOff",n.default.XF86XK_LogOff),o("Power",n.default.XF86XK_PowerOff),o("PowerOff",n.default.XF86XK_PowerDown),o("PrintScreen",n.default.XK_Print),o("Hibernate",n.default.XF86XK_Hibernate),o("Standby",n.default.XF86XK_Standby),o("WakeUp",n.default.XF86XK_WakeUp),o("AllCandidates",n.default.XK_MultipleCandidate),o("Alphanumeric",n.default.XK_Eisu_Shift),o("CodeInput",n.default.XK_Codeinput),o("Compose",n.default.XK_Multi_key),o("Convert",n.default.XK_Henkan),o("GroupFirst",n.default.XK_ISO_First_Group),o("GroupLast",n.default.XK_ISO_Last_Group),o("GroupNext",n.default.XK_ISO_Next_Group),o("GroupPrevious",n.default.XK_ISO_Prev_Group),o("NonConvert",n.default.XK_Muhenkan),o("PreviousCandidate",n.default.XK_PreviousCandidate),o("SingleCandidate",n.default.XK_SingleCandidate),o("HangulMode",n.default.XK_Hangul),o("HanjaMode",n.default.XK_Hangul_Hanja),o("JunjuaMode",n.default.XK_Hangul_Jeonja),o("Eisu",n.default.XK_Eisu_toggle),o("Hankaku",n.default.XK_Hankaku),o("Hiragana",n.default.XK_Hiragana),o("HiraganaKatakana",n.default.XK_Hiragana_Katakana),o("KanaMode",n.default.XK_Kana_Shift),o("KanjiMode",n.default.XK_Kanji),o("Katakana",n.default.XK_Katakana),o("Romaji",n.default.XK_Romaji),o("Zenkaku",n.default.XK_Zenkaku),o("ZenkakuHanaku",n.default.XK_Zenkaku_Hankaku),o("F1",n.default.XK_F1),o("F2",n.default.XK_F2),o("F3",n.default.XK_F3),o("F4",n.default.XK_F4),o("F5",n.default.XK_F5),o("F6",n.default.XK_F6),o("F7",n.default.XK_F7),o("F8",n.default.XK_F8),o("F9",n.default.XK_F9),o("F10",n.default.XK_F10),o("F11",n.default.XK_F11),o("F12",n.default.XK_F12),o("F13",n.default.XK_F13),o("F14",n.default.XK_F14),o("F15",n.default.XK_F15),o("F16",n.default.XK_F16),o("F17",n.default.XK_F17),o("F18",n.default.XK_F18),o("F19",n.default.XK_F19),o("F20",n.default.XK_F20),o("F21",n.default.XK_F21),o("F22",n.default.XK_F22),o("F23",n.default.XK_F23),o("F24",n.default.XK_F24),o("F25",n.default.XK_F25),o("F26",n.default.XK_F26),o("F27",n.default.XK_F27),o("F28",n.default.XK_F28),o("F29",n.default.XK_F29),o("F30",n.default.XK_F30),o("F31",n.default.XK_F31),o("F32",n.default.XK_F32),o("F33",n.default.XK_F33),o("F34",n.default.XK_F34),o("F35",n.default.XK_F35),o("Close",n.default.XF86XK_Close),o("MailForward",n.default.XF86XK_MailForward),o("MailReply",n.default.XF86XK_Reply),o("MailSend",n.default.XF86XK_Send),o("MediaFastForward",n.default.XF86XK_AudioForward),o("MediaPause",n.default.XF86XK_AudioPause),o("MediaPlay",n.default.XF86XK_AudioPlay),o("MediaRecord",n.default.XF86XK_AudioRecord),o("MediaRewind",n.default.XF86XK_AudioRewind),o("MediaStop",n.default.XF86XK_AudioStop),o("MediaTrackNext",n.default.XF86XK_AudioNext),o("MediaTrackPrevious",n.default.XF86XK_AudioPrev),o("New",n.default.XF86XK_New),o("Open",n.default.XF86XK_Open),o("Print",n.default.XK_Print),o("Save",n.default.XF86XK_Save),o("SpellCheck",n.default.XF86XK_Spell),o("AudioVolumeDown",n.default.XF86XK_AudioLowerVolume),o("AudioVolumeUp",n.default.XF86XK_AudioRaiseVolume),o("AudioVolumeMute",n.default.XF86XK_AudioMute),o("MicrophoneVolumeMute",n.default.XF86XK_AudioMicMute),o("LaunchApplication1",n.default.XF86XK_MyComputer),o("LaunchApplication2",n.default.XF86XK_Calculator),o("LaunchCalendar",n.default.XF86XK_Calendar),o("LaunchMail",n.default.XF86XK_Mail),o("LaunchMediaPlayer",n.default.XF86XK_AudioMedia),o("LaunchMusicPlayer",n.default.XF86XK_Music),o("LaunchPhone",n.default.XF86XK_Phone),o("LaunchScreenSaver",n.default.XF86XK_ScreenSaver),o("LaunchSpreadsheet",n.default.XF86XK_Excel),o("LaunchWebBrowser",n.default.XF86XK_WWW),o("LaunchWebCam",n.default.XF86XK_WebCam),o("LaunchWordProcessor",n.default.XF86XK_Word),o("BrowserBack",n.default.XF86XK_Back),o("BrowserFavorites",n.default.XF86XK_Favorites),o("BrowserForward",n.default.XF86XK_Forward),o("BrowserHome",n.default.XF86XK_HomePage),o("BrowserRefresh",n.default.XF86XK_Refresh),o("BrowserSearch",n.default.XF86XK_Search),o("BrowserStop",n.default.XF86XK_Stop),o("Dimmer",n.default.XF86XK_BrightnessAdjust),o("MediaAudioTrack",n.default.XF86XK_AudioCycleTrack),o("RandomToggle",n.default.XF86XK_AudioRandomPlay),o("SplitScreenToggle",n.default.XF86XK_SplitScreen),o("Subtitle",n.default.XF86XK_Subtitle),o("VideoModeNext",n.default.XF86XK_Next_VMode),l("=",n.default.XK_equal,n.default.XK_KP_Equal),l("+",n.default.XK_plus,n.default.XK_KP_Add),l("-",n.default.XK_minus,n.default.XK_KP_Subtract),l("*",n.default.XK_asterisk,n.default.XK_KP_Multiply),l("/",n.default.XK_slash,n.default.XK_KP_Divide),l(".",n.default.XK_period,n.default.XK_KP_Decimal),l(",",n.default.XK_comma,n.default.XK_KP_Separator),l("0",n.default.XK_0,n.default.XK_KP_0),l("1",n.default.XK_1,n.default.XK_KP_1),l("2",n.default.XK_2,n.default.XK_KP_2),l("3",n.default.XK_3,n.default.XK_KP_3),l("4",n.default.XK_4,n.default.XK_KP_4),l("5",n.default.XK_5,n.default.XK_KP_5),l("6",n.default.XK_6,n.default.XK_KP_6),l("7",n.default.XK_7,n.default.XK_KP_7),l("8",n.default.XK_8,n.default.XK_KP_8),l("9",n.default.XK_9,n.default.XK_KP_9);var c=s;t.default=c},mdZa: /*!********************************************************!*\ !*** ./node_modules/@novnc/novnc/lib/util/polyfill.js ***! \********************************************************/ /*! no static exports found */ /*! all exports used */ /*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,i){"use strict";"function"!=typeof Object.assign&&Object.defineProperty(Object,"assign",{value:function(e,t){if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var i=Object(e),r=1;r=e.max))return e.ch=0,e.text=e.cm.getLine(++e.line),!0}function l(e){if(!(e.line<=e.min))return e.text=e.cm.getLine(--e.line),e.ch=e.text.length,!0}function c(e){for(;;){var t=e.text.indexOf(">",e.ch);if(-1==t){if(a(e))continue;return}if(o(e,t+1)){var i=e.text.lastIndexOf("/",t),r=i>-1&&!/\S/.test(e.text.slice(i+1,t));return e.ch=t+1,r?"selfClose":"regular"}e.ch=t+1}}function u(e){for(;;){var t=e.ch?e.text.lastIndexOf("<",e.ch-1):-1;if(-1==t){if(l(e))continue;return}if(o(e,t+1)){n.lastIndex=t,e.ch=t;var i=n.exec(e.text);if(i&&i.index==t)return i}else e.ch=t}}function h(e){for(;;){n.lastIndex=e.ch;var t=n.exec(e.text);if(!t){if(a(e))continue;return}if(o(e,t.index+1))return e.ch=t.index+t[0].length,t;e.ch=t.index+1}}function d(e){for(;;){var t=e.ch?e.text.lastIndexOf(">",e.ch-1):-1;if(-1==t){if(l(e))continue;return}if(o(e,t+1)){var i=e.text.lastIndexOf("/",t),r=i>-1&&!/\S/.test(e.text.slice(i+1,t));return e.ch=t+1,r?"selfClose":"regular"}e.ch=t}}function f(e,i){for(var r=[];;){var n,s=h(e),o=e.line,a=e.ch-(s?s[0].length:0);if(!s||!(n=c(e)))return;if("selfClose"!=n)if(s[1]){for(var l=r.length-1;l>=0;--l)if(r[l]==s[2]){r.length=l;break}if(l<0&&(!i||i==s[2]))return{tag:s[2],from:t(o,a),to:t(e.line,e.ch)}}else r.push(s[2])}}function p(e,i){for(var r=[];;){var n=d(e);if(!n)return;if("selfClose"!=n){var s=e.line,o=e.ch,a=u(e);if(!a)return;if(a[1])r.push(a[2]);else{for(var l=r.length-1;l>=0;--l)if(r[l]==a[2]){r.length=l;break}if(l<0&&(!i||i==a[2]))return{tag:a[2],from:t(e.line,e.ch),to:t(s,o)}}}else u(e)}}e.registerHelper("fold","xml",(function(e,r){for(var n=new s(e,r.line,0);;){var o=h(n);if(!o||n.line!=r.line)return;var a=c(n);if(!a)return;if(!o[1]&&"selfClose"!=a){var l=t(n.line,n.ch),u=f(n,o[2]);return u&&i(u.from,l)>0?{from:l,to:u.from}:null}}})),e.findMatchingTag=function(e,r,n){var o=new s(e,r.line,r.ch,n);if(-1!=o.text.indexOf(">")||-1!=o.text.indexOf("<")){var a=c(o),l=a&&t(o.line,o.ch),h=a&&u(o);if(a&&h&&!(i(o,r)>0)){var d={from:t(o.line,o.ch),to:l,tag:h[2]};return"selfClose"==a?{open:d,close:null,at:"open"}:h[1]?{open:p(o,h[2]),close:d,at:"close"}:{open:d,close:f(o=new s(e,l.line,l.ch,n),h[2]),at:"open"}}}},e.findEnclosingTag=function(e,t,i,r){for(var n=new s(e,t.line,t.ch,i);;){var o=p(n,r);if(!o)break;var a=f(new s(e,t.line,t.ch,i),o.tag);if(a)return{open:o,close:a}}},e.scanForClosingTag=function(e,t,i,r){return f(new s(e,t.line,t.ch,r?{from:0,to:r}:null),i)}}(i(/*! ../../lib/codemirror */"VrN/"))},p5ED: /*!*********************************************!*\ !*** ./src/components/PreviewAll/index.tsx ***! \*********************************************/ /*! exports provided: PreviewAll, default */ /*! exports used: default */function(e,t,i){"use strict";i(/*! antd/es/button/style */"+L6B");var r=i(/*! antd/es/button */"2/Rp"),n=(i(/*! antd/es/tooltip/style */"5Dmo"),i(/*! antd/es/tooltip */"3S7+")),s=i(/*! ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/objectSpread2 */"k1fw"),o=i(/*! ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/asyncToGenerator */"9og8"),a=i(/*! ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/slicedToArray */"tJVT"),l=i(/*! ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/regenerator */"WmNS"),c=i.n(l),u=i(/*! react */"q1tI"),h=i.n(u),d=i(/*! ./index.less?modules */"vHTk"),f=i.n(d),p=i(/*! @ant-design/icons */"yEEn"),g=i(/*! @/components/monaco-editor */"ZW9T"),v=i(/*! @/utils/util */"1vsH"),m=i(/*! @/service/exercise */"V0Rq"),y=i(/*! @/utils/env */"m3rI");t.a=function(e){e.name;var t=e.data,i=(e.theme,e.type),l=e.filename,d=e.monacoEditor,_=e.className,b=e.style,S=e.close,C=e.onClose,w=e.hasMask,k=e.otherData,x=void 0===k?{}:k,E=Object(u.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),T=Object(a.a)(E,2),L=(T[0],T[1],Object(u.useState)("")),A=Object(a.a)(L,2),R=(A[0],A[1]),D=Object(u.useState)(),O=Object(a.a)(D,2),M=O[0],I=O[1],P="build"===window.ENV?"/react/build/office.html":"/office.html",F=Object(u.useRef)();"office"===i&&Object(v.P)(t).filesize>10485760&&(i="other"),l&&(d.filename=l),Object(u.useEffect)((function(){var e,t,i=null===(e=document.cookie)||void 0===e||null===(t=e.replace(/\s/g,""))||void 0===t?void 0:t.split(";");null==i||i.map((function(e){var t=e.split("=");"_educoder_session"===t[0]&&R(t[1])}))}),[]),Object(u.useEffect)((function(){"office"===i&&B()}),[i]);var B=function(){var e=Object(o.a)(c.a.mark((function e(){var i,r,n;return c.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return console.log("data:",t),i=t,t.startsWith("http")||(i=location.origin+i),r=new URL(i).pathname.split("/").pop(),e.next=6,Object(m.U)({attachment_id:r});case 6:n=e.sent,I(n);case 8:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),N=function(){t.startsWith("http")||t.startsWith("blob:")?H():Object(v.x)(l||"educoder",t,l)},H=function(){Object(v.v)(l||"educoder",decodeURIComponent(t))};return h.a.createElement("div",{style:Object(s.a)({},b||{}),className:"".concat(w&&f.a.bgBlack," ").concat(i?f.a.wrp:"hide")},S&&h.a.createElement("div",{className:f.a.close,ref:F},h.a.createElement(n.a,{title:"点击下载此文件",getPopupContainer:function(){return F.current}},h.a.createElement("span",{onClick:H},h.a.createElement("i",{className:"icon-quxiaozhiding"}))),h.a.createElement(n.a,{title:"关闭",getPopupContainer:function(){return F.current}},h.a.createElement("span",{className:"",onClick:function(){C(),I(null)}},h.a.createElement("i",{className:"icon-guanbi1"})))),h.a.createElement("div",{className:"".concat(f.a[_]," ").concat(_," ").concat(f.a.monaco," ").concat("txt"===i?"show":"hide")},"txt"===i&&h.a.createElement(g.b,d)),"audio"===i&&h.a.createElement("audio",{src:"".concat((null==t?void 0:t.indexOf("http://"))>-1||(null==t?void 0:t.indexOf("https://"))>-1?"":"data:audio/mp3;base64,").concat(t),autoPlay:!0}),"video"===i&&h.a.createElement(h.a.Fragment,null,(null==t?void 0:t.indexOf("/api"))>-1?h.a.createElement("video",{controls:!0,src:"".concat(t),autoPlay:!0}):h.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(t),autoPlay:!0})),"office"===i&&M&&h.a.createElement("iframe",{src:"".concat(P,"?key=").concat(M.key,"&url=").concat(y.a.API_SERVER+M.url,"&callbackUrl=").concat(y.a.API_SERVER+M.callbackUrl,"&fileType=").concat(M.fileType,"&title=").concat(M.title,"&model=view")}),("xlsx"===i||"doc"===i||"pptx"===i||"docx"===i)&&h.a.createElement("iframe",{src:"".concat(P,"?key=").concat(x.key,"&url=").concat(y.a.API_SERVER+x.url,"&callbackUrl=").concat(y.a.API_SERVER+x.callbackUrl,"&fileType=").concat(x.fileType,"&title=").concat(x.title,"&model=").concat(x.model)}),"html"===i&&h.a.createElement("iframe",{src:t+"&disposition=inline"}),"pdf"===i&&h.a.createElement("embed",{className:f.a.embed,src:t,type:"application/pdf"}),"image"===i&&h.a.createElement("img",{src:"".concat((null==t?void 0:t.indexOf("http://"))>-1||(null==t?void 0:t.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(t)}),"other"===i&&h.a.createElement("div",null,h.a.createElement(r.a,{type:"primary",size:"large",onClick:N},h.a.createElement(p.a,null),"点击下载")),"download"===i&&h.a.createElement(r.a,{type:"primary",size:"large",onClick:N},h.a.createElement(p.a,null),"点击下载"))}},"p77/": /*!****************************************************!*\ !*** ./node_modules/codemirror/lib/codemirror.css ***! \****************************************************/ /*! no static exports found */ /*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,i){},q7KB: /*!******************************************!*\ !*** ./node_modules/xterm/css/xterm.css ***! \******************************************/ /*! no static exports found */ /*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,i){},"rAM+": /*!*******************************************************************************************************************!*\ !*** ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/createForOfIteratorHelper.js ***! \*******************************************************************************************************************/ /*! exports provided: default */ /*! exports used: default */function(e,t,i){"use strict";i.d(t,"a",(function(){return n}));var r=i(/*! @babel/runtime/helpers/esm/unsupportedIterableToArray */"Qw5x");function n(e,t){var i;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(i=Object(r.a)(e))||t&&e&&"number"==typeof e.length){i&&(e=i);var n=0,s=function(){};return{s:s,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,l=!1;return{s:function(){i=e[Symbol.iterator]()},n:function(){var e=i.next();return a=e.done,e},e:function(e){l=!0,o=e},f:function(){try{a||null==i.return||i.return()}finally{if(l)throw o}}}}},rUJ1: /*!********************************************!*\ !*** ./node_modules/marked/src/helpers.js ***! \********************************************/ /*! no static exports found */ /*! exports used: escape */ /*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t){const i=/[&<>"']/,r=/[&<>"']/g,n=/[<>"']|&(?!#?\w+;)/,s=/[<>"']|&(?!#?\w+;)/g,o={"&":"&","<":"<",">":">",'"':""","'":"'"},a=e=>o[e];const l=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi;function c(e){return e.replace(l,(e,t)=>"colon"===(t=t.toLowerCase())?":":"#"===t.charAt(0)?"x"===t.charAt(1)?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):"")}const u=/(^|[^\[])\^/g;const h=/[^\w:]/g,d=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;const f={},p=/^[^:]+:\/*[^/]*$/,g=/^([^:]+:)[\s\S]*$/,v=/^([^:]+:\/*[^/]*)[\s\S]*$/;function m(e,t){f[" "+e]||(p.test(e)?f[" "+e]=e+"/":f[" "+e]=y(e,"/",!0));const i=-1===(e=f[" "+e]).indexOf(":");return"//"===t.substring(0,2)?i?t:e.replace(g,"$1")+t:"/"===t.charAt(0)?i?t:e.replace(v,"$1")+t:e+t}function y(e,t,i){const r=e.length;if(0===r)return"";let n=0;for(;n(r=(r=r.source||r).replace(u,"$1"),e=e.replace(t,r),i),getRegex:()=>new RegExp(e,t)};return i},cleanUrl:function(e,t,i){if(e){let e;try{e=decodeURIComponent(c(i)).replace(h,"").toLowerCase()}catch(e){return null}if(0===e.indexOf("javascript:")||0===e.indexOf("vbscript:")||0===e.indexOf("data:"))return null}t&&!d.test(i)&&(i=m(t,i));try{i=encodeURI(i).replace(/%25/g,"%")}catch(e){return null}return i},resolveUrl:m,noopTest:{exec:function(){}},merge:function(e){let t,i,r=1;for(;r{let r=!1,n=t;for(;--n>=0&&"\\"===i[n];)r=!r;return r?"|":" |"}).split(/ \|/);let r=0;if(i.length>t)i.splice(t);else for(;i.length>>=b=_>>>24,p-=b,0===(b=_>>>16&255))E[s++]=65535&_;else{if(!(16&b)){if(0==(64&b)){_=g[(65535&_)+(f&(1<>>=b,p-=b),p<15&&(f+=x[r++]<>>=b=_>>>24,p-=b,!(16&(b=_>>>16&255))){if(0==(64&b)){_=v[(65535&_)+(f&(1<l){e.msg="invalid distance too far back",i.mode=30;break e}if(f>>>=b,p-=b,C>(b=s-o)){if((b=C-b)>u&&i.sane){e.msg="invalid distance too far back",i.mode=30;break e}if(w=0,k=d,0===h){if(w+=c-b,b2;)E[s++]=k[w++],E[s++]=k[w++],E[s++]=k[w++],S-=3;S&&(E[s++]=k[w++],S>1&&(E[s++]=k[w++]))}else{w=s-C;do{E[s++]=E[w++],E[s++]=E[w++],E[s++]=E[w++],S-=3}while(S>2);S&&(E[s++]=E[w++],S>1&&(E[s++]=E[w++]))}break}}break}}while(r>3,f&=(1<<(p-=S<<3))-1,e.next_in=r,e.next_out=s,e.avail_in=r0}),!1)}e.exports=function(e,t){t=t||{};var n={main:i.m},a=t.all?{main:Object.keys(n.main)}:function(e,t){for(var i={main:[t]},r={main:[]},n={main:{}};o(i);)for(var a=Object.keys(i),l=0;l=2*h/f||_<=S)){var C,w=Number.POSITIVE_INFINITY;for(C=e.level-1;C>g&&!((w=h*p[C].maxBitrate/(6.4*y))=_)){var k=this.bwEstimator.getEstimate();c.logger.warn("Fragment "+e.sn+(t?" part "+t.index:"")+" of level "+e.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+C+"\n Current BW estimate: "+(Object(r.isFiniteNumber)(k)?(k/1024).toFixed(3):"Unknown")+" Kb/s\n Estimated load time for current fragment: "+_.toFixed(3)+" s\n Estimated load time for the next fragment: "+w.toFixed(3)+" s\n Time to underbuffer: "+S.toFixed(3)+" s"),i.nextLoadLevel=C,this.bwEstimator.sample(d,u.loaded),this.clearTimer(),e.loader&&(this.fragCurrent=this.partCurrent=null,e.loader.abort()),i.trigger(s.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:e,part:t,stats:u})}}}}}},d.onFragLoaded=function(e,t){var i=t.frag,n=t.part;if(i.type===l.PlaylistLevelType.MAIN&&Object(r.isFiniteNumber)(i.sn)){var o=n?n.stats:i.stats,a=n?n.duration:i.duration;if(this.clearTimer(),this.lastLoadedFragLevel=i.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var c=this.hls.levels[i.level],u=(c.loaded?c.loaded.bytes:0)+o.loaded,h=(c.loaded?c.loaded.duration:0)+a;c.loaded={bytes:u,duration:h},c.realBitrate=Math.round(8*u/h)}if(i.bitrateTest){var d={stats:o,frag:i,part:n,id:i.type};this.onFragBuffered(s.Events.FRAG_BUFFERED,d),i.bitrateTest=!1}}},d.onFragBuffered=function(e,t){var i=t.frag,r=t.part,n=r?r.stats:i.stats;if(!n.aborted&&i.type===l.PlaylistLevelType.MAIN&&"initSegment"!==i.sn){var s=n.parsing.end-n.loading.start;this.bwEstimator.sample(s,n.loaded),n.bwEstimate=this.bwEstimator.getEstimate(),i.bitrateTest?this.bitrateTestDelay=s/1e3:this.bitrateTestDelay=0}},d.onError=function(e,t){switch(t.details){case a.ErrorDetails.FRAG_LOAD_ERROR:case a.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer()}},d.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},d.getNextABRAutoLevel=function(){var e=this.fragCurrent,t=this.partCurrent,i=this.hls,r=i.maxAutoLevel,n=i.config,s=i.minAutoLevel,a=i.media,l=t?t.duration:e?e.duration:0,u=a?a.currentTime:0,h=a&&0!==a.playbackRate?Math.abs(a.playbackRate):1,d=this.bwEstimator?this.bwEstimator.getEstimate():n.abrEwmaDefaultEstimate,f=(o.BufferHelper.bufferInfo(a,u,n.maxBufferHole).end-u)/h,p=this.findBestLevel(d,s,r,f,n.abrBandWidthFactor,n.abrBandWidthUpFactor);if(p>=0)return p;c.logger.trace((f?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var g=l?Math.min(l,n.maxStarvationDelay):n.maxStarvationDelay,v=n.abrBandWidthFactor,m=n.abrBandWidthUpFactor;if(!f){var y=this.bitrateTestDelay;y&&(g=(l?Math.min(l,n.maxLoadingDelay):n.maxLoadingDelay)-y,c.logger.trace("bitrate test took "+Math.round(1e3*y)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*g)+" ms"),v=m=1)}return p=this.findBestLevel(d,s,r,f+g,v,m),Math.max(p,0)},d.findBestLevel=function(e,t,i,r,n,s){for(var o,a=this.fragCurrent,l=this.partCurrent,u=this.lastLoadedFragLevel,h=this.hls.levels,d=h[u],f=!(null==d||null===(o=d.details)||void 0===o||!o.live),p=null==d?void 0:d.codecSet,g=l?l.duration:a?a.duration:0,v=i;v>=t;v--){var m=h[v];if(m&&(!p||m.codecSet===p)){var y=m.details,_=(l?null==y?void 0:y.partTarget:null==y?void 0:y.averagetargetduration)||g,b=void 0;b=v<=u?n*e:s*e;var S=h[v].maxBitrate,C=S*_/b;if(c.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+v+"/"+Math.round(b)+"/"+S+"/"+_+"/"+r+"/"+C),b>S&&(!C||f&&!this.bitrateTestDelay||C0&&-1===e?(this.log("Override startPosition with lastCurrentTime @"+t.toFixed(3)),this.state=n.State.IDLE):(this.loadedmetadata=!1,this.state=n.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()},S.doTick=function(){switch(this.state){case n.State.IDLE:this.doTickIdle();break;case n.State.WAITING_TRACK:var t,i=this.levels,r=this.trackId,s=null==i||null===(t=i[r])||void 0===t?void 0:t.details;if(s){if(this.waitForCdnTuneIn(s))break;this.state=n.State.WAITING_INIT_PTS}break;case n.State.FRAG_LOADING_WAITING_RETRY:var a,l=performance.now(),c=this.retryDate;(!c||l>=c||null!==(a=this.media)&&void 0!==a&&a.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=n.State.IDLE);break;case n.State.WAITING_INIT_PTS:var u=this.waitingData;if(u){var h=u.frag,d=u.part,f=u.cache,g=u.complete;if(void 0!==this.initPTS[h.cc]){this.waitingData=null,this.waitingVideoCC=-1,this.state=n.State.FRAG_LOADING;var v={frag:h,part:d,payload:f.flush(),networkDetails:null};this._handleFragmentLoadProgress(v),g&&e.prototype._handleFragmentLoadComplete.call(this,v)}else if(this.videoTrackCC!==this.waitingVideoCC)m.logger.log("Waiting fragment cc ("+h.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var y=this.getLoadPosition(),_=o.BufferHelper.bufferInfo(this.mediaBuffer,y,this.config.maxBufferHole);Object(p.fragmentWithinToleranceTest)(_.end,this.config.maxFragLookUpTolerance,h)<0&&(m.logger.log("Waiting fragment cc ("+h.cc+") @ "+h.start+" cancelled because another fragment at "+_.end+" is needed"),this.clearWaitingFragment())}}else this.state=n.State.IDLE}this.onTickEnd()},S.clearWaitingFragment=function(){var e=this.waitingData;e&&(this.fragmentTracker.removeFragment(e.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=n.State.IDLE)},S.onTickEnd=function(){var e=this.media;if(e&&e.readyState){var t=(this.mediaBuffer?this.mediaBuffer:e).buffered;!this.loadedmetadata&&t.length&&(this.loadedmetadata=!0),this.lastCurrentTime=e.currentTime}},S.doTickIdle=function(){var e,t,i=this.hls,r=this.levels,o=this.media,a=this.trackId,l=i.config;if(r&&r[a]&&(o||!this.startFragRequested&&l.startFragPrefetch)){var h=r[a].details;if(!h||h.live&&this.levelLastLoaded!==a||this.waitForCdnTuneIn(h))this.state=n.State.WAITING_TRACK;else{this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,u.ElementaryStreamTypes.AUDIO,c.PlaylistLevelType.AUDIO));var d=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,c.PlaylistLevelType.AUDIO);if(null!==d){var f=d.len,p=this.getMaxBufferLength(),g=this.audioSwitch;if(!(f>=p)||g){if(!g&&this._streamEnded(d,h))return i.trigger(s.Events.BUFFER_EOS,{type:"audio"}),void(this.state=n.State.ENDED);var v=h.fragments[0].start,m=d.end;if(g){var y=this.getLoadPosition();m=y,h.PTSKnown&&yv||d.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),o.currentTime=v+.05)}var _=this.getNextFragment(m,h);_?"identity"!==(null===(e=_.decryptdata)||void 0===e?void 0:e.keyFormat)||null!==(t=_.decryptdata)&&void 0!==t&&t.key?this.loadFragment(_,h,m):this.loadKey(_,h):this.bufferFlushed=!0}}}}},S.getMaxBufferLength=function(){var t=e.prototype.getMaxBufferLength.call(this),i=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,c.PlaylistLevelType.MAIN);return null===i?t:Math.max(t,i.len)},S.onMediaDetaching=function(){this.videoBuffer=null,e.prototype.onMediaDetaching.call(this)},S.onAudioTracksUpdated=function(e,t){var i=t.audioTracks;this.resetTransmuxer(),this.levels=i.map((function(e){return new l.Level(e)}))},S.onAudioTrackSwitching=function(e,t){var i=!!t.url;this.trackId=t.id;var r=this.fragCurrent;null!=r&&r.loader&&r.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),i?this.setInterval(100):this.resetTransmuxer(),i?(this.audioSwitch=!0,this.state=n.State.IDLE):this.state=n.State.STOPPED,this.tick()},S.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},S.onLevelLoaded=function(e,t){this.mainDetails=t.details},S.onAudioTrackLoaded=function(e,t){var i,r=this.levels,s=t.details,o=t.id;if(r){this.log("Track "+o+" loaded ["+s.startSN+","+s.endSN+"],duration:"+s.totalduration);var a=r[o],l=0;if(s.live||null!==(i=a.details)&&void 0!==i&&i.live){var c=this.mainDetails;if(s.fragments[0]||(s.deltaUpdateFailed=!0),s.deltaUpdateFailed||!c)return;!a.details&&s.hasProgramDateTime&&c.hasProgramDateTime?(Object(g.alignMediaPlaylistByPDT)(s,c),l=s.fragments[0].start):l=this.alignPlaylists(s,a.details)}a.details=s,this.levelLastLoaded=o,this.startFragRequested||!this.mainDetails&&s.live||this.setStartPosition(a.details,l),this.state!==n.State.WAITING_TRACK||this.waitForCdnTuneIn(s)||(this.state=n.State.IDLE),this.tick()}else this.warn("Audio tracks were reset while loading level "+o)},S._handleFragmentLoadProgress=function(e){var t,i=e.frag,r=e.part,s=e.payload,o=this.config,a=this.trackId,l=this.levels;if(l){var u=l[a];console.assert(u,"Audio track is defined on fragment load progress");var p=u.details;console.assert(p,"Audio track details are defined on fragment load progress");var g=o.defaultAudioCodec||u.audioCodec||"mp4a.40.2",v=this.transmuxer;v||(v=this.transmuxer=new d.default(this.hls,c.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var y=this.initPTS[i.cc],_=null===(t=i.initSegment)||void 0===t?void 0:t.data;if(void 0!==y){var b=r?r.index:-1,S=-1!==b,C=new f.ChunkMetadata(i.level,i.sn,i.stats.chunkCount,s.byteLength,b,S);v.push(s,_,g,"",i,r,p.totalduration,!1,C,y)}else m.logger.log("Unknown video PTS for cc "+i.cc+", waiting for video PTS before demuxing audio frag "+i.sn+" of ["+p.startSN+" ,"+p.endSN+"],track "+a),(this.waitingData=this.waitingData||{frag:i,part:r,cache:new h.default,complete:!1}).cache.push(new Uint8Array(s)),this.waitingVideoCC=this.videoTrackCC,this.state=n.State.WAITING_INIT_PTS}else this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+i.sn+" of level "+i.level+" will not be buffered")},S._handleFragmentLoadComplete=function(t){this.waitingData?this.waitingData.complete=!0:e.prototype._handleFragmentLoadComplete.call(this,t)},S.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},S.onBufferCreated=function(e,t){var i=t.tracks.audio;i&&(this.mediaBuffer=i.buffer),t.tracks.video&&(this.videoBuffer=t.tracks.video.buffer)},S.onFragBuffered=function(e,t){var i=t.frag,r=t.part;i.type===c.PlaylistLevelType.AUDIO&&(this.fragContextChanged(i)?this.warn("Fragment "+i.sn+(r?" p: "+r.index:"")+" of level "+i.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch):("initSegment"!==i.sn&&(this.fragPrevious=i,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(s.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(i,r)))},S.onError=function(t,i){switch(i.details){case v.ErrorDetails.FRAG_LOAD_ERROR:case v.ErrorDetails.FRAG_LOAD_TIMEOUT:case v.ErrorDetails.KEY_LOAD_ERROR:case v.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(c.PlaylistLevelType.AUDIO,i);break;case v.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case v.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==n.State.ERROR&&this.state!==n.State.STOPPED&&(this.state=i.fatal?n.State.ERROR:n.State.IDLE,this.warn(i.details+" while loading frag, switching to "+this.state+" state"));break;case v.ErrorDetails.BUFFER_FULL_ERROR:if("audio"===i.parent&&(this.state===n.State.PARSING||this.state===n.State.PARSED)){var r=!0,s=this.getFwdBufferInfo(this.mediaBuffer,c.PlaylistLevelType.AUDIO);s&&s.len>.5&&(r=!this.reduceMaxBufferLength(s.len)),r&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,e.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}}},S.onBufferFlushed=function(e,t){t.type===u.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},S._handleTransmuxComplete=function(e){var t,i="audio",r=this.hls,o=e.remuxResult,a=e.chunkMeta,l=this.getCurrentContext(a);if(!l)return this.warn("The loading context changed while buffering fragment "+a.sn+" of level "+a.level+". This chunk will not be buffered."),void this.resetLiveStartWhenNotLoaded(a.level);var c=l.frag,h=l.part,d=o.audio,f=o.text,p=o.id3,g=o.initSegment;if(!this.fragContextChanged(c)){if(this.state=n.State.PARSING,this.audioSwitch&&d&&this.completeAudioSwitch(),null!=g&&g.tracks&&(this._bufferInitSegment(g.tracks,c,a),r.trigger(s.Events.FRAG_PARSING_INIT_SEGMENT,{frag:c,id:i,tracks:g.tracks})),d){var v=d.startPTS,m=d.endPTS,_=d.startDTS,b=d.endDTS;h&&(h.elementaryStreams[u.ElementaryStreamTypes.AUDIO]={startPTS:v,endPTS:m,startDTS:_,endDTS:b}),c.setElementaryStreamInfo(u.ElementaryStreamTypes.AUDIO,v,m,_,b),this.bufferFragmentData(d,c,h,a)}if(null!=p&&null!==(t=p.samples)&&void 0!==t&&t.length){var S=y({frag:c,id:i},p);r.trigger(s.Events.FRAG_PARSING_METADATA,S)}if(f){var C=y({frag:c,id:i},f);r.trigger(s.Events.FRAG_PARSING_USERDATA,C)}}},S._bufferInitSegment=function(e,t,i){if(this.state===n.State.PARSING){e.video&&delete e.video;var r=e.audio;if(r){r.levelCodec=r.codec,r.id="audio",this.log("Init audio buffer, container:"+r.container+", codecs[parsed]=["+r.codec+"]"),this.hls.trigger(s.Events.BUFFER_CODECS,e);var o=r.initSegment;if(null!=o&&o.byteLength){var a={type:"audio",frag:t,part:null,chunkMeta:i,parent:t.type,data:o};this.hls.trigger(s.Events.BUFFER_APPENDING,a)}this.tick()}}},S.loadFragment=function(t,i,s){var o=this.fragmentTracker.getState(t);this.fragCurrent=t,(this.audioSwitch||o===a.FragmentState.NOT_LOADED||o===a.FragmentState.PARTIAL)&&("initSegment"===t.sn?this._loadInitSegment(t):i.live&&!Object(r.isFiniteNumber)(this.initPTS[t.cc])?(this.log("Waiting for video PTS in continuity counter "+t.cc+" of live stream before loading audio fragment "+t.sn+" of level "+this.trackId),this.state=n.State.WAITING_INIT_PTS):(this.startFragRequested=!0,e.prototype.loadFragment.call(this,t,i,s)))},S.completeAudioSwitch=function(){var t=this.hls,i=this.media,r=this.trackId;i&&(this.log("Switching audio track : flushing all audio"),e.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,t.trigger(s.Events.AUDIO_TRACK_SWITCHED,{id:r})},b}(n.default);t.default=b},"./src/controller/audio-track-controller.ts": /*!**************************************************!*\ !*** ./src/controller/audio-track-controller.ts ***! \**************************************************/ /*! exports provided: default */function(e,t,i){"use strict";i.r(t);var r=i(/*! ../events */"./src/events.ts"),n=i(/*! ../errors */"./src/errors.ts"),s=i(/*! ./base-playlist-controller */"./src/controller/base-playlist-controller.ts"),o=i(/*! ../types/loader */"./src/types/loader.ts");function a(e,t){for(var i=0;i=t.length)this.warn("Invalid id passed to audio-track controller");else{this.clearTimer();var i=t[this.trackId];this.log("Now switching to audio-track index "+e);var n=t[e],s=n.id,o=n.groupId,a=void 0===o?"":o,l=n.name,c=n.type,u=n.url;if(this.trackId=e,this.trackName=l,this.selectDefaultTrack=!1,this.hls.trigger(r.Events.AUDIO_TRACK_SWITCHING,{id:s,groupId:a,name:l,type:c,url:u}),!n.details||n.details.live){var h=this.switchParams(n.url,null==i?void 0:i.details);this.loadPlaylist(h)}}},d.selectInitialTrack=function(){var e=this.tracksInGroup;console.assert(e.length,"Initial audio track should be selected when tracks are known");var t=this.trackName,i=this.findTrackId(t)||this.findTrackId();-1!==i?this.setAudioTrack(i):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(r.Events.ERROR,{type:n.ErrorTypes.MEDIA_ERROR,details:n.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},d.findTrackId=function(e){for(var t=this.tracksInGroup,i=0;it.partTarget&&(c+=1)}if(Object(r.isFiniteNumber)(l))return new n.HlsUrlParameters(l,Object(r.isFiniteNumber)(c)?c:void 0,n.HlsSkip.No)}}},t.loadPlaylist=function(e){},t.shouldLoadTrack=function(e){return this.canLoad&&e&&!!e.url&&(!e.details||e.details.live)},t.playlistLoaded=function(e,t,i){var r=this,n=t.details,o=t.stats,a=o.loading.end?Math.max(0,self.performance.now()-o.loading.end):0;if(n.advancedDateTime=Date.now()-a,n.live||null!=i&&i.live){if(n.reloaded(i),i&&this.log("live playlist "+e+" "+(n.advanced?"REFRESHED "+n.lastPartSn+"-"+n.lastPartIndex:"MISSED")),i&&n.fragments.length>0&&Object(s.mergeDetails)(i,n),!this.canLoad||!n.live)return;var l,c=void 0,u=void 0;if(n.canBlockReload&&n.endSN&&n.advanced){var h=this.hls.config.lowLatencyMode,d=n.lastPartSn,f=n.endSN,p=n.lastPartIndex,g=d===f;-1!==p?(c=g?f+1:d,u=g?h?0:p:p+1):c=f+1;var v=n.age,m=v+n.ageHeader,y=Math.min(m-n.partTarget,1.5*n.targetduration);if(y>0){if(i&&y>i.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+i.tuneInGoal+" to: "+y+" with playlist age: "+n.age),y=0;else{var _=Math.floor(y/n.targetduration);c+=_,void 0!==u&&(u+=Math.round(y%n.targetduration/n.partTarget)),this.log("CDN Tune-in age: "+n.ageHeader+"s last advanced "+v.toFixed(2)+"s goal: "+y+" skip sn "+_+" to part "+u)}n.tuneInGoal=y}if(l=this.getDeliveryDirectives(n,t.deliveryDirectives,c,u),h||!g)return void this.loadPlaylist(l)}else l=this.getDeliveryDirectives(n,t.deliveryDirectives,c,u);var b=Object(s.computeReloadInterval)(n,o);void 0!==c&&n.canBlockReload&&(b-=n.partTarget||1),this.log("reload live playlist "+e+" in "+Math.round(b)+" ms"),this.timer=self.setTimeout((function(){return r.loadPlaylist(l)}),b)}else this.clearTimer()},t.getDeliveryDirectives=function(e,t,i,r){var s=Object(n.getSkipValue)(e,i);return null!=t&&t.skip&&e.deltaUpdateFailed&&(i=t.msn,r=t.part,s=n.HlsSkip.No),new n.HlsUrlParameters(i,r,s)},t.retryLoadingOrFail=function(e){var t,i=this,r=this.hls.config,n=this.retryCount-1&&null!==(t=e.context)&&void 0!==t&&t.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+e.details+'"'),this.loadPlaylist();else{var s=Math.min(Math.pow(2,this.retryCount)*r.levelLoadingRetryDelay,r.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout((function(){return i.loadPlaylist()}),s),this.warn("retry playlist loading #"+this.retryCount+" in "+s+' ms after "'+e.details+'"')}else this.warn('cannot recover from error "'+e.details+'"'),this.clearTimer(),e.fatal=!0;return n},e}()},"./src/controller/base-stream-controller.ts": /*!**************************************************!*\ !*** ./src/controller/base-stream-controller.ts ***! \**************************************************/ /*! exports provided: State, default */function(e,t,i){"use strict";i.r(t),i.d(t,"State",(function(){return S})),i.d(t,"default",(function(){return C}));var r=i(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),n=i(/*! ../task-loop */"./src/task-loop.ts"),s=i(/*! ./fragment-tracker */"./src/controller/fragment-tracker.ts"),o=i(/*! ../utils/buffer-helper */"./src/utils/buffer-helper.ts"),a=i(/*! ../utils/logger */"./src/utils/logger.ts"),l=i(/*! ../events */"./src/events.ts"),c=i(/*! ../errors */"./src/errors.ts"),u=i(/*! ../types/transmuxer */"./src/types/transmuxer.ts"),h=i(/*! ../utils/mp4-tools */"./src/utils/mp4-tools.ts"),d=i(/*! ../utils/discontinuities */"./src/utils/discontinuities.ts"),f=i(/*! ./fragment-finders */"./src/controller/fragment-finders.ts"),p=i(/*! ./level-helper */"./src/controller/level-helper.ts"),g=i(/*! ../loader/fragment-loader */"./src/loader/fragment-loader.ts"),v=i(/*! ../crypt/decrypter */"./src/crypt/decrypter.ts"),m=i(/*! ../utils/time-ranges */"./src/utils/time-ranges.ts"),y=i(/*! ../types/loader */"./src/types/loader.ts");function _(e,t){for(var i=0;it.start+t.duration+c;(a0&&s&&s.key&&s.iv&&"AES-128"===s.method){var o=self.performance.now();return t.decrypter.webCryptoDecrypt(new Uint8Array(n),s.key.buffer,s.iv.buffer).then((function(t){var n=self.performance.now();return r.trigger(l.Events.FRAG_DECRYPTED,{frag:e,payload:t,stats:{tstart:o,tdecrypt:n}}),i.payload=t,i}))}return i})).then((function(i){var r=t.fragCurrent,n=t.hls,s=t.levels;if(!s)throw new Error("init load aborted, missing levels");var o=s[e.level].details;console.assert(o,"Level details are defined when init segment is loaded");var a=e.stats;t.state=S.IDLE,t.fragLoadError=0,e.data=new Uint8Array(i.payload),a.parsing.start=a.buffering.start=self.performance.now(),a.parsing.end=a.buffering.end=self.performance.now(),i.frag===r&&n.trigger(l.Events.FRAG_BUFFERED,{stats:a,frag:r,part:null,id:e.type}),t.tick()})).catch((function(i){t.warn(i),t.resetFragmentLoading(e)}))},x.fragContextChanged=function(e){var t=this.fragCurrent;return!e||!t||e.level!==t.level||e.sn!==t.sn||e.urlId!==t.urlId},x.fragBufferedComplete=function(e,t){var i=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+e.type+" sn: "+e.sn+(t?" part: "+t.index:"")+" of "+("[stream-controller]"===this.logPrefix?"level":"track")+" "+e.level+" "+m.default.toString(o.BufferHelper.getBuffered(i))),this.state=S.IDLE,this.tick()},x._handleFragmentLoadComplete=function(e){var t=this.transmuxer;if(t){var i=e.frag,r=e.part,n=e.partsLoaded,s=!n||0===n.length||n.some((function(e){return!e})),o=new u.ChunkMetadata(i.level,i.sn,i.stats.chunkCount+1,0,r?r.index:-1,!s);t.flush(o)}},x._handleFragmentLoadProgress=function(e){},x._doFragLoad=function(e,t,i,n){var s=this;if(void 0===i&&(i=null),!this.levels)throw new Error("frag load aborted, missing levels");if(i=Math.max(e.start,i||0),this.config.lowLatencyMode&&t){var o=t.partList;if(o&&n){i>e.end&&t.fragmentHint&&(e=t.fragmentHint);var a=this.getNextPart(o,e,i);if(a>-1){var c=o[a];return this.log("Loading part sn: "+e.sn+" p: "+c.index+" cc: "+e.cc+" of playlist ["+t.startSN+"-"+t.endSN+"] parts [0-"+a+"-"+(o.length-1)+"] "+("[stream-controller]"===this.logPrefix?"level":"track")+": "+e.level+", target: "+parseFloat(i.toFixed(3))),this.nextLoadPosition=c.start+c.duration,this.state=S.FRAG_LOADING,this.hls.trigger(l.Events.FRAG_LOADING,{frag:e,part:o[a],targetBufferTime:i}),this.doFragPartsLoad(e,o,a,n).catch((function(e){return s.handleFragLoadError(e)}))}if(!e.url||this.loadedEndOfParts(o,i))return Promise.resolve(null)}}return this.log("Loading fragment "+e.sn+" cc: "+e.cc+" "+(t?"of ["+t.startSN+"-"+t.endSN+"] ":"")+("[stream-controller]"===this.logPrefix?"level":"track")+": "+e.level+", target: "+parseFloat(i.toFixed(3))),Object(r.isFiniteNumber)(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=S.FRAG_LOADING,this.hls.trigger(l.Events.FRAG_LOADING,{frag:e,targetBufferTime:i}),this.fragmentLoader.load(e,n).catch((function(e){return s.handleFragLoadError(e)}))},x.doFragPartsLoad=function(e,t,i,r){var n=this;return new Promise((function(s,o){var a=[];!function i(c){var u=t[c];n.fragmentLoader.loadPart(e,u,r).then((function(r){a[u.index]=r;var o=r.part;n.hls.trigger(l.Events.FRAG_LOADED,r);var h=t[c+1];if(!h||h.fragment!==e)return s({frag:e,part:o,partsLoaded:a});i(c+1)})).catch(o)}(i)}))},x.handleFragLoadError=function(e){var t=e.data;return t&&t.details===c.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(t.frag,t.part):this.hls.trigger(l.Events.ERROR,t),null},x._handleTransmuxerFlush=function(e){var t=this.getCurrentContext(e);if(t&&this.state===S.PARSING){var i=t.frag,r=t.part,n=t.level,s=self.performance.now();i.stats.parsing.end=s,r&&(r.stats.parsing.end=s),this.updateLevelTiming(i,r,n,e.partial)}else this.fragCurrent||(this.state=S.IDLE)},x.getCurrentContext=function(e){var t=this.levels,i=e.level,r=e.sn,n=e.part;if(!t||!t[i])return this.warn("Levels object was unset while buffering fragment "+r+" of level "+i+". The current chunk will not be buffered."),null;var s=t[i],o=n>-1?Object(p.getPartWith)(s,r,n):null,a=o?o.fragment:Object(p.getFragmentWithSN)(s,r,this.fragCurrent);return a?{frag:a,part:o,level:s}:null},x.bufferFragmentData=function(e,t,i,r){if(e&&this.state===S.PARSING){var n=e.data1,s=e.data2,o=n;if(n&&s&&(o=Object(h.appendUint8Array)(n,s)),o&&o.length){var a={type:e.type,frag:t,part:i,chunkMeta:r,parent:t.type,data:o};this.hls.trigger(l.Events.BUFFER_APPENDING,a),e.dropped&&e.independent&&!i&&this.flushBufferGap(t)}}},x.flushBufferGap=function(e){var t=this.media;if(t)if(o.BufferHelper.isBuffered(t,t.currentTime)){var i=t.currentTime,r=o.BufferHelper.bufferInfo(t,i,0),n=e.duration,s=Math.min(2*this.config.maxFragLookUpTolerance,.25*n),a=Math.max(Math.min(e.start-s,r.end-s),i+s);e.start-a>s&&this.flushMainBuffer(a,e.start)}else this.flushMainBuffer(0,e.start)},x.getFwdBufferInfo=function(e,t){var i=this.config,n=this.getLoadPosition();if(!Object(r.isFiniteNumber)(n))return null;var s=o.BufferHelper.bufferInfo(e,n,i.maxBufferHole);if(0===s.len&&void 0!==s.nextStart){var a=this.fragmentTracker.getBufferedFrag(n,t);if(a&&s.nextStart=i&&(t.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+t.maxMaxBufferLength+"s"),!0)},x.getNextFragment=function(e,t){var i,r,n=t.fragments,s=n.length;if(!s)return null;var o,a=this.config,l=n[0].start;if(t.live){var c=a.initialLiveManifestSize;if(s-1&&ii.start&&i.loaded},x.getInitialLiveFragment=function(e,t){var i=this.fragPrevious,r=null;if(i){if(e.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+i.programDateTime),r=Object(f.findFragmentByPDT)(t,i.endProgramDateTime,this.config.maxFragLookUpTolerance)),!r){var n=i.sn+1;if(n>=e.startSN&&n<=e.endSN){var s=t[n-e.startSN];i.cc===s.cc&&(r=s,this.log("Live playlist, switching playlist, load frag with next SN: "+r.sn))}r||(r=Object(f.findFragWithCC)(t,i.cc))&&this.log("Live playlist, switching playlist, load frag with same CC: "+r.sn)}}else{var o=this.hls.liveSyncPosition;null!==o&&(r=this.getFragmentAtPosition(o,this.bitrateTest?e.fragmentEnd:e.edge,e))}return r},x.getFragmentAtPosition=function(e,t,i){var r,n=this.config,o=this.fragPrevious,a=i.fragments,l=i.endSN,c=i.fragmentHint,u=n.maxFragLookUpTolerance,h=!!(n.lowLatencyMode&&i.partList&&c);if(h&&c&&!this.bitrateTest&&(a=a.concat(c),l=c.sn),et-u?0:u;r=Object(f.findFragmentByPTS)(o,a,e,d)}else r=a[a.length-1];if(r){var p=r.sn-i.startSN,g=o&&r.level===o.level,v=a[p+1];if(this.fragmentTracker.getState(r)===s.FragmentState.BACKTRACKED){r=null;for(var m=p;a[m]&&this.fragmentTracker.getState(a[m])===s.FragmentState.BACKTRACKED;)r=o?a[m--]:a[--m];r||(r=v)}else o&&r.sn===o.sn&&!h&&g&&(r.sn=s-t.maxFragLookUpTolerance&&n<=o;if(null!==r&&i.duration>r&&(n"+e.startSN+" prev-sn: "+(s?s.sn:"na")+" fragments: "+a),h}return l},x.waitForCdnTuneIn=function(e){return e.live&&e.canBlockReload&&e.tuneInGoal>Math.max(e.partHoldBack,3*e.partTarget)},x.setStartPosition=function(e,t){var i=this.startPosition;if(i"+e))}}])&&_(C.prototype,w),k&&_(C,k),n}(n.default)},"./src/controller/buffer-controller.ts": /*!*********************************************!*\ !*** ./src/controller/buffer-controller.ts ***! \*********************************************/ /*! exports provided: default */function(e,t,i){"use strict";i.r(t),i.d(t,"default",(function(){return f}));var r=i(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),n=i(/*! ../events */"./src/events.ts"),s=i(/*! ../utils/logger */"./src/utils/logger.ts"),o=i(/*! ../errors */"./src/errors.ts"),a=i(/*! ../utils/buffer-helper */"./src/utils/buffer-helper.ts"),l=i(/*! ../utils/mediasource-helper */"./src/utils/mediasource-helper.ts"),c=i(/*! ../loader/fragment */"./src/loader/fragment.ts"),u=i(/*! ./buffer-operation-queue */"./src/controller/buffer-operation-queue.ts"),h=Object(l.getMediaSource)(),d=/([ha]vc.)(?:\.[^.,]+)+/,f=function(){function e(e){var t=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 e=t.hls,i=t.media,r=t.mediaSource;s.logger.log("[buffer-controller]: Media source opened"),i&&(t.updateMediaElementDuration(),e.trigger(n.Events.MEDIA_ATTACHED,{media:i})),r&&r.removeEventListener("sourceopen",t._onMediaSourceOpen),t.checkPendingTracks()},this._onMediaSourceClose=function(){s.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){s.logger.log("[buffer-controller]: Media source ended")},this.hls=e,this._initSourceBuffer(),this.registerListeners()}var t=e.prototype;return t.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},t.destroy=function(){this.unregisterListeners(),this.details=null},t.registerListeners=function(){var e=this.hls;e.on(n.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(n.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(n.Events.MANIFEST_PARSED,this.onManifestParsed,this),e.on(n.Events.BUFFER_RESET,this.onBufferReset,this),e.on(n.Events.BUFFER_APPENDING,this.onBufferAppending,this),e.on(n.Events.BUFFER_CODECS,this.onBufferCodecs,this),e.on(n.Events.BUFFER_EOS,this.onBufferEos,this),e.on(n.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(n.Events.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(n.Events.FRAG_PARSED,this.onFragParsed,this),e.on(n.Events.FRAG_CHANGED,this.onFragChanged,this)},t.unregisterListeners=function(){var e=this.hls;e.off(n.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(n.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(n.Events.MANIFEST_PARSED,this.onManifestParsed,this),e.off(n.Events.BUFFER_RESET,this.onBufferReset,this),e.off(n.Events.BUFFER_APPENDING,this.onBufferAppending,this),e.off(n.Events.BUFFER_CODECS,this.onBufferCodecs,this),e.off(n.Events.BUFFER_EOS,this.onBufferEos,this),e.off(n.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(n.Events.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(n.Events.FRAG_PARSED,this.onFragParsed,this),e.off(n.Events.FRAG_CHANGED,this.onFragChanged,this)},t._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new u.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},t.onManifestParsed=function(e,t){var i=2;(t.audio&&!t.video||!t.altAudio)&&(i=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=i,this.details=null,s.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},t.onMediaAttaching=function(e,t){var i=this.media=t.media;if(i&&h){var r=this.mediaSource=new h;r.addEventListener("sourceopen",this._onMediaSourceOpen),r.addEventListener("sourceended",this._onMediaSourceEnded),r.addEventListener("sourceclose",this._onMediaSourceClose),i.src=self.URL.createObjectURL(r),this._objectUrl=i.src}},t.onMediaDetaching=function(){var e=this.media,t=this.mediaSource,i=this._objectUrl;if(t){if(s.logger.log("[buffer-controller]: media source detaching"),"open"===t.readyState)try{t.endOfStream()}catch(e){s.logger.warn("[buffer-controller]: onMediaDetaching: "+e.message+" while calling endOfStream")}this.onBufferReset(),t.removeEventListener("sourceopen",this._onMediaSourceOpen),t.removeEventListener("sourceended",this._onMediaSourceEnded),t.removeEventListener("sourceclose",this._onMediaSourceClose),e&&(i&&self.URL.revokeObjectURL(i),e.src===i?(e.removeAttribute("src"),e.load()):s.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(n.Events.MEDIA_DETACHED,void 0)},t.onBufferReset=function(){var e=this;this.getSourceBufferTypes().forEach((function(t){var i=e.sourceBuffer[t];try{i&&(e.removeBufferListeners(t),e.mediaSource&&e.mediaSource.removeSourceBuffer(i),e.sourceBuffer[t]=void 0)}catch(e){s.logger.warn("[buffer-controller]: Failed to reset the "+t+" buffer",e)}})),this._initSourceBuffer()},t.onBufferCodecs=function(e,t){var i=this,r=this.getSourceBufferTypes().length;Object.keys(t).forEach((function(e){if(r){var n=i.tracks[e];if(n&&"function"==typeof n.buffer.changeType){var s=t[e],o=s.codec,a=s.levelCodec,l=s.container;if((n.levelCodec||n.codec).replace(d,"$1")!==(a||o).replace(d,"$1")){var c=l+";codecs="+(a||o);i.appendChangeType(e,c)}}}else i.pendingTracks[e]=t[e]})),r||(this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&"open"===this.mediaSource.readyState&&this.checkPendingTracks())},t.appendChangeType=function(e,t){var i=this,r=this.operationQueue,n={execute:function(){var n=i.sourceBuffer[e];n&&(s.logger.log("[buffer-controller]: changing "+e+" sourceBuffer type to "+t),n.changeType(t)),r.shiftAndExecuteNext(e)},onStart:function(){},onComplete:function(){},onError:function(t){s.logger.warn("[buffer-controller]: Failed to change "+e+" SourceBuffer type",t)}};r.append(n,e)},t.onBufferAppending=function(e,t){var i=this,r=this.hls,l=this.operationQueue,c=this.tracks,u=t.data,h=t.type,d=t.frag,f=t.part,p=t.chunkMeta,g=p.buffering[h],v=self.performance.now();g.start=v;var m=d.stats.buffering,y=f?f.stats.buffering:null;0===m.start&&(m.start=v),y&&0===y.start&&(y.start=v);var _=c.audio,b="audio"===h&&1===p.id&&"audio/mpeg"===(null==_?void 0:_.container),S={execute:function(){if(g.executeStart=self.performance.now(),b){var e=i.sourceBuffer[h];if(e){var t=d.start-e.timestampOffset;Math.abs(t)>=.1&&(s.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+d.start+" (delta: "+t+") sn: "+d.sn+")"),e.timestampOffset=d.start)}}i.appendExecutor(u,h)},onStart:function(){},onComplete:function(){var e=self.performance.now();g.executeEnd=g.end=e,0===m.first&&(m.first=e),y&&0===y.first&&(y.first=e);var t=i.sourceBuffer,r={};for(var s in t)r[s]=a.BufferHelper.getBuffered(t[s]);i.appendError=0,i.hls.trigger(n.Events.BUFFER_APPENDED,{type:h,frag:d,part:f,chunkMeta:p,parent:d.type,timeRanges:r})},onError:function(e){s.logger.error("[buffer-controller]: Error encountered while trying to append to the "+h+" SourceBuffer",e);var t={type:o.ErrorTypes.MEDIA_ERROR,parent:d.type,details:o.ErrorDetails.BUFFER_APPEND_ERROR,err:e,fatal:!1};e.code===DOMException.QUOTA_EXCEEDED_ERR?t.details=o.ErrorDetails.BUFFER_FULL_ERROR:(i.appendError++,t.details=o.ErrorDetails.BUFFER_APPEND_ERROR,i.appendError>r.config.appendErrorMaxRetry&&(s.logger.error("[buffer-controller]: Failed "+r.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),t.fatal=!0)),r.trigger(n.Events.ERROR,t)}};l.append(S,h)},t.onBufferFlushing=function(e,t){var i=this,r=this.operationQueue,o=function(e){return{execute:i.removeExecutor.bind(i,e,t.startOffset,t.endOffset),onStart:function(){},onComplete:function(){i.hls.trigger(n.Events.BUFFER_FLUSHED,{type:e})},onError:function(t){s.logger.warn("[buffer-controller]: Failed to remove from "+e+" SourceBuffer",t)}}};t.type?r.append(o(t.type),t.type):this.getSourceBufferTypes().forEach((function(e){r.append(o(e),e)}))},t.onFragParsed=function(e,t){var i=this,r=t.frag,o=t.part,a=[],l=o?o.elementaryStreams:r.elementaryStreams;l[c.ElementaryStreamTypes.AUDIOVIDEO]?a.push("audiovideo"):(l[c.ElementaryStreamTypes.AUDIO]&&a.push("audio"),l[c.ElementaryStreamTypes.VIDEO]&&a.push("video")),0===a.length&&s.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+r.type+" level: "+r.level+" sn: "+r.sn),this.blockBuffers((function(){var e=self.performance.now();r.stats.buffering.end=e,o&&(o.stats.buffering.end=e);var t=o?o.stats:r.stats;i.hls.trigger(n.Events.FRAG_BUFFERED,{frag:r,part:o,stats:t,id:r.type})}),a)},t.onFragChanged=function(e,t){this.flushBackBuffer()},t.onBufferEos=function(e,t){var i=this;this.getSourceBufferTypes().reduce((function(e,r){var n=i.sourceBuffer[r];return t.type&&t.type!==r||n&&!n.ended&&(n.ended=!0,s.logger.log("[buffer-controller]: "+r+" sourceBuffer now EOS")),e&&!(n&&!n.ended)}),!0)&&this.blockBuffers((function(){var e=i.mediaSource;e&&"open"===e.readyState&&e.endOfStream()}))},t.onLevelUpdated=function(e,t){var i=t.details;i.fragments.length&&(this.details=i,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration())},t.flushBackBuffer=function(){var e=this.hls,t=this.details,i=this.media,s=this.sourceBuffer;if(i&&null!==t){var o=this.getSourceBufferTypes();if(o.length){var l=t.live&&null!==e.config.liveBackBufferLength?e.config.liveBackBufferLength:e.config.backBufferLength;if(Object(r.isFiniteNumber)(l)&&!(l<0)){var c=i.currentTime,u=t.levelTargetDuration,h=Math.max(l,u),d=Math.floor(c/u)*u-h;o.forEach((function(i){var r=s[i];if(r){var o=a.BufferHelper.getBuffered(r);o.length>0&&d>o.start(0)&&(e.trigger(n.Events.BACK_BUFFER_REACHED,{bufferEnd:d}),t.live&&e.trigger(n.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:d}),e.trigger(n.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:d,type:i}))}}))}}}},t.updateMediaElementDuration=function(){if(this.details&&this.media&&this.mediaSource&&"open"===this.mediaSource.readyState){var e=this.details,t=this.hls,i=this.media,n=this.mediaSource,o=e.fragments[0].start+e.totalduration,a=i.duration,l=Object(r.isFiniteNumber)(n.duration)?n.duration:0;e.live&&t.config.liveDurationInfinity?(s.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),n.duration=1/0,this.updateSeekableRange(e)):(o>l&&o>a||!Object(r.isFiniteNumber)(a))&&(s.logger.log("[buffer-controller]: Updating Media Source duration to "+o.toFixed(3)),n.duration=o)}},t.updateSeekableRange=function(e){var t=this.mediaSource,i=e.fragments;if(i.length&&e.live&&null!=t&&t.setLiveSeekableRange){var r=Math.max(0,i[0].start),n=Math.max(r,r+e.totalduration);t.setLiveSeekableRange(r,n)}},t.checkPendingTracks=function(){var e=this.bufferCodecEventsExpected,t=this.operationQueue,i=this.pendingTracks,r=Object.keys(i).length;if(r&&!e||2===r){this.createSourceBuffers(i),this.pendingTracks={};var s=this.getSourceBufferTypes();if(0===s.length)return void this.hls.trigger(n.Events.ERROR,{type:o.ErrorTypes.MEDIA_ERROR,details:o.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});s.forEach((function(e){t.executeNext(e)}))}},t.createSourceBuffers=function(e){var t=this.sourceBuffer,i=this.mediaSource;if(!i)throw Error("createSourceBuffers called when mediaSource was null");var r=0;for(var a in e)if(!t[a]){var l=e[a];if(!l)throw Error("source buffer exists for track "+a+", however track does not");var c=l.levelCodec||l.codec,u=l.container+";codecs="+c;s.logger.log("[buffer-controller]: creating sourceBuffer("+u+")");try{var h=t[a]=i.addSourceBuffer(u),d=a;this.addBufferListener(d,"updatestart",this._onSBUpdateStart),this.addBufferListener(d,"updateend",this._onSBUpdateEnd),this.addBufferListener(d,"error",this._onSBUpdateError),this.tracks[a]={buffer:h,codec:c,container:l.container,levelCodec:l.levelCodec,id:l.id},r++}catch(e){s.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+e.message),this.hls.trigger(n.Events.ERROR,{type:o.ErrorTypes.MEDIA_ERROR,details:o.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:e,mimeType:u})}}r&&this.hls.trigger(n.Events.BUFFER_CREATED,{tracks:this.tracks})},t._onSBUpdateStart=function(e){this.operationQueue.current(e).onStart()},t._onSBUpdateEnd=function(e){var t=this.operationQueue;t.current(e).onComplete(),t.shiftAndExecuteNext(e)},t._onSBUpdateError=function(e,t){s.logger.error("[buffer-controller]: "+e+" SourceBuffer error",t),this.hls.trigger(n.Events.ERROR,{type:o.ErrorTypes.MEDIA_ERROR,details:o.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var i=this.operationQueue.current(e);i&&i.onError(t)},t.removeExecutor=function(e,t,i){var n=this.media,o=this.mediaSource,a=this.operationQueue,l=this.sourceBuffer[e];if(!n||!o||!l)return s.logger.warn("[buffer-controller]: Attempting to remove from the "+e+" SourceBuffer, but it does not exist"),void a.shiftAndExecuteNext(e);var c=Object(r.isFiniteNumber)(n.duration)?n.duration:1/0,u=Object(r.isFiniteNumber)(o.duration)?o.duration:1/0,h=Math.max(0,t),d=Math.min(i,c,u);d>h?(s.logger.log("[buffer-controller]: Removing ["+h+","+d+"] from the "+e+" SourceBuffer"),console.assert(!l.updating,e+" sourceBuffer must not be updating"),l.remove(h,d)):a.shiftAndExecuteNext(e)},t.appendExecutor=function(e,t){var i=this.operationQueue,r=this.sourceBuffer[t];if(!r)return s.logger.warn("[buffer-controller]: Attempting to append to the "+t+" SourceBuffer, but it does not exist"),void i.shiftAndExecuteNext(t);r.ended=!1,console.assert(!r.updating,t+" sourceBuffer must not be updating"),r.appendBuffer(e)},t.blockBuffers=function(e,t){var i=this;if(void 0===t&&(t=this.getSourceBufferTypes()),!t.length)return s.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),void Promise.resolve(e);var r=this.operationQueue,n=t.map((function(e){return r.appendBlocker(e)}));Promise.all(n).then((function(){e(),t.forEach((function(e){var t=i.sourceBuffer[e];t&&t.updating||r.shiftAndExecuteNext(e)}))}))},t.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},t.addBufferListener=function(e,t,i){var r=this.sourceBuffer[e];if(r){var n=i.bind(this,e);this.listeners[e].push({event:t,listener:n}),r.addEventListener(t,n)}},t.removeBufferListeners=function(e){var t=this.sourceBuffer[e];t&&this.listeners[e].forEach((function(e){t.removeEventListener(e.event,e.listener)}))},e}()},"./src/controller/buffer-operation-queue.ts": /*!**************************************************!*\ !*** ./src/controller/buffer-operation-queue.ts ***! \**************************************************/ /*! exports provided: default */function(e,t,i){"use strict";i.r(t),i.d(t,"default",(function(){return n}));var r=i(/*! ../utils/logger */"./src/utils/logger.ts"),n=function(){function e(e){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=e}var t=e.prototype;return t.append=function(e,t){var i=this.queues[t];i.push(e),1===i.length&&this.buffers[t]&&this.executeNext(t)},t.insertAbort=function(e,t){this.queues[t].unshift(e),this.executeNext(t)},t.appendBlocker=function(e){var t,i=new Promise((function(e){t=e})),r={execute:t,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(r,e),i},t.executeNext=function(e){var t=this.buffers,i=this.queues,n=t[e],s=i[e];if(s.length){var o=s[0];try{o.execute()}catch(t){r.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),o.onError(t),n&&n.updating||(s.shift(),this.executeNext(e))}}},t.shiftAndExecuteNext=function(e){this.queues[e].shift(),this.executeNext(e)},t.current=function(e){return this.queues[e][0]},e}()},"./src/controller/cap-level-controller.ts": /*!************************************************!*\ !*** ./src/controller/cap-level-controller.ts ***! \************************************************/ /*! exports provided: default */function(e,t,i){"use strict";i.r(t);var r=i(/*! ../events */"./src/events.ts");function n(e,t){for(var i=0;i0&&this.mediaWidth>0){var e=this.hls.levels;if(e.length){var t=this.hls;t.autoLevelCapping=this.getMaxLevel(e.length-1),t.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=t.autoLevelCapping}}},o.getMaxLevel=function(t){var i=this,r=this.hls.levels;if(!r.length)return-1;var n=r.filter((function(r,n){return e.isLevelAllowed(n,i.restrictedLevels)&&n<=t}));return this.clientRect=null,e.getMaxLevelByMediaSize(n,this.mediaWidth,this.mediaHeight)},o.startCapping=function(){this.timer||(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())},o.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},o.getDimensions=function(){if(this.clientRect)return this.clientRect;var e=this.media,t={width:0,height:0};if(e){var i=e.getBoundingClientRect();t.width=i.width,t.height=i.height,t.width||t.height||(t.width=i.right-i.left||e.width||0,t.height=i.bottom-i.top||e.height||0)}return this.clientRect=t,t},e.isLevelAllowed=function(e,t){return void 0===t&&(t=[]),-1===t.indexOf(e)},e.getMaxLevelByMediaSize=function(e,t,i){if(!e||!e.length)return-1;for(var r,n,s=e.length-1,o=0;o=t||a.height>=i)&&(r=a,!(n=e[o+1])||r.width!==n.width||r.height!==n.height)){s=o;break}}return s},t=e,s=[{key:"contentScaleFactor",get:function(){var e=1;try{e=self.devicePixelRatio}catch(e){}return e}}],(i=[{key:"mediaWidth",get:function(){return this.getDimensions().width*e.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*e.contentScaleFactor}}])&&n(t.prototype,i),s&&n(t,s),e}();t.default=s},"./src/controller/cmcd-controller.ts": /*!*******************************************!*\ !*** ./src/controller/cmcd-controller.ts ***! \*******************************************/ /*! exports provided: default */function(e,t,i){"use strict";i.r(t),i.d(t,"default",(function(){return d}));var r=i(/*! ../events */"./src/events.ts"),n=i(/*! ../types/cmcd */"./src/types/cmcd.ts"),s=i(/*! ../utils/buffer-helper */"./src/utils/buffer-helper.ts"),o=i(/*! ../utils/logger */"./src/utils/logger.ts");function a(e,t){for(var i=0;i=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,r=new Array(t);ii&&(i=s.bitrate)}return i>0?i:NaN},t.getBufferLength=function(e){var t=this.hls.media,i=e===n.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;return i&&t?1e3*s.BufferHelper.bufferInfo(i,t.currentTime,this.config.maxBufferHole).len:NaN},t.createPlaylistLoader=function(){var e=this.config.pLoader,t=this.applyPlaylistData,i=e||this.config.loader;return function(){function e(e){this.loader=void 0,this.loader=new i(e)}var r=e.prototype;return r.destroy=function(){this.loader.destroy()},r.abort=function(){this.loader.abort()},r.load=function(e,i,r){t(e),this.loader.load(e,i,r)},l(e,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),e}()},t.createFragmentLoader=function(){var e=this.config.fLoader,t=this.applyFragmentData,i=e||this.config.loader;return function(){function e(e){this.loader=void 0,this.loader=new i(e)}var r=e.prototype;return r.destroy=function(){this.loader.destroy()},r.abort=function(){this.loader.abort()},r.load=function(e,i,r){t(e),this.loader.load(e,i,r)},l(e,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),e}()},e.uuid=function(){var e=URL.createObjectURL(new Blob),t=e.toString();return URL.revokeObjectURL(e),t.substr(t.lastIndexOf("/")+1)},e.serialize=function(e){for(var t,i=[],r=function(e){return!Number.isNaN(e)&&null!=e&&""!==e&&!1!==e},n=function(e){return Math.round(e)},s=function(e){return 100*n(e/100)},o={br:n,d:n,bl:s,dl:s,mtp:s,nor:function(e){return encodeURIComponent(e)},rtp:s,tb:n},a=c(Object.keys(e||{}).sort());!(t=a()).done;){var l=t.value,u=e[l];if(r(u)&&!("v"===l&&1===u||"pr"==l&&1===u)){var h=o[l];h&&(u=h(u));var d=typeof u,f=void 0;f="ot"===l||"sf"===l||"st"===l?l+"="+u:"boolean"===d?l:"number"===d?l+"="+u:l+"="+JSON.stringify(u),i.push(f)}}return i.join(",")},e.toHeaders=function(t){for(var i={},r=["Object","Request","Session","Status"],n=[{},{},{},{}],s={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},o=0,a=Object.keys(t);o3)return void this.hls.trigger(r.Events.ERROR,{type:n.ErrorTypes.KEY_SYSTEM_ERROR,details:n.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});var c=3-this._requestLicenseFailureCount+1;s.logger.warn("Retrying license request, "+c+" attempts left"),this._requestLicense(i,o)}}},c._generateLicenseRequestChallenge=function(e,t){switch(e.mediaKeySystemDomain){case o.KeySystems.WIDEVINE:return t}throw new Error("unsupported key-system: "+e.mediaKeySystemDomain)},c._requestLicense=function(e,t){s.logger.log("Requesting content license for key-system");var i=this._mediaKeysList[0];if(!i)return s.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),void this.hls.trigger(r.Events.ERROR,{type:n.ErrorTypes.KEY_SYSTEM_ERROR,details:n.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});try{var o=this.getLicenseServerUrl(i.mediaKeySystemDomain),a=this._createLicenseXhr(o,e,t);s.logger.log("Sending license request to URL: "+o);var l=this._generateLicenseRequestChallenge(i,e);a.send(l)}catch(e){s.logger.error("Failure requesting DRM license: "+e),this.hls.trigger(r.Events.ERROR,{type:n.ErrorTypes.KEY_SYSTEM_ERROR,details:n.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},c.onMediaAttached=function(e,t){if(this._emeEnabled){var i=t.media;this._media=i,i.addEventListener("encrypted",this._onMediaEncrypted)}},c.onMediaDetached=function(){var e=this._media,t=this._mediaKeysList;e&&(e.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(t.map((function(e){if(e.mediaKeysSession)return e.mediaKeysSession.close().catch((function(){}))}))).then((function(){return e.setMediaKeys(null)})).catch((function(){})))},c.onManifestParsed=function(e,t){if(this._emeEnabled){var i=t.levels.map((function(e){return e.audioCodec})).filter((function(e){return!!e})),r=t.levels.map((function(e){return e.videoCodec})).filter((function(e){return!!e}));this._attemptKeySystemAccess(o.KeySystems.WIDEVINE,i,r)}},t=e,(i=[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}])&&a(t.prototype,i),l&&a(t,l),e}();t.default=l},"./src/controller/fps-controller.ts": /*!******************************************!*\ !*** ./src/controller/fps-controller.ts ***! \******************************************/ /*! exports provided: default */function(e,t,i){"use strict";i.r(t);var r=i(/*! ../events */"./src/events.ts"),n=i(/*! ../utils/logger */"./src/utils/logger.ts"),s=function(){function e(e){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=e,this.registerListeners()}var t=e.prototype;return t.setStreamController=function(e){this.streamController=e},t.registerListeners=function(){this.hls.on(r.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},t.unregisterListeners=function(){this.hls.off(r.Events.MEDIA_ATTACHING,this.onMediaAttaching)},t.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},t.onMediaAttaching=function(e,t){var i=this.hls.config;if(i.capLevelOnFPSDrop){var r=t.media instanceof self.HTMLVideoElement?t.media:null;this.media=r,r&&"function"==typeof r.getVideoPlaybackQuality&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),i.fpsDroppedMonitoringPeriod)}},t.checkFPS=function(e,t,i){var s=performance.now();if(t){if(this.lastTime){var o=s-this.lastTime,a=i-this.lastDroppedFrames,l=t-this.lastDecodedFrames,c=1e3*a/o,u=this.hls;if(u.trigger(r.Events.FPS_DROP,{currentDropped:a,currentDecoded:l,totalDroppedFrames:i}),c>0&&a>u.config.fpsDroppedMonitoringThreshold*l){var h=u.currentLevel;n.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+h),h>0&&(-1===u.autoLevelCapping||u.autoLevelCapping>=h)&&(h-=1,u.trigger(r.Events.FPS_DROP_LEVEL_CAPPING,{level:h,droppedLevel:u.currentLevel}),u.autoLevelCapping=h,this.streamController.nextLevelSwitch())}}this.lastTime=s,this.lastDroppedFrames=i,this.lastDecodedFrames=t}},t.checkFPSInterval=function(){var e=this.media;if(e)if(this.isVideoPlaybackQualityAvailable){var t=e.getVideoPlaybackQuality();this.checkFPS(e,t.totalVideoFrames,t.droppedVideoFrames)}else this.checkFPS(e,e.webkitDecodedFrameCount,e.webkitDroppedFrameCount)},e}();t.default=s},"./src/controller/fragment-finders.ts": /*!********************************************!*\ !*** ./src/controller/fragment-finders.ts ***! \********************************************/ /*! exports provided: findFragmentByPDT, findFragmentByPTS, fragmentWithinToleranceTest, pdtWithinToleranceTest, findFragWithCC */function(e,t,i){"use strict";i.r(t),i.d(t,"findFragmentByPDT",(function(){return s})),i.d(t,"findFragmentByPTS",(function(){return o})),i.d(t,"fragmentWithinToleranceTest",(function(){return a})),i.d(t,"pdtWithinToleranceTest",(function(){return l})),i.d(t,"findFragWithCC",(function(){return c}));var r=i(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),n=i(/*! ../utils/binary-search */"./src/utils/binary-search.ts");function s(e,t,i){if(null===t||!Array.isArray(e)||!e.length||!Object(r.isFiniteNumber)(t))return null;if(t<(e[0].programDateTime||0))return null;if(t>=(e[e.length-1].endProgramDateTime||0))return null;i=i||0;for(var n=0;ne&&i.start?-1:0}function l(e,t,i){var r=1e3*Math.min(t,i.duration+(i.deltaPTS?i.deltaPTS:0));return(i.endProgramDateTime||0)-r>e}function c(e,t){return n.default.search(e,(function(e){return e.cct?-1:0}))}},"./src/controller/fragment-tracker.ts": /*!********************************************!*\ !*** ./src/controller/fragment-tracker.ts ***! \********************************************/ /*! exports provided: FragmentState, FragmentTracker */function(e,t,i){"use strict";i.r(t),i.d(t,"FragmentState",(function(){return r})),i.d(t,"FragmentTracker",(function(){return o}));var r,n=i(/*! ../events */"./src/events.ts"),s=i(/*! ../types/loader */"./src/types/loader.ts");!function(e){e.NOT_LOADED="NOT_LOADED",e.BACKTRACKED="BACKTRACKED",e.APPENDING="APPENDING",e.PARTIAL="PARTIAL",e.OK="OK"}(r||(r={}));var o=function(){function e(e){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=e,this._registerListeners()}var t=e.prototype;return t._registerListeners=function(){var e=this.hls;e.on(n.Events.BUFFER_APPENDED,this.onBufferAppended,this),e.on(n.Events.FRAG_BUFFERED,this.onFragBuffered,this),e.on(n.Events.FRAG_LOADED,this.onFragLoaded,this)},t._unregisterListeners=function(){var e=this.hls;e.off(n.Events.BUFFER_APPENDED,this.onBufferAppended,this),e.off(n.Events.FRAG_BUFFERED,this.onFragBuffered,this),e.off(n.Events.FRAG_LOADED,this.onFragLoaded,this)},t.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},t.getAppendedFrag=function(e,t){if(t===s.PlaylistLevelType.MAIN){var i=this.activeFragment,r=this.activeParts;if(!i)return null;if(r)for(var n=r.length;n--;){var o=r[n],a=o?o.end:i.appendedPTS;if(o.start<=e&&void 0!==a&&e<=a)return n>9&&(this.activeParts=r.slice(n-9)),o}else if(i.start<=e&&void 0!==i.appendedPTS&&e<=i.appendedPTS)return i}return this.getBufferedFrag(e,t)},t.getBufferedFrag=function(e,t){for(var i=this.fragments,r=Object.keys(i),n=r.length;n--;){var s=i[r[n]];if((null==s?void 0:s.body.type)===t&&s.buffered){var o=s.body;if(o.start<=e&&e<=o.end)return o}}return null},t.detectEvictedFragments=function(e,t,i){var r=this;Object.keys(this.fragments).forEach((function(n){var s=r.fragments[n];if(s)if(s.buffered){var o=s.range[e];o&&o.time.some((function(e){var i=!r.isTimeBuffered(e.startPTS,e.endPTS,t);return i&&r.removeFragment(s.body),i}))}else s.body.type===i&&r.removeFragment(s.body)}))},t.detectPartialFragments=function(e){var t=this,i=this.timeRanges,r=e.frag,n=e.part;if(i&&"initSegment"!==r.sn){var s=l(r),o=this.fragments[s];o&&(Object.keys(i).forEach((function(e){var s=r.elementaryStreams[e];if(s){var a=i[e],l=null!==n||!0===s.partial;o.range[e]=t.getBufferedTimes(r,n,l,a)}})),o.backtrack=o.loaded=null,Object.keys(o.range).length?o.buffered=!0:this.removeFragment(o.body))}},t.fragBuffered=function(e){var t=l(e),i=this.fragments[t];i&&(i.backtrack=i.loaded=null,i.buffered=!0)},t.getBufferedTimes=function(e,t,i,r){for(var n={time:[],partial:i},s=t?t.start:e.start,o=t?t.end:e.end,a=e.minEndPTS||o,l=e.maxStartPTS||s,c=0;c=u&&a<=h){n.time.push({startPTS:Math.max(s,r.start(c)),endPTS:Math.min(o,r.end(c))});break}if(su)n.partial=!0,n.time.push({startPTS:Math.max(s,r.start(c)),endPTS:Math.min(o,r.end(c))});else if(o<=u)break}return n},t.getPartialFragment=function(e){var t,i,r,n=null,s=0,o=this.bufferPadding,l=this.fragments;return Object.keys(l).forEach((function(c){var u=l[c];u&&a(u)&&(i=u.body.start-o,r=u.body.end+o,e>=i&&e<=r&&(t=Math.min(e-i,r-e),s<=t&&(n=u.body,s=t)))})),n},t.getState=function(e){var t=l(e),i=this.fragments[t];return i?i.buffered?a(i)?r.PARTIAL:r.OK:i.backtrack?r.BACKTRACKED:r.APPENDING:r.NOT_LOADED},t.backtrack=function(e,t){var i=l(e),r=this.fragments[i];if(!r||r.backtrack)return null;var n=r.backtrack=t||r.loaded;return r.loaded=null,n},t.getBacktrackData=function(e){var t=l(e),i=this.fragments[t];if(i){var r,n=i.backtrack;if(null!=n&&null!==(r=n.payload)&&void 0!==r&&r.byteLength)return n;this.removeFragment(e)}return null},t.isTimeBuffered=function(e,t,i){for(var r,n,s=0;s=r&&t<=n)return!0;if(t<=r)return!1}return!1},t.onFragLoaded=function(e,t){var i=t.frag,r=t.part;if("initSegment"!==i.sn&&!i.bitrateTest&&!r){var n=l(i);this.fragments[n]={body:i,loaded:t,backtrack:null,buffered:!1,range:Object.create(null)}}},t.onBufferAppended=function(e,t){var i=this,r=t.frag,n=t.part,o=t.timeRanges;if(r.type===s.PlaylistLevelType.MAIN)if(this.activeFragment=r,n){var a=this.activeParts;a||(this.activeParts=a=[]),a.push(n)}else this.activeParts=null;this.timeRanges=o,Object.keys(o).forEach((function(e){var t=o[e];if(i.detectEvictedFragments(e,t),!n)for(var s=0;se&&r.removeFragment(o)}}))},t.removeFragment=function(e){var t=l(e);e.stats.loaded=0,e.clearElementaryStreamInfo(),delete this.fragments[t]},t.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},e}();function a(e){var t,i;return e.buffered&&((null===(t=e.range.video)||void 0===t?void 0:t.partial)||(null===(i=e.range.audio)||void 0===i?void 0:i.partial))}function l(e){return e.type+"_"+e.level+"_"+e.urlId+"_"+e.sn}},"./src/controller/gap-controller.ts": /*!******************************************!*\ !*** ./src/controller/gap-controller.ts ***! \******************************************/ /*! exports provided: STALL_MINIMUM_DURATION_MS, MAX_START_GAP_JUMP, SKIP_BUFFER_HOLE_STEP_SECONDS, SKIP_BUFFER_RANGE_START, default */function(e,t,i){"use strict";i.r(t),i.d(t,"STALL_MINIMUM_DURATION_MS",(function(){return a})),i.d(t,"MAX_START_GAP_JUMP",(function(){return l})),i.d(t,"SKIP_BUFFER_HOLE_STEP_SECONDS",(function(){return c})),i.d(t,"SKIP_BUFFER_RANGE_START",(function(){return u})),i.d(t,"default",(function(){return h}));var r=i(/*! ../utils/buffer-helper */"./src/utils/buffer-helper.ts"),n=i(/*! ../errors */"./src/errors.ts"),s=i(/*! ../events */"./src/events.ts"),o=i(/*! ../utils/logger */"./src/utils/logger.ts"),a=250,l=2,c=.1,u=.05,h=function(){function e(e,t,i,r){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=e,this.media=t,this.fragmentTracker=i,this.hls=r}var t=e.prototype;return t.destroy=function(){this.hls=this.fragmentTracker=this.media=null},t.poll=function(e){var t=this.config,i=this.media,n=this.stalled,s=i.currentTime,c=i.seeking,u=this.seeking&&!c,h=!this.seeking&&c;if(this.seeking=c,s===e){if((h||u)&&(this.stalled=null),!i.paused&&!i.ended&&0!==i.playbackRate&&r.BufferHelper.getBuffered(i).length){var d=r.BufferHelper.bufferInfo(i,s,0),f=d.len>0,p=d.nextStart||0;if(f||p){if(c){var g=d.len>l,v=!p||p-s>l&&!this.fragmentTracker.getPartialFragment(s);if(g||v)return;this.moved=!1}if(!this.moved&&null!==this.stalled){var m,y=Math.max(p,d.start||0)-s,_=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,b=(null==_||null===(m=_.details)||void 0===m?void 0:m.live)?2*_.details.targetduration:l;if(y>0&&y<=b)return void this._trySkipBufferHole(null)}var S=self.performance.now();if(null!==n){var C=S-n;!c&&C>=a&&this._reportStall(d.len);var w=r.BufferHelper.bufferInfo(i,s,t.maxBufferHole);this._tryFixBufferStall(w,C)}else this.stalled=S}}}else if(this.moved=!0,null!==n){if(this.stallReported){var k=self.performance.now()-n;o.logger.warn("playback not stuck anymore @"+s+", after "+Math.round(k)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}},t._tryFixBufferStall=function(e,t){var i=this.config,r=this.fragmentTracker,n=this.media.currentTime,s=r.getPartialFragment(n);s&&this._trySkipBufferHole(s)||e.len>i.maxBufferHole&&t>1e3*i.highBufferWatchdogPeriod&&(o.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},t._reportStall=function(e){var t=this.hls,i=this.media;this.stallReported||(this.stallReported=!0,o.logger.warn("Playback stalling at @"+i.currentTime+" due to low buffer (buffer="+e+")"),t.trigger(s.Events.ERROR,{type:n.ErrorTypes.MEDIA_ERROR,details:n.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:e}))},t._trySkipBufferHole=function(e){for(var t=this.config,i=this.hls,a=this.media,l=a.currentTime,h=0,d=r.BufferHelper.getBuffered(a),f=0;f=h&&l.05&&this.forwardBufferLength>1){var c=Math.min(2,Math.max(1,s)),u=Math.round(2/(1+Math.exp(-.75*a-this.edgeStalled))*20)/20;e.playbackRate=Math.min(c,Math.max(1,u))}else 1!==e.playbackRate&&0!==e.playbackRate&&(e.playbackRate=1)}}}}},l.estimateLiveEdge=function(){var e=this.levelDetails;return null===e?null:e.edge+e.age},l.computeLatency=function(){var e=this.estimateLiveEdge();return null===e?null:e-this.currentTime},t=e,(i=[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var e=this.config,t=this.levelDetails;return void 0!==e.liveMaxLatencyDuration?e.liveMaxLatencyDuration:t?e.liveMaxLatencyDurationCount*t.targetduration:0}},{key:"targetLatency",get:function(){var e=this.levelDetails;if(null===e)return null;var t=e.holdBack,i=e.partHoldBack,r=e.targetduration,n=this.config,s=n.liveSyncDuration,o=n.liveSyncDurationCount,a=n.lowLatencyMode,l=this.hls.userConfig,c=a&&i||t;(l.liveSyncDuration||l.liveSyncDurationCount||0===c)&&(c=void 0!==s?s:o*r);var u=r;return c+Math.min(1*this.stallCount,u)}},{key:"liveSyncPosition",get:function(){var e=this.estimateLiveEdge(),t=this.targetLatency,i=this.levelDetails;if(null===e||null===t||null===i)return null;var r=i.edge,n=e-t-this.edgeStalled,s=r-i.totalduration,o=r-(this.config.lowLatencyMode&&i.partTarget||i.targetduration);return Math.min(Math.max(s,n),o)}},{key:"drift",get:function(){var e=this.levelDetails;return null===e?1:e.drift}},{key:"edgeStalled",get:function(){var e=this.levelDetails;if(null===e)return 0;var t=3*(this.config.lowLatencyMode&&e.partTarget||e.targetduration);return Math.max(e.age-t,0)}},{key:"forwardBufferLength",get:function(){var e=this.media,t=this.levelDetails;if(!e||!t)return 0;var i=e.buffered.length;return i?e.buffered.end(i-1):t.edge-this.currentTime}}])&&o(t.prototype,i),a&&o(t,a),e}()},"./src/controller/level-controller.ts": /*!********************************************!*\ !*** ./src/controller/level-controller.ts ***! \********************************************/ /*! exports provided: default */function(e,t,i){"use strict";i.r(t),i.d(t,"default",(function(){return p}));var r=i(/*! ../types/level */"./src/types/level.ts"),n=i(/*! ../events */"./src/events.ts"),s=i(/*! ../errors */"./src/errors.ts"),o=i(/*! ../utils/codecs */"./src/utils/codecs.ts"),a=i(/*! ./level-helper */"./src/controller/level-helper.ts"),l=i(/*! ./base-playlist-controller */"./src/controller/base-playlist-controller.ts"),c=i(/*! ../types/loader */"./src/types/loader.ts");function u(){return(u=Object.assign||function(e){for(var t=1;t0){i=c[0].bitrate,c.sort((function(e,t){return e.bitrate-t.bitrate})),this._levels=c;for(var m=0;mthis.hls.config.fragLoadingMaxRetry&&(o=i.frag.level)):o=i.frag.level}break;case s.ErrorDetails.LEVEL_LOAD_ERROR:case s.ErrorDetails.LEVEL_LOAD_TIMEOUT:r&&(r.deliveryDirectives&&(l=!1),o=r.level),a=!0;break;case s.ErrorDetails.REMUX_ALLOC_ERROR:o=i.level,a=!0}void 0!==o&&this.recoverLevel(i,o,a,l)}}},m.recoverLevel=function(e,t,i,r){var n=e.details,s=this._levels[t];if(s.loadError++,i){if(!this.retryLoadingOrFail(e))return void(this.currentLevelIndex=-1);e.levelRetry=!0}if(r){var o=s.url.length;if(o>1&&s.loadError1){var r=(t.urlId+1)%i;this.warn("Switching to redundant URL-id "+r),this._levels.forEach((function(e){e.urlId=r})),this.level=e}},m.onFragLoaded=function(e,t){var i=t.frag;if(void 0!==i&&i.type===c.PlaylistLevelType.MAIN){var r=this._levels[i.level];void 0!==r&&(r.fragmentError=0,r.loadError=0)}},m.onLevelLoaded=function(e,t){var i,r,n=t.level,s=t.details,o=this._levels[n];if(!o)return this.warn("Invalid level index "+n),void(null!==(r=t.deliveryDirectives)&&void 0!==r&&r.skip&&(s.deltaUpdateFailed=!0));n===this.currentLevelIndex?(0===o.fragmentError&&(o.loadError=0,this.retryCount=0),this.playlistLoaded(n,t,o.details)):null!==(i=t.deliveryDirectives)&&void 0!==i&&i.skip&&(s.deltaUpdateFailed=!0)},m.onAudioTrackSwitched=function(e,t){var i=this.hls.levels[this.currentLevelIndex];if(i&&i.audioGroupIds){for(var r=-1,n=this.hls.audioTracks[t.id].groupId,s=0;s0){var r=i.urlId,s=i.url[r];if(e)try{s=e.addDirectives(s)}catch(e){this.warn("Could not construct new URL with HLS Delivery Directives: "+e)}this.log("Attempt loading level index "+t+(e?" at sn "+e.msn+" part "+e.part:"")+" with URL-id "+r+" "+s),this.clearTimer(),this.hls.trigger(n.Events.LEVEL_LOADING,{url:s,level:t,id:r,deliveryDirectives:e||null})}},m.removeLevel=function(e,t){var i=function(e,i){return i!==t},r=this._levels.filter((function(r,n){return n!==e||r.url.length>1&&void 0!==t&&(r.url=r.url.filter(i),r.audioGroupIds&&(r.audioGroupIds=r.audioGroupIds.filter(i)),r.textGroupIds&&(r.textGroupIds=r.textGroupIds.filter(i)),r.urlId=0,!0)})).map((function(e,t){var i=e.details;return null!=i&&i.fragments&&i.fragments.forEach((function(e){e.level=t})),e}));this._levels=r,this.hls.trigger(n.Events.LEVELS_UPDATED,{levels:r})},p=l,(g=[{key:"levels",get:function(){return 0===this._levels.length?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(e){var t,i=this._levels;if(0!==i.length&&(this.currentLevelIndex!==e||null===(t=i[e])||void 0===t||!t.details)){if(e<0||e>=i.length){var r=e<0;if(this.hls.trigger(n.Events.ERROR,{type:s.ErrorTypes.OTHER_ERROR,details:s.ErrorDetails.LEVEL_SWITCH_ERROR,level:e,fatal:r,reason:"invalid level idx"}),r)return;e=Math.min(e,i.length-1)}this.clearTimer();var o=this.currentLevelIndex,a=i[o],l=i[e];this.log("switching to level "+e+" from "+o),this.currentLevelIndex=e;var c=u({},l,{level:e,maxBitrate:l.maxBitrate,uri:l.uri,urlId:l.urlId});delete c._urlId,this.hls.trigger(n.Events.LEVEL_SWITCHING,c);var h=l.details;if(!h||h.live){var d=this.switchParams(l.uri,null==a?void 0:a.details);this.loadPlaylist(d)}}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(e){this.manualLevelIndex=e,void 0===this._startLevel&&(this._startLevel=e),-1!==e&&(this.level=e)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(e){this._firstLevel=e}},{key:"startLevel",get:function(){if(void 0===this._startLevel){var e=this.hls.config.startLevel;return void 0!==e?e:this._firstLevel}return this._startLevel},set:function(e){this._startLevel=e}},{key:"nextLoadLevel",get:function(){return-1!==this.manualLevelIndex?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(e){this.level=e,-1===this.manualLevelIndex&&(this.hls.nextAutoLevel=e)}}])&&h(p.prototype,g),v&&h(p,v),l}(l.default)},"./src/controller/level-helper.ts": /*!****************************************!*\ !*** ./src/controller/level-helper.ts ***! \****************************************/ /*! exports provided: addGroupId, assignTrackIdsByGroup, updatePTS, updateFragPTSDTS, mergeDetails, mapPartIntersection, mapFragmentIntersection, adjustSliding, addSliding, computeReloadInterval, getFragmentWithSN, getPartWith */function(e,t,i){"use strict";i.r(t),i.d(t,"addGroupId",(function(){return s})),i.d(t,"assignTrackIdsByGroup",(function(){return o})),i.d(t,"updatePTS",(function(){return a})),i.d(t,"updateFragPTSDTS",(function(){return c})),i.d(t,"mergeDetails",(function(){return u})),i.d(t,"mapPartIntersection",(function(){return h})),i.d(t,"mapFragmentIntersection",(function(){return d})),i.d(t,"adjustSliding",(function(){return f})),i.d(t,"addSliding",(function(){return p})),i.d(t,"computeReloadInterval",(function(){return g})),i.d(t,"getFragmentWithSN",(function(){return v})),i.d(t,"getPartWith",(function(){return m}));var r=i(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),n=i(/*! ../utils/logger */"./src/utils/logger.ts");function s(e,t,i){switch(t){case"audio":e.audioGroupIds||(e.audioGroupIds=[]),e.audioGroupIds.push(i);break;case"text":e.textGroupIds||(e.textGroupIds=[]),e.textGroupIds.push(i)}}function o(e){var t={};e.forEach((function(e){var i=e.groupId||"";e.id=t[i]=t[i]||0,t[i]++}))}function a(e,t,i){l(e[t],e[i])}function l(e,t){var i=t.startPTS;if(Object(r.isFiniteNumber)(i)){var n,s=0;t.sn>e.sn?(s=i-e.start,n=e):(s=e.start-i,n=t),n.duration!==s&&(n.duration=s)}else t.sn>e.sn?e.cc===t.cc&&e.minEndPTS?t.start=e.start+(e.minEndPTS-e.start):t.start=e.start+e.duration:t.start=Math.max(e.start-t.duration,0)}function c(e,t,i,s,o,a){s-i<=0&&(n.logger.warn("Fragment should have a positive duration",t),s=i+t.duration,a=o+t.duration);var c=i,u=s,h=t.startPTS,d=t.endPTS;if(Object(r.isFiniteNumber)(h)){var f=Math.abs(h-i);Object(r.isFiniteNumber)(t.deltaPTS)?t.deltaPTS=Math.max(f,t.deltaPTS):t.deltaPTS=f,c=Math.max(i,h),i=Math.min(i,h),o=Math.min(o,t.startDTS),u=Math.min(s,d),s=Math.max(s,d),a=Math.max(a,t.endDTS)}t.duration=s-i;var p=i-t.start;t.appendedPTS=s,t.start=t.startPTS=i,t.maxStartPTS=c,t.startDTS=o,t.endPTS=s,t.minEndPTS=u,t.endDTS=a;var g,v=t.sn;if(!e||ve.endSN)return 0;var m=v-e.startSN,y=e.fragments;for(y[m]=t,g=m;g>0;g--)l(y[g],y[g-1]);for(g=m;g=0;o--){var a=s[o].initSegment;if(a){i=a;break}}e.fragmentHint&&delete e.fragmentHint.endPTS;var l,u=0;if(d(e,t,(function(e,n){e.relurl&&(u=e.cc-n.cc),Object(r.isFiniteNumber)(e.startPTS)&&Object(r.isFiniteNumber)(e.endPTS)&&(n.start=n.startPTS=e.startPTS,n.startDTS=e.startDTS,n.appendedPTS=e.appendedPTS,n.maxStartPTS=e.maxStartPTS,n.endPTS=e.endPTS,n.endDTS=e.endDTS,n.minEndPTS=e.minEndPTS,n.duration=e.endPTS-e.startPTS,n.duration&&(l=n),t.PTSKnown=t.alignedSliding=!0),n.elementaryStreams=e.elementaryStreams,n.loader=e.loader,n.stats=e.stats,n.urlId=e.urlId,e.initSegment&&(n.initSegment=e.initSegment,i=e.initSegment)})),i&&(t.fragmentHint?t.fragments.concat(t.fragmentHint):t.fragments).forEach((function(e){var t;e.initSegment&&e.initSegment.relurl!==(null===(t=i)||void 0===t?void 0:t.relurl)||(e.initSegment=i)})),t.skippedSegments&&(t.deltaUpdateFailed=t.fragments.some((function(e){return!e})),t.deltaUpdateFailed)){n.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var p=t.skippedSegments;p--;)t.fragments.shift();t.startSN=t.fragments[0].sn,t.startCC=t.fragments[0].cc}var g=t.fragments;if(u){n.logger.warn("discontinuity sliding from playlist, take drift into account");for(var v=0;v=r.length||p(t,r[i].start)}function p(e,t){if(t){for(var i=e.fragments,r=e.skippedSegments;r0&&s<3*r,a=t.loading.end-t.loading.start,l=e.availabilityDelay;if(!1===e.updated)if(o){var c=333*e.misses;i=Math.max(Math.min(n,2*a),c),e.availabilityDelay=(e.availabilityDelay||0)+i}else i=n;else o?(l=Math.min(l||r/2,s),e.availabilityDelay=l,i=l+r-s):i=r-a;return Math.round(i)}function v(e,t,i){if(!e||!e.details)return null;var r=e.details,n=r.fragments[t-r.startSN];return n||((n=r.fragmentHint)&&n.sn===t?n:t0&&-1===e&&(this.log("Override startPosition with lastCurrentTime @"+t.toFixed(3)),e=t),this.state=n.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}else this._forceStartLoad=!0,this.state=n.State.STOPPED},C.stopLoad=function(){this._forceStartLoad=!1,e.prototype.stopLoad.call(this)},C.doTick=function(){switch(this.state){case n.State.IDLE:this.doTickIdle();break;case n.State.WAITING_LEVEL:var e,t=this.levels,i=this.level,r=null==t||null===(e=t[i])||void 0===e?void 0:e.details;if(r&&(!r.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(r))break;this.state=n.State.IDLE;break}break;case n.State.FRAG_LOADING_WAITING_RETRY:var s,o=self.performance.now(),a=this.retryDate;(!a||o>=a||null!==(s=this.media)&&void 0!==s&&s.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=n.State.IDLE)}this.onTickEnd()},C.onTickEnd=function(){e.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},C.doTickIdle=function(){var e,t,i=this.hls,r=this.levelLastLoaded,s=this.levels,a=this.media,h=i.config,d=i.nextLoadLevel;if(null!==r&&(a||!this.startFragRequested&&h.startFragPrefetch)&&(!this.altAudio||!this.audioOnly)&&s&&s[d]){var f=s[d];this.level=i.nextLoadLevel=d;var p=f.details;if(!p||this.state===n.State.WAITING_LEVEL||p.live&&this.levelLastLoaded!==d)this.state=n.State.WAITING_LEVEL;else{var g=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:a,c.PlaylistLevelType.MAIN);if(null!==g&&!(g.len>=this.getMaxBufferLength(f.maxBitrate))){if(this._streamEnded(g,p)){var v={};return this.altAudio&&(v.type="video"),this.hls.trigger(o.Events.BUFFER_EOS,v),void(this.state=n.State.ENDED)}var m=g.end,y=this.getNextFragment(m,p);if(this.couldBacktrack&&!this.fragPrevious&&y&&"initSegment"!==y.sn){var _=y.sn-p.startSN;_>1&&(y=p.fragments[_-1],this.fragmentTracker.removeFragment(y))}if(y&&this.fragmentTracker.getState(y)===l.FragmentState.OK&&this.nextLoadPosition>m){var b=this.audioOnly&&!this.altAudio?u.ElementaryStreamTypes.AUDIO:u.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(a,b,c.PlaylistLevelType.MAIN),y=this.getNextFragment(this.nextLoadPosition,p)}y&&(!y.initSegment||y.initSegment.data||this.bitrateTest||(y=y.initSegment),"identity"!==(null===(e=y.decryptdata)||void 0===e?void 0:e.keyFormat)||null!==(t=y.decryptdata)&&void 0!==t&&t.key?this.loadFragment(y,p,m):this.loadKey(y,p))}}}},C.loadFragment=function(t,i,r){var n,s=this.fragmentTracker.getState(t);if(this.fragCurrent=t,s===l.FragmentState.BACKTRACKED){var o=this.fragmentTracker.getBacktrackData(t);if(o)return this._handleFragmentLoadProgress(o),void this._handleFragmentLoadComplete(o);s=l.FragmentState.NOT_LOADED}s===l.FragmentState.NOT_LOADED||s===l.FragmentState.PARTIAL?"initSegment"===t.sn?this._loadInitSegment(t):this.bitrateTest?(t.bitrateTest=!0,this.log("Fragment "+t.sn+" of level "+t.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(t)):(this.startFragRequested=!0,e.prototype.loadFragment.call(this,t,i,r)):s===l.FragmentState.APPENDING?this.reduceMaxBufferLength(t.duration)&&this.fragmentTracker.removeFragment(t):0===(null===(n=this.media)||void 0===n?void 0:n.buffered.length)&&this.fragmentTracker.removeAllFragments()},C.getAppendedFrag=function(e){var t=this.fragmentTracker.getAppendedFrag(e,c.PlaylistLevelType.MAIN);return t&&"fragment"in t?t.fragment:t},C.getBufferedFrag=function(e){return this.fragmentTracker.getBufferedFrag(e,c.PlaylistLevelType.MAIN)},C.followingBufferedFrag=function(e){return e?this.getBufferedFrag(e.end+.5):null},C.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},C.nextLevelSwitch=function(){var e=this.levels,t=this.media;if(null!=t&&t.readyState){var i,r=this.getAppendedFrag(t.currentTime);if(r&&r.start>1&&this.flushMainBuffer(0,r.start-1),!t.paused&&e){var n=e[this.hls.nextLoadLevel],s=this.fragLastKbps;i=s&&this.fragCurrent?this.fragCurrent.duration*n.maxBitrate/(1e3*s)+1:0}else i=0;var o=this.getBufferedFrag(t.currentTime+i);if(o){var a=this.followingBufferedFrag(o);if(a){this.abortCurrentFrag();var l=a.maxStartPTS?a.maxStartPTS:a.start,c=a.duration,u=Math.max(o.end,l+Math.min(Math.max(c-this.config.maxFragLookUpTolerance,.5*c),.75*c));this.flushMainBuffer(u,Number.POSITIVE_INFINITY)}}}},C.abortCurrentFrag=function(){var e=this.fragCurrent;this.fragCurrent=null,null!=e&&e.loader&&e.loader.abort(),this.state===n.State.KEY_LOADING&&(this.state=n.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},C.flushMainBuffer=function(t,i){e.prototype.flushMainBuffer.call(this,t,i,this.altAudio?"video":null)},C.onMediaAttached=function(t,i){e.prototype.onMediaAttached.call(this,t,i);var r=i.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),r.addEventListener("playing",this.onvplaying),r.addEventListener("seeked",this.onvseeked),this.gapController=new f.default(this.config,r,this.fragmentTracker,this.hls)},C.onMediaDetaching=function(){var t=this.media;t&&(t.removeEventListener("playing",this.onvplaying),t.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),e.prototype.onMediaDetaching.call(this)},C.onMediaPlaying=function(){this.tick()},C.onMediaSeeked=function(){var e=this.media,t=e?e.currentTime:null;Object(r.isFiniteNumber)(t)&&this.log("Media seeked to "+t.toFixed(3)),this.tick()},C.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(o.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},C.onManifestParsed=function(e,t){var i,r=!1,n=!1;t.levels.forEach((function(e){(i=e.audioCodec)&&(-1!==i.indexOf("mp4a.40.2")&&(r=!0),-1!==i.indexOf("mp4a.40.5")&&(n=!0))})),this.audioCodecSwitch=r&&n&&!Object(s.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=t.levels,this.startFragRequested=!1},C.onLevelLoading=function(e,t){var i=this.levels;if(i&&this.state===n.State.IDLE){var r=i[t.level];(!r.details||r.details.live&&this.levelLastLoaded!==t.level||this.waitForCdnTuneIn(r.details))&&(this.state=n.State.WAITING_LEVEL)}},C.onLevelLoaded=function(e,t){var i,r=this.levels,s=t.level,a=t.details,l=a.totalduration;if(r){this.log("Level "+s+" loaded ["+a.startSN+","+a.endSN+"], cc ["+a.startCC+", "+a.endCC+"] duration:"+l);var c=this.fragCurrent;!c||this.state!==n.State.FRAG_LOADING&&this.state!==n.State.FRAG_LOADING_WAITING_RETRY||c.level!==t.level&&c.loader&&(this.state=n.State.IDLE,c.loader.abort());var u=r[s],h=0;if(a.live||null!==(i=u.details)&&void 0!==i&&i.live){if(a.fragments[0]||(a.deltaUpdateFailed=!0),a.deltaUpdateFailed)return;h=this.alignPlaylists(a,u.details)}if(u.details=a,this.levelLastLoaded=s,this.hls.trigger(o.Events.LEVEL_UPDATED,{details:a,level:s}),this.state===n.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(a))return;this.state=n.State.IDLE}this.startFragRequested?a.live&&this.synchronizeToLiveEdge(a):this.setStartPosition(a,h),this.tick()}else this.warn("Levels were reset while loading level "+s)},C._handleFragmentLoadProgress=function(e){var t,i=e.frag,r=e.part,n=e.payload,s=this.levels;if(s){var o=s[i.level],a=o.details;if(a){var l=o.videoCodec,u=a.PTSKnown||!a.live,f=null===(t=i.initSegment)||void 0===t?void 0:t.data,p=this._getAudioCodec(o),g=this.transmuxer=this.transmuxer||new h.default(this.hls,c.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),v=r?r.index:-1,m=-1!==v,y=new d.ChunkMetadata(i.level,i.sn,i.stats.chunkCount,n.byteLength,v,m),_=this.initPTS[i.cc];g.push(n,f,p,l,i,r,a.totalduration,u,y,_)}else this.warn("Dropping fragment "+i.sn+" of level "+i.level+" after level details were reset")}else this.warn("Levels were reset while fragment load was in progress. Fragment "+i.sn+" of level "+i.level+" will not be buffered")},C.onAudioTrackSwitching=function(e,t){var i=this.altAudio,r=!!t.url,n=t.id;if(!r){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var s=this.fragCurrent;null!=s&&s.loader&&(this.log("Switching to main audio track, cancel main fragment load"),s.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var a=this.hls;i&&a.trigger(o.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),a.trigger(o.Events.AUDIO_TRACK_SWITCHED,{id:n})}},C.onAudioTrackSwitched=function(e,t){var i=t.id,r=!!this.hls.audioTracks[i].url;if(r){var n=this.videoBuffer;n&&this.mediaBuffer!==n&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=n)}this.altAudio=r,this.tick()},C.onBufferCreated=function(e,t){var i,r,n=t.tracks,s=!1;for(var o in n){var a=n[o];if("main"===a.id){if(r=o,i=a,"video"===o){var l=n[o];l&&(this.videoBuffer=l.buffer)}}else s=!0}s&&i?(this.log("Alternate track found, use "+r+".buffered to schedule main fragment loading"),this.mediaBuffer=i.buffer):this.mediaBuffer=this.media},C.onFragBuffered=function(e,t){var i=t.frag,r=t.part;if(!i||i.type===c.PlaylistLevelType.MAIN){if(this.fragContextChanged(i))return this.warn("Fragment "+i.sn+(r?" p: "+r.index:"")+" of level "+i.level+" finished buffering, but was aborted. state: "+this.state),void(this.state===n.State.PARSED&&(this.state=n.State.IDLE));var s=r?r.stats:i.stats;this.fragLastKbps=Math.round(8*s.total/(s.buffering.end-s.loading.first)),"initSegment"!==i.sn&&(this.fragPrevious=i),this.fragBufferedComplete(i,r)}},C.onError=function(e,t){switch(t.details){case p.ErrorDetails.FRAG_LOAD_ERROR:case p.ErrorDetails.FRAG_LOAD_TIMEOUT:case p.ErrorDetails.KEY_LOAD_ERROR:case p.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(c.PlaylistLevelType.MAIN,t);break;case p.ErrorDetails.LEVEL_LOAD_ERROR:case p.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==n.State.ERROR&&(t.fatal?(this.warn(""+t.details),this.state=n.State.ERROR):t.levelRetry||this.state!==n.State.WAITING_LEVEL||(this.state=n.State.IDLE));break;case p.ErrorDetails.BUFFER_FULL_ERROR:if("main"===t.parent&&(this.state===n.State.PARSING||this.state===n.State.PARSED)){var i=!0,r=this.getFwdBufferInfo(this.media,c.PlaylistLevelType.MAIN);r&&r.len>.5&&(i=!this.reduceMaxBufferLength(r.len)),i&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}}},C.checkBuffer=function(){var e=this.media,t=this.gapController;if(e&&t&&e.readyState){var i=a.BufferHelper.getBuffered(e);!this.loadedmetadata&&i.length?(this.loadedmetadata=!0,this.seekToStartPos()):t.poll(this.lastCurrentTime),this.lastCurrentTime=e.currentTime}},C.onFragLoadEmergencyAborted=function(){this.state=n.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},C.onBufferFlushed=function(e,t){var i=t.type;if(i!==u.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var r=(i===u.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(r,i,c.PlaylistLevelType.MAIN)}},C.onLevelsUpdated=function(e,t){this.levels=t.levels},C.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},C.seekToStartPos=function(){var e=this.media,t=e.currentTime,i=this.startPosition;if(i>=0&&t0&&(n1&&!1===e.seeking){var i=e.currentTime;if(a.BufferHelper.isBuffered(e,i)?t=this.getAppendedFrag(i):a.BufferHelper.isBuffered(e,i+.1)&&(t=this.getAppendedFrag(i+.1)),t){var r=this.fragPlaying,n=t.level;r&&t.sn===r.sn&&r.level===n&&t.urlId===r.urlId||(this.hls.trigger(o.Events.FRAG_CHANGED,{frag:t}),r&&r.level===n||this.hls.trigger(o.Events.LEVEL_SWITCHED,{level:n}),this.fragPlaying=t)}}},_=y,(b=[{key:"nextLevel",get:function(){var e=this.nextBufferedFrag;return e?e.level:-1}},{key:"currentLevel",get:function(){var e=this.media;if(e){var t=this.getAppendedFrag(e.currentTime);if(t)return t.level}return-1}},{key:"nextBufferedFrag",get:function(){var e=this.media;if(e){var t=this.getAppendedFrag(e.currentTime);return this.followingBufferedFrag(t)}return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}])&&v(_.prototype,b),S&&v(_,S),y}(n.default)},"./src/controller/subtitle-stream-controller.ts": /*!******************************************************!*\ !*** ./src/controller/subtitle-stream-controller.ts ***! \******************************************************/ /*! exports provided: SubtitleStreamController */function(e,t,i){"use strict";i.r(t),i.d(t,"SubtitleStreamController",(function(){return g}));var r=i(/*! ../events */"./src/events.ts"),n=i(/*! ../utils/logger */"./src/utils/logger.ts"),s=i(/*! ../utils/buffer-helper */"./src/utils/buffer-helper.ts"),o=i(/*! ./fragment-finders */"./src/controller/fragment-finders.ts"),a=i(/*! ../utils/discontinuities */"./src/utils/discontinuities.ts"),l=i(/*! ./level-helper */"./src/controller/level-helper.ts"),c=i(/*! ./fragment-tracker */"./src/controller/fragment-tracker.ts"),u=i(/*! ./base-stream-controller */"./src/controller/base-stream-controller.ts"),h=i(/*! ../types/loader */"./src/types/loader.ts"),d=i(/*! ../types/level */"./src/types/level.ts");function f(e,t){for(var i=0;i=n[a].start&&o<=n[a].end){s=n[a];break}var l=i.start+i.duration;s?s.end=l:(s={start:o,end:l},n.push(s)),this.fragmentTracker.fragBuffered(i)}}},_.onBufferFlushing=function(e,t){var i=t.startOffset,r=t.endOffset;if(0===i&&r!==Number.POSITIVE_INFINITY){var n=this.currentTrackId,s=this.levels;if(!s.length||!s[n]||!s[n].details)return;var o=r-s[n].details.targetduration;if(o<=0)return;t.endOffsetSubtitles=Math.max(0,o),this.tracksBuffered.forEach((function(e){for(var t=0;t=c.length||n!==s)&&h){if(this.mediaBuffer=this.mediaBufferTimeRanges,r.live||null!==(i=h.details)&&void 0!==i&&i.live){var d=this.mainDetails;if(r.deltaUpdateFailed||!d)return;var f=d.fragments[0];h.details?0===this.alignPlaylists(r,h.details)&&f&&Object(l.addSliding)(r,f.start):r.hasProgramDateTime&&d.hasProgramDateTime?Object(a.alignMediaPlaylistByPDT)(r,d):f&&Object(l.addSliding)(r,f.start)}h.details=r,this.levelLastLoaded=n,this.tick(),r.live&&!this.fragCurrent&&this.media&&this.state===u.State.IDLE&&(Object(o.findFragmentByPTS)(null,r.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),h.details=void 0))}}},_._handleFragmentLoadComplete=function(e){var t=e.frag,i=e.payload,n=t.decryptdata,s=this.hls;if(!this.fragContextChanged(t)&&i&&i.byteLength>0&&n&&n.key&&n.iv&&"AES-128"===n.method){var o=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(i),n.key.buffer,n.iv.buffer).then((function(e){var i=performance.now();s.trigger(r.Events.FRAG_DECRYPTED,{frag:t,payload:e,stats:{tstart:o,tdecrypt:i}})}))}},_.doTick=function(){if(this.media){if(this.state===u.State.IDLE){var e,t=this.currentTrackId,i=this.levels;if(!i.length||!i[t]||!i[t].details)return;var a=i[t].details,l=a.targetduration,h=this.config,d=this.media,f=s.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,d.currentTime-l,h.maxBufferHole),p=f.end;if(f.len>this.getMaxBufferLength()+l)return;console.assert(a,"Subtitle track details are defined on idle subtitle stream controller tick");var g,v=a.fragments,m=v.length,y=a.edge,_=this.fragPrevious;if(p-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))},f.pollTrackChange=function(e){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,e)},f.onMediaDetaching=function(){this.media&&(self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId),u(this.media.textTracks).forEach((function(e){Object(n.clearCurrentCues)(e)})),this.subtitleTrack=-1,this.media=null)},f.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},f.onManifestParsed=function(e,t){this.tracks=t.subtitleTracks},f.onSubtitleTrackLoaded=function(e,t){var i=t.id,r=t.details,n=this.trackId,s=this.tracksInGroup[n];if(s){var o=s.details;s.details=t.details,this.log("subtitle track "+i+" loaded ["+r.startSN+"-"+r.endSN+"]"),i===this.trackId&&(this.retryCount=0,this.playlistLoaded(i,t,o))}else this.warn("Invalid subtitle track id "+i)},f.onLevelLoading=function(e,t){this.switchLevel(t.level)},f.onLevelSwitching=function(e,t){this.switchLevel(t.level)},f.switchLevel=function(e){var t=this.hls.levels[e];if(null!=t&&t.textGroupIds){var i=t.textGroupIds[t.urlId];if(this.groupId!==i){var n=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,s=this.tracks.filter((function(e){return!i||e.groupId===i}));this.tracksInGroup=s;var o=this.findTrackId(null==n?void 0:n.name)||this.findTrackId();this.groupId=i;var a={subtitleTracks:s};this.log("Updating subtitle tracks, "+s.length+' track(s) found in "'+i+'" group-id'),this.hls.trigger(r.Events.SUBTITLE_TRACKS_UPDATED,a),-1!==o&&this.setSubtitleTrack(o,n)}}},f.findTrackId=function(e){for(var t=this.tracksInGroup,i=0;i=n.length)){this.clearTimer();var s=n[e];if(this.log("Switching to subtitle track "+e),this.trackId=e,s){var o=s.id,a=s.groupId,l=void 0===a?"":a,c=s.name,u=s.type,h=s.url;this.hls.trigger(r.Events.SUBTITLE_TRACK_SWITCH,{id:o,groupId:l,name:c,type:u,url:h});var d=this.switchParams(s.url,null==t?void 0:t.details);this.loadPlaylist(d)}else this.hls.trigger(r.Events.SUBTITLE_TRACK_SWITCH,{id:e})}}else this.queuedDefaultTrack=e},f.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),this.media&&this.hls.config.renderTextTracksNatively){for(var e=-1,t=u(this.media.textTracks),i=0;i=0&&(d[0]=Math.min(d[0],t),d[1]=Math.max(d[1],i),u=!0,f/(i-t)>.5))return}if(u||s.push([t,i]),this.config.renderTextTracksNatively){var p=this.captionsTracks[e];this.Cues.newCue(p,t,i,r)}else{var g=this.Cues.newCue(null,t,i,r);this.hls.trigger(n.Events.CUES_PARSED,{type:"captions",cues:g,track:e})}},t.onInitPtsFound=function(e,t){var i=this,r=t.frag,s=t.id,o=t.initPTS,a=t.timescale,l=this.unparsedVttFrags;"main"===s&&(this.initPTS[r.cc]=o,this.timescale[r.cc]=a),l.length&&(this.unparsedVttFrags=[],l.forEach((function(e){i.onFragLoaded(n.Events.FRAG_LOADED,e)})))},t.getExistingTrack=function(e){var t=this.media;if(t)for(var i=0;i>>8^255&v^99,e[f]=v,t[v]=f;var m=d[f],y=d[m],_=d[y],b=257*d[v]^16843008*v;r[f]=b<<24|b>>>8,n[f]=b<<16|b>>>16,s[f]=b<<8|b>>>24,o[f]=b,b=16843009*_^65537*y^257*m^16843008*f,l[v]=b<<24|b>>>8,c[v]=b<<16|b>>>16,u[v]=b<<8|b>>>24,h[v]=b,f?(f=m^d[d[d[_^m]]],p^=d[d[p]]):f=p=1}},t.expandKey=function(e){for(var t=this.uint8ArrayToUint32Array_(e),i=!0,r=0;r>>6);var p=(60&t[i+2])>>>2;if(!(p>f.length-1))return c=(1&t[i+2])<<2,c|=(192&t[i+3])>>>6,r.logger.log("manifest codec:"+o+", ADTS type:"+a+", samplingIndex:"+p),/firefox/i.test(h)?p>=6?(a=5,u=new Array(4),l=p-3):(a=2,u=new Array(2),l=p):-1!==h.indexOf("android")?(a=2,u=new Array(2),l=p):(a=5,u=new Array(4),o&&(-1!==o.indexOf("mp4a.40.29")||-1!==o.indexOf("mp4a.40.5"))||!o&&p>=6?l=p-3:((o&&-1!==o.indexOf("mp4a.40.2")&&(p>=6&&1===c||/vivaldi/i.test(h))||!o&&1===c)&&(a=2,u=new Array(2)),l=p)),u[0]=a<<3,u[0]|=(14&p)>>1,u[1]|=(1&p)<<7,u[1]|=c<<3,5===a&&(u[1]|=(14&l)>>1,u[2]=(1&l)<<7,u[2]|=8,u[3]=0),{config:u,samplerate:f[p],channelCount:c,codec:"mp4a.40."+a,manifestCodec:d};e.trigger(s.Events.ERROR,{type:n.ErrorTypes.MEDIA_ERROR,details:n.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+p})}function a(e,t){return 255===e[t]&&240==(246&e[t+1])}function l(e,t){return 1&e[t+1]?7:9}function c(e,t){return(3&e[t+3])<<11|e[t+4]<<3|(224&e[t+5])>>>5}function u(e,t){return t+5=e.length)return!1;var r=c(e,t);if(r<=i)return!1;var n=t+r;return n===e.length||h(e,n)}return!1}function p(e,t,i,n,s){if(!e.samplerate){var a=o(t,i,n,s);if(!a)return;e.config=a.config,e.samplerate=a.samplerate,e.channelCount=a.channelCount,e.codec=a.codec,e.manifestCodec=a.manifestCodec,r.logger.log("parsed codec:"+e.codec+", rate:"+a.samplerate+", channels:"+a.channelCount)}}function g(e){return 9216e4/e}function v(e,t,i,r,n){var s=l(e,t),o=c(e,t);if((o-=s)>0)return{headerLength:s,frameLength:o,stamp:i+r*n}}function m(e,t,i,r,n){var s=v(t,i,r,n,g(e.samplerate));if(s){var o,a=s.frameLength,l=s.headerLength,c=s.stamp,u=l+a,h=Math.max(0,i+u-t.length);h?(o=new Uint8Array(u-l)).set(t.subarray(i+l,t.length),0):o=t.subarray(i+l,i+u);var d={unit:o,pts:c};return h||e.samples.push(d),{sample:d,length:u,missing:h}}}},"./src/demux/base-audio-demuxer.ts": /*!*****************************************!*\ !*** ./src/demux/base-audio-demuxer.ts ***! \*****************************************/ /*! exports provided: initPTSFn, default */function(e,t,i){"use strict";i.r(t),i.d(t,"initPTSFn",(function(){return c}));var r=i(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),n=i(/*! ../demux/id3 */"./src/demux/id3.ts"),s=i(/*! ./dummy-demuxed-track */"./src/demux/dummy-demuxed-track.ts"),o=i(/*! ../utils/mp4-tools */"./src/utils/mp4-tools.ts"),a=i(/*! ../utils/typed-array */"./src/utils/typed-array.ts"),l=function(){function e(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var t=e.prototype;return t.resetInitSegment=function(e,t,i){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},t.resetTimeStamp=function(){},t.resetContiguity=function(){},t.canParse=function(e,t){return!1},t.appendFrame=function(e,t,i){},t.demux=function(e,t){this.cachedData&&(e=Object(o.appendUint8Array)(this.cachedData,e),this.cachedData=null);var i,r,l=n.getID3Data(e,0),u=l?l.length:0,h=this._audioTrack,d=this._id3Track,f=l?n.getTimeStamp(l):void 0,p=e.length;for(0!==this.frameIndex&&null!==this.initPTS||(this.initPTS=c(f,t)),l&&l.length>0&&d.samples.push({pts:this.initPTS,dts:this.initPTS,data:l}),r=this.initPTS;ue?(this.word<<=e,this.bitsAvailable-=e):(e-=this.bitsAvailable,e-=(t=e>>3)>>3,this.bytesAvailable-=t,this.loadWord(),this.word<<=e,this.bitsAvailable-=e)},t.readBits=function(e){var t=Math.min(this.bitsAvailable,e),i=this.word>>>32-t;return e>32&&r.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=t,this.bitsAvailable>0?this.word<<=t:this.bytesAvailable>0&&this.loadWord(),(t=e-t)>0&&this.bitsAvailable?i<>>e))return this.word<<=e,this.bitsAvailable-=e,e;return this.loadWord(),e+this.skipLZ()},t.skipUEG=function(){this.skipBits(1+this.skipLZ())},t.skipEG=function(){this.skipBits(1+this.skipLZ())},t.readUEG=function(){var e=this.skipLZ();return this.readBits(e+1)-1},t.readEG=function(){var e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)},t.readBoolean=function(){return 1===this.readBits(1)},t.readUByte=function(){return this.readBits(8)},t.readUShort=function(){return this.readBits(16)},t.readUInt=function(){return this.readBits(32)},t.skipScalingList=function(e){for(var t=8,i=8,r=0;r0)return e.subarray(i,i+r)},a=function(e,t){var i=0;return i=(127&e[t])<<21,i|=(127&e[t+1])<<14,i|=(127&e[t+2])<<7,i|=127&e[t+3]},l=function(e,t){return n(e,t)&&a(e,t+6)+10<=e.length-t},c=function(e){for(var t=d(e),i=0;i>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:c+=String.fromCharCode(s);break;case 12:case 13:o=e[u++],c+=String.fromCharCode((31&s)<<6|63&o);break;case 14:o=e[u++],a=e[u++],c+=String.fromCharCode((15&s)<<12|(63&o)<<6|(63&a)<<0)}}return c},_={decodeTextFrame:g};function b(){return r||void 0===self.TextDecoder||(r=new self.TextDecoder("utf-8")),r}},"./src/demux/mp3demuxer.ts": /*!*********************************!*\ !*** ./src/demux/mp3demuxer.ts ***! \*********************************/ /*! exports provided: default */function(e,t,i){"use strict";i.r(t);var r=i(/*! ./base-audio-demuxer */"./src/demux/base-audio-demuxer.ts"),n=i(/*! ../demux/id3 */"./src/demux/id3.ts"),s=i(/*! ../utils/logger */"./src/utils/logger.ts"),o=i(/*! ./mpegaudio */"./src/demux/mpegaudio.ts");function a(e,t){return(a=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var l=function(e){var t,i;function r(){return e.apply(this,arguments)||this}i=e,(t=r).prototype=Object.create(i.prototype),t.prototype.constructor=t,a(t,i);var l=r.prototype;return l.resetInitSegment=function(t,i,r){e.prototype.resetInitSegment.call(this,t,i,r),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:t,duration:r,inputTimeScale:9e4,dropped:0}},r.probe=function(e){if(!e)return!1;for(var t=(n.getID3Data(e,0)||[]).length,i=e.length;t0},t.demux=function(e){var t=e,i=Object(n.dummyTrack)();if(this.config.progressive){this.remainderData&&(t=Object(r.appendUint8Array)(this.remainderData,e));var s=Object(r.segmentValidRange)(t);this.remainderData=s.remainder,i.samples=s.valid||new Uint8Array}else i.samples=t;return{audioTrack:Object(n.dummyTrack)(),avcTrack:i,id3Track:Object(n.dummyTrack)(),textTrack:Object(n.dummyTrack)()}},t.flush=function(){var e=Object(n.dummyTrack)();return e.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(n.dummyTrack)(),avcTrack:e,id3Track:Object(n.dummyTrack)(),textTrack:Object(n.dummyTrack)()}},t.demuxSampleAes=function(e,t,i){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},t.destroy=function(){},e}();s.minProbeByteLength=1024,t.default=s},"./src/demux/mpegaudio.ts": /*!********************************!*\ !*** ./src/demux/mpegaudio.ts ***! \********************************/ /*! exports provided: appendFrame, parseHeader, isHeaderPattern, isHeader, canParse, probe */function(e,t,i){"use strict";i.r(t),i.d(t,"appendFrame",(function(){return l})),i.d(t,"parseHeader",(function(){return c})),i.d(t,"isHeaderPattern",(function(){return u})),i.d(t,"isHeader",(function(){return h})),i.d(t,"canParse",(function(){return d})),i.d(t,"probe",(function(){return f}));var r=null,n=[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],s=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],o=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],a=[0,1,1,4];function l(e,t,i,r,n){if(!(i+24>t.length)){var s=c(t,i);if(s&&i+s.frameLength<=t.length){var o=r+n*(9e4*s.samplesPerFrame/s.sampleRate),a={unit:t.subarray(i,i+s.frameLength),pts:o,dts:o};return e.config=[],e.channelCount=s.channelCount,e.samplerate=s.sampleRate,e.samples.push(a),{sample:a,length:s.frameLength,missing:0}}}}function c(e,t){var i=e[t+1]>>3&3,l=e[t+1]>>1&3,c=e[t+2]>>4&15,u=e[t+2]>>2&3;if(1!==i&&0!==c&&15!==c&&3!==u){var h=e[t+2]>>1&1,d=e[t+3]>>6,f=1e3*n[14*(3===i?3-l:3===l?3:4)+c-1],p=s[3*(3===i?0:2===i?1:2)+u],g=3===d?1:2,v=o[i][l],m=a[l],y=8*v*m,_=Math.floor(v*f/p+h)*m;if(null===r){var b=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);r=b?parseInt(b[1]):0}return!!r&&r<=87&&2===l&&f>=224e3&&0===d&&(e[t+3]=128|e[t+3]),{sampleRate:p,channelCount:g,frameLength:_,samplesPerFrame:y}}}function u(e,t){return 255===e[t]&&224==(224&e[t+1])&&0!=(6&e[t+1])}function h(e,t){return t+1=e.length)return void i();if(!(e[t].unit.length<32)){var r=this.decrypter.isSync();if(this.decryptAacSample(e,t,i,r),!r)return}}},t.getAvcEncryptedData=function(e){for(var t=16*Math.floor((e.length-48)/160)+16,i=new Int8Array(t),r=0,n=32;n<=e.length-16;n+=160,r+=16)i.set(e.subarray(n,n+16),r);return i},t.getAvcDecryptedUnit=function(e,t){for(var i=new Uint8Array(t),r=0,n=32;n<=e.length-16;n+=160,r+=16)e.set(i.subarray(r,r+16),n);return e},t.decryptAvcSample=function(e,t,i,r,s,o){var a=Object(n.discardEPB)(s.data),l=this.getAvcEncryptedData(a),c=this;this.decryptBuffer(l.buffer,(function(n){s.data=c.getAvcDecryptedUnit(a,n),o||c.decryptAvcSamples(e,t,i+1,r)}))},t.decryptAvcSamples=function(e,t,i,r){if(e instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;t++,i=0){if(t>=e.length)return void r();for(var n=e[t].units;!(i>=n.length);i++){var s=n[i];if(!(s.data.length<=48||1!==s.type&&5!==s.type)){var o=this.decrypter.isSync();if(this.decryptAvcSample(e,t,i,r,s,o),!o)return}}}},e}();t.default=s},"./src/demux/transmuxer-interface.ts": /*!*******************************************!*\ !*** ./src/demux/transmuxer-interface.ts ***! \*******************************************/ /*! exports provided: default */function(e,t,i){"use strict";i.r(t),i.d(t,"default",(function(){return h}));var r=i(/*! webworkify-webpack */"./node_modules/webworkify-webpack/index.js"),n=i(/*! ../events */"./src/events.ts"),s=i(/*! ../demux/transmuxer */"./src/demux/transmuxer.ts"),o=i(/*! ../utils/logger */"./src/utils/logger.ts"),a=i(/*! ../errors */"./src/errors.ts"),l=i(/*! ../utils/mediasource-helper */"./src/utils/mediasource-helper.ts"),c=i(/*! eventemitter3 */"./node_modules/eventemitter3/index.js"),u=Object(l.getMediaSource)()||{isTypeSupported:function(){return!1}},h=function(){function e(e,t,i,l){var h=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=e,this.id=t,this.onTransmuxComplete=i,this.onFlush=l;var d=e.config,f=function(t,i){(i=i||{}).frag=h.frag,i.id=h.id,e.trigger(t,i)};this.observer=new c.EventEmitter,this.observer.on(n.Events.FRAG_DECRYPTED,f),this.observer.on(n.Events.ERROR,f);var p={mp4:u.isTypeSupported("video/mp4"),mpeg:u.isTypeSupported("audio/mpeg"),mp3:u.isTypeSupported('audio/mp4; codecs="mp3"')},g=navigator.vendor;if(d.enableWorker&&"undefined"!=typeof Worker){var v;o.logger.log("demuxing in webworker");try{v=this.worker=r(/*! ../demux/transmuxer-worker.ts */"./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),v.addEventListener("message",this.onwmsg),v.onerror=function(t){e.trigger(n.Events.ERROR,{type:a.ErrorTypes.OTHER_ERROR,details:a.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(t.message+" ("+t.filename+":"+t.lineno+")")})},v.postMessage({cmd:"init",typeSupported:p,vendor:g,id:t,config:JSON.stringify(d)})}catch(e){o.logger.warn("Error in worker:",e),o.logger.error("Error while initializing DemuxerWorker, fallback to inline"),v&&self.URL.revokeObjectURL(v.objectURL),this.transmuxer=new s.default(this.observer,p,d,g,t),this.worker=null}}else this.transmuxer=new s.default(this.observer,p,d,g,t)}var t=e.prototype;return t.destroy=function(){var e=this.worker;if(e)e.removeEventListener("message",this.onwmsg),e.terminate(),this.worker=null;else{var t=this.transmuxer;t&&(t.destroy(),this.transmuxer=null)}var i=this.observer;i&&i.removeAllListeners(),this.observer=null},t.push=function(e,t,i,r,n,a,l,c,u,h){var d=this;u.transmuxing.start=self.performance.now();var f=this.transmuxer,p=this.worker,g=a?a.start:n.start,v=n.decryptdata,m=this.frag,y=!(m&&n.cc===m.cc),_=!(m&&u.level===m.level),b=m?u.sn-m.sn:-1,S=this.part?u.part-this.part.index:1,C=!_&&(1===b||0===b&&1===S),w=self.performance.now();(_||b||0===n.stats.parsing.start)&&(n.stats.parsing.start=w),!a||!S&&C||(a.stats.parsing.start=w);var k=new s.TransmuxState(y,C,c,_,g);if(!C||y){o.logger.log("[transmuxer-interface, "+n.type+"]: Starting new transmux session for sn: "+u.sn+" p: "+u.part+" level: "+u.level+" id: "+u.id+"\n discontinuity: "+y+"\n trackSwitch: "+_+"\n contiguous: "+C+"\n accurateTimeOffset: "+c+"\n timeOffset: "+g);var x=new s.TransmuxConfig(i,r,t,l,h);this.configureTransmuxer(x)}if(this.frag=n,this.part=a,p)p.postMessage({cmd:"demux",data:e,decryptdata:v,chunkMeta:u,state:k},e instanceof ArrayBuffer?[e]:[]);else if(f){var E=f.push(e,v,u,k);Object(s.isPromise)(E)?E.then((function(e){d.handleTransmuxComplete(e)})):this.handleTransmuxComplete(E)}},t.flush=function(e){var t=this;e.transmuxing.start=self.performance.now();var i=this.transmuxer,r=this.worker;if(r)r.postMessage({cmd:"flush",chunkMeta:e});else if(i){var n=i.flush(e);Object(s.isPromise)(n)?n.then((function(i){t.handleFlushResult(i,e)})):this.handleFlushResult(n,e)}},t.handleFlushResult=function(e,t){var i=this;e.forEach((function(e){i.handleTransmuxComplete(e)})),this.onFlush(t)},t.onWorkerMessage=function(e){var t=e.data,i=this.hls;switch(t.event){case"init":self.URL.revokeObjectURL(this.worker.objectURL);break;case"transmuxComplete":this.handleTransmuxComplete(t.data);break;case"flush":this.onFlush(t.data);break;default:t.data=t.data||{},t.data.frag=this.frag,t.data.id=this.id,i.trigger(t.event,t.data)}},t.configureTransmuxer=function(e){var t=this.worker,i=this.transmuxer;t?t.postMessage({cmd:"configure",config:e}):i&&i.configure(e)},t.handleTransmuxComplete=function(e){e.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(e)},e}()},"./src/demux/transmuxer-worker.ts": /*!****************************************!*\ !*** ./src/demux/transmuxer-worker.ts ***! \****************************************/ /*! exports provided: default */function(e,t,i){"use strict";i.r(t),i.d(t,"default",(function(){return a}));var r=i(/*! ../demux/transmuxer */"./src/demux/transmuxer.ts"),n=i(/*! ../events */"./src/events.ts"),s=i(/*! ../utils/logger */"./src/utils/logger.ts"),o=i(/*! eventemitter3 */"./node_modules/eventemitter3/index.js");function a(e){var t=new o.EventEmitter,i=function(t,i){e.postMessage({event:t,data:i})};t.on(n.Events.FRAG_DECRYPTED,i),t.on(n.Events.ERROR,i),e.addEventListener("message",(function(n){var o=n.data;switch(o.cmd){case"init":var a=JSON.parse(o.config);e.transmuxer=new r.default(t,o.typeSupported,a,o.vendor,o.id),Object(s.enableLogs)(a.debug),i("init",null);break;case"configure":e.transmuxer.configure(o.config);break;case"demux":var c=e.transmuxer.push(o.data,o.decryptdata,o.chunkMeta,o.state);Object(r.isPromise)(c)?c.then((function(t){l(e,t)})):l(e,c);break;case"flush":var h=o.chunkMeta,d=e.transmuxer.flush(h);Object(r.isPromise)(d)?d.then((function(t){u(e,t,h)})):u(e,d,h)}}))}function l(e,t){if((i=t.remuxResult).audio||i.video||i.text||i.id3||i.initSegment){var i,r=[],n=t.remuxResult,s=n.audio,o=n.video;s&&c(r,s),o&&c(r,o),e.postMessage({event:"transmuxComplete",data:t},r)}}function c(e,t){t.data1&&e.push(t.data1.buffer),t.data2&&e.push(t.data2.buffer)}function u(e,t,i){t.forEach((function(t){l(e,t)})),e.postMessage({event:"flush",data:i})}},"./src/demux/transmuxer.ts": /*!*********************************!*\ !*** ./src/demux/transmuxer.ts ***! \*********************************/ /*! exports provided: default, isPromise, TransmuxConfig, TransmuxState */function(e,t,i){"use strict";i.r(t),i.d(t,"default",(function(){return y})),i.d(t,"isPromise",(function(){return b})),i.d(t,"TransmuxConfig",(function(){return S})),i.d(t,"TransmuxState",(function(){return C}));var r,n=i(/*! ../events */"./src/events.ts"),s=i(/*! ../errors */"./src/errors.ts"),o=i(/*! ../crypt/decrypter */"./src/crypt/decrypter.ts"),a=i(/*! ../demux/aacdemuxer */"./src/demux/aacdemuxer.ts"),l=i(/*! ../demux/mp4demuxer */"./src/demux/mp4demuxer.ts"),c=i(/*! ../demux/tsdemuxer */"./src/demux/tsdemuxer.ts"),u=i(/*! ../demux/mp3demuxer */"./src/demux/mp3demuxer.ts"),h=i(/*! ../remux/mp4-remuxer */"./src/remux/mp4-remuxer.ts"),d=i(/*! ../remux/passthrough-remuxer */"./src/remux/passthrough-remuxer.ts"),f=i(/*! ./chunk-cache */"./src/demux/chunk-cache.ts"),p=i(/*! ../utils/mp4-tools */"./src/utils/mp4-tools.ts"),g=i(/*! ../utils/logger */"./src/utils/logger.ts");try{r=self.performance.now.bind(self.performance)}catch(e){g.logger.debug("Unable to use Performance API on this environment"),r=self.Date.now}var v=[{demux:c.default,remux:h.default},{demux:l.default,remux:d.default},{demux:a.default,remux:h.default},{demux:u.default,remux:h.default}],m=1024;v.forEach((function(e){var t=e.demux;m=Math.max(m,t.minProbeByteLength)}));var y=function(){function e(e,t,i,r,n){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 f.default,this.observer=e,this.typeSupported=t,this.config=i,this.vendor=r,this.id=n}var t=e.prototype;return t.configure=function(e){this.transmuxConfig=e,this.decrypter&&this.decrypter.reset()},t.push=function(e,t,i,n){var s=this,o=i.transmuxing;o.executeStart=r();var a=new Uint8Array(e),l=this.cache,c=this.config,u=this.currentTransmuxState,h=this.transmuxConfig;n&&(this.currentTransmuxState=n);var d=function(e,t){var i=null;return e.byteLength>0&&null!=t&&null!=t.key&&null!==t.iv&&null!=t.method&&(i=t),i}(a,t);if(d&&"AES-128"===d.method){var f=this.getDecrypter();if(!c.enableSoftwareAES)return this.decryptionPromise=f.webCryptoDecrypt(a,d.key.buffer,d.iv.buffer).then((function(e){var t=s.push(e,null,i);return s.decryptionPromise=null,t})),this.decryptionPromise;var g=f.softwareDecrypt(a,d.key.buffer,d.iv.buffer);if(!g)return o.executeEnd=r(),_(i);a=new Uint8Array(g)}var v=n||u,m=v.contiguous,y=v.discontinuity,b=v.trackSwitch,S=v.accurateTimeOffset,C=v.timeOffset,w=h.audioCodec,k=h.videoCodec,x=h.defaultInitPts,E=h.duration,T=h.initSegmentData;if((y||b)&&this.resetInitSegment(T,w,k,E),y&&this.resetInitialTimestamp(x),m||this.resetContiguity(),this.needsProbing(a,y,b)){if(l.dataLength){var L=l.flush();a=Object(p.appendUint8Array)(L,a)}this.configureTransmuxer(a,h)}var A=this.transmux(a,d,C,S,i),R=this.currentTransmuxState;return R.contiguous=!0,R.discontinuity=!1,R.trackSwitch=!1,o.executeEnd=r(),A},t.flush=function(e){var t=this,i=e.transmuxing;i.executeStart=r();var o=this.decrypter,a=this.cache,l=this.currentTransmuxState,c=this.decryptionPromise;if(c)return c.then((function(){return t.flush(e)}));var u=[],h=l.timeOffset;if(o){var d=o.flush();d&&u.push(this.push(d,null,e))}var f=a.dataLength;a.reset();var p=this.demuxer,g=this.remuxer;if(!p||!g)return f>=m&&this.observer.emit(n.Events.ERROR,n.Events.ERROR,{type:s.ErrorTypes.MEDIA_ERROR,details:s.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),i.executeEnd=r(),[_(e)];var v=p.flush(h);return b(v)?v.then((function(i){return t.flushRemux(u,i,e),u})):(this.flushRemux(u,v,e),u)},t.flushRemux=function(e,t,i){var n=t.audioTrack,s=t.avcTrack,o=t.id3Track,a=t.textTrack,l=this.currentTransmuxState,c=l.accurateTimeOffset,u=l.timeOffset;g.logger.log("[transmuxer.ts]: Flushed fragment "+i.sn+(i.part>-1?" p: "+i.part:"")+" of level "+i.level);var h=this.remuxer.remux(n,s,o,a,u,c,!0,this.id);e.push({remuxResult:h,chunkMeta:i}),i.transmuxing.executeEnd=r()},t.resetInitialTimestamp=function(e){var t=this.demuxer,i=this.remuxer;t&&i&&(t.resetTimeStamp(e),i.resetTimeStamp(e))},t.resetContiguity=function(){var e=this.demuxer,t=this.remuxer;e&&t&&(e.resetContiguity(),t.resetNextTimestamp())},t.resetInitSegment=function(e,t,i,r){var n=this.demuxer,s=this.remuxer;n&&s&&(n.resetInitSegment(t,i,r),s.resetInitSegment(e,t,i))},t.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},t.transmux=function(e,t,i,r,n){return t&&"SAMPLE-AES"===t.method?this.transmuxSampleAes(e,t,i,r,n):this.transmuxUnencrypted(e,i,r,n)},t.transmuxUnencrypted=function(e,t,i,r){var n=this.demuxer.demux(e,t,!1,!this.config.progressive),s=n.audioTrack,o=n.avcTrack,a=n.id3Track,l=n.textTrack;return{remuxResult:this.remuxer.remux(s,o,a,l,t,i,!1,this.id),chunkMeta:r}},t.transmuxSampleAes=function(e,t,i,r,n){var s=this;return this.demuxer.demuxSampleAes(e,t,i).then((function(e){return{remuxResult:s.remuxer.remux(e.audioTrack,e.avcTrack,e.id3Track,e.textTrack,i,r,!1,s.id),chunkMeta:n}}))},t.configureTransmuxer=function(e,t){for(var i,r=this.config,n=this.observer,s=this.typeSupported,o=this.vendor,a=t.audioCodec,c=t.defaultInitPts,u=t.duration,h=t.initSegmentData,f=t.videoCodec,p=0,m=v.length;p>4>1){if((R=T+5+t[T+4])===T+188)continue}else R=T+4;switch(A){case f:L&&(p&&(s=m(p))&&this.parseAVCPES(s,!1),p={data:[],size:0}),p&&(p.data.push(t.subarray(R,T+188)),p.size+=T+188-R);break;case y:L&&(b&&(s=m(b))&&(a.isAAC?this.parseAACPES(s):this.parseMPEGPES(s)),b={data:[],size:0}),b&&(b.data.push(t.subarray(R,T+188)),b.size+=T+188-R);break;case _:L&&(S&&(s=m(S))&&this.parseID3PES(s),S={data:[],size:0}),S&&(S.data.push(t.subarray(R,T+188)),S.size+=T+188-R);break;case 0:L&&(R+=t[R]+1),k=this._pmtId=g(t,R);break;case k:L&&(R+=t[R]+1);var D=v(t,R,!0===this.typeSupported.mpeg||!0===this.typeSupported.mp3,r);(f=D.avc)>0&&(o.pid=f),(y=D.audio)>0&&(a.pid=y,a.isAAC=D.isAAC),(_=D.id3)>0&&(d.pid=_),C&&!w&&(u.logger.log("reparse from beginning"),C=!1,T=E-188),w=this.pmtParsed=!0;break;case 17:case 8191:break;default:C=!0}}else this.observer.emit(l.Events.ERROR,l.Events.ERROR,{type:h.ErrorTypes.MEDIA_ERROR,details:h.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});o.pesData=p,a.pesData=b,d.pesData=S;var O={audioTrack:a,avcTrack:o,id3Track:d,textTrack:this._txtTrack};return n&&this.extractRemainingSamples(O),O},t.flush=function(){var e,t=this.remainderData;return this.remainderData=null,e=t?this.demux(t,-1,!1,!0):{audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(e),this.sampleAes?this.decrypt(e,this.sampleAes):e},t.extractRemainingSamples=function(e){var t,i=e.audioTrack,r=e.avcTrack,n=e.id3Track,s=r.pesData,o=i.pesData,a=n.pesData;s&&(t=m(s))?(this.parseAVCPES(t,!0),r.pesData=null):r.pesData=s,o&&(t=m(o))?(i.isAAC?this.parseAACPES(t):this.parseMPEGPES(t),i.pesData=null):(null!=o&&o.size&&u.logger.log("last AAC PES packet truncated,might overlap between fragments"),i.pesData=o),a&&(t=m(a))?(this.parseID3PES(t),n.pesData=null):n.pesData=a},t.demuxSampleAes=function(e,t,i){var r=this.demux(e,i,!0,!this.config.progressive),n=this.sampleAes=new a.default(this.observer,this.config,t);return this.decrypt(r,n)},t.decrypt=function(e,t){return new Promise((function(i){var r=e.audioTrack,n=e.avcTrack;r.samples&&r.isAAC?t.decryptAacSamples(r.samples,0,(function(){n.samples?t.decryptAvcSamples(n.samples,0,0,(function(){i(e)})):i(e)})):n.samples&&t.decryptAvcSamples(n.samples,0,0,(function(){i(e)}))}))},t.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},t.parseAVCPES=function(e,t){var i,r=this,n=this._avcTrack,a=this.parseAVCNALu(e.data),l=this.avcSample,c=!1;e.data=null,l&&a.length&&!n.audFound&&(y(l,n),l=this.avcSample=p(!1,e.pts,e.dts,"")),a.forEach((function(t){switch(t.type){case 1:i=!0,l||(l=r.avcSample=p(!0,e.pts,e.dts,"")),l.frame=!0;var a=t.data;if(c&&a.length>4){var u=new s.default(a).readSliceType();2!==u&&4!==u&&7!==u&&9!==u||(l.key=!0)}break;case 5:i=!0,l||(l=r.avcSample=p(!0,e.pts,e.dts,"")),l.key=!0,l.frame=!0;break;case 6:i=!0;var h=new s.default(b(t.data));h.readUByte();for(var d=0,f=0,g=!1,v=0;!g&&h.bytesAvailable>1;){d=0;do{d+=v=h.readUByte()}while(255===v);f=0;do{f+=v=h.readUByte()}while(255===v);if(4===d&&0!==h.bytesAvailable){if(g=!0,181===h.readUByte()&&49===h.readUShort()&&1195456820===h.readUInt()&&3===h.readUByte()){for(var m=h.readUByte(),S=31&m,C=[m,h.readUByte()],w=0;w16){for(var k=[],x=0;x<16;x++)k.push(h.readUByte().toString(16)),3!==x&&5!==x&&7!==x&&9!==x||k.push("-");for(var E=f-16,T=new Uint8Array(E),L=0;L=0){var h={data:e.subarray(c,l-s-1),type:u};a.push(h)}else{var d=this.getLastNalUnit();if(d&&(o&&l<=4-o&&d.state&&(d.data=d.data.subarray(0,d.data.byteLength-o)),(i=l-s-1)>0)){var f=new Uint8Array(d.data.byteLength+i);f.set(d.data,0),f.set(e.subarray(0,i),d.data.byteLength),d.data=f,d.state=0}}l=0&&s>=0){var p={data:e.subarray(c,r),type:u,state:s};a.push(p)}if(0===a.length){var g=this.getLastNalUnit();if(g){var v=new Uint8Array(g.data.byteLength+e.byteLength);v.set(g.data,0),v.set(e,g.data.byteLength),g.data=v}}return n.naluState=s,a},t.parseAACPES=function(e){var t,i,n,s,o,a=0,c=this._audioTrack,d=this.aacOverFlow,f=e.data;if(d){this.aacOverFlow=null;var p=d.sample.unit.byteLength,g=Math.min(d.missing,p),v=p-g;d.sample.unit.set(f.subarray(0,g),v),c.samples.push(d.sample),a=d.missing}for(t=a,i=f.length;t1;){var l=new Uint8Array(a[0].length+a[1].length);l.set(a[0]),l.set(a[1],a[0].length),a[0]=l,a.splice(1,1)}if(1===((t=a[0])[0]<<16)+(t[1]<<8)+t[2]){if((i=(t[4]<<8)+t[5])&&i>e.size-6)return null;var c=t[7];192&c&&(n=536870912*(14&t[9])+4194304*(255&t[10])+16384*(254&t[11])+128*(255&t[12])+(254&t[13])/2,64&c?n-(s=536870912*(14&t[14])+4194304*(255&t[15])+16384*(254&t[16])+128*(255&t[17])+(254&t[18])/2)>54e5&&(u.logger.warn(Math.round((n-s)/9e4)+"s delta between PTS and DTS, align them"),n=s):s=n);var h=(r=t[8])+9;if(e.size<=h)return null;e.size-=h;for(var d=new Uint8Array(e.size),f=0,p=a.length;fg){h-=g;continue}t=t.subarray(h),g-=h,h=0}d.set(t,o),o+=g}return i&&(i-=r+3),{data:d,pts:n,dts:s,len:i}}return null}function y(e,t){if(e.units.length&&e.frame){if(void 0===e.pts){var i=t.samples,r=i.length;if(!r)return void t.dropped++;var n=i[r-1];e.pts=n.pts,e.dts=n.dts}t.samples.push(e)}e.debug.length&&u.logger.log(e.pts+"/"+e.dts+":"+e.debug)}function _(e,t){var i=e.length;if(i>0){if(t.pts>=e[i-1].pts)e.push(t);else for(var r=i-1;r>=0;r--)if(t.ptst)return r;return 0}},{key:"maxAutoLevel",get:function(){var e=this.levels,t=this.autoLevelCapping;return-1===t&&e&&e.length?e.length-1:t}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(e){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,e)}},{key:"audioTracks",get:function(){var e=this.audioTrackController;return e?e.audioTracks:[]}},{key:"audioTrack",get:function(){var e=this.audioTrackController;return e?e.audioTrack:-1},set:function(e){var t=this.audioTrackController;t&&(t.audioTrack=e)}},{key:"subtitleTracks",get:function(){var e=this.subtitleTrackController;return e?e.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var e=this.subtitleTrackController;return e?e.subtitleTrack:-1},set:function(e){var t=this.subtitleTrackController;t&&(t.subtitleTrack=e)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var e=this.subtitleTrackController;return!!e&&e.subtitleDisplay},set:function(e){var t=this.subtitleTrackController;t&&(t.subtitleDisplay=e)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(e){this.config.lowLatencyMode=e}},{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}}])&&m(t.prototype,i),y&&m(t,y),e}();y.defaultConfig=void 0},"./src/is-supported.ts": /*!*****************************!*\ !*** ./src/is-supported.ts ***! \*****************************/ /*! exports provided: isSupported, changeTypeSupported */function(e,t,i){"use strict";i.r(t),i.d(t,"isSupported",(function(){return s})),i.d(t,"changeTypeSupported",(function(){return o}));var r=i(/*! ./utils/mediasource-helper */"./src/utils/mediasource-helper.ts");function n(){return self.SourceBuffer||self.WebKitSourceBuffer}function s(){var e=Object(r.getMediaSource)();if(!e)return!1;var t=n(),i=e&&"function"==typeof e.isTypeSupported&&e.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),s=!t||t.prototype&&"function"==typeof t.prototype.appendBuffer&&"function"==typeof t.prototype.remove;return!!i&&!!s}function o(){var e,t=n();return"function"==typeof(null==t||null===(e=t.prototype)||void 0===e?void 0:e.changeType)}},"./src/loader/fragment-loader.ts": /*!***************************************!*\ !*** ./src/loader/fragment-loader.ts ***! \***************************************/ /*! exports provided: default, LoadError */function(e,t,i){"use strict";i.r(t),i.d(t,"default",(function(){return h})),i.d(t,"LoadError",(function(){return f}));var r=i(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),n=i(/*! ../errors */"./src/errors.ts");function s(e){var t="function"==typeof Map?new Map:void 0;return(s=function(e){if(null===e||(i=e,-1===Function.toString.call(i).indexOf("[native code]")))return e;var i;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return o(e,arguments,c(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),l(r,e)})(e)}function o(e,t,i){return(o=a()?Reflect.construct:function(e,t,i){var r=[null];r.push.apply(r,t);var n=new(Function.bind.apply(e,r));return i&&l(n,i.prototype),n}).apply(null,arguments)}function a(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function l(e,t){return(l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function c(e){return(c=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var u=Math.pow(2,17),h=function(){function e(e){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=e}var t=e.prototype;return t.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},t.abort=function(){this.loader&&this.loader.abort()},t.load=function(e,t){var i=this,r=e.url;if(!r)return Promise.reject(new f({type:n.ErrorTypes.NETWORK_ERROR,details:n.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:e,networkDetails:null},"Fragment does not have a "+(r?"part list":"url")));this.abort();var s=this.config,o=s.fLoader,a=s.loader;return new Promise((function(r,l){i.loader&&i.loader.destroy();var c=i.loader=e.loader=o?new o(s):new a(s),h=d(e),p={timeout:s.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:s.fragLoadingMaxRetryTimeout,highWaterMark:u};e.stats=c.stats,c.load(h,p,{onSuccess:function(t,n,s,o){i.resetLoader(e,c),r({frag:e,part:null,payload:t.data,networkDetails:o})},onError:function(t,r,s){i.resetLoader(e,c),l(new f({type:n.ErrorTypes.NETWORK_ERROR,details:n.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:t,networkDetails:s}))},onAbort:function(t,r,s){i.resetLoader(e,c),l(new f({type:n.ErrorTypes.NETWORK_ERROR,details:n.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:e,networkDetails:s}))},onTimeout:function(t,r,s){i.resetLoader(e,c),l(new f({type:n.ErrorTypes.NETWORK_ERROR,details:n.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,networkDetails:s}))},onProgress:function(i,r,n,s){t&&t({frag:e,part:null,payload:n,networkDetails:s})}})}))},t.loadPart=function(e,t,i){var r=this;this.abort();var s=this.config,o=s.fLoader,a=s.loader;return new Promise((function(l,c){r.loader&&r.loader.destroy();var h=r.loader=e.loader=o?new o(s):new a(s),p=d(e,t),g={timeout:s.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:s.fragLoadingMaxRetryTimeout,highWaterMark:u};t.stats=h.stats,h.load(p,g,{onSuccess:function(n,s,o,a){r.resetLoader(e,h),r.updateStatsFromPart(e,t);var c={frag:e,part:t,payload:n.data,networkDetails:a};i(c),l(c)},onError:function(i,s,o){r.resetLoader(e,h),c(new f({type:n.ErrorTypes.NETWORK_ERROR,details:n.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:i,networkDetails:o}))},onAbort:function(i,s,o){e.stats.aborted=t.stats.aborted,r.resetLoader(e,h),c(new f({type:n.ErrorTypes.NETWORK_ERROR,details:n.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:e,part:t,networkDetails:o}))},onTimeout:function(i,s,o){r.resetLoader(e,h),c(new f({type:n.ErrorTypes.NETWORK_ERROR,details:n.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:t,networkDetails:o}))}})}))},t.updateStatsFromPart=function(e,t){var i=e.stats,r=t.stats,n=r.total;if(i.loaded+=r.loaded,n){var s=Math.round(e.duration/t.duration),o=Math.min(Math.round(i.loaded/n),s),a=(s-o)*Math.round(i.loaded/o);i.total=i.loaded+a}else i.total=Math.max(i.loaded,i.total);var l=i.loading,c=r.loading;l.start?l.first+=c.first-c.start:(l.start=c.start,l.first=c.first),l.end=c.end},t.resetLoader=function(e,t){e.loader=null,this.loader===t&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),t.destroy()},e}();function d(e,t){void 0===t&&(t=null);var i=t||e,n={frag:e,part:t,responseType:"arraybuffer",url:i.url,headers:{},rangeStart:0,rangeEnd:0},s=i.byteRangeStartOffset,o=i.byteRangeEndOffset;return Object(r.isFiniteNumber)(s)&&Object(r.isFiniteNumber)(o)&&(n.rangeStart=s,n.rangeEnd=o),n}var f=function(e){var t,i;function r(t){for(var i,r=arguments.length,n=new Array(r>1?r-1:0),s=1;s>8*(15-i)&255;return t},i.setDecryptDataFromLevelKey=function(e,t){var i=e;return"AES-128"===(null==e?void 0:e.method)&&e.uri&&!e.iv&&((i=a.LevelKey.fromURI(e.uri)).method=e.method,i.iv=this.createInitializationVector(t),i.keyFormat="identity"),i},i.setElementaryStreamInfo=function(e,t,i,r,n,s){void 0===s&&(s=!1);var o=this.elementaryStreams,a=o[e];a?(a.startPTS=Math.min(a.startPTS,t),a.endPTS=Math.max(a.endPTS,i),a.startDTS=Math.min(a.startDTS,r),a.endDTS=Math.max(a.endDTS,n)):o[e]={startPTS:t,endPTS:i,startDTS:r,endDTS:n,partial:s}},i.clearElementaryStreamInfo=function(){var e=this.elementaryStreams;e[r.AUDIO]=null,e[r.VIDEO]=null,e[r.AUDIOVIDEO]=null},d(t,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var e=this.sn;"number"!=typeof e&&(this.levelkey&&"AES-128"===this.levelkey.method&&!this.levelkey.iv&&o.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),e=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,e)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(null===this.programDateTime)return null;if(!Object(n.isFiniteNumber)(this.programDateTime))return null;var e=Object(n.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+1e3*e}},{key:"encrypted",get:function(){var e;return!(null===(e=this.decryptdata)||void 0===e||!e.keyFormat||!this.decryptdata.uri)}}]),t}(f),g=function(e){function t(t,i,r,n,s){var o;(o=e.call(this,r)||this).fragOffset=0,o.duration=0,o.gap=!1,o.independent=!1,o.relurl=void 0,o.fragment=void 0,o.index=void 0,o.stats=new l.LoadStats,o.duration=t.decimalFloatingPoint("DURATION"),o.gap=t.bool("GAP"),o.independent=t.bool("INDEPENDENT"),o.relurl=t.enumeratedString("URI"),o.fragment=i,o.index=n;var a=t.enumeratedString("BYTERANGE");return a&&o.setByteRange(a,s),s&&(o.fragOffset=s.fragOffset+s.duration),o}return c(t,e),d(t,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var e=this.elementaryStreams;return!!(e.audio||e.video||e.audiovideo)}}]),t}(f)},"./src/loader/key-loader.ts": /*!**********************************!*\ !*** ./src/loader/key-loader.ts ***! \**********************************/ /*! exports provided: default */function(e,t,i){"use strict";i.r(t),i.d(t,"default",(function(){return o}));var r=i(/*! ../events */"./src/events.ts"),n=i(/*! ../errors */"./src/errors.ts"),s=i(/*! ../utils/logger */"./src/utils/logger.ts"),o=function(){function e(e){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=e,this._registerListeners()}var t=e.prototype;return t._registerListeners=function(){this.hls.on(r.Events.KEY_LOADING,this.onKeyLoading,this)},t._unregisterListeners=function(){this.hls.off(r.Events.KEY_LOADING,this.onKeyLoading)},t.destroy=function(){for(var e in this._unregisterListeners(),this.loaders){var t=this.loaders[e];t&&t.destroy()}this.loaders={}},t.onKeyLoading=function(e,t){var i=t.frag,n=i.type,o=this.loaders[n];if(i.decryptdata){var a=i.decryptdata.uri;if(a!==this.decrypturl||null===this.decryptkey){var l=this.hls.config;if(o&&(s.logger.warn("abort previous key loader for type:"+n),o.abort()),!a)return void s.logger.warn("key uri is falsy");var c=l.loader,u=i.loader=this.loaders[n]=new c(l);this.decrypturl=a,this.decryptkey=null;var h={url:a,frag:i,responseType:"arraybuffer"},d={timeout:l.fragLoadingTimeOut,maxRetry:0,retryDelay:l.fragLoadingRetryDelay,maxRetryDelay:l.fragLoadingMaxRetryTimeout,highWaterMark:0},f={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};u.load(h,d,f)}else this.decryptkey&&(i.decryptdata.key=this.decryptkey,this.hls.trigger(r.Events.KEY_LOADED,{frag:i}))}else s.logger.warn("Missing decryption data on fragment in onKeyLoading")},t.loadsuccess=function(e,t,i){var n=i.frag;n.decryptdata?(this.decryptkey=n.decryptdata.key=new Uint8Array(e.data),n.loader=null,delete this.loaders[n.type],this.hls.trigger(r.Events.KEY_LOADED,{frag:n})):s.logger.error("after key load, decryptdata unset")},t.loaderror=function(e,t){var i=t.frag,s=i.loader;s&&s.abort(),delete this.loaders[i.type],this.hls.trigger(r.Events.ERROR,{type:n.ErrorTypes.NETWORK_ERROR,details:n.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:i,response:e})},t.loadtimeout=function(e,t){var i=t.frag,s=i.loader;s&&s.abort(),delete this.loaders[i.type],this.hls.trigger(r.Events.ERROR,{type:n.ErrorTypes.NETWORK_ERROR,details:n.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:i})},e}()},"./src/loader/level-details.ts": /*!*************************************!*\ !*** ./src/loader/level-details.ts ***! \*************************************/ /*! exports provided: LevelDetails */function(e,t,i){"use strict";i.r(t),i.d(t,"LevelDetails",(function(){return s}));var r=i(/*! ./src/polyfills/number */"./src/polyfills/number.ts");function n(e,t){for(var i=0;ie.endSN||t>0||0===t&&i>0,this.updated||this.advanced?this.misses=Math.floor(.6*e.misses):this.misses=e.misses+1,this.availabilityDelay=e.availabilityDelay},t=e,(i=[{key:"hasProgramDateTime",get:function(){return!!this.fragments.length&&Object(r.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime)}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||10}},{key:"drift",get:function(){var e=this.driftEndTime-this.driftStartTime;return e>0?1e3*(this.driftEnd-this.driftStart)/e:1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var e;return null!==(e=this.partList)&&void 0!==e&&e.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var e;return null!==(e=this.fragments)&&void 0!==e&&e.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 e;return null!==(e=this.partList)&&void 0!==e&&e.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var e;return null!==(e=this.partList)&&void 0!==e&&e.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}])&&n(t.prototype,i),s&&n(t,s),e}()},"./src/loader/level-key.ts": /*!*********************************!*\ !*** ./src/loader/level-key.ts ***! \*********************************/ /*! exports provided: LevelKey */function(e,t,i){"use strict";i.r(t),i.d(t,"LevelKey",(function(){return s}));var r=i(/*! url-toolkit */"./node_modules/url-toolkit/src/url-toolkit.js");function n(e,t){for(var i=0;i2){var i=t.shift()+".";return i+=parseInt(t.shift()).toString(16),i+=("000"+parseInt(t.shift()).toString(16)).substr(-4)}return e},e.resolve=function(e,t){return n.buildAbsoluteURL(t,e,{alwaysNormalize:!0})},e.parseMasterPlaylist=function(t,i){var r,n=[],s={},o=!1;for(h.lastIndex=0;null!=(r=h.exec(t));)if(r[1]){var a=new l.AttrList(r[1]),c={attrs:a,bitrate:a.decimalInteger("AVERAGE-BANDWIDTH")||a.decimalInteger("BANDWIDTH"),name:a.NAME,url:e.resolve(r[2],i)},u=a.decimalResolution("RESOLUTION");u&&(c.width=u.width,c.height=u.height),m((a.CODECS||"").split(/[ ,]+/).filter((function(e){return e})),c),c.videoCodec&&-1!==c.videoCodec.indexOf("avc1")&&(c.videoCodec=e.convertAVC1ToAVCOTI(c.videoCodec)),n.push(c)}else if(r[3]){var d=new l.AttrList(r[3]);d["DATA-ID"]&&(o=!0,s[d["DATA-ID"]]=d)}return{levels:n,sessionData:o?s:null}},e.parseMasterPlaylistMedia=function(t,i,r,n){var s;void 0===n&&(n=[]);var o=[],a=0;for(d.lastIndex=0;null!==(s=d.exec(t));){var c=new l.AttrList(s[1]);if(c.TYPE===r){var u={attrs:c,bitrate:0,id:a++,groupId:c["GROUP-ID"],instreamId:c["INSTREAM-ID"],name:c.NAME||c.LANGUAGE||"",type:r,default:c.bool("DEFAULT"),autoselect:c.bool("AUTOSELECT"),forced:c.bool("FORCED"),lang:c.LANGUAGE,url:c.URI?e.resolve(c.URI,i):""};if(n.length){var h=e.findGroup(n,u.groupId)||n[0];y(u,h,"audioCodec"),y(u,h,"textCodec")}o.push(u)}}return o},e.parseLevelPlaylist=function(e,t,i,u,h){var d,v,m,y=new o.LevelDetails(t),b=y.fragments,S=null,C=0,w=0,k=0,x=0,E=null,T=new s.Fragment(u,t),L=-1,A=!1;for(f.lastIndex=0,y.m3u8=e;null!==(d=f.exec(e));){A&&(A=!1,(T=new s.Fragment(u,t)).start=k,T.sn=C,T.cc=x,T.level=i,S&&(T.initSegment=S,T.rawProgramDateTime=S.rawProgramDateTime));var R=d[1];if(R){T.duration=parseFloat(R);var D=(" "+d[2]).slice(1);T.title=D||null,T.tagList.push(D?["INF",R,D]:["INF",R])}else if(d[3])Object(r.isFiniteNumber)(T.duration)&&(T.start=k,m&&(T.levelkey=m),T.sn=C,T.level=i,T.cc=x,T.urlId=h,b.push(T),T.relurl=(" "+d[3]).slice(1),_(T,E),E=T,k+=T.duration,C++,w=0,A=!0);else if(d[4]){var O=(" "+d[4]).slice(1);E?T.setByteRange(O,E):T.setByteRange(O)}else if(d[5])T.rawProgramDateTime=(" "+d[5]).slice(1),T.tagList.push(["PROGRAM-DATE-TIME",T.rawProgramDateTime]),-1===L&&(L=b.length);else{if(!(d=d[0].match(p))){c.logger.warn("No matches on slow regex match for level playlist!");continue}for(v=1;v-1){c.logger.warn("Keyformat "+V+" is not supported from the manifest");continue}if("identity"!==V)continue;K&&(m=a.LevelKey.fromURL(t,X),X&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(K)>=0&&(m.method=K,m.keyFormat=V,G&&(m.keyID=G),z&&(m.keyFormatVersions=z),m.iv=W));break;case"START":var q=new l.AttrList(I).decimalFloatingPoint("TIME-OFFSET");Object(r.isFiniteNumber)(q)&&(y.startTimeOffset=q);break;case"MAP":var Q=new l.AttrList(I);T.relurl=Q.URI,Q.BYTERANGE&&T.setByteRange(Q.BYTERANGE),T.level=i,T.sn="initSegment",m&&(T.levelkey=m),T.initSegment=null,S=T,A=!0;break;case"SERVER-CONTROL":var Y=new l.AttrList(I);y.canBlockReload=Y.bool("CAN-BLOCK-RELOAD"),y.canSkipUntil=Y.optionalFloat("CAN-SKIP-UNTIL",0),y.canSkipDateRanges=y.canSkipUntil>0&&Y.bool("CAN-SKIP-DATERANGES"),y.partHoldBack=Y.optionalFloat("PART-HOLD-BACK",0),y.holdBack=Y.optionalFloat("HOLD-BACK",0);break;case"PART-INF":var Z=new l.AttrList(I);y.partTarget=Z.decimalFloatingPoint("PART-TARGET");break;case"PART":var $=y.partList;$||($=y.partList=[]);var J=w>0?$[$.length-1]:void 0,ee=w++,te=new s.Part(new l.AttrList(I),T,t,ee,J);$.push(te),T.duration+=te.duration;break;case"PRELOAD-HINT":var ie=new l.AttrList(I);y.preloadHint=ie;break;case"RENDITION-REPORT":var re=new l.AttrList(I);y.renditionReports=y.renditionReports||[],y.renditionReports.push(re);break;default:c.logger.warn("line parsed but not handled: "+d)}}}E&&!E.relurl?(b.pop(),k-=E.duration,y.partList&&(y.fragmentHint=E)):y.partList&&(_(T,E),T.cc=x,y.fragmentHint=T);var ne=b.length,se=b[0],oe=b[ne-1];if((k+=y.skippedSegments*y.targetduration)>0&&ne&&oe){y.averagetargetduration=k/ne;var ae=oe.sn;y.endSN="initSegment"!==ae?ae:0,se&&(y.startCC=se.cc,se.initSegment||y.fragments.every((function(e){return e.relurl&&(t=e.relurl,g.test(null!=(i=null===(r=n.parseURL(t))||void 0===r?void 0:r.path)?i:""));var t,i,r}))&&(c.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),(T=new s.Fragment(u,t)).relurl=oe.relurl,T.level=i,T.sn="initSegment",se.initSegment=T,y.needSidxRanges=!0))}else y.endSN=0,y.startCC=0;return y.fragmentHint&&(k+=y.fragmentHint.duration),y.totalduration=k,y.endCC=x,L>0&&function(e,t){for(var i=e[t],r=t;r--;){var n=e[r];if(!n)return;n.programDateTime=i.programDateTime-1e3*n.duration,i=n}}(b,L),y},e}();function m(e,t){["video","audio","text"].forEach((function(i){var r=e.filter((function(e){return Object(u.isCodecType)(e,i)}));if(r.length){var n=r.filter((function(e){return 0===e.lastIndexOf("avc1",0)||0===e.lastIndexOf("mp4a",0)}));t[i+"Codec"]=n.length>0?n[0]:r[0],e=e.filter((function(e){return-1===r.indexOf(e)}))}})),t.unknownCodecs=e}function y(e,t,i){var r=t[i];r&&(e[i]=r)}function _(e,t){e.rawProgramDateTime?e.programDateTime=Date.parse(e.rawProgramDateTime):null!=t&&t.programDateTime&&(e.programDateTime=t.endProgramDateTime),Object(r.isFiniteNumber)(e.programDateTime)||(e.programDateTime=null,e.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts": /*!***************************************!*\ !*** ./src/loader/playlist-loader.ts ***! \***************************************/ /*! exports provided: default */function(e,t,i){"use strict";i.r(t);var r=i(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),n=i(/*! ../events */"./src/events.ts"),s=i(/*! ../errors */"./src/errors.ts"),o=i(/*! ../utils/logger */"./src/utils/logger.ts"),a=i(/*! ../utils/mp4-tools */"./src/utils/mp4-tools.ts"),l=i(/*! ./m3u8-parser */"./src/loader/m3u8-parser.ts"),c=i(/*! ../types/loader */"./src/types/loader.ts"),u=i(/*! ../utils/attr-list */"./src/utils/attr-list.ts");function h(e,t){var i=e.url;return void 0!==i&&0!==i.indexOf("data:")||(i=t.url),i}var d=function(){function e(e){this.hls=void 0,this.loaders=Object.create(null),this.hls=e,this.registerListeners()}var t=e.prototype;return t.registerListeners=function(){var e=this.hls;e.on(n.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.on(n.Events.LEVEL_LOADING,this.onLevelLoading,this),e.on(n.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(n.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},t.unregisterListeners=function(){var e=this.hls;e.off(n.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.off(n.Events.LEVEL_LOADING,this.onLevelLoading,this),e.off(n.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(n.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},t.createInternalLoader=function(e){var t=this.hls.config,i=t.pLoader,r=t.loader,n=new(i||r)(t);return e.loader=n,this.loaders[e.type]=n,n},t.getInternalLoader=function(e){return this.loaders[e.type]},t.resetInternalLoader=function(e){this.loaders[e]&&delete this.loaders[e]},t.destroyInternalLoaders=function(){for(var e in this.loaders){var t=this.loaders[e];t&&t.destroy(),this.resetInternalLoader(e)}},t.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},t.onManifestLoading=function(e,t){var i=t.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:c.PlaylistContextType.MANIFEST,url:i,deliveryDirectives:null})},t.onLevelLoading=function(e,t){var i=t.id,r=t.level,n=t.url,s=t.deliveryDirectives;this.load({id:i,groupId:null,level:r,responseType:"text",type:c.PlaylistContextType.LEVEL,url:n,deliveryDirectives:s})},t.onAudioTrackLoading=function(e,t){var i=t.id,r=t.groupId,n=t.url,s=t.deliveryDirectives;this.load({id:i,groupId:r,level:null,responseType:"text",type:c.PlaylistContextType.AUDIO_TRACK,url:n,deliveryDirectives:s})},t.onSubtitleTrackLoading=function(e,t){var i=t.id,r=t.groupId,n=t.url,s=t.deliveryDirectives;this.load({id:i,groupId:r,level:null,responseType:"text",type:c.PlaylistContextType.SUBTITLE_TRACK,url:n,deliveryDirectives:s})},t.load=function(e){var t,i,r,n,s,a,l=this.hls.config,u=this.getInternalLoader(e);if(u){var h=u.context;if(h&&h.url===e.url)return void o.logger.trace("[playlist-loader]: playlist request ongoing");o.logger.log("[playlist-loader]: aborting previous loader for type: "+e.type),u.abort()}switch(e.type){case c.PlaylistContextType.MANIFEST:i=l.manifestLoadingMaxRetry,r=l.manifestLoadingTimeOut,n=l.manifestLoadingRetryDelay,s=l.manifestLoadingMaxRetryTimeout;break;case c.PlaylistContextType.LEVEL:case c.PlaylistContextType.AUDIO_TRACK:case c.PlaylistContextType.SUBTITLE_TRACK:i=0,r=l.levelLoadingTimeOut;break;default:i=l.levelLoadingMaxRetry,r=l.levelLoadingTimeOut,n=l.levelLoadingRetryDelay,s=l.levelLoadingMaxRetryTimeout}if(u=this.createInternalLoader(e),null!==(t=e.deliveryDirectives)&&void 0!==t&&t.part&&(e.type===c.PlaylistContextType.LEVEL&&null!==e.level?a=this.hls.levels[e.level].details:e.type===c.PlaylistContextType.AUDIO_TRACK&&null!==e.id?a=this.hls.audioTracks[e.id].details:e.type===c.PlaylistContextType.SUBTITLE_TRACK&&null!==e.id&&(a=this.hls.subtitleTracks[e.id].details),a)){var d=a.partTarget,f=a.targetduration;d&&f&&(r=Math.min(1e3*Math.max(3*d,.8*f),r))}var p={timeout:r,maxRetry:i,retryDelay:n,maxRetryDelay:s,highWaterMark:0},g={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};u.load(e,p,g)},t.loadsuccess=function(e,t,i,r){if(void 0===r&&(r=null),i.isSidxRequest)return this.handleSidxRequest(e,i),void this.handlePlaylistLoaded(e,t,i,r);this.resetInternalLoader(i.type);var n=e.data;0===n.indexOf("#EXTM3U")?(t.parsing.start=performance.now(),n.indexOf("#EXTINF:")>0||n.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(e,t,i,r):this.handleMasterPlaylist(e,t,i,r)):this.handleManifestParsingError(e,i,"no EXTM3U delimiter",r)},t.loaderror=function(e,t,i){void 0===i&&(i=null),this.handleNetworkError(t,i,!1,e)},t.loadtimeout=function(e,t,i){void 0===i&&(i=null),this.handleNetworkError(t,i,!0)},t.handleMasterPlaylist=function(e,t,i,r){var s=this.hls,a=e.data,c=h(e,i),d=l.default.parseMasterPlaylist(a,c),f=d.levels,p=d.sessionData;if(f.length){var g=f.map((function(e){return{id:e.attrs.AUDIO,audioCodec:e.audioCodec}})),v=f.map((function(e){return{id:e.attrs.SUBTITLES,textCodec:e.textCodec}})),m=l.default.parseMasterPlaylistMedia(a,c,"AUDIO",g),y=l.default.parseMasterPlaylistMedia(a,c,"SUBTITLES",v),_=l.default.parseMasterPlaylistMedia(a,c,"CLOSED-CAPTIONS");m.length&&(m.some((function(e){return!e.url}))||!f[0].audioCodec||f[0].attrs.AUDIO||(o.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),m.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new u.AttrList({}),bitrate:0,url:""}))),s.trigger(n.Events.MANIFEST_LOADED,{levels:f,audioTracks:m,subtitles:y,captions:_,url:c,stats:t,networkDetails:r,sessionData:p})}else this.handleManifestParsingError(e,i,"no level found in manifest",r)},t.handleTrackOrLevelPlaylist=function(e,t,i,o){var a=this.hls,d=i.id,f=i.level,p=i.type,g=h(e,i),v=Object(r.isFiniteNumber)(d)?d:0,m=Object(r.isFiniteNumber)(f)?f:v,y=function(e){switch(e.type){case c.PlaylistContextType.AUDIO_TRACK:return c.PlaylistLevelType.AUDIO;case c.PlaylistContextType.SUBTITLE_TRACK:return c.PlaylistLevelType.SUBTITLE;default:return c.PlaylistLevelType.MAIN}}(i),_=l.default.parseLevelPlaylist(e.data,g,m,y,v);if(_.fragments.length){if(p===c.PlaylistContextType.MANIFEST){var b={attrs:new u.AttrList({}),bitrate:0,details:_,name:"",url:g};a.trigger(n.Events.MANIFEST_LOADED,{levels:[b],audioTracks:[],url:g,stats:t,networkDetails:o,sessionData:null})}if(t.parsing.end=performance.now(),_.needSidxRanges){var S,C=null===(S=_.fragments[0].initSegment)||void 0===S?void 0:S.url;this.load({url:C,isSidxRequest:!0,type:p,level:f,levelDetails:_,id:d,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null})}else i.levelDetails=_,this.handlePlaylistLoaded(e,t,i,o)}else a.trigger(n.Events.ERROR,{type:s.ErrorTypes.NETWORK_ERROR,details:s.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:g,reason:"no fragments found in level",level:"number"==typeof i.level?i.level:void 0})},t.handleSidxRequest=function(e,t){var i=Object(a.parseSegmentIndex)(new Uint8Array(e.data));if(i){var r=i.references,n=t.levelDetails;r.forEach((function(e,t){var r=e.info,s=n.fragments[t];0===s.byteRange.length&&s.setByteRange(String(1+r.end-r.start)+"@"+String(r.start)),s.initSegment&&s.initSegment.setByteRange(String(i.moovEndOffset)+"@0")}))}},t.handleManifestParsingError=function(e,t,i,r){this.hls.trigger(n.Events.ERROR,{type:s.ErrorTypes.NETWORK_ERROR,details:s.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:t.type===c.PlaylistContextType.MANIFEST,url:e.url,reason:i,response:e,context:t,networkDetails:r})},t.handleNetworkError=function(e,t,i,r){void 0===i&&(i=!1),o.logger.warn("[playlist-loader]: A network "+(i?"timeout":"error")+" occurred while loading "+e.type+" level: "+e.level+" id: "+e.id+' group-id: "'+e.groupId+'"');var a=s.ErrorDetails.UNKNOWN,l=!1,u=this.getInternalLoader(e);switch(e.type){case c.PlaylistContextType.MANIFEST:a=i?s.ErrorDetails.MANIFEST_LOAD_TIMEOUT:s.ErrorDetails.MANIFEST_LOAD_ERROR,l=!0;break;case c.PlaylistContextType.LEVEL:a=i?s.ErrorDetails.LEVEL_LOAD_TIMEOUT:s.ErrorDetails.LEVEL_LOAD_ERROR,l=!1;break;case c.PlaylistContextType.AUDIO_TRACK:a=i?s.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:s.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,l=!1;break;case c.PlaylistContextType.SUBTITLE_TRACK:a=i?s.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:s.ErrorDetails.SUBTITLE_LOAD_ERROR,l=!1}u&&this.resetInternalLoader(e.type);var h={type:s.ErrorTypes.NETWORK_ERROR,details:a,fatal:l,url:e.url,loader:u,context:e,networkDetails:t};r&&(h.response=r),this.hls.trigger(n.Events.ERROR,h)},t.handlePlaylistLoaded=function(e,t,i,r){var s=i.type,o=i.level,a=i.id,l=i.groupId,u=i.loader,h=i.levelDetails,d=i.deliveryDirectives;if(null!=h&&h.targetduration){if(u)switch(h.live&&(u.getCacheAge&&(h.ageHeader=u.getCacheAge()||0),u.getCacheAge&&!isNaN(h.ageHeader)||(h.ageHeader=0)),s){case c.PlaylistContextType.MANIFEST:case c.PlaylistContextType.LEVEL:this.hls.trigger(n.Events.LEVEL_LOADED,{details:h,level:o||0,id:a||0,stats:t,networkDetails:r,deliveryDirectives:d});break;case c.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(n.Events.AUDIO_TRACK_LOADED,{details:h,id:a||0,groupId:l||"",stats:t,networkDetails:r,deliveryDirectives:d});break;case c.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(n.Events.SUBTITLE_TRACK_LOADED,{details:h,id:a||0,groupId:l||"",stats:t,networkDetails:r,deliveryDirectives:d})}}else this.handleManifestParsingError(e,i,"invalid target duration",r)},e}();t.default=d},"./src/polyfills/number.ts": /*!*********************************!*\ !*** ./src/polyfills/number.ts ***! \*********************************/ /*! exports provided: isFiniteNumber, MAX_SAFE_INTEGER */function(e,t,i){"use strict";i.r(t),i.d(t,"isFiniteNumber",(function(){return r})),i.d(t,"MAX_SAFE_INTEGER",(function(){return n}));var r=Number.isFinite||function(e){return"number"==typeof e&&isFinite(e)},n=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts": /*!*********************************!*\ !*** ./src/remux/aac-helper.ts ***! \*********************************/ /*! exports provided: default */function(e,t,i){"use strict";i.r(t);var r=function(){function e(){}return e.getSilentFrame=function(e,t){switch(e){case"mp4a.40.2":if(1===t)return new Uint8Array([0,200,0,128,35,128]);if(2===t)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(3===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(4===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(5===t)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(6===t)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(1===t)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(2===t)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(3===t)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])}},e}();t.default=r},"./src/remux/mp4-generator.ts": /*!************************************!*\ !*** ./src/remux/mp4-generator.ts ***! \************************************/ /*! exports provided: default */function(e,t,i){"use strict";i.r(t);var r=Math.pow(2,32)-1,n=function(){function e(){}return e.init=function(){var t;for(t in e.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:[]},e.types)e.types.hasOwnProperty(t)&&(e.types[t]=[t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2),t.charCodeAt(3)]);var i=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]),r=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]);e.HDLR_TYPES={video:i,audio:r};var n=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),s=new Uint8Array([0,0,0,0,0,0,0,0]);e.STTS=e.STSC=e.STCO=s,e.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),e.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),e.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),e.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var o=new Uint8Array([105,115,111,109]),a=new Uint8Array([97,118,99,49]),l=new Uint8Array([0,0,0,1]);e.FTYP=e.box(e.types.ftyp,o,l,o,a),e.DINF=e.box(e.types.dinf,e.box(e.types.dref,n))},e.box=function(e){for(var t=8,i=arguments.length,r=new Array(i>1?i-1:0),n=1;n>24&255,a[1]=t>>16&255,a[2]=t>>8&255,a[3]=255&t,a.set(e,4),s=0,t=8;s>24&255,t>>16&255,t>>8&255,255&t,n>>24,n>>16&255,n>>8&255,255&n,s>>24,s>>16&255,s>>8&255,255&s,85,196,0,0]))},e.mdia=function(t){return e.box(e.types.mdia,e.mdhd(t.timescale,t.duration),e.hdlr(t.type),e.minf(t))},e.mfhd=function(t){return e.box(e.types.mfhd,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t]))},e.minf=function(t){return"audio"===t.type?e.box(e.types.minf,e.box(e.types.smhd,e.SMHD),e.DINF,e.stbl(t)):e.box(e.types.minf,e.box(e.types.vmhd,e.VMHD),e.DINF,e.stbl(t))},e.moof=function(t,i,r){return e.box(e.types.moof,e.mfhd(t),e.traf(r,i))},e.moov=function(t){for(var i=t.length,r=[];i--;)r[i]=e.trak(t[i]);return e.box.apply(null,[e.types.moov,e.mvhd(t[0].timescale,t[0].duration)].concat(r).concat(e.mvex(t)))},e.mvex=function(t){for(var i=t.length,r=[];i--;)r[i]=e.trex(t[i]);return e.box.apply(null,[e.types.mvex].concat(r))},e.mvhd=function(t,i){i*=t;var n=Math.floor(i/(r+1)),s=Math.floor(i%(r+1)),o=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,255&t,n>>24,n>>16&255,n>>8&255,255&n,s>>24,s>>16&255,s>>8&255,255&s,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 e.box(e.types.mvhd,o)},e.sdtp=function(t){var i,r,n=t.samples||[],s=new Uint8Array(4+n.length);for(i=0;i>>8&255),s.push(255&n),s=s.concat(Array.prototype.slice.call(r));for(i=0;i>>8&255),o.push(255&n),o=o.concat(Array.prototype.slice.call(r));var a=e.box(e.types.avcC,new Uint8Array([1,s[3],s[4],s[5],255,224|t.sps.length].concat(s).concat([t.pps.length]).concat(o))),l=t.width,c=t.height,u=t.pixelRatio[0],h=t.pixelRatio[1];return e.box(e.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,l>>8&255,255&l,c>>8&255,255&c,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]),a,e.box(e.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),e.box(e.types.pasp,new Uint8Array([u>>24,u>>16&255,u>>8&255,255&u,h>>24,h>>16&255,h>>8&255,255&h])))},e.esds=function(e){var t=e.config.length;return new Uint8Array([0,0,0,0,3,23+t,0,1,0,4,15+t,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([t]).concat(e.config).concat([6,1,2]))},e.mp4a=function(t){var i=t.samplerate;return e.box(e.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t.channelCount,0,16,0,0,0,0,i>>8&255,255&i,0,0]),e.box(e.types.esds,e.esds(t)))},e.mp3=function(t){var i=t.samplerate;return e.box(e.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t.channelCount,0,16,0,0,0,0,i>>8&255,255&i,0,0]))},e.stsd=function(t){return"audio"===t.type?t.isAAC||"mp3"!==t.codec?e.box(e.types.stsd,e.STSD,e.mp4a(t)):e.box(e.types.stsd,e.STSD,e.mp3(t)):e.box(e.types.stsd,e.STSD,e.avc1(t))},e.tkhd=function(t){var i=t.id,n=t.duration*t.timescale,s=t.width,o=t.height,a=Math.floor(n/(r+1)),l=Math.floor(n%(r+1));return e.box(e.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,i>>24&255,i>>16&255,i>>8&255,255&i,0,0,0,0,a>>24,a>>16&255,a>>8&255,255&a,l>>24,l>>16&255,l>>8&255,255&l,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,s>>8&255,255&s,0,0,o>>8&255,255&o,0,0]))},e.traf=function(t,i){var n=e.sdtp(t),s=t.id,o=Math.floor(i/(r+1)),a=Math.floor(i%(r+1));return e.box(e.types.traf,e.box(e.types.tfhd,new Uint8Array([0,0,0,0,s>>24,s>>16&255,s>>8&255,255&s])),e.box(e.types.tfdt,new Uint8Array([1,0,0,0,o>>24,o>>16&255,o>>8&255,255&o,a>>24,a>>16&255,a>>8&255,255&a])),e.trun(t,n.length+16+20+8+16+8+8),n)},e.trak=function(t){return t.duration=t.duration||4294967295,e.box(e.types.trak,e.tkhd(t),e.mdia(t))},e.trex=function(t){var i=t.id;return e.box(e.types.trex,new Uint8Array([0,0,0,0,i>>24,i>>16&255,i>>8&255,255&i,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},e.trun=function(t,i){var r,n,s,o,a,l,c=t.samples||[],u=c.length,h=12+16*u,d=new Uint8Array(h);for(i+=8+h,d.set([0,0,15,1,u>>>24&255,u>>>16&255,u>>>8&255,255&u,i>>>24&255,i>>>16&255,i>>>8&255,255&i],0),r=0;r>>24&255,s>>>16&255,s>>>8&255,255&s,o>>>24&255,o>>>16&255,o>>>8&255,255&o,a.isLeading<<2|a.dependsOn,a.isDependedOn<<6|a.hasRedundancy<<4|a.paddingValue<<1|a.isNonSync,61440&a.degradPrio,15&a.degradPrio,l>>>24&255,l>>>16&255,l>>>8&255,255&l],12+16*r);return e.box(e.types.trun,d)},e.initSegment=function(t){e.types||e.init();var i=e.moov(t),r=new Uint8Array(e.FTYP.byteLength+i.byteLength);return r.set(e.FTYP),r.set(i,e.FTYP.byteLength),r},e}();n.types=void 0,n.HDLR_TYPES=void 0,n.STTS=void 0,n.STSC=void 0,n.STCO=void 0,n.STSZ=void 0,n.VMHD=void 0,n.SMHD=void 0,n.STSD=void 0,n.FTYP=void 0,n.DINF=void 0,t.default=n},"./src/remux/mp4-remuxer.ts": /*!**********************************!*\ !*** ./src/remux/mp4-remuxer.ts ***! \**********************************/ /*! exports provided: default, normalizePts */function(e,t,i){"use strict";i.r(t),i.d(t,"default",(function(){return g})),i.d(t,"normalizePts",(function(){return v}));var r=i(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),n=i(/*! ./aac-helper */"./src/remux/aac-helper.ts"),s=i(/*! ./mp4-generator */"./src/remux/mp4-generator.ts"),o=i(/*! ../events */"./src/events.ts"),a=i(/*! ../errors */"./src/errors.ts"),l=i(/*! ../utils/logger */"./src/utils/logger.ts"),c=i(/*! ../types/loader */"./src/types/loader.ts"),u=i(/*! ../utils/timescale-conversion */"./src/utils/timescale-conversion.ts");function h(){return(h=Object.assign||function(e){for(var t=1;t0?e:i.pts}),e[0].pts);return t&&l.logger.debug("PTS rollover detected"),i},t.remux=function(e,t,i,r,n,s,o,a){var u,h,d,f,p,g,m=n,y=n,_=e.pid>-1,b=t.pid>-1,S=t.samples.length,C=e.samples.length>0,w=S>1;if((!_||C)&&(!b||w)||this.ISGenerated||o){this.ISGenerated||(d=this.generateIS(e,t,n));var k=this.isVideoContiguous,x=-1;if(w&&(x=function(e){for(var t=0;t0){l.logger.warn("[mp4-remuxer]: Dropped "+x+" out of "+S+" video samples due to a missing keyframe");var E=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(x),t.dropped+=x,y+=(t.samples[0].pts-E)/(t.timescale||9e4)}else-1===x&&(l.logger.warn("[mp4-remuxer]: No keyframe found out of "+S+" video samples"),g=!1);if(this.ISGenerated){if(C&&w){var T=this.getVideoStartPts(t.samples),L=(v(e.samples[0].pts,T)-T)/t.inputTimeScale;m+=Math.max(0,L),y+=Math.max(0,-L)}if(C){if(e.samplerate||(l.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),d=this.generateIS(e,t,n)),h=this.remuxAudio(e,m,this.isAudioContiguous,s,b||w||a===c.PlaylistLevelType.AUDIO?y:void 0),w){var A=h?h.endPTS-h.startPTS:0;t.inputTimeScale||(l.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),d=this.generateIS(e,t,n)),u=this.remuxVideo(t,y,k,A)}}else w&&(u=this.remuxVideo(t,y,k,0));u&&(u.firstKeyFrame=x,u.independent=-1!==x)}}return this.ISGenerated&&(i.samples.length&&(p=this.remuxID3(i,n)),r.samples.length&&(f=this.remuxText(r,n))),{audio:h,video:u,initSegment:d,independent:g,text:f,id3:p}},t.generateIS=function(e,t,i){var n,o,a,l=e.samples,c=t.samples,u=this.typeSupported,h={},d=!Object(r.isFiniteNumber)(this._initPTS),f="audio/mp4";if(d&&(n=o=1/0),e.config&&l.length&&(e.timescale=e.samplerate,e.isAAC||(u.mpeg?(f="audio/mpeg",e.codec=""):u.mp3&&(e.codec="mp3")),h.audio={id:"audio",container:f,codec:e.codec,initSegment:!e.isAAC&&u.mpeg?new Uint8Array(0):s.default.initSegment([e]),metadata:{channelCount:e.channelCount}},d&&(a=e.inputTimeScale,n=o=l[0].pts-Math.round(a*i))),t.sps&&t.pps&&c.length&&(t.timescale=t.inputTimeScale,h.video={id:"main",container:"video/mp4",codec:t.codec,initSegment:s.default.initSegment([t]),metadata:{width:t.width,height:t.height}},d)){a=t.inputTimeScale;var p=this.getVideoStartPts(c),g=Math.round(a*i);o=Math.min(o,v(c[0].dts,p)-g),n=Math.min(n,p-g)}if(Object.keys(h).length)return this.ISGenerated=!0,d&&(this._initPTS=n,this._initDTS=o),{tracks:h,initPTS:n,timescale:a}},t.remuxVideo=function(e,t,i,r){var n,c,f,g=e.inputTimeScale,y=e.samples,_=[],b=y.length,S=this._initPTS,C=this.nextAvcDts,w=8,k=Number.POSITIVE_INFINITY,x=Number.NEGATIVE_INFINITY,E=0,T=!1;i&&null!==C||(C=t*g-(y[0].pts-v(y[0].dts,y[0].pts)));for(var L=0;LA.pts&&(E=Math.max(Math.min(E,A.pts-A.dts),-18e3)),A.dts0?L-1:L].dts&&(T=!0)}T&&y.sort((function(e,t){var i=e.dts-t.dts,r=e.pts-t.pts;return i||r})),c=y[0].dts,f=y[y.length-1].dts;var R=Math.round((f-c)/(b-1));if(E<0){if(E<-2*R){l.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(u.toMsFromMpegTsClock)(-R,!0)+" ms");for(var D=E,O=0;OR;if(P||I<-1){P?l.logger.warn("AVC: "+Object(u.toMsFromMpegTsClock)(I,!0)+" ms ("+I+"dts) hole between fragments detected, filling it"):l.logger.warn("AVC: "+Object(u.toMsFromMpegTsClock)(-I,!0)+" ms ("+I+"dts) overlapping between fragments detected"),c=C;var F=y[0].pts-I;y[0].dts=c,y[0].pts=F,l.logger.log("Video: First PTS/DTS adjusted: "+Object(u.toMsFromMpegTsClock)(F,!0)+"/"+Object(u.toMsFromMpegTsClock)(c,!0)+", delta: "+Object(u.toMsFromMpegTsClock)(I,!0)+" ms")}}p&&(c=Math.max(0,c));for(var B=0,N=0,H=0;H0?q-1:q].dts;if(re.stretchShortVideoTrack&&null!==this.nextAudioPts){var se=Math.floor(re.maxBufferHole*g),oe=(r?k+r*g:this.nextAudioPts)-Q.pts;oe>se?((n=oe-ne)<0&&(n=ne),l.logger.log("[mp4-remuxer]: It is approximately "+oe/90+" ms to the next segment; using duration "+n/90+" ms for the last video frame.")):n=ne}else n=ne}var ae=Math.round(Q.pts-Q.dts);_.push(new m(Q.key,n,Z,ae))}if(_.length&&d&&d<70){var le=_[0].flags;le.dependsOn=2,le.isNonSync=0}console.assert(void 0!==n,"mp4SampleDuration must be computed"),this.nextAvcDts=C=f+n,this.isVideoContiguous=!0;var ce={data1:s.default.moof(e.sequenceNumber++,c,h({},e,{samples:_})),data2:z,startPTS:k/g,endPTS:(x+n)/g,startDTS:c/g,endDTS:C/g,type:"video",hasAudio:!1,hasVideo:!0,nb:_.length,dropped:e.dropped};return e.samples=[],e.dropped=0,console.assert(z.length,"MDAT length must not be zero"),ce},t.remuxAudio=function(e,t,i,r,c){var u=e.inputTimeScale,d=u/(e.samplerate?e.samplerate:u),f=e.isAAC?1024:1152,p=f*d,g=this._initPTS,y=!e.isAAC&&this.typeSupported.mpeg,_=[],b=e.samples,S=y?0:8,C=this.nextAudioPts||-1,w=t*u;if(this.isAudioContiguous=i=i||b.length&&C>0&&(r&&Math.abs(w-C)<9e3||Math.abs(v(b[0].pts-g,w)-C)<20*p),b.forEach((function(e){e.pts=v(e.pts-g,w)})),!i||C<0){if(!(b=b.filter((function(e){return e.pts>=0}))).length)return;C=0===c?0:r?Math.max(0,w):b[0].pts}if(e.isAAC)for(var k=void 0!==c,x=this.config.maxAudioFramesDrift,E=0,T=C;E=x*p&&D<1e4&&k){var O=Math.round(R/p);(T=A-O*p)<0&&(O--,T+=p),0===E&&(this.nextAudioPts=C=T),l.logger.warn("[mp4-remuxer]: Injecting "+O+" audio frame @ "+(T/u).toFixed(3)+"s due to "+Math.round(1e3*R/u)+" ms gap.");for(var M=0;M0))return;H+=S;try{F=new Uint8Array(H)}catch(e){return void this.observer.emit(o.Events.ERROR,o.Events.ERROR,{type:a.ErrorTypes.MUX_ERROR,details:a.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:H,reason:"fail allocating audio mdat "+H})}y||(new DataView(F.buffer).setUint32(0,H),F.set(s.default.types.mdat,4))}F.set(W,S);var G=W.byteLength;S+=G,_.push(new m(!0,f,G,0)),N=z}var V=_.length;if(V){var q=_[_.length-1];this.nextAudioPts=C=N+d*q.duration;var Q=y?new Uint8Array(0):s.default.moof(e.sequenceNumber++,B/d,h({},e,{samples:_}));e.samples=[];var Y=B/u,Z=C/u,$={data1:Q,data2:F,startPTS:Y,endPTS:Z,startDTS:Y,endDTS:Z,type:"audio",hasAudio:!0,hasVideo:!1,nb:V};return this.isAudioContiguous=!0,console.assert(F.length,"MDAT length must not be zero"),$}},t.remuxEmptyAudio=function(e,t,i,r){var s=e.inputTimeScale,o=s/(e.samplerate?e.samplerate:s),a=this.nextAudioPts,c=(null!==a?a:r.startDTS*s)+this._initDTS,u=r.endDTS*s+this._initDTS,h=1024*o,d=Math.ceil((u-c)/h),f=n.default.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);if(l.logger.warn("[mp4-remuxer]: remux empty Audio"),f){for(var p=[],g=0;g4294967296;)e+=i;return e}var m=function(e,t,i,r){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=t,this.size=i,this.cts=r,this.flags=new y(e)},y=function(e){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=e?2:1,this.isNonSync=e?0:1}},"./src/remux/passthrough-remuxer.ts": /*!******************************************!*\ !*** ./src/remux/passthrough-remuxer.ts ***! \******************************************/ /*! exports provided: default */function(e,t,i){"use strict";i.r(t);var r=i(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),n=i(/*! ../utils/mp4-tools */"./src/utils/mp4-tools.ts"),s=i(/*! ../loader/fragment */"./src/loader/fragment.ts"),o=i(/*! ../utils/logger */"./src/utils/logger.ts"),a=function(){function e(){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 t=e.prototype;return t.destroy=function(){},t.resetTimeStamp=function(e){this.initPTS=e,this.lastEndDTS=null},t.resetNextTimestamp=function(){this.lastEndDTS=null},t.resetInitSegment=function(e,t,i){this.audioCodec=t,this.videoCodec=i,this.generateInitSegment(e),this.emitInitSegment=!0},t.generateInitSegment=function(e){var t=this.audioCodec,i=this.videoCodec;if(!e||!e.byteLength)return this.initTracks=void 0,void(this.initData=void 0);var r=this.initData=Object(n.parseInitSegment)(e);t||(t=c(r.audio,s.ElementaryStreamTypes.AUDIO)),i||(i=c(r.video,s.ElementaryStreamTypes.VIDEO));var a={};r.audio&&r.video?a.audiovideo={container:"video/mp4",codec:t+","+i,initSegment:e,id:"main"}:r.audio?a.audio={container:"audio/mp4",codec:t,initSegment:e,id:"audio"}:r.video?a.video={container:"video/mp4",codec:i,initSegment:e,id:"main"}:o.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=a},t.remux=function(e,t,i,s,a){var c=this.initPTS,u=this.lastEndDTS,h={audio:void 0,video:void 0,text:s,id3:i,initSegment:void 0};Object(r.isFiniteNumber)(u)||(u=this.lastEndDTS=a||0);var d=t.samples;if(!d||!d.length)return h;var f={initPTS:void 0,timescale:1},p=this.initData;if(p&&p.length||(this.generateInitSegment(d),p=this.initData),!p||!p.length)return o.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),h;this.emitInitSegment&&(f.tracks=this.initTracks,this.emitInitSegment=!1),Object(r.isFiniteNumber)(c)||(this.initPTS=f.initPTS=c=l(p,d,u));var g=Object(n.getDuration)(d,p),v=u,m=g+v;Object(n.offsetStartDTS)(p,d,c),g>0?this.lastEndDTS=m:(o.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var y=!!p.audio,_=!!p.video,b="";y&&(b+="audio"),_&&(b+="video");var S={data1:d,startPTS:v,startDTS:v,endPTS:m,endDTS:m,type:b,hasAudio:y,hasVideo:_,nb:1,dropped:0};return h.audio="audio"===S.type?S:void 0,h.video="audio"!==S.type?S:void 0,h.text=s,h.id3=i,h.initSegment=f,h},e}(),l=function(e,t,i){return Object(n.getStartDTS)(e,t)-i};function c(e,t){var i=null==e?void 0:e.codec;return i&&i.length>4?i:"hvc1"===i?"hvc1.1.c.L120.90":"av01"===i?"av01.0.04M.08":"avc1"===i||t===s.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}t.default=a},"./src/task-loop.ts": /*!**************************!*\ !*** ./src/task-loop.ts ***! \**************************/ /*! exports provided: default */function(e,t,i){"use strict";i.r(t),i.d(t,"default",(function(){return r}));var r=function(){function e(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var t=e.prototype;return t.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},t.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},t.onHandlerDestroyed=function(){},t.hasInterval=function(){return!!this._tickInterval},t.hasNextTick=function(){return!!this._tickTimer},t.setInterval=function(e){return!this._tickInterval&&(this._tickInterval=self.setInterval(this._boundTick,e),!0)},t.clearInterval=function(){return!!this._tickInterval&&(self.clearInterval(this._tickInterval),this._tickInterval=null,!0)},t.clearNextTick=function(){return!!this._tickTimer&&(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0)},t.tick=function(){this._tickCallCount++,1===this._tickCallCount&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},t.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},t.doTick=function(){},e}()},"./src/types/cmcd.ts": /*!***************************!*\ !*** ./src/types/cmcd.ts ***! \***************************/ /*! exports provided: CMCDVersion, CMCDObjectType, CMCDStreamingFormat, CMCDStreamType */function(e,t,i){"use strict";i.r(t),i.d(t,"CMCDVersion",(function(){return o})),i.d(t,"CMCDObjectType",(function(){return r})),i.d(t,"CMCDStreamingFormat",(function(){return n})),i.d(t,"CMCDStreamType",(function(){return s}));var r,n,s,o=1;!function(e){e.MANIFEST="m",e.AUDIO="a",e.VIDEO="v",e.MUXED="av",e.INIT="i",e.CAPTION="c",e.TIMED_TEXT="tt",e.KEY="k",e.OTHER="o"}(r||(r={})),function(e){e.DASH="d",e.HLS="h",e.SMOOTH="s",e.OTHER="o"}(n||(n={})),function(e){e.VOD="v",e.LIVE="l"}(s||(s={}))},"./src/types/level.ts": /*!****************************!*\ !*** ./src/types/level.ts ***! \****************************/ /*! exports provided: HlsSkip, getSkipValue, HlsUrlParameters, Level */function(e,t,i){"use strict";function r(e,t){for(var i=0;iNumber.MAX_SAFE_INTEGER?1/0:t},t.hexadecimalInteger=function(e){if(this[e]){var t=(this[e]||"0x").slice(2);t=(1&t.length?"0":"")+t;for(var i=new Uint8Array(t.length/2),r=0;rNumber.MAX_SAFE_INTEGER?1/0:t},t.decimalFloatingPoint=function(e){return parseFloat(this[e])},t.optionalFloat=function(e,t){var i=this[e];return i?parseFloat(i):t},t.enumeratedString=function(e){return this[e]},t.bool=function(e){return"YES"===this[e]},t.decimalResolution=function(e){var t=r.exec(this[e]);if(null!==t)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}},e.parseAttrList=function(e){var t,i={};for(n.lastIndex=0;null!==(t=n.exec(e));){var r=t[2];0===r.indexOf('"')&&r.lastIndexOf('"')===r.length-1&&(r=r.slice(1,-1)),i[t[1]]=r}return i},e}()},"./src/utils/binary-search.ts": /*!************************************!*\ !*** ./src/utils/binary-search.ts ***! \************************************/ /*! exports provided: default */function(e,t,i){"use strict";i.r(t),t.default={search:function(e,t){for(var i=0,r=e.length-1,n=null,s=null;i<=r;){var o=t(s=e[n=(i+r)/2|0]);if(o>0)i=n+1;else{if(!(o<0))return s;r=n-1}}return null}}},"./src/utils/buffer-helper.ts": /*!************************************!*\ !*** ./src/utils/buffer-helper.ts ***! \************************************/ /*! exports provided: BufferHelper */function(e,t,i){"use strict";i.r(t),i.d(t,"BufferHelper",(function(){return s}));var r=i(/*! ./logger */"./src/utils/logger.ts"),n={length:0,start:function(){return 0},end:function(){return 0}},s=function(){function e(){}return e.isBuffered=function(t,i){try{if(t)for(var r=e.getBuffered(t),n=0;n=r.start(n)&&i<=r.end(n))return!0}catch(e){}return!1},e.bufferInfo=function(t,i,r){try{if(t){var n,s=e.getBuffered(t),o=[];for(n=0;no&&(r[s-1].end=e[n].end):r.push(e[n])}else r.push(e[n])}else r=e;for(var a,l=0,c=t,u=t,h=0;h=d&&t=e&&n.logger.log(this.time+" ["+e+"] "+t)},e}(),f=function(e){for(var t=[],i=0;i100&&(this.logger.log(r.DEBUG,"Too large cursor position "+this.pos),this.pos=100)},t.moveCursor=function(e){var t=this.pos+e;if(e>1)for(var i=this.pos+1;i=144&&this.backSpace();var t=o(e);this.pos>=100?this.logger.log(r.ERROR,"Cannot insert "+e.toString(16)+" ("+t+") at position "+this.pos+". Skipping it!"):(this.chars[this.pos].setChar(t,this.currPenState),this.moveCursor(1))},t.clearFromPos=function(e){var t;for(t=e;t<100;t++)this.chars[t].reset()},t.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},t.clearToEndOfRow=function(){this.clearFromPos(this.pos)},t.getTextString=function(){for(var e=[],t=!0,i=0;i<100;i++){var r=this.chars[i].uchar;" "!==r&&(t=!1),e.push(r)}return t?"":e.join("")},t.setPenStyles=function(e){this.currPenState.setStyles(e),this.chars[this.pos].setPenState(this.currPenState)},e}(),m=function(){function e(e){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var t=0;t<15;t++)this.rows.push(new v(e));this.logger=e,this.currRow=14,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var t=e.prototype;return t.reset=function(){for(var e=0;e<15;e++)this.rows[e].clear();this.currRow=14},t.equals=function(e){for(var t=!0,i=0;i<15;i++)if(!this.rows[i].equals(e.rows[i])){t=!1;break}return t},t.copy=function(e){for(var t=0;t<15;t++)this.rows[t].copy(e.rows[t])},t.isEmpty=function(){for(var e=!0,t=0;t<15;t++)if(!this.rows[t].isEmpty()){e=!1;break}return e},t.backSpace=function(){this.rows[this.currRow].backSpace()},t.clearToEndOfRow=function(){this.rows[this.currRow].clearToEndOfRow()},t.insertChar=function(e){this.rows[this.currRow].insertChar(e)},t.setPen=function(e){this.rows[this.currRow].setPenStyles(e)},t.moveCursor=function(e){this.rows[this.currRow].moveCursor(e)},t.setCursor=function(e){this.logger.log(r.INFO,"setCursor: "+e),this.rows[this.currRow].setCursor(e)},t.setPAC=function(e){this.logger.log(r.INFO,"pacData = "+JSON.stringify(e));var t=e.row-1;if(this.nrRollUpRows&&t0&&(i=e?"["+t.join(" | ")+"]":t.join("\n")),i},t.getTextAndFormat=function(){return this.rows},e}(),y=function(){function e(e,t,i){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=e,this.outputFilter=t,this.mode=null,this.verbose=0,this.displayedMemory=new m(i),this.nonDisplayedMemory=new m(i),this.lastOutputScreen=new m(i),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=i}var t=e.prototype;return t.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},t.getHandler=function(){return this.outputFilter},t.setHandler=function(e){this.outputFilter=e},t.setPAC=function(e){this.writeScreen.setPAC(e)},t.setBkgData=function(e){this.writeScreen.setBkgData(e)},t.setMode=function(e){e!==this.mode&&(this.mode=e,this.logger.log(r.INFO,"MODE="+e),"MODE_POP-ON"===this.mode?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),"MODE_ROLL-UP"!==this.mode&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=e)},t.insertChars=function(e){for(var t=0;t=46,t.italics)t.foreground="white";else{var i=Math.floor(e/2)-16;t.foreground=["white","green","blue","cyan","red","yellow","magenta"][i]}this.logger.log(r.INFO,"MIDROW: "+JSON.stringify(t)),this.writeScreen.setPen(t)},t.outputDataUpdate=function(e){void 0===e&&(e=!1);var t=this.logger.time;null!==t&&this.outputFilter&&(null!==this.cueStartTime||this.displayedMemory.isEmpty()?this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,t,this.lastOutputScreen),e&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:t):this.cueStartTime=t,this.lastOutputScreen.copy(this.displayedMemory))},t.cueSplitAtTime=function(e){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,e,this.displayedMemory),this.cueStartTime=e))},e}(),_=function(){function e(e,t,i){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var r=new d;this.channels=[null,new y(e,t,r),new y(e+1,i,r)],this.cmdHistory={a:null,b:null},this.logger=r}var t=e.prototype;return t.getHandler=function(e){return this.channels[e].getHandler()},t.setHandler=function(e,t){this.channels[e].setHandler(t)},t.addData=function(e,t){var i,n,s,o=!1;this.logger.time=e;for(var a=0;a ("+f([n,s])+")"),(i=this.parseCmd(n,s))||(i=this.parseMidrow(n,s)),i||(i=this.parsePAC(n,s)),i||(i=this.parseBackgroundAttributes(n,s)),!i&&(o=this.parseChars(n,s))){var l=this.currentChannel;l&&l>0?this.channels[l].insertChars(o):this.logger.log(r.WARNING,"No channel found yet. TEXT-MODE?")}i||o||this.logger.log(r.WARNING,"Couldn't parse cleaned data "+f([n,s])+" orig: "+f([t[a],t[a+1]]))}},t.parseCmd=function(e,t){var i=this.cmdHistory;if(!((20===e||28===e||21===e||29===e)&&t>=32&&t<=47||(23===e||31===e)&&t>=33&&t<=35))return!1;if(S(e,t,i))return b(null,null,i),this.logger.log(r.DEBUG,"Repeated command ("+f([e,t])+") is dropped"),!0;var n=20===e||21===e||23===e?1:2,s=this.channels[n];return 20===e||21===e||28===e||29===e?32===t?s.ccRCL():33===t?s.ccBS():34===t?s.ccAOF():35===t?s.ccAON():36===t?s.ccDER():37===t?s.ccRU(2):38===t?s.ccRU(3):39===t?s.ccRU(4):40===t?s.ccFON():41===t?s.ccRDC():42===t?s.ccTR():43===t?s.ccRTD():44===t?s.ccEDM():45===t?s.ccCR():46===t?s.ccENM():47===t&&s.ccEOC():s.ccTO(t-32),b(e,t,i),this.currentChannel=n,!0},t.parseMidrow=function(e,t){var i=0;if((17===e||25===e)&&t>=32&&t<=47){if((i=17===e?1:2)!==this.currentChannel)return this.logger.log(r.ERROR,"Mismatch channel in midrow parsing"),!1;var n=this.channels[i];return!!n&&(n.ccMIDROW(t),this.logger.log(r.DEBUG,"MIDROW ("+f([e,t])+")"),!0)}return!1},t.parsePAC=function(e,t){var i,r=this.cmdHistory;if(!((e>=17&&e<=23||e>=25&&e<=31)&&t>=64&&t<=127||(16===e||24===e)&&t>=64&&t<=95))return!1;if(S(e,t,r))return b(null,null,r),!0;var n=e<=23?1:2;i=t>=64&&t<=95?1===n?a[e]:c[e]:1===n?l[e]:u[e];var s=this.channels[n];return!!s&&(s.setPAC(this.interpretPAC(i,t)),b(e,t,r),this.currentChannel=n,!0)},t.interpretPAC=function(e,t){var i,r={color:null,italics:!1,indent:null,underline:!1,row:e};return i=t>95?t-96:t-64,r.underline=1==(1&i),i<=13?r.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(i/2)]:i<=15?(r.italics=!0,r.color="white"):r.indent=4*Math.floor((i-16)/2),r},t.parseChars=function(e,t){var i,n,s=null,a=null;if(e>=25?(i=2,a=e-8):(i=1,a=e),a>=17&&a<=19?(n=17===a?t+80:18===a?t+112:t+144,this.logger.log(r.INFO,"Special char '"+o(n)+"' in channel "+i),s=[n]):e>=32&&e<=127&&(s=0===t?[e]:[e,t]),s){var l=f(s);this.logger.log(r.DEBUG,"Char codes = "+l.join(",")),b(e,t,this.cmdHistory)}return s},t.parseBackgroundAttributes=function(e,t){var i;if(!((16===e||24===e)&&t>=32&&t<=47||(23===e||31===e)&&t>=45&&t<=47))return!1;var r={};16===e||24===e?(i=Math.floor((t-32)/2),r.background=h[i],t%2==1&&(r.background=r.background+"_semi")):45===t?r.background="transparent":(r.foreground="black",47===t&&(r.underline=!0));var n=e<=23?1:2;return this.channels[n].setBkgData(r),b(e,t,this.cmdHistory),!0},t.reset=function(){for(var e=0;e=16?h--:h++;var m=Object(r.fixLineBreaks)(d.trim()),y=Object(n.generateCueId)(t,i,m);e&&e.cues&&e.cues.getCueById(y)||((c=new p(t,i,m)).id=y,c.line=g+1,c.align="left",c.position=10+Math.min(80,10*Math.floor(8*h/32)),f.push(c))}return e&&f.length&&(f.sort((function(e,t){return"auto"===e.line||"auto"===t.line?0:e.line>8&&t.line>8?t.line-e.line:e.line-t.line})),f.forEach((function(t){return Object(s.addCueToTrack)(e,t)}))),f}};t.default=a},"./src/utils/discontinuities.ts": /*!**************************************!*\ !*** ./src/utils/discontinuities.ts ***! \**************************************/ /*! exports provided: findFirstFragWithCC, shouldAlignOnDiscontinuities, findDiscontinuousReferenceFrag, adjustSlidingStart, alignStream, alignPDT, alignFragmentByPDTDelta, alignMediaPlaylistByPDT */function(e,t,i){"use strict";i.r(t),i.d(t,"findFirstFragWithCC",(function(){return o})),i.d(t,"shouldAlignOnDiscontinuities",(function(){return a})),i.d(t,"findDiscontinuousReferenceFrag",(function(){return l})),i.d(t,"adjustSlidingStart",(function(){return u})),i.d(t,"alignStream",(function(){return h})),i.d(t,"alignPDT",(function(){return d})),i.d(t,"alignFragmentByPDTDelta",(function(){return f})),i.d(t,"alignMediaPlaylistByPDT",(function(){return p}));var r=i(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),n=i(/*! ./logger */"./src/utils/logger.ts"),s=i(/*! ../controller/level-helper */"./src/controller/level-helper.ts");function o(e,t){for(var i=null,r=0,n=e.length;ri.startCC||e&&e.cc=this.minWeight_},t.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},t.destroy=function(){},e}();t.default=n},"./src/utils/ewma.ts": /*!***************************!*\ !*** ./src/utils/ewma.ts ***! \***************************/ /*! exports provided: default */function(e,t,i){"use strict";i.r(t);var r=function(){function e(e,t,i){void 0===t&&(t=0),void 0===i&&(i=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=e,this.alpha_=e?Math.exp(Math.log(.5)/e):0,this.estimate_=t,this.totalWeight_=i}var t=e.prototype;return t.sample=function(e,t){var i=Math.pow(this.alpha_,e);this.estimate_=t*(1-i)+i*this.estimate_,this.totalWeight_+=e},t.getTotalWeight=function(){return this.totalWeight_},t.getEstimate=function(){if(this.alpha_){var e=1-Math.pow(this.alpha_,this.totalWeight_);if(e)return this.estimate_/e}return this.estimate_},e}();t.default=r},"./src/utils/fetch-loader.ts": /*!***********************************!*\ !*** ./src/utils/fetch-loader.ts ***! \***********************************/ /*! exports provided: fetchSupported, default */function(e,t,i){"use strict";i.r(t),i.d(t,"fetchSupported",(function(){return d}));var r=i(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),n=i(/*! ../loader/load-stats */"./src/loader/load-stats.ts"),s=i(/*! ../demux/chunk-cache */"./src/demux/chunk-cache.ts");function o(e){var t="function"==typeof Map?new Map:void 0;return(o=function(e){if(null===e||(i=e,-1===Function.toString.call(i).indexOf("[native code]")))return e;var i;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return a(e,arguments,u(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),c(r,e)})(e)}function a(e,t,i){return(a=l()?Reflect.construct:function(e,t,i){var r=[null];r.push.apply(r,t);var n=new(Function.bind.apply(e,r));return i&&c(n,i.prototype),n}).apply(null,arguments)}function l(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function c(e,t){return(c=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function u(e){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function h(){return(h=Object.assign||function(e){for(var t=1;t=r&&n(t,i,o.flush(),e)):n(t,i,l,e),s()})).catch((function(){return Promise.reject()}))}()},e}();function p(e,t){return new self.Request(e.url,t)}var g=function(e){var t,i;function r(t,i,r){var n;return(n=e.call(this,t)||this).code=void 0,n.details=void 0,n.code=i,n.details=r,n}return i=e,(t=r).prototype=Object.create(i.prototype),t.prototype.constructor=t,c(t,i),r}(o(Error));t.default=f},"./src/utils/imsc1-ttml-parser.ts": /*!****************************************!*\ !*** ./src/utils/imsc1-ttml-parser.ts ***! \****************************************/ /*! exports provided: IMSC1_CODEC, parseIMSC1 */function(e,t,i){"use strict";i.r(t),i.d(t,"IMSC1_CODEC",(function(){return u})),i.d(t,"parseIMSC1",(function(){return p}));var r=i(/*! ./mp4-tools */"./src/utils/mp4-tools.ts"),n=i(/*! ./vttparser */"./src/utils/vttparser.ts"),s=i(/*! ./vttcue */"./src/utils/vttcue.ts"),o=i(/*! ../demux/id3 */"./src/demux/id3.ts"),a=i(/*! ./timescale-conversion */"./src/utils/timescale-conversion.ts"),l=i(/*! ./webvtt-parser */"./src/utils/webvtt-parser.ts");function c(){return(c=Object.assign||function(e){for(var t=1;t"):r}function a(e){if(self.console&&!0===e||"object"==typeof e){!function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r>24,e[t+1]=i>>16&255,e[t+2]=i>>8&255,e[t+3]=255&i}function h(e,t){var i,r,n,s=[];if(!t.length)return s;"data"in e?(i=e.data,r=e.start,n=e.end):(r=0,n=(i=e).byteLength);for(var l=r;l1?l+u:n;if(a(i.subarray(l+4,l+8))===t[0])if(1===t.length)s.push({data:i,start:l+8,end:d});else{var f=h({data:i,start:l+8,end:d},t.slice(1));f.length&&o.apply(s,f)}l=d}return s}function d(e){var t=h(e,["moov"])[0],i=t?t.end:null,r=h(e,["sidx"]);if(!r||!r[0])return null;var n=[],s=r[0],o=s.data[0],a=0===o?8:16,u=c(s,a);a+=4,a+=0===o?8:16,a+=2;var d=s.end+0,f=l(s,a);a+=2;for(var p=0;p>>31)return console.warn("SIDX has hierarchical references (not supported)"),null;var y=c(s,g);g+=4,n.push({referenceSize:m,subsegmentDuration:y,info:{duration:y/u,start:d,end:d+m-1}}),d+=m,a=g+=4}return{earliestPresentationTime:0,timescale:u,version:o,referencesCount:f,references:n,moovEndOffset:i}}function f(e){for(var t=[],i=h(e,["moov","trak"]),r=0;re)&&(this.startTime=e),this.endTime=t,this.screen=i,this.timelineController.createCaptionsTrack(this.trackName)},t.reset=function(){this.cueRanges=[]},e}()},"./src/utils/texttrack-utils.ts": /*!**************************************!*\ !*** ./src/utils/texttrack-utils.ts ***! \**************************************/ /*! exports provided: sendAddTrackEvent, addCueToTrack, clearCurrentCues, removeCuesInRange, getCuesInRange */function(e,t,i){"use strict";i.r(t),i.d(t,"sendAddTrackEvent",(function(){return n})),i.d(t,"addCueToTrack",(function(){return s})),i.d(t,"clearCurrentCues",(function(){return o})),i.d(t,"removeCuesInRange",(function(){return a})),i.d(t,"getCuesInRange",(function(){return l}));var r=i(/*! ./logger */"./src/utils/logger.ts");function n(e,t){var i;try{i=new Event("addtrack")}catch(e){(i=document.createEvent("Event")).initEvent("addtrack",!1,!1)}i.track=e,t.dispatchEvent(i)}function s(e,t){var i=e.mode;if("disabled"===i&&(e.mode="hidden"),e.cues&&!e.cues.getCueById(t.id))try{if(e.addCue(t),!e.cues.getCueById(t.id))throw new Error("addCue is failed for: "+t)}catch(i){r.logger.debug("[texttrack-utils]: "+i);var n=new self.TextTrackCue(t.startTime,t.endTime,t.text);n.id=t.id,e.addCue(n)}"disabled"===i&&(e.mode=i)}function o(e){var t=e.mode;if("disabled"===t&&(e.mode="hidden"),e.cues)for(var i=e.cues.length;i--;)e.removeCue(e.cues[i]);"disabled"===t&&(e.mode=t)}function a(e,t,i){var r=e.mode;if("disabled"===r&&(e.mode="hidden"),e.cues&&e.cues.length>0)for(var n=l(e.cues,t,i),s=0;se[i].endTime)return-1;for(var r=0,n=i;r<=n;){var s=Math.floor((n+r)/2);if(te[s].startTime&&r-1)for(var s=n,o=e.length;s=t&&a.endTime<=i)r.push(a);else if(a.startTime>i)return r}return r}},"./src/utils/time-ranges.ts": /*!**********************************!*\ !*** ./src/utils/time-ranges.ts ***! \**********************************/ /*! exports provided: default */function(e,t,i){"use strict";i.r(t),t.default={toString:function(e){for(var t="",i=e.length,r=0;r1?t-1:0),r=1;r100)throw new Error("Position must be between 0 and 100.");_=e,this.hasBeenReset=!0}})),Object.defineProperty(a,"positionAlign",n({},l,{get:function(){return b},set:function(e){var t=r(e);if(!t)throw new SyntaxError("An invalid or illegal string was specified.");b=t,this.hasBeenReset=!0}})),Object.defineProperty(a,"size",n({},l,{get:function(){return S},set:function(e){if(e<0||e>100)throw new Error("Size must be between 0 and 100.");S=e,this.hasBeenReset=!0}})),Object.defineProperty(a,"align",n({},l,{get:function(){return C},set:function(e){var t=r(e);if(!t)throw new SyntaxError("An invalid or illegal string was specified.");C=t,this.hasBeenReset=!0}})),a.displayState=void 0}return s.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},s}()},"./src/utils/vttparser.ts": /*!********************************!*\ !*** ./src/utils/vttparser.ts ***! \********************************/ /*! exports provided: parseTimeStamp, fixLineBreaks, VTTParser */function(e,t,i){"use strict";i.r(t),i.d(t,"parseTimeStamp",(function(){return s})),i.d(t,"fixLineBreaks",(function(){return h})),i.d(t,"VTTParser",(function(){return d}));var r=i(/*! ./vttcue */"./src/utils/vttcue.ts"),n=function(){function e(){}return e.prototype.decode=function(e,t){if(!e)return"";if("string"!=typeof e)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))},e}();function s(e){function t(e,t,i,r){return 3600*(0|e)+60*(0|t)+(0|i)+parseFloat(r||0)}var i=e.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return i?parseFloat(i[2])>59?t(i[2],i[3],0,i[4]):t(i[1],i[2],i[3],i[4]):null}var o=function(){function e(){this.values=Object.create(null)}var t=e.prototype;return t.set=function(e,t){this.get(e)||""===t||(this.values[e]=t)},t.get=function(e,t,i){return i?this.has(e)?this.values[e]:t[i]:this.has(e)?this.values[e]:t},t.has=function(e){return e in this.values},t.alt=function(e,t,i){for(var r=0;r=0&&i<=100)return this.set(e,i),!0}return!1},e}();function a(e,t,i,r){var n=r?e.split(r):[e];for(var s in n)if("string"==typeof n[s]){var o=n[s].split(i);2===o.length&&t(o[0],o[1])}}var l=new r.default(0,0,""),c="middle"===l.align?"middle":"center";function u(e,t,i){var r=e;function n(){var t=s(e);if(null===t)throw new Error("Malformed timestamp: "+r);return e=e.replace(/^[^\sa-zA-Z-]+/,""),t}function u(){e=e.replace(/^\s+/,"")}if(u(),t.startTime=n(),u(),"--\x3e"!==e.substr(0,3))throw new Error("Malformed time stamp (time stamps must be separated by '--\x3e'): "+r);e=e.substr(3),u(),t.endTime=n(),u(),function(e,t){var r=new o;a(e,(function(e,t){var n;switch(e){case"region":for(var s=i.length-1;s>=0;s--)if(i[s].id===t){r.set(e,i[s].region);break}break;case"vertical":r.alt(e,t,["rl","lr"]);break;case"line":n=t.split(","),r.integer(e,n[0]),r.percent(e,n[0])&&r.set("snapToLines",!1),r.alt(e,n[0],["auto"]),2===n.length&&r.alt("lineAlign",n[1],["start",c,"end"]);break;case"position":n=t.split(","),r.percent(e,n[0]),2===n.length&&r.alt("positionAlign",n[1],["start",c,"end","line-left","line-right","auto"]);break;case"size":r.percent(e,t);break;case"align":r.alt(e,t,["start",c,"end","left","right"])}}),/:/,/\s/),t.region=r.get("region",null),t.vertical=r.get("vertical","");var n=r.get("line","auto");"auto"===n&&-1===l.line&&(n=-1),t.line=n,t.lineAlign=r.get("lineAlign","start"),t.snapToLines=r.get("snapToLines",!0),t.size=r.get("size",100),t.align=r.get("align",c);var s=r.get("position","auto");"auto"===s&&50===l.position&&(s="start"===t.align||"left"===t.align?0:"end"===t.align||"right"===t.align?100:50),t.position=s}(e,t)}function h(e){return e.replace(//gi,"\n")}var d=function(){function e(){this.state="INITIAL",this.buffer="",this.decoder=new n,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var t=e.prototype;return t.parse=function(e){var t=this;function i(){var e=t.buffer,i=0;for(e=h(e);i>>0).toString()};function h(e,t,i){return u(e.toString())+u(t.toString())+u(i)}function d(e,t,i,u,d,f,p,g){var v,m=new n.VTTParser,y=Object(s.utf8ArrayToStr)(new Uint8Array(e)).trim().replace(l,"\n").split("\n"),_=[],b=Object(o.toMpegTsClockFromTimescale)(t,i),S="00:00.000",C=0,w=0,k=!0,x=!1;m.oncue=function(e){var t=u[d],i=u.ccOffset,r=(C-b)/9e4;if(null!=t&&t.new&&(void 0!==w?i=u.ccOffset=t.start:function(e,t,i){var r=e[t],n=e[r.prevCC];if(!n||!n.new&&r.new)return e.ccOffset=e.presentationOffset=r.start,void(r.new=!1);for(;null!==(s=n)&&void 0!==s&&s.new;){var s;e.ccOffset+=r.start-n.start,r.new=!1,n=e[(r=n).prevCC]}e.presentationOffset=i}(u,d,r)),r&&(i=r-u.presentationOffset),x){var n=e.endTime-e.startTime,s=Object(a.normalizePts)(9e4*(e.startTime+i-w),9e4*f)/9e4;e.startTime=s,e.endTime=s+n}var o=e.text.trim();e.text=decodeURIComponent(encodeURIComponent(o)),e.id||(e.id=h(e.startTime,e.endTime,o)),e.endTime>0&&_.push(e)},m.onparsingerror=function(e){v=e},m.onflush=function(){v?g(v):p(_)},y.forEach((function(e){if(k){if(c(e,"X-TIMESTAMP-MAP=")){k=!1,x=!0,e.substr(16).split(",").forEach((function(e){c(e,"LOCAL:")?S=e.substr(6):c(e,"MPEGTS:")&&(C=parseInt(e.substr(7)))}));try{w=function(e){var t=parseInt(e.substr(-3)),i=parseInt(e.substr(-6,2)),n=parseInt(e.substr(-9,2)),s=e.length>9?parseInt(e.substr(0,e.indexOf(":"))):0;if(!(Object(r.isFiniteNumber)(t)&&Object(r.isFiniteNumber)(i)&&Object(r.isFiniteNumber)(n)&&Object(r.isFiniteNumber)(s)))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+e);return t+=1e3*i,t+=6e4*n,t+=36e5*s}(S)/1e3}catch(e){x=!1,v=e}return}""===e&&(k=!1)}m.parse(e+"\n")})),m.flush()}},"./src/utils/xhr-loader.ts": /*!*********************************!*\ !*** ./src/utils/xhr-loader.ts ***! \*********************************/ /*! exports provided: default */function(e,t,i){"use strict";i.r(t);var r=i(/*! ../utils/logger */"./src/utils/logger.ts"),n=i(/*! ../loader/load-stats */"./src/loader/load-stats.ts"),s=/^age:\s*[\d.]+\s*$/m,o=function(){function e(e){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=e?e.xhrSetup:null,this.stats=new n.LoadStats,this.retryDelay=0}var t=e.prototype;return t.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},t.abortInternal=function(){var e=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),e&&(e.onreadystatechange=null,e.onprogress=null,4!==e.readyState&&(this.stats.aborted=!0,e.abort()))},t.abort=function(){var e;this.abortInternal(),null!==(e=this.callbacks)&&void 0!==e&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},t.load=function(e,t,i){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=e,this.config=t,this.callbacks=i,this.retryDelay=t.retryDelay,this.loadInternal()},t.loadInternal=function(){var e=this.config,t=this.context;if(e){var i=this.loader=new self.XMLHttpRequest,r=this.stats;r.loading.first=0,r.loaded=0;var n=this.xhrSetup;try{if(n)try{n(i,t.url)}catch(e){i.open("GET",t.url,!0),n(i,t.url)}i.readyState||i.open("GET",t.url,!0);var s=this.context.headers;if(s)for(var o in s)i.setRequestHeader(o,s[o])}catch(e){return void this.callbacks.onError({code:i.status,text:e.message},t,i)}t.rangeEnd&&i.setRequestHeader("Range","bytes="+t.rangeStart+"-"+(t.rangeEnd-1)),i.onreadystatechange=this.readystatechange.bind(this),i.onprogress=this.loadprogress.bind(this),i.responseType=t.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),e.timeout),i.send()}},t.readystatechange=function(){var e=this.context,t=this.loader,i=this.stats;if(e&&t){var n=t.readyState,s=this.config;if(!i.aborted&&n>=2)if(self.clearTimeout(this.requestTimeout),0===i.loading.first&&(i.loading.first=Math.max(self.performance.now(),i.loading.start)),4===n){t.onreadystatechange=null,t.onprogress=null;var o=t.status;if(o>=200&&o<300){var a,l;if(i.loading.end=Math.max(self.performance.now(),i.loading.first),l="arraybuffer"===e.responseType?(a=t.response).byteLength:(a=t.responseText).length,i.loaded=i.total=l,!this.callbacks)return;var c=this.callbacks.onProgress;if(c&&c(i,e,a,t),!this.callbacks)return;var u={url:t.responseURL,data:a};this.callbacks.onSuccess(u,i,e,t)}else i.retry>=s.maxRetry||o>=400&&o<499?(r.logger.error(o+" while loading "+e.url),this.callbacks.onError({code:o,text:t.statusText},e,t)):(r.logger.warn(o+" while loading "+e.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),i.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),s.timeout)}},t.loadtimeout=function(){r.logger.warn("timeout while loading "+this.context.url);var e=this.callbacks;e&&(this.abortInternal(),e.onTimeout(this.stats,this.context,this.loader))},t.loadprogress=function(e){var t=this.stats;t.loaded=e.loaded,e.lengthComputable&&(t.total=e.total)},t.getCacheAge=function(){var e=null;if(this.loader&&s.test(this.loader.getAllResponseHeaders())){var t=this.loader.getResponseHeader("age");e=t?parseFloat(t):null}return e},e}();t.default=o}}).default},e.exports=r())},vHTk: /*!******************************************************!*\ !*** ./src/components/PreviewAll/index.less?modules ***! \******************************************************/ /*! no static exports found */ /*! exports used: default */ /*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,i){e.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}},vewr: /*!******************************************************!*\ !*** ./node_modules/@novnc/novnc/lib/util/events.js ***! \******************************************************/ /*! no static exports found */ /*! all exports used */ /*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getPointerEvent=function(e){return e.changedTouches?e.changedTouches[0]:e.touches?e.touches[0]:e},t.stopEvent=function(e){e.stopPropagation(),e.preventDefault()},t.setCapture=function(e){if(e.setCapture)e.setCapture(),document.captureElement=e,e.addEventListener("mouseup",l);else{l();var t=document.getElementById("noVNC_mouse_capture_elem");null===t&&((t=document.createElement("div")).id="noVNC_mouse_capture_elem",t.style.position="fixed",t.style.top="0px",t.style.left="0px",t.style.width="100%",t.style.height="100%",t.style.zIndex=1e4,t.style.display="none",document.body.appendChild(t),t.addEventListener("contextmenu",s),t.addEventListener("mousemove",s),t.addEventListener("mouseup",s)),document.captureElement=e,a.observe(e,{attributes:!0}),o(),t.style.display="",window.addEventListener("mousemove",s),window.addEventListener("mouseup",s)}},t.releaseCapture=l;var r=!1,n=null;function s(e){if(!r){var t=new e.constructor(e.type,e);r=!0,document.captureElement?document.captureElement.dispatchEvent(t):n.dispatchEvent(t),r=!1,e.stopPropagation(),t.defaultPrevented&&e.preventDefault(),"mouseup"===e.type&&l()}}function o(){document.getElementById("noVNC_mouse_capture_elem").style.cursor=window.getComputedStyle(document.captureElement).cursor}document.captureElement=null;var a=new MutationObserver(o);function l(){if(document.releaseCapture)document.releaseCapture(),document.captureElement=null;else{if(!document.captureElement)return;n=document.captureElement,document.captureElement=null,a.disconnect(),document.getElementById("noVNC_mouse_capture_elem").style.display="none",window.removeEventListener("mousemove",s),window.removeEventListener("mouseup",s)}}},whVF: /*!***************************************************!*\ !*** ./node_modules/@novnc/novnc/lib/deflator.js ***! \***************************************************/ /*! no static exports found */ /*! all exports used */ /*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r,n=i(/*! ../lib/vendor/pako/lib/zlib/deflate.js */"lNSK"),s=(r=i(/*! ../lib/vendor/pako/lib/zlib/zstream.js */"1q3G"))&&r.__esModule?r:{default:r};function o(e,t){for(var i=0;i0){var r=[i],s=i.length;do{if(this.strm.output=new Uint8Array(this.chunkSize),this.strm.next_out=0,this.strm.avail_out=this.chunkSize,(t=(0,n.deflate)(this.strm,n.Z_FULL_FLUSH))<0)throw new Error("zlib deflate failed");var o=new Uint8Array(this.strm.output.buffer,0,this.strm.next_out);s+=o.length,r.push(o)}while(this.strm.avail_in>0);for(var a=new Uint8Array(s),l=0,c=0;c>>16&65535|0,o=0;for(;0!==i;){i-=o=i>2e3?2e3:i;do{n=n+t[r++]|0,s=s+n|0}while(--o);n%=65521,s%=65521}return n|s<<16|0}}}]);