gotty/js/dist/gotty-bundle.js

88 lines
325 KiB
JavaScript
Raw Normal View History

!function(e){function t(i){if(r[i])return r[i].exports;var o=r[i]={i:i,l:!1,exports:{}};return e[i].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var r={};t.m=e,t.c=r,t.i=function(e){return e},t.d=function(e,r,i){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:i})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=28)}([function(e,t,r){"use strict";function i(e){var t=this;if(!(this instanceof i))return new i(arguments[0],arguments[1],arguments[2]);t.browser=S,t.cancel=i.cancel,u.EventEmitter.call(this),"number"==typeof e&&(e={cols:arguments[0],rows:arguments[1],handler:arguments[2]}),e=e||{},Object.keys(i.defaults).forEach(function(r){null==e[r]&&(e[r]=i.options[r],i[r]!==i.defaults[r]&&(e[r]=i[r])),t[r]=e[r]}),8===e.colors.length?e.colors=e.colors.concat(i._colors.slice(8)):16===e.colors.length?e.colors=e.colors.concat(i._colors.slice(16)):10===e.colors.length?e.colors=e.colors.slice(0,-2).concat(i._colors.slice(8,-2),e.colors.slice(-2)):18===e.colors.length&&(e.colors=e.colors.concat(i._colors.slice(16,-2),e.colors.slice(-2))),this.colors=e.colors,this.options=e,this.parent=e.body||e.parent||(A?A.getElementsByTagName("body")[0]:null),this.cols=e.cols||e.geometry[0],this.rows=e.rows||e.geometry[1],this.geometry=[this.cols,this.rows],e.handler&&this.on("data",e.handler),this.ybase=0,this.ydisp=0,this.x=0,this.y=0,this.cursorState=0,this.cursorHidden=!1,this.convertEol,this.queue="",this.scrollTop=0,this.scrollBottom=this.rows-1,this.customKeyEventHandler=null,this.cursorBlinkInterval=null,this.applicationKeypad=!1,this.applicationCursor=!1,this.originMode=!1,this.insertMode=!1,this.wraparoundMode=!0,this.normal=null,this.charset=null,this.gcharset=null,this.glevel=0,this.charsets=[null],this.decLocator,this.x10Mouse,this.vt200Mouse,this.vt300Mouse,this.normalMouse,this.mouseEvents,this.sendFocus,this.utfMouse,this.sgrMouse,this.urxvtMouse,this.element,this.children,this.refreshStart,this.refreshEnd,this.savedX,this.savedY,this.savedCols,this.readable=!0,this.writable=!0,this.defAttr=131840,this.curAttr=this.defAttr,this.params=[],this.currentParam=0,this.prefix="",this.postfix="",this.inputHandler=new m.InputHandler(this),this.parser=new y.Parser(this.inputHandler,this),this.renderer=this.renderer||null,this.selectionManager=this.selectionManager||null,this.linkifier=this.linkifier||new _.Linkifier,this.writeBuffer=[],this.writeInProgress=!1,this.xoffSentToCatchUp=!1,this.writeStopped=!1,this.surrogate_high="",this.lines=new f.CircularList(this.scrollback);for(var r=this.rows;r--;)this.lines.push(this.blankLine());this.selectionManager&&this.selectionManager.setBuffer(this.lines),this.tabs,this.setupStops(),this.userScrolling=!1}function o(e,t,r,i){Array.isArray(e)||(e=[e]),e.forEach(function(e){e.addEventListener(t,r,i||!1)})}function s(e,t,r,i){e.removeEventListener(t,r,i||!1)}function n(e,t){function r(){this.constructor=e}r.prototype=t.prototype,e.prototype=new r}function a(e,t){var r=e.browser.isMac&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.browser.isMSWindows&&t.altKey&&t.ctrlKey&&!t.metaKey;return"keypress"==t.type?r:r&&(!t.keyCode||t.keyCode>47)}function l(e,t,r){var o=e<<16|t<<8|r;if(null!=l._cache[o])return l._cache[o];for(var s,n,a,h,c,u=1/0,p=-1,d=0;d<i.vcolors.length;d++){if(s=i.vcolors[d],n=s[0],a=s[1],h=s[2],0===(c=l.distance(e,t,r,n,a,h))){p=d;break}c<u&&(u=c,p=d)}return l._cache[o]=p}function h(e){return 16===e.keyCode||17===e.keyCode||18===e.keyCode}/*!
* xterm (https://npmjs.com/package/xterm)
* @license MIT
* @version 2.8.1
* ==xterm/LICENSE==
* Copyright (c) 2014-2016, SourceLair Private Company (https://www.sourcelair.com)
* Copyright (c) 2012-2013, Christopher Jeffrey (https://github.com/chjj/)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
Object.defineProperty(t,"__esModule",{value:!0});var c=r(15),u=r(1),p=r(22),d=r(23),f=r(25),g=r(2),m=r(16),y=r(18),b=r(19),_=r(17),C=r(20),w=r(24),S=r(8),v=r(9),A="undefined"!=typeof window?window.document:null;n(i,u.EventEmitter),i.prototype.eraseAttr=function(){return-512&this.defAttr|511&this.curAttr},i.tangoColors=["#2e3436","#cc0000","#4e9a06","#c4a000","#3465a4","#75507b","#06989a","#d3d7cf","#555753","#ef2929","#8ae234","#fce94f","#729fcf","#ad7fa8","#34e2e2","#eeeeec"],i.colors=function(){function e(e,r,i){o.push("#"+t(e)+t(r)+t(i))}function t(e){return(e=e.toString(16)).length<2?"0"+e:e}var r,o=i.tangoColors.slice(),s=[0,95,135,175,215,255];for(r=0;r<216;r++)e(s[r/36%6|0],s[r/6%6|0],s[r%6]);for(r=0;r<24;r++)e(s=8+10*r,s,s);return o}(),i._colors=i.colors.slice(),i.vcolors=function(){for(var e,t=[],r=i.colors,o=0;o<256;o++)e=parseInt(r[o].substring(1),16),t.push([e>>16&255,e>>8&255,255&e]);return t}(),i.defaults={colors:i.colors,theme:"default",convertEol:!1,termName:"xterm",geometry:[80,24],cursorBlink:!1,cursorStyle:"block",visualBell:!1,popOnBell:!1,scrollback:1e3,screenKeys:!1,debug:!1,cancelEvents:!1,disableStdin:!1,useFlowControl:!1,tabStopWidth:8},i.options={},i.focus=null,function(e,t,r){if(e.forEach)return e.forEach(t,r);for(var i=0;i<e.length;i++)t.call(r,e[i],i,e)}(function(e){if(Object.keys)return Object.keys(e);var t,r=[];for(t in e)Object.prototype.hasOwnProperty.call(e,t)&&r.push(t);return r}(i.defaults),function(e){i[e]=i.defaults[e],i.options[e]=i.defaults[e]}),i.prototype.focus=function(){return this.textarea.focus()},i.prototype.getOption=function(e,t){if(!(e in i.defaults))throw new Error('No option with key "'+e+'"');return void 0!==this.options[e]?this.options[e]:this[e]},i.prototype.setOption=function(e,t){if(!(e in i.defaults))throw new Error('No option with key "'+e+'"');switch(e){case"scrollback":if(t<this.rows){var r="Setting the scrollback value less than the number of rows ";return r+="("+this.rows+") is not allowed.",console.warn(r),!1}if(this.options[e]!==t){if(this.lines.length>t){var o=this.lines.length-t,s=this.ydisp-o<0;this.lines.trimStart(o),this.ybase=Math.max(this.ybase-o,0),this.ydisp=Math.max(this.ydisp-o,0),s&&this.refresh(0,this.rows-1)}this.lines.maxLength=t,this.viewport.syncScrollArea()}}switch(this[e]=t,this.options[e]=t,e){case"cursorBlink":this.setCursorBlinking(t);break;case"cursorStyle":this.element.classList.toggle("xterm-cursor-style-underline","underline"===t),this.element.classList.toggle("xterm-cursor-style-bar","bar"===t);break;case"tabStopWidth":this.setupStops()}},i.prototype.restartCursorBlinking=function(){this.setCursorBlinking(this.options.cursorBlink)},i.prototype.setCursorBlinking=function(e){if(this.element.classList.toggle("xterm-cursor-blink",e),this.clearCursorBlinkingInterval(),e){var t=this;this.cursorBlinkInterval=setInterval(function(){t.element.classList.toggle("xterm-cursor-blink-on")},600)}},i.prototype.clearCursorBlinkingInterval=function(){this.element.classList.remove("xterm-cursor-blink-on"),this.cursorBlinkInterval&&(clearInterval(this.cursorBlinkInterval),this.cursorBlinkInterval=null)},i.bindFocus=function(e){o(e.textarea,"focus",function(t){e.sendFocus&&e.send(g.C0.ESC+"[I"),e.element.classList.add("focus"),e.showCursor(),e.restartCursorBlinking.apply(e),i.focus=e,e.emit("focus",{terminal:e})})},i.prototype.blur=function(){return this.textarea.blur()},i.bindBlur=function(e){o(e.textarea,"blur",function(t){e.refresh(e.y,e.y),e.sendFocus&&e.send(g.C0.ESC+"[O"),e.element.classList.remove("focus"),e.clearCursorBlinkingInterval.apply(e),i.focus=null,e.emit("blur",{terminal:e})})},i.prototype.initGlobal=function(){var e=this,t=this;i.bindKeys(this),i.bindFocus(this),i.bindBlur(this),o(this.element,"copy",function(r){e.mouseEvents||d.copyHandler(r,t,e.selectionManager)});var r=function(e){return d.pasteHandler(e,t)};o(this.textarea,"paste",r),o(this.element,"paste",r),t.browser.isFirefox?o(this.element,"mousedown",function(t){2==t.button&&d.rightClickHandler(t,e.textarea,e.selectionManager)}):o(this.element,"contextmenu",function(t){d.ri
* Implements the attach method, that attaches the terminal to a WebSocket stream.
* @module xterm/addons/attach/attach
* @license MIT
*/
2017-08-22 07:58:15 +00:00
!function(t){e.exports=t(r(0))}(function(e){"use strict";var t={};return t.attach=function(e,t,r,i){r=void 0===r||r,e.socket=t,e._flushBuffer=function(){e.write(e._attachSocketBuffer),e._attachSocketBuffer=null,clearTimeout(e._attachSocketBufferTimer),e._attachSocketBufferTimer=null},e._pushToBuffer=function(t){e._attachSocketBuffer?e._attachSocketBuffer+=t:(e._attachSocketBuffer=t,setTimeout(e._flushBuffer,10))},e._getMessage=function(t){i?e._pushToBuffer(t.data):e.write(t.data)},e._sendData=function(e){t.send(e)},t.addEventListener("message",e._getMessage),r&&e.on("data",e._sendData),t.addEventListener("close",e.detach.bind(e,t)),t.addEventListener("error",e.detach.bind(e,t))},t.detach=function(e,t){e.off("data",e._sendData),(t=void 0===t?e.socket:t)&&t.removeEventListener("message",e._getMessage),delete e.socket},e.prototype.attach=function(e,r,i){return t.attach(this,e,r,i)},e.prototype.detach=function(e){return t.detach(this,e)},t})},function(e,t,r){/**
* Fit terminal columns and rows to the dimensions of its DOM element.
*
* ## Approach
* - Rows: Truncate the division of the terminal parent element height by the terminal row height.
*
* - Columns: Truncate the division of the terminal parent element width by the terminal character
* width (apply display: inline at the terminal row and truncate its width with the current
* number of columns).
* @module xterm/addons/fit/fit
* @license MIT
*/
2017-08-22 07:58:15 +00:00
!function(t){e.exports=t(r(0))}(function(e){var t={};return t.proposeGeometry=function(e){if(!e.element.parentElement)return null;var t,r,i,o,s=window.getComputedStyle(e.element.parentElement),n=parseInt(s.getPropertyValue("height")),a=Math.max(0,parseInt(s.getPropertyValue("width"))-17),l=window.getComputedStyle(e.element),h=n-(parseInt(l.getPropertyValue("padding-top"))+parseInt(l.getPropertyValue("padding-bottom"))),c=a-(parseInt(l.getPropertyValue("padding-right"))+parseInt(l.getPropertyValue("padding-left"))),u=(e.rowContainer,e.rowContainer.firstElementChild),p=u.innerHTML;return u.style.display="inline",u.innerHTML="W",i=u.getBoundingClientRect().width,u.style.display="",t=u.getBoundingClientRect().height,u.innerHTML=p,r=parseInt(h/t),o=parseInt(c/i),{cols:o,rows:r}},t.fit=function(e){var r=t.proposeGeometry(e);r&&e.resize(r.cols,r.rows)},e.prototype.proposeGeometry=function(){return t.proposeGeometry(this)},e.prototype.fit=function(){return t.fit(this)},t})},function(e,t,r){/**
* Fullscreen addon for xterm.js
* @module xterm/addons/fullscreen/fullscreen
* @license MIT
*/
2017-08-22 07:58:15 +00:00
!function(t){e.exports=t(r(0))}(function(e){var t={};return t.toggleFullScreen=function(e,t){var r;r=void 0===t?e.element.classList.contains("fullscreen")?"remove":"add":t?"add":"remove",e.element.classList[r]("fullscreen")},e.prototype.toggleFullscreen=function(e){t.toggleFullScreen(this,e)},t})},function(e,t,r){/**
* This module provides methods for attaching a terminal to a terminado WebSocket stream.
*
* @module xterm/addons/terminado/terminado
* @license MIT
*/
!function(t){e.exports=t(r(0))}(function(e){"use strict";var t={};return t.terminadoAttach=function(e,t,r,i){r=void 0===r||r,e.socket=t,e._flushBuffer=function(){e.write(e._attachSocketBuffer),e._attachSocketBuffer=null,clearTimeout(e._attachSocketBufferTimer),e._attachSocketBufferTimer=null},e._pushToBuffer=function(t){e._attachSocketBuffer?e._attachSocketBuffer+=t:(e._attachSocketBuffer=t,setTimeout(e._flushBuffer,10))},e._getMessage=function(t){var r=JSON.parse(t.data);"stdout"==r[0]&&(i?e._pushToBuffer(r[1]):e.write(r[1]))},e._sendData=function(e){t.send(JSON.stringify(["stdin",e]))},e._setSize=function(e){t.send(JSON.stringify(["set_size",e.rows,e.cols]))},t.addEventListener("message",e._getMessage),r&&e.on("data",e._sendData),e.on("resize",e._setSize),t.addEventListener("close",e.terminadoDetach.bind(e,t)),t.addEventListener("error",e.terminadoDetach.bind(e,t))},t.terminadoDetach=function(e,t){e.off("data",e._sendData),(t=void 0===t?e.socket:t)&&t.removeEventListener("message",e._getMessage),delete e.socket},e.prototype.terminadoAttach=function(e,r,i){return t.terminadoAttach(this,e,r,i)},e.prototype.terminadoDetach=function(e){return t.terminadoDetach(this,e)},t})},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(27),o="undefined"==typeof navigator,s=o?"node":navigator.userAgent,n=o?"node":navigator.platform;t.isFirefox=!!~s.indexOf("Firefox"),t.isMSIE=!!~s.indexOf("MSIE")||!!~s.indexOf("Trident"),t.isMac=i.contains(["Macintosh","MacIntel","MacPPC","Mac68K"],n),t.isIpad="iPad"===n,t.isIphone="iPhone"===n,t.isMSWindows=i.contains(["Windows","Win16","Win32","WinCE"],n),t.isLinux=n.indexOf("Linux")>=0},function(e,t,r){"use strict";function i(e,t){if(null==e.pageX)return null;for(var r=e.pageX,i=e.pageY;t&&t!==self.document.documentElement;)r-=t.offsetLeft,i-=t.offsetTop,t="offsetParent"in t?t.offsetParent:t.parentElement;return[r,i]}function o(e,t,r,o,s,n){var a=i(e,t);return a[0]=Math.ceil((a[0]+(n?r.width/2:0))/r.width),a[1]=Math.ceil(a[1]/r.height),a[0]=Math.min(Math.max(a[0],1),o+1),a[1]=Math.min(Math.max(a[1],1),s+1),a}Object.defineProperty(t,"__esModule",{value:!0}),t.getCoordsRelativeToElement=i,t.getCoords=o,t.getRawByteCoords=function(e,t,r,i,s){var n=o(e,t,r,i,s),a=n[0],l=n[1];return a+=32,l+=32,{x:a,y:l}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(14),o=function(){function e(e){this.elem=e,i.hterm.defaultStorage=new i.lib.Storage.Memory,this.term=new i.hterm.Terminal,this.term.getPrefs().set("send-encoding","raw"),this.term.decorate(this.elem),this.io=this.term.io.push(),this.term.installKeyboard()}return e.prototype.info=function(){return{columns:this.columns,rows:this.rows}},e.prototype.output=function(e){null!=this.term.io&&this.term.io.writeUTF16(e)},e.prototype.showMessage=function(e,t){this.message=e,t>0?this.term.io.showOverlay(e,t):this.term.io.showOverlay(e,null)},e.prototype.removeMessage=function(){this.term.io.showOverlay(this.message,0)},e.prototype.setWindowTitle=function(e){this.term.setWindowTitle(e)},e.prototype.setPreferences=function(e){var t=this;Object.keys(e).forEach(function(r){t.term.getPrefs().set(r,e[r])})},e.prototype.onInput=function(e){this.io.onVTKeystroke=function(t){e(t)},this.io.sendString=function(t){e(t)}},e.prototype.onResize=function(e){var t=this;this.io.onTerminalResize=function(r,i){t.columns=r,t.rows=i,e(r,i)}},e.prototype.deactivate=function(){this.io.onVTKeystroke=null,this.io.sendString=null,this.io.onTerminalResize=null,this.term.uninstallKeyboard()},e.prototype.reset=function(){this.removeMessage(),this.term.installKeyboard()},e.prototype.close=function(){this.term.uninstallKeyboard()},e}();t.Hterm=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){this.url=e,this.protocols=t}return e.prototype.create=function(){return new o(this.url,this.protocols)},e}();t.ConnectionFactory=i;var o=function(){function e(e,t){this.bare=new WebSocket(e,t)}return e.prototype.open=function(){},e.prototype.close=function(){this.bare.close(
* libapps (https://npmjs.com/package/libapps)
* @license BSD-3-Clause
* @version 1.70.0
* ==libapps/LICENSE==
* // Copyright (c) 2006-2009 The Chromium OS Authors. All rights reserved.
* //
* // Redistribution and use in source and binary forms, with or without
* // modification, are permitted provided that the following conditions are
* // met:
* //
* // * Redistributions of source code must retain the above copyright
* // notice, this list of conditions and the following disclaimer.
* // * Redistributions in binary form must reproduce the above
* // copyright notice, this list of conditions and the following disclaimer
* // in the documentation and/or other materials provided with the
* // distribution.
* // * Neither the name of Google Inc. nor the names of its
* // contributors may be used to endorse or promote products derived from
* // this software without specific prior written permission.
* //
* // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
if(void 0!==i)throw new Error('Global "lib" object already exists.');var i={};i.runtimeDependencies_={},i.initCallbacks_=[],i.rtdep=function(e){var t;try{throw new Error}catch(e){var r=e.stack.split("\n");t=r.length>=3?r[2].replace(/^\s*at\s+/,""):r[1].replace(/^\s*global code@/,"")}for(var o=0;o<arguments.length;o++){var s=arguments[o];if(s instanceof Array)i.rtdep.apply(i,s);else{var n=this.runtimeDependencies_[s];n||(n=this.runtimeDependencies_[s]=[]),n.push(t)}}},i.ensureRuntimeDependencies_=function(){var e=!0;for(var t in i.runtimeDependencies_)for(var r=i.runtimeDependencies_[t],o=t.split("."),s=window||self,n=0;n<o.length;n++){if(!(o[n]in s)){console.warn('Missing "'+t+'" is needed by',r),e=!1;break}s=s[o[n]]}if(!e)throw new Error("Failed runtime dependency check")},i.registerInit=function(e,t){return i.initCallbacks_.push([e,t]),t},i.init=function(e,t){var r=i.initCallbacks_,o=function(){if(r.length){var s=r.shift();t&&t("init: "+s[0]),s[1](i.f.alarm(o))}else e()};if("function"!=typeof e)throw new Error("Missing or invalid argument: onInit");i.ensureRuntimeDependencies_(),setTimeout(o,0)},String.prototype.padStart||(String.prototype.padStart=function(e,t){return(e-=this.length)<=0?String(this):(void 0===t&&(t=" "),e>t.length&&(t=t.repeat(e/t.length+1)),t.slice(0,e)+String(this))}),String.prototype.padEnd||(String.prototype.padEnd=function(e,t){return(e-=this.length)<=0?String(this):(void 0===t&&(t=" "),e>t.length&&(t=t.repeat(e/t.length+1)),String(this)+t.slice(0,e))}),i.colors={},i.colors.re_={hex16:/#([a-f0-9])([a-f0-9])([a-f0-9])/i,hex24:/#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/i,rgb:new RegExp("^/s*rgb/s*/(/s*(/d{1,3})/s*,/s*(/d{1,3})/s*,/s*(/d{1,3})/s*/)/s*$".replace(/\//g,"\\"),"i"),rgba:new RegExp("^/s*rgba/s*/(/s*(/d{1,3})/s*,/s*(/d{1,3})/s*,/s*(/d{1,3})/s*(?:,/s*(/d+(?:/./d+)?)/s*)/)/s*$".replace(/\//g,"\\"),"i"),rgbx:new RegExp("^/s*rgba?/s*/(/s*(/d{1,3})/s*,/s*(/d{1,3})/s*,/s*(/d{1,3})/s*(?:,/s*(/d+(?:/./d+)?)/s*)?/)/s*$".replace(/\//g,"\\"),"i"),x11rgb:/^\s*rgb:([a-f0-9]{1,4})\/([a-f0-9]{1,4})\/([a-f0-9]{1,4})\s*$/i,name:/[a-z][a-z0-9\s]+/},i.colors.rgbToX11=function(e){function t(e){return e=(257*Math.min(e,255)).toString(16),i.f.zpad(e,4)}var r=e.match(i.colors.re_.rgbx);return r?"rgb:"+t(r[1])+"/"+t(r[2])+"/"+t(r[3]):null},i.colors.x11HexToCSS=function(e){if(!e.startsWith("#"))return null;if(e=e.substr(1),-1==[3,6,9,12].indexOf(e.length))return null;if(e.match(/[^a-f0-9]/i))return null;var t=e.length/3,r=e.substr(0,t),o=e.substr(t,t),s=e.substr(t+t,t);return i.colors.arrayToRGBA([r,o,s].map(function(e){return e=parseInt(e,16),2==t?e:1==t?e<<4:e>>4*(t-2)}))},i.colors.x11ToCSS=function(e){var t=e.match(i.colors.re_.x11rgb);return t?(t.splice(0,1),i.colors.arrayToRGBA(t.map(function(e){return 1==e.length?parseInt(e+e,16):2==e.length?parseInt(e,16):(3==e.length&&(e+=e.substr(2)),Math.round(parseInt(e,16)/257))}))):e.startsWith("#")?i.colors.x11HexToCSS(e):i.colors.nameToRGB(e)},i.colors.hexToRGB=function(e){function t(e){4==e.length&&(e=e.replace(r,function(e,t,r,i){return"#"+t+t+r+r+i+i}));var t=e.match(o);return t?"rgb("+parseInt(t[1],16)+", "+parseInt(t[2],16)+", "+parseInt(t[3],16)+")":null}var r=i.colors.re_.hex16,o=i.colors.re_.hex24;if(e instanceof Array)for(var s=0;s<e.length;s++)e[s]=t(e[s]);else e=t(e);return e},i.colors.rgbToHex=function(e){function t(e){var t=i.colors.crackRGB(e);return t?"#"+i.f.zpad((parseInt(t[0])<<16|parseInt(t[1])<<8|parseInt(t[2])<<0).toString(16),6):null}if(e instanceof Array)for(var r=0;r<e.length;r++)e[r]=t(e[r]);else e=t(e);return e},i.colors.normalizeCSS=function(e){return e.startsWith("#")?i.colors.hexToRGB(e):i.colors.re_.rgbx.test(e)?e:i.colors.nameToRGB(e)},i.colors.arrayToRGBA=function(e){var t=e.length>3?e[3]:1;return"rgba("+e[0]+", "+e[1]+", "+e[2]+", "+t+")"},i.colors.setAlpha=function(e,t){var r=i.colors.crackRGB(e);return r[3]=t,i.colors.arrayToRGBA(r)},i.colors.mix=function(e,t,r){for(var o=i.colors.crackRGB(e),s=i.colors.crackRGB(t),n=0;n<4;++n){var a=s[n]-o[n];o[n]=Math.round(parseInt(o[n])+a*r)}return i.colors.arrayToRGBA(o)},i.colors.crackRGB=fu