![]() System : Linux absol.cf 5.4.0-198-generic #218-Ubuntu SMP Fri Sep 27 20:18:53 UTC 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, Directory : /var/www/html/tech_preview/hr/absol/ |
Upload File : |
/******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.l = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); /******/ } /******/ }; /******/ /******/ // define __esModule on exports /******/ __webpack_require__.r = function(exports) { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ /******/ // create a fake namespace object /******/ // mode & 1: value is a module id, require it /******/ // mode & 2: merge all properties of value into the ns /******/ // mode & 4: return value when already ns object /******/ // mode & 8|1: behave like require /******/ __webpack_require__.t = function(value, mode) { /******/ if(mode & 1) value = __webpack_require__(value); /******/ if(mode & 8) return value; /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; /******/ var ns = Object.create(null); /******/ __webpack_require__.r(ns); /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); /******/ return ns; /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = 30); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /*** * * @param {Number} x * @param {Number} y * @constructor */ function Vec2(x, y) { this.x = x; this.y = y; } /*** * * @returns {Vec2} */ Vec2.prototype.copy = function () { return new Vec2(this.x, this.y); }; /*** * * @returns {string} */ Vec2.prototype.toString = function () { return "(" + this.x + ", " + this.y + ")"; }; /*** * * @returns {number} */ Vec2.prototype.abs = function () { return Math.sqrt(this.x * this.x + this.y * this.y); }; /*** * * @returns {Vec2} */ Vec2.prototype.normalized = function () { var l = this.abs(); if (l == 0) l = 1; return this.div(l); }; /*** * * @param {number} h * @returns {Vec2} */ Vec2.prototype.mult = function (h) { return new Vec2(this.x * h, this.y * h); }; /*** * * @param {number} h * @returns {Vec2} */ Vec2.prototype.div = function (h) { return new Vec2(this.x / h, this.y / h); }; /*** * * @param v * @returns {number} */ Vec2.prototype.dist = function (v) { var dx = v.x - this.x; var dy = v.y - this.y; return Math.sqrt(dx * dx + dy * dy); }; /*** * * @param {Vec2} v * @returns {Vec2} */ Vec2.prototype.sub = function (v) { return new Vec2(this.x - v.x, this.y - v.y); }; /*** * * @param {Vec2} v * @returns {Vec2} */ Vec2.prototype.add = function (v) { return new Vec2(this.x + v.x, this.y + v.y); }; /*** * * @returns {Vec2} */ Vec2.prototype.inv = function () { return new Vec2(-this.x, -this.y); }; /*** * * @param {Vec2} v * @param {number} h * @returns {Vec2} */ Vec2.prototype.linear = function (v, h) { return new Vec2(this.x * (1 - h) + v.x * h, this.y * (1 - h) + v.y * h); }; /*** * * @param {Vec2} v1 * @returns {number} */ Vec2.prototype.dot = function (v1) { return this.x * v1.x + this.y * v1.y; }; /*** * * @returns {number} */ Vec2.prototype.direction = function () { return Math.atan2(this.y, this.x); }; /*** * * @param {Number} dx * @param {Number} dy */ Vec2.prototype.translate = function (dx, dy) { return this.add(new Vec2(dx, dy)); }; /**** * * @param {Number} angle - radian * @returns {Vec2} */ Vec2.prototype.rotate = function (angle) { var sinA = Math.sin(angle); var cosA = Math.cos(angle); var x = this.x * cosA - this.y * sinA; var y = this.x * sinA + this.y * cosA; return new Vec2(x, y); }; /*** * * @returns {Vec2} */ Vec2.prototype.rotate90 = function () { return new Vec2(-this.y, this.x); }; /*** * * @param {number} angle * @returns {Vec2} */ Vec2.fromDirection = function (angle) { return new Vec2(Math.cos(angle), Math.sin(angle)); }; /*** * * @param x * @param y * @returns {Vec2} */ Vec2.make = function (x, y) { if (x instanceof Array) { return new Vec2(x[0], x[1]); } else if (x instanceof Vec2) { return x.copy(); } else return new Vec2(x, y); }; /* harmony default export */ __webpack_exports__["a"] = (Vec2); /***/ }), /* 1 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "map", function() { return map; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "sumArr", function() { return sumArr; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "radianInRange", function() { return radianInRange; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "distance", function() { return distance; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "numberToString", function() { return numberToString; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "numberAutoFixed", function() { return numberAutoFixed; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "integerZeroPadding", function() { return integerZeroPadding; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "harmonicMean", function() { return harmonicMean; }); /** * * @param {number} x * @param {number} l * @param {number} h * @param {number} L * @param {number} H * @returns {number} */ function map(x, l, h, L, H) { return (x - l) / (h - l) * (H - L) + L; } function sumArr(arr) { var res = 0; for (var i = 0; i < arr.length; ++i) res += arr[i]; return res; } function radianInRange(x, start, end) { if (start > end) return radianInRange(x, end, start); if (x < start) x += (Math.PI * 2) * Math.ceil((start - x) / 2 / Math.PI); if (x > end) x -= (Math.PI * 2) * Math.ceil((x - end) / 2 / Math.PI); return x >= start && x <= end; } function distance(x0, y0, x1, y1) { var dx = x0 - x1; var dy = y0 - y1; return Math.sqrt(dx * dx + dy * dy); } /** * * @param {Number} numb * @param {Number} floatFixed * @param {"."|","} decimalSeparator * @param {","|"."} thousandsSeparator * @param {Number} decimalPadding */ function numberToString(numb, floatFixed, decimalSeparator, thousandsSeparator, decimalPadding) { if (floatFixed === undefined || floatFixed === null || typeof floatFixed != "number" || isNaN(floatFixed) || floatFixed < -1) floatFixed = -1; if (decimalSeparator === undefined || decimalSeparator === null || (decimalSeparator != '.' && decimalSeparator != ',')) decimalSeparator = '.'; if (thousandsSeparator === undefined || thousandsSeparator === null || (floatFixed >= 0 && thousandsSeparator == decimalSeparator)) thousandsSeparator = undefined; if (thousandsSeparator != ',' && thousandsSeparator != '.') thousandsSeparator = undefined; if (decimalPadding === undefined || decimalPadding === null || typeof decimalPadding != "number" || isNaN(decimalPadding) || decimalPadding < 0) decimalPadding = 0; var text = numb.toString(); var matched = text.match(/[+-]?([0-9]*)(\.([0-9]*))?(e([+-]?[0-9]+))?/); var dec = matched[1] || ''; var real = matched[3] || ''; var floatPoint = parseInt(matched[5] || '0'); var decDigits = dec.split('').map(function (d) { return parseInt(d) }); var realDigits = real.split('').map(function (d) { return parseInt(d) }); while (floatPoint < 0) { if (decDigits.length > 0) { realDigits.unshift(decDigits.pop()); } else { realDigits.unshift(0); } floatPoint++; } while (floatPoint > 0) { if (realDigits.length > 0) { decDigits.push(realDigits.unshift()); } else { decDigits.push(0); } floatPoint++; } var mem = 0, i, cValue; if (floatFixed > realDigits.length) { while (realDigits.length < floatFixed) { realDigits.push(0); } } else if (floatFixed < realDigits.length && floatFixed >= 0) { i = floatFixed; mem = realDigits[i] >= 5 ? 1 : 0; realDigits.splice(floatFixed); --i; while (mem > 0) { if (i >= 0) { cValue = realDigits[i] + mem; realDigits[i] = cValue % 10; mem = Math.floor(cValue / 10); } else { if (decDigits.length + i < 0) decDigits.unshift(0); cValue = decDigits[decDigits.length + i] + mem; decDigits[decDigits.length + i] = cValue % 10; mem = Math.floor(cValue / 10); } --i; } } while (decDigits.length < decimalPadding) { decDigits.unshift(0); } var decText = numb < 0 ? '-' : ''; var breadMod = (decDigits.length + 2) % 3; if (thousandsSeparator) { for (i = 0; i < decDigits.length; ++i) { decText += decDigits[i]; if (i % 3 == breadMod && i + 1 < decDigits.length) { decText += thousandsSeparator; } } } else { decText += decDigits.join(''); } var realText = realDigits.length == 0 ? '' : decimalSeparator + realDigits.join(''); return decText + realText; } function numberAutoFixed(x, eDelta) { eDelta = eDelta || 10; eDelta = Math.round(eDelta); var e = parseFloat('1e+' + eDelta); return Math.round(x * e) / e; } /*** * * @param {number} number * @param {number} length * @returns {string} */ function integerZeroPadding(number, length) { var res = number + ''; while (res.length < length) res = '0' + res; return res; } function harmonicMean(a, b) { return 2 / (1 / a + 1 / b); } /***/ }), /* 2 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export eventProperties */ /* unused harmony export touchProperties */ /* unused harmony export isMouseRight */ /* unused harmony export isMouseLeft */ /* unused harmony export hitElement */ /* unused harmony export copyEvent */ /* unused harmony export copyTouch */ /* unused harmony export findChangedTouchByIdent */ /* unused harmony export findTouchByIdent */ function EventEmitter() { if (!this._azar_extendEvents) { Object.defineProperty(this, '_azar_extendEvents', { enumerable: false, value: this._azar_extendEvents || { supported: {}, prioritize: {}, nonprioritize: {} } }); Object.defineProperty(this, '__azar_force', { value: !(typeof Node === "object" ? this instanceof Node : this && typeof this === "object" && typeof this.nodeType === "number" && typeof this.nodeName === "string"), enumerable: false }); } } EventEmitter.prototype.defineEvent = function (name) { if (name instanceof Array) { for (var i = 0; i < name.length; ++i) this._azar_extendEvents.supported[name[i]] = true; } else this._azar_extendEvents.supported[name] = true; return this; }; EventEmitter.prototype.isSupportedEvent = function (name) { return this.__azar_force || !!this._azar_extendEvents.supported[name]; }; EventEmitter.prototype.emit = function (eventName, data) { this.fire.apply(this, arguments); }; EventEmitter.prototype.fire = function (eventName, data) { var others = Array.prototype.slice.call(arguments, 1); if (this.isSupportedEvent(eventName)) { var listenerList; var i; if (this._azar_extendEvents.prioritize[eventName]) { listenerList = this._azar_extendEvents.prioritize[eventName].slice(); for (i = 0; i < listenerList.length; ++i) { try { listenerList[i].wrappedCallback.apply(this, others); } catch (e) { console.error(e); } } } if (this._azar_extendEvents.nonprioritize[eventName]) { listenerList = this._azar_extendEvents.nonprioritize[eventName].slice(); for (i = 0; i < listenerList.length; ++i) { try { listenerList[i].wrappedCallback.apply(this, others); } catch (e) { console.error(e); } } } } else { if (this.dispatchEvent) { var event = new Event(eventName); data && Object.assign(event, data); this.dispatchEvent(event); } else throw new Error("Not support event " + eventName); } return this; }; EventEmitter.prototype.eventEmittorOnWithTime = function (isOnce, arg0, arg1, arg2) { if (typeof arg0 == 'object') { for (var key in arg0) { this.eventEmittorOnWithTime(isOnce, key, arg0[key]); } return this; } else { if (typeof arg1 == 'object') { return this.eventEmittorOnWithTime(isOnce, arg0, arg1.callback, arg1.cap); } else { var eventArr = this._azar_extendEvents[arg2 ? 'prioritize' : 'nonprioritize'][arg0] || []; var eventIndex = -1; for (var i = 0; i < eventArr.length; ++i) { if (eventArr[i].wrappedCallback == arg1) { eventIndex = i; break; } } if (eventIndex < 0) { var event = { isOnce: isOnce, eventName: arg0, callback: arg1, cap: !!arg2 }; //wrappedCallback will be call if (isOnce) { event.wrappedCallback = function () { event.callback.apply(this, arguments); this.off(event.eventName, event.wrappedCallback, event.cap); }; } else { event.wrappedCallback = event.callback; } if (!this.isSupportedEvent(arg0)) { if (this.addEventListener) { this.addEventListener(arg0, event.wrappedCallback, !!arg2); } else { this.attachEvent('on' + arg0, arg1, !!arg2); } } eventArr.push(event); this._azar_extendEvents[arg2 ? 'prioritize' : 'nonprioritize'][arg0] = eventArr; } else { console.warn("dupplicate event"); } } return this; } }; EventEmitter.prototype.on = function (arg0, arg1, arg2) { this.eventEmittorOnWithTime(false, arg0, arg1, arg2); return this; }; EventEmitter.prototype.once = function (arg0, arg1, arg2) { this.eventEmittorOnWithTime(true, arg0, arg1, arg2); return this; }; EventEmitter.prototype.off = function (arg0, arg1, arg2) { if (typeof arg0 == 'object') { for (var key in arg0) { this.off(key, arg0[key]); } return this; } else { if (typeof arg1 == 'object') { return this.off(arg0, arg1.callback, arg1.cap); } else { var eventArr = this._azar_extendEvents[arg2 ? 'prioritize' : 'nonprioritize'][arg0] || []; var newEventArray = []; for (var i = 0; i < eventArr.length; ++i) { var event = eventArr[i]; if (event.wrappedCallback == arg1) { //Dont add to newEventArray if (this.isSupportedEvent(arg0)) { } else { if (this.removeEventListener) { this.removeEventListener(event.eventName, event.wrappedCallback, !!event.cap); } else { this.detachEvent('on' + event.eventName, event.wrappedCallback, !!event.cap); } } } else { newEventArray.push(event); } } this._azar_extendEvents[arg2 ? 'prioritize' : 'nonprioritize'][arg0] = newEventArray; return this; } } }; var eventProperties = ["altKey", "bubbles", "button", "buttons", "cancelBubble", "cancelable", "clientX", "clientY", "composed", "ctrlKey", "currentTarget", "defaultPrevented", "deltaMode", "deltaX", "deltaY", "deltaZ", "detail", "eventPhase", "explicitOriginalTarget", "isTrusted", "layerX", "layerY", "metaKey", "movementX", "movementY", "mozInputSource", "mozPressure", "offsetX", "offsetY", "originalTarget", "pageX", "pageY", "rangeOffset", "rangeParent", "region", "relatedTarget", "returnValue", "screenX", "screenY", "shiftKey", "srcElement", "target", "timeStamp", "type", "deltaMode", "deltaX", "deltaY", "deltaZ", 'preventDefault']; var touchProperties = ['clientX', 'clientY', 'force', 'identifier', 'pageX', 'pageY', 'rotationAngle', 'screenX', 'screenY', 'target']; function isMouseRight(event) { var isRightMB = false; if ("which" in event) // Gecko (Firefox), WebKit (Safari/Chrome) & Opera isRightMB = event.which == 3; else if ("button" in event) // IE, Opera isRightMB = event.button == 2; return isRightMB; } function isMouseLeft(event) { var isLeftMB = false; if ("which" in event) // Gecko (Firefox), WebKit (Safari/Chrome) & Opera isLeftMB = event.which == 1; else if ("button" in event) // IE, Opera isLeftMB = event.button == 1; return isLeftMB; } function hitElement(element, event) { var current = event.target; while (current) { if (current == element) return true; current = current.parentElement; } return false; } function copyEvent(event, props) { var result = {}; var key, value; //copy native property for (var i = 0; i < eventProperties.length; ++i) { key = eventProperties[i]; value = event[key]; if (value !== undefined) { if (typeof value == "function") { result[key] = event[key].bind(event); } else { result[key] = event[key]; } } } Object.assign(result, event); if (props) Object.assign(result, props) if (event.changedTouches) { result.changedTouches = Array.prototype.map.call(event.changedTouches, function (touch) { return copyTouch(touch); }); } if (event.touches) { result.touches = Array.prototype.map.call(event.touches, function (touch) { return copyTouch(touch); }); } return result; } function copyTouch(touch, props) { var result = {}; var key, value; //copy native property for (var i = 0; i < touchProperties.length; ++i) { key = touchProperties[i]; value = touch[key]; if (value !== undefined) { if (typeof value == "function") { result[key] = touch[key].bind(touch); } else { result[key] = touch[key]; } } } Object.assign(result, touch); if (props) Object.assign(result, props); return result; } /*** * * @param {TouchEvent} event * @return {Touch | null} */ function findChangedTouchByIdent(event, identifier) { if (event.changedTouches) { for (var i = 0; i < event.changedTouches.length; ++i) { if (event.changedTouches[i].identifier === identifier) { return event.changedTouches[i]; } } } return null; } /*** * * @param event * @param identifier * @return {Touch|null} */ function findTouchByIdent(event, identifier) { if (event.touches) { for (var i = 0; i < event.touches.length; ++i) { if (event.touches[i].identifier === identifier) { return event.touches[i]; } } } return null; } EventEmitter.isMouseRight = isMouseRight; EventEmitter.isMouseLeft = isMouseLeft; EventEmitter.hitElement = hitElement; EventEmitter.copyEvent = copyEvent; EventEmitter.eventProperties = eventProperties; /* harmony default export */ __webpack_exports__["a"] = (EventEmitter); /***/ }), /* 3 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; // ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); // EXPORTS __webpack_require__.d(__webpack_exports__, "identCharacters", function() { return /* binding */ identCharacters; }); __webpack_require__.d(__webpack_exports__, "randomIdent", function() { return /* binding */ randomIdent; }); __webpack_require__.d(__webpack_exports__, "parallelMatch", function() { return /* binding */ parallelMatch; }); __webpack_require__.d(__webpack_exports__, "ipsumLoremWord", function() { return /* binding */ ipsumLoremWord; }); __webpack_require__.d(__webpack_exports__, "randomWord", function() { return /* binding */ randomWord; }); __webpack_require__.d(__webpack_exports__, "randomPhrase", function() { return /* binding */ randomPhrase; }); __webpack_require__.d(__webpack_exports__, "randomSentence", function() { return /* binding */ randomSentence; }); __webpack_require__.d(__webpack_exports__, "randomParagraph", function() { return /* binding */ randomParagraph; }); // CONCATENATED MODULE: ./node_modules/absol/src/Math/random.js /** * Returns a random number between min (inclusive) and max (exclusive) */ function randomArbitrary(min, max) { return Math.random() * (max - min) + min; } /** * Returns a random integer between min (inclusive) and max (inclusive) * Using Math.round() will give you a non-uniform distribution! */ function randomInt(min, max) { return Math.floor(Math.random() * (max - min + 1)) + min; } function randomPick(arr) { var id = randomInt(0, arr.length - 1); return arr[id]; } // CONCATENATED MODULE: ./node_modules/absol/src/String/stringGenerate.js var identCharacters = function () { var chars = 'qwertyuiopasdfghjklzxcvbnm'; chars = chars + chars.toUpperCase(); var num = '0123456789'; var spect = '_'; return (chars + spect + num).split(''); }(); function randomIdent(length) { if (!(length > 0)) length = 4; var factor = identCharacters; return [factor[(Math.random() * (factor.length - 10)) >> 0]].concat(Array(length - 1).fill('').map(function () { return factor[(Math.random() * factor.length) >> 0]; })).join(''); } function parallelMatch(a, b) { var l = Math.min(a.length, b.length); var res = 0; for (var i = 0; i < l; ++i) { if (a[i] == b[i])++res; } return res; } var ipsumLoremWord = ['lorem', 'ipsum', 'dolor', 'sit', 'amet', 'consectetur', 'adipiscing', 'elit', 'sed', 'do', 'eiusmod', 'tempor', 'incididunt', 'ut', 'labore', 'et', 'dolore', 'magna', 'aliqua', 'enim', 'ad', 'minim', 'veniam', 'quis', 'nostrud', 'exercitation', 'ullamco', 'laboris', 'nisi', 'aliquip', 'ex', 'ea', 'commodo', 'consequat', 'duis', 'aute', 'irure', 'in', 'reprehenderit', 'voluptate', 'velit', 'esse', 'cillum', 'eu', 'fugiat', 'nulla', 'pariatur', 'excepteur', 'sint', 'occaecat', 'cupidatat', 'non', 'proident', 'sunt', 'culpa', 'qui', 'officia', 'deserunt', 'mollit', 'anim', 'id', 'est', 'laborum', 'perspiciatis', 'unde', 'omnis', 'iste', 'natus', 'error', 'voluptatem', 'accusantium', 'doloremque', 'laudantium', 'totam', 'rem', 'aperiam', 'eaque', 'ipsa', 'quae', 'ab', 'illo', 'inventore', 'veritatis', 'quasi', 'architecto', 'beatae', 'vitae', 'dicta', 'explicabo', 'nemo', 'ipsam', 'quia', 'voluptas', 'aspernatur', 'aut', 'odit', 'fugit', 'consequuntur', 'magni', 'dolores', 'eos', 'ratione', 'sequi', 'nesciunt', 'neque', 'porro', 'quisquam', 'dolorem', 'adipisci', 'numquam', 'eius', 'modi', 'tempora', 'incidunt', 'magnam', 'aliquam', 'quaerat', 'minima', 'nostrum', 'exercitationem', 'ullam', 'corporis', 'suscipit', 'laboriosam', 'aliquid', 'commodi', 'consequatur', 'autem', 'vel', 'eum', 'iure', 'quam', 'nihil', 'molestiae', 'illum', 'quo', 'at', 'vero', 'accusamus', 'iusto', 'odio', 'dignissimos', 'ducimus', 'blanditiis', 'praesentium', 'voluptatum', 'deleniti', 'atque', 'corrupti', 'quos', 'quas', 'molestias', 'excepturi', 'occaecati', 'cupiditate', 'provident', 'similique', 'mollitia', 'animi', 'dolorum', 'fuga', 'harum', 'quidem', 'rerum', 'facilis', 'expedita', 'distinctio', 'nam', 'libero', 'tempore', 'sum', 'soluta', 'nobis', 'eligendi', 'optio', 'cumque', 'impedit', 'minus', 'quod', 'maxime', 'placeat', 'facere', 'possimus', 'assumenda', 'repellendus', 'temporibus', 'quibusdam', 'officiis', 'debitis', 'necessitatibus', 'saepe', 'eveniet', 'voluptates', 'repudiandae', 'recusandae', 'itaque', 'earum', 'hic', 'tenetur', 'a', 'sapiente', 'delectus', 'reiciendis', 'voluptatibus', 'maiores', 'alias', 'perferendis', 'doloribus', 'asperiores', 'repellat', 'integer', 'nec', 'praesent', 'cursus', 'ante', 'dapibus', 'diam', 'sem', 'nibh', 'elementum', 'imperdiet', 'sagittis', 'mauris', 'fusce', 'tellus', 'augue', 'semper', 'porta', 'massa', 'vestibulum', 'lacinia', 'arcu', 'eget', 'class', 'aptent', 'taciti', 'sociosqu', 'litora', 'torquent', 'per', 'conubia', 'nostra', 'inceptos', 'himenaeos', 'curabitur', 'sodales', 'ligula', 'dignissim', 'nunc', 'tortor', 'pellentesque', 'aenean', 'scelerisque', 'maecenas', 'mattis', 'convallis', 'tristique', 'proin', 'egestas', 'porttitor', 'morbi', 'lectus', 'risus', 'iaculis', 'luctus', 'ac', 'turpis', 'aliquet', 'metus', 'ullamcorper', 'tincidunt', 'euismod', 'quisque', 'volutpat', 'condimentum', 'urna', 'facilisi', 'fringilla', 'suspendisse', 'potenti', 'feugiat', 'mi', 'sapien', 'etiam', 'ultrices', 'justo', 'lacus', 'pharetra', 'auctor', 'interdum', 'primis', 'faucibus', 'orci', 'posuere', 'cubilia', 'curae', 'molestie', 'dui', 'blandit', 'congue', 'pede', 'facilisis', 'laoreet', 'donec', 'viverra', 'malesuada', 'pulvinar', 'sollicitudin', 'cras', 'nisl', 'felis', 'venenatis', 'ultricies', 'accumsan', 'pretium', 'fermentum', 'nullam', 'purus', 'mollis', 'vivamus', 'consectetuer' ]; function randomWord() { var arr = ipsumLoremWord; var idx = randomInt(0, arr.length - 1); return arr[idx]; } function randomPhrase(limitLenght) { if (!limitLenght) limitLenght = 50; var length = Math.ceil(Math.random() * limitLenght / 7); return new Array(length) .fill(null) .map(randomWord) .reduce(function (ac, cr) { if (ac.length + cr.length < limitLenght) { ac.parts.push(cr); } return ac; }, { parts: [], length: 0 }).parts .join(' '); } function randomSentence(limitLenght) { if (!limitLenght) limitLenght = 300; var length = Math.ceil(Math.random() * limitLenght / 70); var res = new Array(length) .fill(null) .map(randomPhrase) .reduce(function (ac, cr) { if (ac.length + cr.length < limitLenght) { ac.parts.push(cr); } return ac; }, { parts: [], length: 0 }).parts .join(', '); if (Math.random() < 0.03) { res = res.replace(/\,/i, ':'); } res = res.replace(/^./, function (x) { return x.toUpperCase(); }); res += '.'; return res; } function randomParagraph(limitLenght) { if (!limitLenght) limitLenght = 1000; var length = Math.ceil(Math.random() * limitLenght / 200); return new Array(length).fill(null) .map(randomSentence) .reduce(function (ac, cr) { if (ac.length + cr.length < limitLenght) { ac.parts.push(cr); } return ac; }, { parts: [], length: 0 }).parts .join(' '); } /***/ }), /* 4 */ /***/ (function(module, exports) { var g; // This works in non-strict mode g = (function() { return this; })(); try { // This works if eval is allowed (see CSP) g = g || new Function("return this")(); } catch (e) { // This works if the window reference is available if (typeof window === "object") g = window; } // g can still be undefined, but nothing to do about it... // We return undefined, instead of nothing here, so it's // easier to handle this case. if(!global) { ...} module.exports = g; /***/ }), /* 5 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var _HTML5_EventEmitter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2); /* harmony import */ var _String_stringGenerate__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(3); /** * * @param {Worker} host */ function IFrameBridge(host, origin) { _HTML5_EventEmitter__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"].call(this); this.detach(); this.origin = origin; if (host) this.attach(host); this.__azarResolveCallbacks = {}; this.__azarRejectCallbacks = {}; } IFrameBridge.prototype.attach = function (host) { this.host = host; if (this.host.addEventListener) { this.host.addEventListener("message", this.__azarMessageListener.bind(this), false); } else if (this.host.attachEvent) { this.host.attachEvent("onmessage", this.__azarMessageListener.bind(this)); } else { this.host.onmessage = this.__azarMessageListener.bind(this); } this.__IFrameBridge_resolve(); }; IFrameBridge.prototype.detach = function () { this.sync = new Promise(function (resolve) { this.__IFrameBridge_resolve = resolve; }.bind(this)); }; IFrameBridge.fromIFrame = function (iframe) { var host = iframe.contentWindow || iframe.contentDocument; var src = iframe.src; var rootOrigin = location.origin; var iframeOrigin = src.match(/^(http|https):\/\/[^/]+/); if (iframeOrigin) { iframeOrigin = iframeOrigin[0]; } else { iframeOrigin = rootOrigin; } if (host) return new IFrameBridge(host, iframeOrigin); else { var result = new IFrameBridge(undefined, iframeOrigin); var attachedHost = function () { var host = iframe.contentWindow || iframe.contentDocument; result.attach(host); }; if (iframe.addEventListener) { iframe.addEventListener("load", attachedHost); } else { iframe.attachEvent("onload", attachedHost); } return result; } }; IFrameBridge.getInstance = function () { if (!IFrameBridge.shareInstance) { var origin = location.origin; var rootOrigin = IFrameBridge.getParentUrl().match(/^(http|https):\/\/[^/]+/); if (rootOrigin) { rootOrigin = rootOrigin[0]; } else { rootOrigin = origin; } // IFrameBridge.shareInstance = new IFrameBridge(self, rootOrigin == origin? undefined: "*" || rootOrigin ); IFrameBridge.shareInstance = new IFrameBridge(self, rootOrigin); } return IFrameBridge.shareInstance; }; Object.defineProperties(IFrameBridge.prototype, Object.getOwnPropertyDescriptors(_HTML5_EventEmitter__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"].prototype)); IFrameBridge.prototype.constructor = IFrameBridge; IFrameBridge.isInIFrame = function () { return (top !== self); }; IFrameBridge.getParentUrl = function () { var parentUrl = (window.location != window.parent.location) ? document.referrer : document.location.href; return parentUrl; }; IFrameBridge.prototype.__azarMessageListener = function (event) { this.__azarHandleData(event.data); }; IFrameBridge.prototype.__azarHandleData = function (data) { if (data.type) { if (data.type == "INVOKE") { try { var result = this.__azarSelfInvoke(data.name, data.params); if (result && typeof result.then == 'function') { result.then(function (result) { this.__azarResolve(data.taskId, result); }.bind(this)) .catch(function (err) { console.error(err); this.__azarResolve(data.taskId, null, err); }.bind(this)); } else { this.__azarResolve(data.taskId, result); } } catch (err) { console.error(err); this.__azarResolve(data.taskId, null, err); } } else if (data.type == "INVOKE_RESULT") { if (this.__azarResolveCallbacks[data.taskId]) { if (data.error) { this.__azarRejectCallbacks[data.taskId](data.error); } else { this.__azarResolveCallbacks[data.taskId](data.result); } delete this.__azarResolveCallbacks[data.taskId]; delete this.__azarRejectCallbacks[data.taskId]; } } else if (data.type == "EMIT") { this.fire.apply(this, data.params); } else this.fire('message', data, this); } }; IFrameBridge.prototype.__azarResolve = function (taskId, result, error) { var data = { type: "INVOKE_RESULT", taskId: taskId, result: result, error: error }; if (this.origin) { this.host.postMessage(data, this.origin); } else { this.host.postMessage(data); } }; IFrameBridge.prototype.__azarSelfInvoke = function (name, params) { if (typeof this[name] == 'function') { return this[name].apply(this, params); } else { return this[name]; } }; IFrameBridge.prototype.emit = function () { var params = []; params.push.apply(params, arguments); this.sync.then(function () { var data = { type: "EMIT", params: params }; if (this.origin) { this.host.postMessage(data, this.origin); } else { this.host.postMessage(data); } }.bind(this)); return this; }; IFrameBridge.prototype.invoke = function (name) { var params = []; params.push.apply(params, arguments); params.shift(); return this.sync.then(function () { var indent = Object(_String_stringGenerate__WEBPACK_IMPORTED_MODULE_1__["randomIdent"])(32); var data = { type: 'INVOKE', params: params, taskId: indent, name: name }; if (this.origin) { this.host.postMessage(data, this.origin); } else { this.host.postMessage(data); } return new Promise(function (resolve, reject) { this.__azarResolveCallbacks[indent] = resolve; this.__azarRejectCallbacks[indent] = reject; }.bind(this)); }.bind(this)); }; IFrameBridge.prototype.importScriptURLs = function () { return this.invoke.apply(this, ['_receiveScriptURLs'].concat(Array.prototype.slice.call(arguments))); }; IFrameBridge.prototype.importScript = function (code) { var blob = new Blob([code], { type: 'application/javascript' }); var url = URL.createObjectURL(blob); return this.importScriptURLs(url); }; IFrameBridge.prototype.createMethod = function (name, fx) { this[name] = function () { return this.invoke.apply(this, [name].concat(Array.prototype.slice.call(arguments))); }; return this.invoke.apply(this, ['_receiveMethod', name, fx.toString()]); }; IFrameBridge.prototype._receiveScriptURLs = function () { if (self.importScripts) { self.importScripts.apply(self, arguments); } }; IFrameBridge.prototype._receiveMethod = function (name, code) { this[name] = (new Function('return ' + code))(); }; /* harmony default export */ __webpack_exports__["a"] = (IFrameBridge); /***/ }), /* 6 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "wrapToLines", function() { return wrapToLines; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "nonAccentVietnamese", function() { return nonAccentVietnamese; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "pascalCaseToCamelCase", function() { return pascalCaseToCamelCase; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "kebabCaseToCamelCase", function() { return kebabCaseToCamelCase; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "underScoreToCamelCase", function() { return underScoreToCamelCase; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "camelCaseToPascalCase", function() { return camelCaseToPascalCase; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "underScoreToPascalCase", function() { return underScoreToPascalCase; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "kebabCaseToPascalCase", function() { return kebabCaseToPascalCase; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "pascalCaseToKebabCase", function() { return pascalCaseToKebabCase; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "camelCaseToKebabCase", function() { return camelCaseToKebabCase; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "underScoreToKebabCase", function() { return underScoreToKebabCase; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "pascalCaseToUnderScore", function() { return pascalCaseToUnderScore; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "pascalCaseToUpperUnderScore", function() { return pascalCaseToUpperUnderScore; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "camelCaseToUnderScore", function() { return camelCaseToUnderScore; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "camelCaseToUpperUnderScore", function() { return camelCaseToUpperUnderScore; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "kebabCaseToUnderScore", function() { return kebabCaseToUnderScore; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "kebabCaseToUpperUnderScore", function() { return kebabCaseToUpperUnderScore; }); /** * * @param {String} s * @param {Number} maxLength */ function wrapToLines(s, maxLength) { var res = []; var currentWord = ''; var currentLine = ''; for (var i = 0; i < s.length; ++i) { if (s[i].match(/\s/)) { if (currentWord.length + currentLine.length >= maxLength) { if (currentLine.length > 0) { res.push(currentLine.trim()); currentLine = ''; currentWord = currentWord.trimLeft() + s[i]; } else { currentLine = currentLine + currentWord; res.push(currentLine.trim()); currentLine = ''; currentWord = ''; } } else { currentLine = currentLine + currentWord; currentWord = s[i]; } } else { currentWord = currentWord + s[i]; } } currentLine = (currentLine + currentWord).trim(); if (currentLine.length > 0) res.push(currentLine); return res; } /** * * @param {String} s * @returns {String} */ function nonAccentVietnamese(s) { return s.replace(/à|á|ạ|ả|ã|â|ầ|ấ|ậ|ẩ|ẫ|ă|ằ|ắ|ặ|ẳ|ẵ/g, "a") .replace(/À|Á|Ạ|Ả|Ã|Â|Ầ|Ấ|Ậ|Ẩ|Ẫ|Ă|Ằ|Ắ|Ặ|Ẳ|Ẵ/g, "A") .replace(/è|é|ẹ|ẻ|ẽ|ê|ề|ế|ệ|ể|ễ/g, "e") .replace(/È|É|Ẹ|Ẻ|Ẽ|Ê|Ề|Ế|Ệ|Ể|Ễ/g, "E") .replace(/ì|í|ị|ỉ|ĩ/g, "i") .replace(/Ì|Í|Ị|Ỉ|Ĩ/g, "I") .replace(/ò|ó|ọ|ỏ|õ|ô|ồ|ố|ộ|ổ|ỗ|ơ|ờ|ớ|ợ|ở|ỡ/g, "o") .replace(/Ò|Ó|Ọ|Ỏ|Õ|Ô|Ồ|Ố|Ộ|Ổ|Ỗ|Ơ|Ờ|Ớ|Ợ|Ở|Ỡ/g, "O") .replace(/ù|ú|ụ|ủ|ũ|ư|ừ|ứ|ự|ử|ữ/g, "u") .replace(/Ù|Ú|Ụ|Ủ|Ũ|Ư|Ừ|Ứ|Ự|Ử|Ữ/g, "U") .replace(/ỳ|ý|ỵ|ỷ|ỹ/g, "y") .replace(/Ỳ|Ý|Ỵ|Ỷ|Ỹ/g, "Y") .replace(/đ/g, "d") .replace(/Đ/g, "D") .replace(/\u0300|\u0301|\u0303|\u0309|\u0323/g, "") .replace(/\u02C6|\u0306|\u031B/g, ""); } /** * * @param {String} s * @returns {String} */ function pascalCaseToCamelCase(s) { return s.substr(0, 1).toLowerCase() + s.substr(1); } /** * * @param {String} s * @returns {String} */ function kebabCaseToCamelCase(s) { return s.replace(/-+([^-])/g, function (full, c) { return c.toUpperCase(); }); } /** * * @param {String} s * @returns {String} */ function underScoreToCamelCase(s) { return s.replace(/(_+)?([^_]+)/g, function (full, underscore, word) { if (underscore) { if (word) { return word.substr(0, 1).toUpperCase() + word.substr(1).toLowerCase(); } else return ''; } else { return word.toLowerCase(); }; }); } /** * * @param {String} s * @returns {String} */ function camelCaseToPascalCase(s) { return s.substr(0, 1).toUpperCase() + s.substr(1); } /** * * @param {String} s * @returns {String} */ function underScoreToPascalCase(s) { return s.replace(/(_+|^)?([^_]+)/g, function (full, underscore, word) { return word.substr(0, 1).toUpperCase() + word.substr(1).toLowerCase(); }); } /** * * @param {String} s * @returns {String} */ function kebabCaseToPascalCase(s) { return s.replace(/(-+|^)([^-])/g, function (full, u, c) { return c.toUpperCase(); }); } /** * * @param {String} s * @returns {String} */ function pascalCaseToKebabCase(s) { return s.replace(/[A-Z][^A-Z]*/g, function (full, index) { if (index == 0) return full.toLowerCase(); return '-' + full.toLowerCase() }); } /** * * @param {String} s * @returns {String} */ function camelCaseToKebabCase(s) { return s.replace(/(^|[A-Z])[^A-Z]*/g, function (full, index) { if (index == 0) return full.toLowerCase(); return '-' + full.toLowerCase() }); } /** * * @param {String} s * @returns {String} */ function underScoreToKebabCase(s) { return s.replace(/(^|_+)([^_]+)/g, function (full, score, word, index) { if (index == 0) return word.toLowerCase(); return '-' + word.toLowerCase() }); } /** * * @param {String} s * @returns {String} */ function pascalCaseToUnderScore(s) { return s.replace(/[A-Z][^A-Z]*/g, function (full, index) { if (index == 0) return full.toLowerCase(); return '_' + full.toLowerCase() }); } /** * * @param {String} s * @returns {String} */ function pascalCaseToUpperUnderScore(s) { return s.replace(/[A-Z][^A-Z]*/g, function (full, index) { if (index == 0) return full.toUpperCase(); return '_' + full.toUpperCase() }); } /** * * @param {String} s * @returns {String} */ function camelCaseToUnderScore(s) { return s.replace(/(^|[A-Z])[^A-Z]*/g, function (full, index) { if (index == 0) return full.toLowerCase(); return '_' + full.toLowerCase() }); } /** * * @param {String} s * @returns {String} */ function camelCaseToUpperUnderScore(s) { return s.replace(/(^|[A-Z])[^A-Z]*/g, function (full, index) { if (index == 0) return full.toUpperCase(); return '_' + full.toUpperCase() }); } /** * * @param {String} s * @returns {String} */ function kebabCaseToUnderScore(s) { return s.replace(/(-+|^)([^-]+)/g, function (full, u, word, index) { if (index == 0) return word.toLowerCase(); return '_' + word.toLowerCase() }); } /** * * @param {String} s * @returns {String} */ function kebabCaseToUpperUnderScore(s) { return s.replace(/(-+|^)([^-]+)/g, function (full, u, word, index) { if (index == 0) return word.toUpperCase(); return '_' + word.toUpperCase() }); } String.nonAccentVietnamese = nonAccentVietnamese; String.prototype.nonAccentVietnamese = function () { return String.nonAccentVietnamese(this); }; /***/ }), /* 7 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; var OOP = {}; /** * @param {Object} object * @param {String} key * @param {Function} method */ OOP.overrideMethod = function (object, key, method) { if (object[key] === undefined) object[key] = method; else { var _superMethod = object[key]; object[key] = (function (_superMethod, method) { return function () { var _super = this.super; this.super = _superMethod; var result = method.apply(this, arguments); this.super = _super; return result; }; })(_superMethod, method); } }; OOP.extends = function (object, prototype) { // do not use setter, getter for (var key in prototype) { if (key !== 'constructor' && key !== '__proto__') { if ((typeof prototype[key] == 'function')) { OOP.overrideMethod(object, key, prototype[key]); } else if (prototype[key] !== undefined && prototype[key] !== null) { object[key] = prototype[key];//just copy } } } }; OOP.inherit = function (child, parent) { // do not use setter, getter Object.keys(parent).forEach(function (key) { if (key !== 'constructor' && (typeof parent[key] == 'function')) { var superMethod = parent[key]; var currentMethod = child[key]; if (!currentMethod) child[key] = superMethod; else { child[key] = function () { var _super = this.super; this.super = superMethod; var result = currentMethod.apply(this, arguments); this.super = _super; return result; }; } } }); }; OOP.drillProperty = function (topObject, botObject, keyTop, keyBot) { if (typeof (keyTop) == 'string') { keyBot = keyBot || keyTop; Object.defineProperty(topObject, keyTop, { set: function (value) { botObject[keyBot] = value; }, get: function () { return botObject[keyBot]; } }); } else { if (keyTop instanceof Array) { for (var i = 0; i < keyTop.length; ++i) { OOP.drillProperty(topObject, botObject, keyTop[i], keyTop[i]); } } else { for (var key in keyTop) { OOP.drillProperty(topObject, botObject, key, keyTop[key]); } } } }; OOP.bindFunctions = function (_this, handlers) { var res = {}; for (var key in handlers) { res[key] = handlers[key].bind(_this); } return res; }; OOP.inheritCreator = function (parent, child) { var i; if (child.property) { if (parent.property) { for (i in parent.property) { if (!child.property[i]) child.property[i] = parent.property[i]; } } } for (i in parent.prototype) { if (!child.prototype[i]) { child.prototype[i] = parent.prototype[i]; } else { child.prototype[i] = (function (superFunction, childFunction) { return function () { var _super = this.super; this.super = superFunction; var result = childFunction.apply(this, arguments); this.super = _super; return result; }; })(parent.prototype[i], child.prototype[i]); } } }; /*** * * @param {Function} constructor */ OOP.mixClass = function (constructor) { var descriptors = {}; for (var i = 1; i < arguments.length; ++i) { Object.assign(descriptors, Object.getOwnPropertyDescriptors(arguments[i].prototype)); } Object.defineProperties(constructor.prototype, descriptors); constructor.prototype.constructor = constructor; }; /* harmony default export */ __webpack_exports__["a"] = (OOP); /***/ }), /* 8 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(global) {/*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh <http://feross.org> * @license MIT */ /* eslint-disable no-proto */ var base64 = __webpack_require__(37) var ieee754 = __webpack_require__(38) var isArray = __webpack_require__(39) exports.Buffer = Buffer exports.SlowBuffer = SlowBuffer exports.INSPECT_MAX_BYTES = 50 /** * If `Buffer.TYPED_ARRAY_SUPPORT`: * === true Use Uint8Array implementation (fastest) * === false Use Object implementation (most compatible, even IE6) * * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+, * Opera 11.6+, iOS 4.2+. * * Due to various browser bugs, sometimes the Object implementation will be used even * when the browser supports typed arrays. * * Note: * * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances, * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438. * * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function. * * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of * incorrect length in some situations. * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they * get the Object implementation, which is slower but behaves correctly. */ Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined ? global.TYPED_ARRAY_SUPPORT : typedArraySupport() /* * Export kMaxLength after typed array support is determined. */ exports.kMaxLength = kMaxLength() function typedArraySupport () { try { var arr = new Uint8Array(1) arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }} return arr.foo() === 42 && // typed array instances can be augmented typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray` arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray` } catch (e) { return false } } function kMaxLength () { return Buffer.TYPED_ARRAY_SUPPORT ? 0x7fffffff : 0x3fffffff } function createBuffer (that, length) { if (kMaxLength() < length) { throw new RangeError('Invalid typed array length') } if (Buffer.TYPED_ARRAY_SUPPORT) { // Return an augmented `Uint8Array` instance, for best performance that = new Uint8Array(length) that.__proto__ = Buffer.prototype } else { // Fallback: Return an object instance of the Buffer class if (that === null) { that = new Buffer(length) } that.length = length } return that } /** * The Buffer constructor returns instances of `Uint8Array` that have their * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of * `Uint8Array`, so the returned instances will have all the node `Buffer` methods * and the `Uint8Array` methods. Square bracket notation works as expected -- it * returns a single octet. * * The `Uint8Array` prototype remains unmodified. */ function Buffer (arg, encodingOrOffset, length) { if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) { return new Buffer(arg, encodingOrOffset, length) } // Common case. if (typeof arg === 'number') { if (typeof encodingOrOffset === 'string') { throw new Error( 'If encoding is specified then the first argument must be a string' ) } return allocUnsafe(this, arg) } return from(this, arg, encodingOrOffset, length) } Buffer.poolSize = 8192 // not used by this implementation // TODO: Legacy, not needed anymore. Remove in next major version. Buffer._augment = function (arr) { arr.__proto__ = Buffer.prototype return arr } function from (that, value, encodingOrOffset, length) { if (typeof value === 'number') { throw new TypeError('"value" argument must not be a number') } if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) { return fromArrayBuffer(that, value, encodingOrOffset, length) } if (typeof value === 'string') { return fromString(that, value, encodingOrOffset) } return fromObject(that, value) } /** * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError * if value is a number. * Buffer.from(str[, encoding]) * Buffer.from(array) * Buffer.from(buffer) * Buffer.from(arrayBuffer[, byteOffset[, length]]) **/ Buffer.from = function (value, encodingOrOffset, length) { return from(null, value, encodingOrOffset, length) } if (Buffer.TYPED_ARRAY_SUPPORT) { Buffer.prototype.__proto__ = Uint8Array.prototype Buffer.__proto__ = Uint8Array if (typeof Symbol !== 'undefined' && Symbol.species && Buffer[Symbol.species] === Buffer) { // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97 Object.defineProperty(Buffer, Symbol.species, { value: null, configurable: true }) } } function assertSize (size) { if (typeof size !== 'number') { throw new TypeError('"size" argument must be a number') } else if (size < 0) { throw new RangeError('"size" argument must not be negative') } } function alloc (that, size, fill, encoding) { assertSize(size) if (size <= 0) { return createBuffer(that, size) } if (fill !== undefined) { // Only pay attention to encoding if it's a string. This // prevents accidentally sending in a number that would // be interpretted as a start offset. return typeof encoding === 'string' ? createBuffer(that, size).fill(fill, encoding) : createBuffer(that, size).fill(fill) } return createBuffer(that, size) } /** * Creates a new filled Buffer instance. * alloc(size[, fill[, encoding]]) **/ Buffer.alloc = function (size, fill, encoding) { return alloc(null, size, fill, encoding) } function allocUnsafe (that, size) { assertSize(size) that = createBuffer(that, size < 0 ? 0 : checked(size) | 0) if (!Buffer.TYPED_ARRAY_SUPPORT) { for (var i = 0; i < size; ++i) { that[i] = 0 } } return that } /** * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance. * */ Buffer.allocUnsafe = function (size) { return allocUnsafe(null, size) } /** * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. */ Buffer.allocUnsafeSlow = function (size) { return allocUnsafe(null, size) } function fromString (that, string, encoding) { if (typeof encoding !== 'string' || encoding === '') { encoding = 'utf8' } if (!Buffer.isEncoding(encoding)) { throw new TypeError('"encoding" must be a valid string encoding') } var length = byteLength(string, encoding) | 0 that = createBuffer(that, length) var actual = that.write(string, encoding) if (actual !== length) { // Writing a hex string, for example, that contains invalid characters will // cause everything after the first invalid character to be ignored. (e.g. // 'abxxcd' will be treated as 'ab') that = that.slice(0, actual) } return that } function fromArrayLike (that, array) { var length = array.length < 0 ? 0 : checked(array.length) | 0 that = createBuffer(that, length) for (var i = 0; i < length; i += 1) { that[i] = array[i] & 255 } return that } function fromArrayBuffer (that, array, byteOffset, length) { array.byteLength // this throws if `array` is not a valid ArrayBuffer if (byteOffset < 0 || array.byteLength < byteOffset) { throw new RangeError('\'offset\' is out of bounds') } if (array.byteLength < byteOffset + (length || 0)) { throw new RangeError('\'length\' is out of bounds') } if (byteOffset === undefined && length === undefined) { array = new Uint8Array(array) } else if (length === undefined) { array = new Uint8Array(array, byteOffset) } else { array = new Uint8Array(array, byteOffset, length) } if (Buffer.TYPED_ARRAY_SUPPORT) { // Return an augmented `Uint8Array` instance, for best performance that = array that.__proto__ = Buffer.prototype } else { // Fallback: Return an object instance of the Buffer class that = fromArrayLike(that, array) } return that } function fromObject (that, obj) { if (Buffer.isBuffer(obj)) { var len = checked(obj.length) | 0 that = createBuffer(that, len) if (that.length === 0) { return that } obj.copy(that, 0, 0, len) return that } if (obj) { if ((typeof ArrayBuffer !== 'undefined' && obj.buffer instanceof ArrayBuffer) || 'length' in obj) { if (typeof obj.length !== 'number' || isnan(obj.length)) { return createBuffer(that, 0) } return fromArrayLike(that, obj) } if (obj.type === 'Buffer' && isArray(obj.data)) { return fromArrayLike(that, obj.data) } } throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.') } function checked (length) { // Note: cannot use `length < kMaxLength()` here because that fails when // length is NaN (which is otherwise coerced to zero.) if (length >= kMaxLength()) { throw new RangeError('Attempt to allocate Buffer larger than maximum ' + 'size: 0x' + kMaxLength().toString(16) + ' bytes') } return length | 0 } function SlowBuffer (length) { if (+length != length) { // eslint-disable-line eqeqeq length = 0 } return Buffer.alloc(+length) } Buffer.isBuffer = function isBuffer (b) { return !!(b != null && b._isBuffer) } Buffer.compare = function compare (a, b) { if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) { throw new TypeError('Arguments must be Buffers') } if (a === b) return 0 var x = a.length var y = b.length for (var i = 0, len = Math.min(x, y); i < len; ++i) { if (a[i] !== b[i]) { x = a[i] y = b[i] break } } if (x < y) return -1 if (y < x) return 1 return 0 } Buffer.isEncoding = function isEncoding (encoding) { switch (String(encoding).toLowerCase()) { case 'hex': case 'utf8': case 'utf-8': case 'ascii': case 'latin1': case 'binary': case 'base64': case 'ucs2': case 'ucs-2': case 'utf16le': case 'utf-16le': return true default: return false } } Buffer.concat = function concat (list, length) { if (!isArray(list)) { throw new TypeError('"list" argument must be an Array of Buffers') } if (list.length === 0) { return Buffer.alloc(0) } var i if (length === undefined) { length = 0 for (i = 0; i < list.length; ++i) { length += list[i].length } } var buffer = Buffer.allocUnsafe(length) var pos = 0 for (i = 0; i < list.length; ++i) { var buf = list[i] if (!Buffer.isBuffer(buf)) { throw new TypeError('"list" argument must be an Array of Buffers') } buf.copy(buffer, pos) pos += buf.length } return buffer } function byteLength (string, encoding) { if (Buffer.isBuffer(string)) { return string.length } if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' && (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) { return string.byteLength } if (typeof string !== 'string') { string = '' + string } var len = string.length if (len === 0) return 0 // Use a for loop to avoid recursion var loweredCase = false for (;;) { switch (encoding) { case 'ascii': case 'latin1': case 'binary': return len case 'utf8': case 'utf-8': case undefined: return utf8ToBytes(string).length case 'ucs2': case 'ucs-2': case 'utf16le': case 'utf-16le': return len * 2 case 'hex': return len >>> 1 case 'base64': return base64ToBytes(string).length default: if (loweredCase) return utf8ToBytes(string).length // assume utf8 encoding = ('' + encoding).toLowerCase() loweredCase = true } } } Buffer.byteLength = byteLength function slowToString (encoding, start, end) { var loweredCase = false // No need to verify that "this.length <= MAX_UINT32" since it's a read-only // property of a typed array. // This behaves neither like String nor Uint8Array in that we set start/end // to their upper/lower bounds if the value passed is out of range. // undefined is handled specially as per ECMA-262 6th Edition, // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization. if (start === undefined || start < 0) { start = 0 } // Return early if start > this.length. Done here to prevent potential uint32 // coercion fail below. if (start > this.length) { return '' } if (end === undefined || end > this.length) { end = this.length } if (end <= 0) { return '' } // Force coersion to uint32. This will also coerce falsey/NaN values to 0. end >>>= 0 start >>>= 0 if (end <= start) { return '' } if (!encoding) encoding = 'utf8' while (true) { switch (encoding) { case 'hex': return hexSlice(this, start, end) case 'utf8': case 'utf-8': return utf8Slice(this, start, end) case 'ascii': return asciiSlice(this, start, end) case 'latin1': case 'binary': return latin1Slice(this, start, end) case 'base64': return base64Slice(this, start, end) case 'ucs2': case 'ucs-2': case 'utf16le': case 'utf-16le': return utf16leSlice(this, start, end) default: if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) encoding = (encoding + '').toLowerCase() loweredCase = true } } } // The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect // Buffer instances. Buffer.prototype._isBuffer = true function swap (b, n, m) { var i = b[n] b[n] = b[m] b[m] = i } Buffer.prototype.swap16 = function swap16 () { var len = this.length if (len % 2 !== 0) { throw new RangeError('Buffer size must be a multiple of 16-bits') } for (var i = 0; i < len; i += 2) { swap(this, i, i + 1) } return this } Buffer.prototype.swap32 = function swap32 () { var len = this.length if (len % 4 !== 0) { throw new RangeError('Buffer size must be a multiple of 32-bits') } for (var i = 0; i < len; i += 4) { swap(this, i, i + 3) swap(this, i + 1, i + 2) } return this } Buffer.prototype.swap64 = function swap64 () { var len = this.length if (len % 8 !== 0) { throw new RangeError('Buffer size must be a multiple of 64-bits') } for (var i = 0; i < len; i += 8) { swap(this, i, i + 7) swap(this, i + 1, i + 6) swap(this, i + 2, i + 5) swap(this, i + 3, i + 4) } return this } Buffer.prototype.toString = function toString () { var length = this.length | 0 if (length === 0) return '' if (arguments.length === 0) return utf8Slice(this, 0, length) return slowToString.apply(this, arguments) } Buffer.prototype.equals = function equals (b) { if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer') if (this === b) return true return Buffer.compare(this, b) === 0 } Buffer.prototype.inspect = function inspect () { var str = '' var max = exports.INSPECT_MAX_BYTES if (this.length > 0) { str = this.toString('hex', 0, max).match(/.{2}/g).join(' ') if (this.length > max) str += ' ... ' } return '<Buffer ' + str + '>' } Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) { if (!Buffer.isBuffer(target)) { throw new TypeError('Argument must be a Buffer') } if (start === undefined) { start = 0 } if (end === undefined) { end = target ? target.length : 0 } if (thisStart === undefined) { thisStart = 0 } if (thisEnd === undefined) { thisEnd = this.length } if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) { throw new RangeError('out of range index') } if (thisStart >= thisEnd && start >= end) { return 0 } if (thisStart >= thisEnd) { return -1 } if (start >= end) { return 1 } start >>>= 0 end >>>= 0 thisStart >>>= 0 thisEnd >>>= 0 if (this === target) return 0 var x = thisEnd - thisStart var y = end - start var len = Math.min(x, y) var thisCopy = this.slice(thisStart, thisEnd) var targetCopy = target.slice(start, end) for (var i = 0; i < len; ++i) { if (thisCopy[i] !== targetCopy[i]) { x = thisCopy[i] y = targetCopy[i] break } } if (x < y) return -1 if (y < x) return 1 return 0 } // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`, // OR the last index of `val` in `buffer` at offset <= `byteOffset`. // // Arguments: // - buffer - a Buffer to search // - val - a string, Buffer, or number // - byteOffset - an index into `buffer`; will be clamped to an int32 // - encoding - an optional encoding, relevant is val is a string // - dir - true for indexOf, false for lastIndexOf function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) { // Empty buffer means no match if (buffer.length === 0) return -1 // Normalize byteOffset if (typeof byteOffset === 'string') { encoding = byteOffset byteOffset = 0 } else if (byteOffset > 0x7fffffff) { byteOffset = 0x7fffffff } else if (byteOffset < -0x80000000) { byteOffset = -0x80000000 } byteOffset = +byteOffset // Coerce to Number. if (isNaN(byteOffset)) { // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer byteOffset = dir ? 0 : (buffer.length - 1) } // Normalize byteOffset: negative offsets start from the end of the buffer if (byteOffset < 0) byteOffset = buffer.length + byteOffset if (byteOffset >= buffer.length) { if (dir) return -1 else byteOffset = buffer.length - 1 } else if (byteOffset < 0) { if (dir) byteOffset = 0 else return -1 } // Normalize val if (typeof val === 'string') { val = Buffer.from(val, encoding) } // Finally, search either indexOf (if dir is true) or lastIndexOf if (Buffer.isBuffer(val)) { // Special case: looking for empty string/buffer always fails if (val.length === 0) { return -1 } return arrayIndexOf(buffer, val, byteOffset, encoding, dir) } else if (typeof val === 'number') { val = val & 0xFF // Search for a byte value [0-255] if (Buffer.TYPED_ARRAY_SUPPORT && typeof Uint8Array.prototype.indexOf === 'function') { if (dir) { return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset) } else { return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset) } } return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir) } throw new TypeError('val must be string, number or Buffer') } function arrayIndexOf (arr, val, byteOffset, encoding, dir) { var indexSize = 1 var arrLength = arr.length var valLength = val.length if (encoding !== undefined) { encoding = String(encoding).toLowerCase() if (encoding === 'ucs2' || encoding === 'ucs-2' || encoding === 'utf16le' || encoding === 'utf-16le') { if (arr.length < 2 || val.length < 2) { return -1 } indexSize = 2 arrLength /= 2 valLength /= 2 byteOffset /= 2 } } function read (buf, i) { if (indexSize === 1) { return buf[i] } else { return buf.readUInt16BE(i * indexSize) } } var i if (dir) { var foundIndex = -1 for (i = byteOffset; i < arrLength; i++) { if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) { if (foundIndex === -1) foundIndex = i if (i - foundIndex + 1 === valLength) return foundIndex * indexSize } else { if (foundIndex !== -1) i -= i - foundIndex foundIndex = -1 } } } else { if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength for (i = byteOffset; i >= 0; i--) { var found = true for (var j = 0; j < valLength; j++) { if (read(arr, i + j) !== read(val, j)) { found = false break } } if (found) return i } } return -1 } Buffer.prototype.includes = function includes (val, byteOffset, encoding) { return this.indexOf(val, byteOffset, encoding) !== -1 } Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) { return bidirectionalIndexOf(this, val, byteOffset, encoding, true) } Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) { return bidirectionalIndexOf(this, val, byteOffset, encoding, false) } function hexWrite (buf, string, offset, length) { offset = Number(offset) || 0 var remaining = buf.length - offset if (!length) { length = remaining } else { length = Number(length) if (length > remaining) { length = remaining } } // must be an even number of digits var strLen = string.length if (strLen % 2 !== 0) throw new TypeError('Invalid hex string') if (length > strLen / 2) { length = strLen / 2 } for (var i = 0; i < length; ++i) { var parsed = parseInt(string.substr(i * 2, 2), 16) if (isNaN(parsed)) return i buf[offset + i] = parsed } return i } function utf8Write (buf, string, offset, length) { return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length) } function asciiWrite (buf, string, offset, length) { return blitBuffer(asciiToBytes(string), buf, offset, length) } function latin1Write (buf, string, offset, length) { return asciiWrite(buf, string, offset, length) } function base64Write (buf, string, offset, length) { return blitBuffer(base64ToBytes(string), buf, offset, length) } function ucs2Write (buf, string, offset, length) { return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length) } Buffer.prototype.write = function write (string, offset, length, encoding) { // Buffer#write(string) if (offset === undefined) { encoding = 'utf8' length = this.length offset = 0 // Buffer#write(string, encoding) } else if (length === undefined && typeof offset === 'string') { encoding = offset length = this.length offset = 0 // Buffer#write(string, offset[, length][, encoding]) } else if (isFinite(offset)) { offset = offset | 0 if (isFinite(length)) { length = length | 0 if (encoding === undefined) encoding = 'utf8' } else { encoding = length length = undefined } // legacy write(string, encoding, offset, length) - remove in v0.13 } else { throw new Error( 'Buffer.write(string, encoding, offset[, length]) is no longer supported' ) } var remaining = this.length - offset if (length === undefined || length > remaining) length = remaining if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) { throw new RangeError('Attempt to write outside buffer bounds') } if (!encoding) encoding = 'utf8' var loweredCase = false for (;;) { switch (encoding) { case 'hex': return hexWrite(this, string, offset, length) case 'utf8': case 'utf-8': return utf8Write(this, string, offset, length) case 'ascii': return asciiWrite(this, string, offset, length) case 'latin1': case 'binary': return latin1Write(this, string, offset, length) case 'base64': // Warning: maxLength not taken into account in base64Write return base64Write(this, string, offset, length) case 'ucs2': case 'ucs-2': case 'utf16le': case 'utf-16le': return ucs2Write(this, string, offset, length) default: if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) encoding = ('' + encoding).toLowerCase() loweredCase = true } } } Buffer.prototype.toJSON = function toJSON () { return { type: 'Buffer', data: Array.prototype.slice.call(this._arr || this, 0) } } function base64Slice (buf, start, end) { if (start === 0 && end === buf.length) { return base64.fromByteArray(buf) } else { return base64.fromByteArray(buf.slice(start, end)) } } function utf8Slice (buf, start, end) { end = Math.min(buf.length, end) var res = [] var i = start while (i < end) { var firstByte = buf[i] var codePoint = null var bytesPerSequence = (firstByte > 0xEF) ? 4 : (firstByte > 0xDF) ? 3 : (firstByte > 0xBF) ? 2 : 1 if (i + bytesPerSequence <= end) { var secondByte, thirdByte, fourthByte, tempCodePoint switch (bytesPerSequence) { case 1: if (firstByte < 0x80) { codePoint = firstByte } break case 2: secondByte = buf[i + 1] if ((secondByte & 0xC0) === 0x80) { tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F) if (tempCodePoint > 0x7F) { codePoint = tempCodePoint } } break case 3: secondByte = buf[i + 1] thirdByte = buf[i + 2] if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) { tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F) if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) { codePoint = tempCodePoint } } break case 4: secondByte = buf[i + 1] thirdByte = buf[i + 2] fourthByte = buf[i + 3] if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) { tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F) if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) { codePoint = tempCodePoint } } } } if (codePoint === null) { // we did not generate a valid codePoint so insert a // replacement char (U+FFFD) and advance only 1 byte codePoint = 0xFFFD bytesPerSequence = 1 } else if (codePoint > 0xFFFF) { // encode to utf16 (surrogate pair dance) codePoint -= 0x10000 res.push(codePoint >>> 10 & 0x3FF | 0xD800) codePoint = 0xDC00 | codePoint & 0x3FF } res.push(codePoint) i += bytesPerSequence } return decodeCodePointsArray(res) } // Based on http://stackoverflow.com/a/22747272/680742, the browser with // the lowest limit is Chrome, with 0x10000 args. // We go 1 magnitude less, for safety var MAX_ARGUMENTS_LENGTH = 0x1000 function decodeCodePointsArray (codePoints) { var len = codePoints.length if (len <= MAX_ARGUMENTS_LENGTH) { return String.fromCharCode.apply(String, codePoints) // avoid extra slice() } // Decode in chunks to avoid "call stack size exceeded". var res = '' var i = 0 while (i < len) { res += String.fromCharCode.apply( String, codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH) ) } return res } function asciiSlice (buf, start, end) { var ret = '' end = Math.min(buf.length, end) for (var i = start; i < end; ++i) { ret += String.fromCharCode(buf[i] & 0x7F) } return ret } function latin1Slice (buf, start, end) { var ret = '' end = Math.min(buf.length, end) for (var i = start; i < end; ++i) { ret += String.fromCharCode(buf[i]) } return ret } function hexSlice (buf, start, end) { var len = buf.length if (!start || start < 0) start = 0 if (!end || end < 0 || end > len) end = len var out = '' for (var i = start; i < end; ++i) { out += toHex(buf[i]) } return out } function utf16leSlice (buf, start, end) { var bytes = buf.slice(start, end) var res = '' for (var i = 0; i < bytes.length; i += 2) { res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256) } return res } Buffer.prototype.slice = function slice (start, end) { var len = this.length start = ~~start end = end === undefined ? len : ~~end if (start < 0) { start += len if (start < 0) start = 0 } else if (start > len) { start = len } if (end < 0) { end += len if (end < 0) end = 0 } else if (end > len) { end = len } if (end < start) end = start var newBuf if (Buffer.TYPED_ARRAY_SUPPORT) { newBuf = this.subarray(start, end) newBuf.__proto__ = Buffer.prototype } else { var sliceLen = end - start newBuf = new Buffer(sliceLen, undefined) for (var i = 0; i < sliceLen; ++i) { newBuf[i] = this[i + start] } } return newBuf } /* * Need to make sure that buffer isn't trying to write out of bounds. */ function checkOffset (offset, ext, length) { if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint') if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length') } Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) { offset = offset | 0 byteLength = byteLength | 0 if (!noAssert) checkOffset(offset, byteLength, this.length) var val = this[offset] var mul = 1 var i = 0 while (++i < byteLength && (mul *= 0x100)) { val += this[offset + i] * mul } return val } Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) { offset = offset | 0 byteLength = byteLength | 0 if (!noAssert) { checkOffset(offset, byteLength, this.length) } var val = this[offset + --byteLength] var mul = 1 while (byteLength > 0 && (mul *= 0x100)) { val += this[offset + --byteLength] * mul } return val } Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) { if (!noAssert) checkOffset(offset, 1, this.length) return this[offset] } Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) { if (!noAssert) checkOffset(offset, 2, this.length) return this[offset] | (this[offset + 1] << 8) } Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) { if (!noAssert) checkOffset(offset, 2, this.length) return (this[offset] << 8) | this[offset + 1] } Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) { if (!noAssert) checkOffset(offset, 4, this.length) return ((this[offset]) | (this[offset + 1] << 8) | (this[offset + 2] << 16)) + (this[offset + 3] * 0x1000000) } Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) { if (!noAssert) checkOffset(offset, 4, this.length) return (this[offset] * 0x1000000) + ((this[offset + 1] << 16) | (this[offset + 2] << 8) | this[offset + 3]) } Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) { offset = offset | 0 byteLength = byteLength | 0 if (!noAssert) checkOffset(offset, byteLength, this.length) var val = this[offset] var mul = 1 var i = 0 while (++i < byteLength && (mul *= 0x100)) { val += this[offset + i] * mul } mul *= 0x80 if (val >= mul) val -= Math.pow(2, 8 * byteLength) return val } Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) { offset = offset | 0 byteLength = byteLength | 0 if (!noAssert) checkOffset(offset, byteLength, this.length) var i = byteLength var mul = 1 var val = this[offset + --i] while (i > 0 && (mul *= 0x100)) { val += this[offset + --i] * mul } mul *= 0x80 if (val >= mul) val -= Math.pow(2, 8 * byteLength) return val } Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) { if (!noAssert) checkOffset(offset, 1, this.length) if (!(this[offset] & 0x80)) return (this[offset]) return ((0xff - this[offset] + 1) * -1) } Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) { if (!noAssert) checkOffset(offset, 2, this.length) var val = this[offset] | (this[offset + 1] << 8) return (val & 0x8000) ? val | 0xFFFF0000 : val } Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) { if (!noAssert) checkOffset(offset, 2, this.length) var val = this[offset + 1] | (this[offset] << 8) return (val & 0x8000) ? val | 0xFFFF0000 : val } Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) { if (!noAssert) checkOffset(offset, 4, this.length) return (this[offset]) | (this[offset + 1] << 8) | (this[offset + 2] << 16) | (this[offset + 3] << 24) } Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) { if (!noAssert) checkOffset(offset, 4, this.length) return (this[offset] << 24) | (this[offset + 1] << 16) | (this[offset + 2] << 8) | (this[offset + 3]) } Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) { if (!noAssert) checkOffset(offset, 4, this.length) return ieee754.read(this, offset, true, 23, 4) } Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) { if (!noAssert) checkOffset(offset, 4, this.length) return ieee754.read(this, offset, false, 23, 4) } Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) { if (!noAssert) checkOffset(offset, 8, this.length) return ieee754.read(this, offset, true, 52, 8) } Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) { if (!noAssert) checkOffset(offset, 8, this.length) return ieee754.read(this, offset, false, 52, 8) } function checkInt (buf, value, offset, ext, max, min) { if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance') if (value > max || value < min) throw new RangeError('"value" argument is out of bounds') if (offset + ext > buf.length) throw new RangeError('Index out of range') } Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) { value = +value offset = offset | 0 byteLength = byteLength | 0 if (!noAssert) { var maxBytes = Math.pow(2, 8 * byteLength) - 1 checkInt(this, value, offset, byteLength, maxBytes, 0) } var mul = 1 var i = 0 this[offset] = value & 0xFF while (++i < byteLength && (mul *= 0x100)) { this[offset + i] = (value / mul) & 0xFF } return offset + byteLength } Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) { value = +value offset = offset | 0 byteLength = byteLength | 0 if (!noAssert) { var maxBytes = Math.pow(2, 8 * byteLength) - 1 checkInt(this, value, offset, byteLength, maxBytes, 0) } var i = byteLength - 1 var mul = 1 this[offset + i] = value & 0xFF while (--i >= 0 && (mul *= 0x100)) { this[offset + i] = (value / mul) & 0xFF } return offset + byteLength } Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) { value = +value offset = offset | 0 if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0) if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value) this[offset] = (value & 0xff) return offset + 1 } function objectWriteUInt16 (buf, value, offset, littleEndian) { if (value < 0) value = 0xffff + value + 1 for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) { buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>> (littleEndian ? i : 1 - i) * 8 } } Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) { value = +value offset = offset | 0 if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0) if (Buffer.TYPED_ARRAY_SUPPORT) { this[offset] = (value & 0xff) this[offset + 1] = (value >>> 8) } else { objectWriteUInt16(this, value, offset, true) } return offset + 2 } Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) { value = +value offset = offset | 0 if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0) if (Buffer.TYPED_ARRAY_SUPPORT) { this[offset] = (value >>> 8) this[offset + 1] = (value & 0xff) } else { objectWriteUInt16(this, value, offset, false) } return offset + 2 } function objectWriteUInt32 (buf, value, offset, littleEndian) { if (value < 0) value = 0xffffffff + value + 1 for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) { buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff } } Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) { value = +value offset = offset | 0 if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0) if (Buffer.TYPED_ARRAY_SUPPORT) { this[offset + 3] = (value >>> 24) this[offset + 2] = (value >>> 16) this[offset + 1] = (value >>> 8) this[offset] = (value & 0xff) } else { objectWriteUInt32(this, value, offset, true) } return offset + 4 } Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) { value = +value offset = offset | 0 if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0) if (Buffer.TYPED_ARRAY_SUPPORT) { this[offset] = (value >>> 24) this[offset + 1] = (value >>> 16) this[offset + 2] = (value >>> 8) this[offset + 3] = (value & 0xff) } else { objectWriteUInt32(this, value, offset, false) } return offset + 4 } Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) { value = +value offset = offset | 0 if (!noAssert) { var limit = Math.pow(2, 8 * byteLength - 1) checkInt(this, value, offset, byteLength, limit - 1, -limit) } var i = 0 var mul = 1 var sub = 0 this[offset] = value & 0xFF while (++i < byteLength && (mul *= 0x100)) { if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) { sub = 1 } this[offset + i] = ((value / mul) >> 0) - sub & 0xFF } return offset + byteLength } Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) { value = +value offset = offset | 0 if (!noAssert) { var limit = Math.pow(2, 8 * byteLength - 1) checkInt(this, value, offset, byteLength, limit - 1, -limit) } var i = byteLength - 1 var mul = 1 var sub = 0 this[offset + i] = value & 0xFF while (--i >= 0 && (mul *= 0x100)) { if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) { sub = 1 } this[offset + i] = ((value / mul) >> 0) - sub & 0xFF } return offset + byteLength } Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) { value = +value offset = offset | 0 if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80) if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value) if (value < 0) value = 0xff + value + 1 this[offset] = (value & 0xff) return offset + 1 } Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) { value = +value offset = offset | 0 if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000) if (Buffer.TYPED_ARRAY_SUPPORT) { this[offset] = (value & 0xff) this[offset + 1] = (value >>> 8) } else { objectWriteUInt16(this, value, offset, true) } return offset + 2 } Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) { value = +value offset = offset | 0 if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000) if (Buffer.TYPED_ARRAY_SUPPORT) { this[offset] = (value >>> 8) this[offset + 1] = (value & 0xff) } else { objectWriteUInt16(this, value, offset, false) } return offset + 2 } Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) { value = +value offset = offset | 0 if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000) if (Buffer.TYPED_ARRAY_SUPPORT) { this[offset] = (value & 0xff) this[offset + 1] = (value >>> 8) this[offset + 2] = (value >>> 16) this[offset + 3] = (value >>> 24) } else { objectWriteUInt32(this, value, offset, true) } return offset + 4 } Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) { value = +value offset = offset | 0 if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000) if (value < 0) value = 0xffffffff + value + 1 if (Buffer.TYPED_ARRAY_SUPPORT) { this[offset] = (value >>> 24) this[offset + 1] = (value >>> 16) this[offset + 2] = (value >>> 8) this[offset + 3] = (value & 0xff) } else { objectWriteUInt32(this, value, offset, false) } return offset + 4 } function checkIEEE754 (buf, value, offset, ext, max, min) { if (offset + ext > buf.length) throw new RangeError('Index out of range') if (offset < 0) throw new RangeError('Index out of range') } function writeFloat (buf, value, offset, littleEndian, noAssert) { if (!noAssert) { checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38) } ieee754.write(buf, value, offset, littleEndian, 23, 4) return offset + 4 } Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) { return writeFloat(this, value, offset, true, noAssert) } Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) { return writeFloat(this, value, offset, false, noAssert) } function writeDouble (buf, value, offset, littleEndian, noAssert) { if (!noAssert) { checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308) } ieee754.write(buf, value, offset, littleEndian, 52, 8) return offset + 8 } Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) { return writeDouble(this, value, offset, true, noAssert) } Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) { return writeDouble(this, value, offset, false, noAssert) } // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length) Buffer.prototype.copy = function copy (target, targetStart, start, end) { if (!start) start = 0 if (!end && end !== 0) end = this.length if (targetStart >= target.length) targetStart = target.length if (!targetStart) targetStart = 0 if (end > 0 && end < start) end = start // Copy 0 bytes; we're done if (end === start) return 0 if (target.length === 0 || this.length === 0) return 0 // Fatal error conditions if (targetStart < 0) { throw new RangeError('targetStart out of bounds') } if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds') if (end < 0) throw new RangeError('sourceEnd out of bounds') // Are we oob? if (end > this.length) end = this.length if (target.length - targetStart < end - start) { end = target.length - targetStart + start } var len = end - start var i if (this === target && start < targetStart && targetStart < end) { // descending copy from end for (i = len - 1; i >= 0; --i) { target[i + targetStart] = this[i + start] } } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) { // ascending copy from start for (i = 0; i < len; ++i) { target[i + targetStart] = this[i + start] } } else { Uint8Array.prototype.set.call( target, this.subarray(start, start + len), targetStart ) } return len } // Usage: // buffer.fill(number[, offset[, end]]) // buffer.fill(buffer[, offset[, end]]) // buffer.fill(string[, offset[, end]][, encoding]) Buffer.prototype.fill = function fill (val, start, end, encoding) { // Handle string cases: if (typeof val === 'string') { if (typeof start === 'string') { encoding = start start = 0 end = this.length } else if (typeof end === 'string') { encoding = end end = this.length } if (val.length === 1) { var code = val.charCodeAt(0) if (code < 256) { val = code } } if (encoding !== undefined && typeof encoding !== 'string') { throw new TypeError('encoding must be a string') } if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) { throw new TypeError('Unknown encoding: ' + encoding) } } else if (typeof val === 'number') { val = val & 255 } // Invalid ranges are not set to a default, so can range check early. if (start < 0 || this.length < start || this.length < end) { throw new RangeError('Out of range index') } if (end <= start) { return this } start = start >>> 0 end = end === undefined ? this.length : end >>> 0 if (!val) val = 0 var i if (typeof val === 'number') { for (i = start; i < end; ++i) { this[i] = val } } else { var bytes = Buffer.isBuffer(val) ? val : utf8ToBytes(new Buffer(val, encoding).toString()) var len = bytes.length for (i = 0; i < end - start; ++i) { this[i + start] = bytes[i % len] } } return this } // HELPER FUNCTIONS // ================ var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g function base64clean (str) { // Node strips out invalid characters like \n and \t from the string, base64-js does not str = stringtrim(str).replace(INVALID_BASE64_RE, '') // Node converts strings with length < 2 to '' if (str.length < 2) return '' // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not while (str.length % 4 !== 0) { str = str + '=' } return str } function stringtrim (str) { if (str.trim) return str.trim() return str.replace(/^\s+|\s+$/g, '') } function toHex (n) { if (n < 16) return '0' + n.toString(16) return n.toString(16) } function utf8ToBytes (string, units) { units = units || Infinity var codePoint var length = string.length var leadSurrogate = null var bytes = [] for (var i = 0; i < length; ++i) { codePoint = string.charCodeAt(i) // is surrogate component if (codePoint > 0xD7FF && codePoint < 0xE000) { // last char was a lead if (!leadSurrogate) { // no lead yet if (codePoint > 0xDBFF) { // unexpected trail if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) continue } else if (i + 1 === length) { // unpaired lead if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) continue } // valid lead leadSurrogate = codePoint continue } // 2 leads in a row if (codePoint < 0xDC00) { if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) leadSurrogate = codePoint continue } // valid surrogate pair codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000 } else if (leadSurrogate) { // valid bmp char, but last char was a lead if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) } leadSurrogate = null // encode utf8 if (codePoint < 0x80) { if ((units -= 1) < 0) break bytes.push(codePoint) } else if (codePoint < 0x800) { if ((units -= 2) < 0) break bytes.push( codePoint >> 0x6 | 0xC0, codePoint & 0x3F | 0x80 ) } else if (codePoint < 0x10000) { if ((units -= 3) < 0) break bytes.push( codePoint >> 0xC | 0xE0, codePoint >> 0x6 & 0x3F | 0x80, codePoint & 0x3F | 0x80 ) } else if (codePoint < 0x110000) { if ((units -= 4) < 0) break bytes.push( codePoint >> 0x12 | 0xF0, codePoint >> 0xC & 0x3F | 0x80, codePoint >> 0x6 & 0x3F | 0x80, codePoint & 0x3F | 0x80 ) } else { throw new Error('Invalid code point') } } return bytes } function asciiToBytes (str) { var byteArray = [] for (var i = 0; i < str.length; ++i) { // Node's code seems to be doing this and not & 0x7F.. byteArray.push(str.charCodeAt(i) & 0xFF) } return byteArray } function utf16leToBytes (str, units) { var c, hi, lo var byteArray = [] for (var i = 0; i < str.length; ++i) { if ((units -= 2) < 0) break c = str.charCodeAt(i) hi = c >> 8 lo = c % 256 byteArray.push(lo) byteArray.push(hi) } return byteArray } function base64ToBytes (str) { return base64.toByteArray(base64clean(str)) } function blitBuffer (src, dst, offset, length) { for (var i = 0; i < length; ++i) { if ((i + offset >= dst.length) || (i >= src.length)) break dst[i + offset] = src[i] } return i } function isnan (val) { return val !== val // eslint-disable-line no-self-compare } /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(4))) /***/ }), /* 9 */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(Buffer, module) {(function (w) { "use strict"; function findBest(atobNative) { // normal window if ('function' === typeof atobNative) { return atobNative; } // browserify (web worker) if ('function' === typeof Buffer) { return function atobBrowserify(a) { //!! Deliberately using an API that's deprecated in node.js because //!! this file is for browsers and we expect them to cope with it. //!! Discussion: github.com/node-browser-compat/atob/pull/9 return new Buffer(a, 'base64').toString('binary'); }; } // ios web worker with base64js if ('object' === typeof w.base64js) { // bufferToBinaryString // https://git.coolaj86.com/coolaj86/unibabel.js/blob/master/index.js#L50 return function atobWebWorker_iOS(a) { var buf = w.base64js.b64ToByteArray(a); return Array.prototype.map.call(buf, function (ch) { return String.fromCharCode(ch); }).join(''); }; } return function () { // ios web worker without base64js throw new Error("You're probably in an old browser or an iOS webworker." + " It might help to include beatgammit's base64-js."); }; } var atobBest = findBest(w.atob); w.atob = atobBest; if (( true) && module && module.exports) { module.exports = atobBest; } }(window)); /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(8).Buffer, __webpack_require__(40)(module))) /***/ }), /* 10 */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(Buffer) {(function () { "use strict"; function btoa(str) { var buffer; if (str instanceof Buffer) { buffer = str; } else { buffer = Buffer.from(str.toString(), 'binary'); } return buffer.toString('base64'); } module.exports = btoa; }()); /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(8).Buffer)) /***/ }), /* 11 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "blobToFile", function() { return blobToFile; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "dataURItoBlob", function() { return dataURItoBlob; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "blobToArrayBuffer", function() { return blobToArrayBuffer; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "stringToBlob", function() { return stringToBlob; }); function blobToFile(theBlob, fileName) { return new File([theBlob], fileName); } function dataURItoBlob(dataURI) { var byteString = atob(dataURI.split(',')[1]); var mimeString = dataURI.split(',')[0].split(':')[1].split(';')[0]; var ab = new ArrayBuffer(byteString.length); var ia = new Uint8Array(ab); for (var i = 0; i < byteString.length; i++) { ia[i] = byteString.charCodeAt(i); } var blob = new Blob([ab], { type: mimeString }); return blob; } function blobToArrayBuffer(blob) { var fileReader = new FileReader(); return new Promise(function (rs) { fileReader.onload = function (event) { var arrayBuffer = event.target.result; rs(arrayBuffer); }; fileReader.readAsArrayBuffer(blob); }); } function stringToBlob(text, type) { return new Blob([text], { type: type || 'text/plain' }); } /***/ }), /* 12 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "base64EncodeUnicode", function() { return base64EncodeUnicode; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "base64DecodeUnicode", function() { return base64DecodeUnicode; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "UnicodeBase64Converter", function() { return UnicodeBase64Converter; }); function base64EncodeUnicode(str) { return btoa(encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, function toSolidBytes(match, p1) { return String.fromCharCode('0x' + p1); })); }; function base64DecodeUnicode(str) { return decodeURIComponent(atob(str).split('').map(function (c) { return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2); }).join('')); } var UnicodeBase64Converter = { encode: base64EncodeUnicode, decode: base64DecodeUnicode }; /***/ }), /* 13 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /** * * @param {Date| Number} time * @param {Function} callback */ function Alarm(time, callback) { this.LIMIT_TIMEOUT = 2147483647; this.callback = callback; this.state = "STAND_BY"; this.timeout = -1; if (typeof time == 'number') this.time = time; else this.time = time.getTime(); this.args = Array.prototype.slice.call(arguments, 2); this.tick = this.tick.bind(this); if (this.time >= new Date().getTime()) this.start(); else this.kill(); } Alarm.prototype.start = function () { if (this.state == 'STAND_BY' || this.state == "PAUSE") { this.state = "RUNNING"; this.tick(); return true; } return false; }; Alarm.prototype.pause = function () { if (this.state == "RUNNING") { clearTimeout(this.timeout); this.timeout = -1; this.state = 'PAUSE'; } }; Alarm.prototype.tick = function () { var now = new Date().getTime(); if (now >= this.time) { this.callback && this.callback.apply(null, this.args); this.start = 'FINISH'; } else { var deltaTime = Math.min(this.LIMIT_TIMEOUT, this.time - now); this.timeout = setTimeout(this.tick, deltaTime); this.state = "RUNNING"; } } Alarm.prototype.kill = function () { if (this.state != "FINISH" && this.state != "DEAD") { if (this.timeout >= 0) clearTimeout(this.timeout); this.state = 'DEAD'; return true; } return false; }; /* harmony default export */ __webpack_exports__["a"] = (Alarm); /***/ }), /* 14 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; function Ref(value) { this.set(value); } Ref.prototype.toString = function () { return this.value + ''; }; Ref.prototype.valueOf = function () { return this.value; }; Ref.prototype.set = function (value) { this.value = value; }; Ref.prototype.get = function () { return this.value; } /* harmony default export */ __webpack_exports__["a"] = (Ref); /***/ }), /* 15 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; var XHR = {}; XHR.makeHttpObject = function () { try { return new XMLHttpRequest(); } catch (error) { } try { return new ActiveXObject("Msxml2.XMLHTTP"); } catch (error) { } try { return new ActiveXObject("Microsoft.XMLHTTP"); } catch (error) { } throw new Error("Could not create HTTP request object."); }; /*** * * @param {String} url * @param {String} body * @param {String} responseType * @param {Function} success * @param {Function} failure * @returns {Promise} */ XHR.getRequest = function (url, props, success, failure) { return new Promise(function (rs, rj) { var request = XHR.makeHttpObject(); request.open("GET", url, true); if (typeof props == 'string') request.responseType = props || ''; else if (props && (typeof props == 'object')) { Object.assign(request, props); } request.send(null); request.onreadystatechange = function () { if (request.readyState == 4) { if (request.status == 200) { var response = request.response; success && success(response); rs(response); } else { failure && failure(request.status, request.statusText); rj(request.status); } } }; request.onerror = function () { failure && failure(request.status, request.statusText); rj(new Error(request.status + request.statusText)); }; }); }; XHR.postRepquest = function (url, payload, props, headers, success, failure) { return new Promise(function (rs, rj) { var method = "POST"; var shouldBeAsync = true; var request = XHR.makeHttpObject(); request.onreadystatechange = function () { if (request.readyState == 4) { if (request.status == 200) { success && success(request.response); rs(request.response); } else if (failure) { failure && failure(request.status, request.statusText); rj({ status: request.status, statusText: request.statusText }); } } }; request.onerror = function () { failure && failure(request.status, request.statusText); rj(new Error(request.status + request.statusText)); }; request.open(method, url, shouldBeAsync); if (typeof props == 'string') request.responseType = props || ''; else if (props && (typeof props == 'object')) { Object.assign(request, props); } headers = headers || {}; headers["Content-Type"] = headers["Content-Type"] || "application/json;charset=UTF-8"; Object.keys(headers).forEach(function (key) { request.setRequestHeader(key, headers[key]); }); request.send(payload); }); }; XHR.request = function (method, url, props, headers, body, successCallback, failureCallback) { return new Promise(function (rs, rj) { var shouldBeAsync = true; var request = new XMLHttpRequest(); request.onreadystatechange = function () { if (request.readyState == 4) { if (request.status == 200) { successCallback && successCallback(request.response); rs(request.response); } else { failureCallback && failureCallback(request.status, request.statusText); rj({ status: request.status, statusText: request.statusText }); } } }; request.onerror = function () { var error = new Error("Network Error!"); if (failureCallback) failureCallback(error); rj(error); }; request.open(method, url, shouldBeAsync); if (typeof props == 'string') request.responseType = props || ''; else if (props && (typeof props == 'object')) { Object.assign(request, props); } headers = headers || {}; headers["Content-Type"] = headers["Content-Type"] || "application/json;charset=UTF-8"; Object.keys(headers).forEach(function (key) { request.setRequestHeader(key, headers[key]); }); request.send(body); }); }; /* harmony default export */ __webpack_exports__["a"] = (XHR); /***/ }), /* 16 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; function VarScope(parent) { this.parent = parent; this.data = {}; } VarScope.prototype.declare = function (name, initValue) { if (name in this.data) throw new Error(name + ' is already delared in this scope!'); this.data[name] = initValue; }; VarScope.prototype.get = function (name) { var scope = this.findScope(name); if (!scope) throw new Error(name + ' is not declared!'); return scope.data[name]; }; VarScope.prototype.set = function (name, value) { var scope = this.findScope(name); if (!scope) throw new Error(name + ' is not declared!'); scope.data[name] = value; }; VarScope.prototype.findScope = function (name) { var currentScope = this; while (currentScope) { if (name in currentScope.data) break; currentScope = currentScope.parent; } return currentScope; }; /* harmony default export */ __webpack_exports__["a"] = (VarScope); /***/ }), /* 17 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var _Vec2__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0); /** * * @param {Number} x * @param {Number} y * @param {Number} width * @param {Number} height */ function Rectangle(x, y, width, height) { this.width = width; this.height = height; this.x = x; this.y = y; } /** * * @return {Vec2} * @constructor */ Rectangle.prototype.A = function () { return new _Vec2__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"](this.x, this.y); }; /*** * * @return {Vec2} * @constructor */ Rectangle.prototype.B = function () { return new _Vec2__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"](this.x + this.width, this.y); }; /*** * * @return {Vec2} * @constructor */ Rectangle.prototype.C = function () { return new _Vec2__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"](this.x + this.width, this.y + this.height); }; /*** * * @return {Vec2} * @constructor */ Rectangle.prototype.D = function () { return new _Vec2__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"](this.x, this.y + this.height); }; /*** * * @return {number} */ Rectangle.prototype.square = function () { return this.width * this.height; }; Rectangle.prototype.nearestPoint = function (arg0, arg1) { if (arg1) arg0 = _Vec2__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"].make(arg0, arg1); var res = this.A(); var mind = res.dist(arg0); var d = this.B().dist(arg0); if (d < mind) { mind = d; res = this.B(); } d = this.C().dist(arg0); if (d < mind) { mind = d; res = this.C(); } d = this.D().dist(arg0); if (d < mind) { mind = d; res = this.D(); } return res; }; Rectangle.prototype.centerPoint = function () { return new _Vec2__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"](this.x + this.width / 2, this.y + this.height / 2); }; /*** * * @param {Rectangle} r * @param {boolean} margin * @return {boolean} */ Rectangle.prototype.isCollapse = function (r, margin) { if (!margin) margin = 0; if (this.x >= r.x + r.width + margin) return false; if (this.y >= r.y + r.height + margin) return false; if (r.x >= this.x + this.width + margin) return false; if (r.y >= this.y + this.height + margin) return false; return true; }; /*** * * @param {Rectangle} r * @return {number} */ Rectangle.prototype.collapsedSquare = function (r) { var collapseRect = this.collapsedRect(r); if (collapseRect) { return collapseRect.square(); } else { return 0; } }; /*** * * @param {Rectangle} r * @return {Rectangle} */ Rectangle.prototype.collapsedRect = function (r) { var maxX, minX, maxY, minY, width, height; minX = Math.max(this.x, r.x); minY = Math.max(this.y, r.y); maxX = Math.min(this.x + this.width, r.x + r.width); maxY = Math.min(this.y + this.height, r.y + r.height); width = maxX - minX; height = maxY - minY; if (width >= 0 && height >= 0) { return new Rectangle(minX, minY, width, height); } return null; }; /** * @param {Rectangle} r * @returns {Boolean} */ Rectangle.prototype.contains = function (r) { return (this.x <= r.x) && (this.y <= r.y) && (this.x + this.width >= r.x + r.width) && (this.y + this.height >= r.y + r.height); }; /** * @param {Vec2} p * @returns {Boolean} */ Rectangle.prototype.containsPoint = function (p) { return (this.x <= p.x) && (this.y <= p.y) && (this.x + this.width >= p.x) && (this.y + this.height >= p.y); }; /** * @param {Rectangle} other * @returns {Rectangle} */ Rectangle.prototype.merge = function (other) { var left = Math.min(this.x, other.x); var top = Math.min(this.y, other.y); var right = Math.max(this.x + this.width, other.x + other.width); var bottom = Math.max(this.y + this.height, other.y + other.height); return new Rectangle(left, top, right - left, bottom - top); }; /** * @returns {Rectangle} */ Rectangle.prototype.clone = function () { return new Rectangle(this.x, this.y, this.width, this.height); }; /*** * * @param {Rectangle} r */ Rectangle.prototype.equals = function (r) { return this.x == r.x && this.y == r.y && this.height == r.height && this.width == r.width; }; /** * @param {Number} x * @param {Number} y * @param {Number} width * @param {Number} height * @returns {Rectangle} */ Rectangle.make = function (x, y, width, height) { return new Rectangle(x, y, width, height); }; /** * @param {Number} x * @param {Number} y * @param {Number} width * @param {Number} height * @returns {Rectangle} */ Rectangle.makeCenter = function (x, y, width, height) { return new Rectangle(x - width / 2, y - height / 2, width, height); }; /** * @param {ClientRect|DOMRect} clientRect * @returns {Rectangle} */ Rectangle.fromClientRect = function (clientRect) { return new Rectangle(clientRect.left, clientRect.top, clientRect.width, clientRect.height); }; /* harmony default export */ __webpack_exports__["a"] = (Rectangle); /***/ }), /* 18 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var _Vec2__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0); /* harmony import */ var _int__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1); function Arc(x, y, r, start, end) { this.x = x; this.y = y; this.r = r; this.start = start; this.end = end; } Arc.prototype.isPointInBound = function (p) { if (Object(_int__WEBPACK_IMPORTED_MODULE_1__["distance"])(this.x, this.y, p.x, p.y) > r) return false; return Object(_int__WEBPACK_IMPORTED_MODULE_1__["radianInRange"])(Math.atan2(p.y - this.y, p.x - this.x), start, end); }; Arc.prototype.isRectInBound = function (rect) { return this.isPointInBound(rect.A()) && this.isPointInBound(rect.B()) && this.isPointInBound(rect.C()) && this.isPointInBound(rect.D()); }; Arc.prototype.isRectOutBound = function (rect) { return !this.isPointInBound(rect.A()) && !this.isPointInBound(rect.B()) && !this.isPointInBound(rect.C()) && !this.isPointInBound(rect.D()); }; Arc.prototype.isRectCollapse = function (rect) { return this.isPointInBound(rect.A()) || this.isPointInBound(rect.B()) || this.isPointInBound(rect.C()) || this.isPointInBound(rect.D()); }; Arc.prototype.centerPoint = function () { var mid = (this.start + this.end) / 2; var x = this.x + Math.cos(mid) * this.r * 2 / 3; var y = this.y + Math.sin(mid) * this.r * 2 / 3; return new _Vec2__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"](x, y); }; Arc.prototype.centerRoundPoint = function () { var mid = (this.start + this.end) / 2; var x = this.x + Math.cos(mid) * this.r; var y = this.y + Math.sin(mid) * this.r; return new _Vec2__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"](x, y); }; Arc.make = function (x, y, r, start, end) { return new Arc(x, y, r, start, end); }; /* harmony default export */ __webpack_exports__["a"] = (Arc); /***/ }), /* 19 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /** * * @param {Number} start */ function NumRange(start, length) { if (arguments.length == 1) length = 0; else if (arguments.length == 0) { length = 0; start = 0; } this.start = start; this.length = length; } /** * @param {Number} num */ NumRange.prototype.contains = function (num) { return (num >= this.start) && (num <= this.start + this.length); }; /** * @param {NumRange} other * @returns {NumRange} */ NumRange.prototype.merge = function (other) { var start = Math.min(this.start, other.start); var end = Math.max(this.start + this.length, other.start + other.length); return new NumRange(start, end - start); }; NumRange.prototype.centerValue = function () { return this.start + this.length / 2; }; /** * @param {NumRange} other * @returns {Boolean} */ NumRange.prototype.isCollapse = function (other) { var start = Math.max(this.start, other.start); var end = Math.min(this.start + this.length, other.start + other.length); return start <= end; }; /** * @param {NumRange} other * @returns {Boolean} */ NumRange.prototype.collapsedNumRange = function (other) { var start = Math.max(this.start, other.start); var end = Math.min(this.start + this.length, other.start + other.length); if (start <= end) return new NumRange(start, end - start); return null; }; NumRange.prototype.clone = function () { return new NumRange(this.start, this.length); }; /* harmony default export */ __webpack_exports__["a"] = (NumRange); /***/ }), /* 20 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export defaultCmp */ /* unused harmony export heapDown */ /* unused harmony export heapUp */ /* unused harmony export heapify */ /* unused harmony export heapPop */ /* unused harmony export heapPush */ function defaultCmp(x, y) { if (x < y) { return -1; } if (x > y) { return 1; } return 0; }; /** * * @param {Array} arr * @param {Number} pos * @param {Function} cmp */ function heapDown(arr, pos, cmp) { if (!cmp) cmp = defaultCmp; var item = arr[pos]; var endPos = arr.length; var childPos = (pos << 1) | 1; var childRightPos; while (childPos < endPos) { childRightPos = childPos + 1; if (childPos + 1 < endPos && cmp(arr[childPos], arr[childRightPos]) > 0) { childPos = childRightPos; } if (cmp(arr[childPos], item) < 0) { arr[pos] = arr[childPos]; arr[childPos] = item; pos = childPos; childPos = (pos << 1) | 1; } else break; } } /** * * @param {Array} arr * @param {Number} pos * @param {Function} cmp */ function heapUp(arr, pos, cmp) { if (!cmp) cmp = defaultCmp; var item = arr[pos]; var parPos; while (pos > 0) { parPos = (pos - 1) >> 1; if (cmp(arr[parPos], item) > 0) { arr[pos] = arr[parPos]; arr[parPos] = item; pos = parPos; } else break; } } /** * * @param {Array} arr * @param {Function} cmp */ function heapify(arr, cmp) { if (!cmp) cmp = defaultCmp; var endPos = arr.length; for (var i = 0; i < endPos; ++i) heapUp(arr, i, cmp); } /** * * @param {Array} arr * @param {Function} cmp */ function heapPop(arr, cmp) { if (!cmp) cmp = defaultCmp; var item = arr[0]; var lastItem = arr.pop(); if (arr.length > 0) { arr[0] = lastItem; heapDown(arr, 0, cmp); } return item; } /** * * @param {Array} arr * @param {*} item * @param {Function} cmp */ function heapPush(arr, item, cmp) { if (!cmp) cmp = defaultCmp; arr.push(item); heapUp(arr, arr.length - 1, cmp); } function Heap(cmd) { this.cmp = cmd || defaultCmp; this.arr = []; } /** * @param {Array} arr * @param {Function} cmp * @returns {Heap} */ Heap.fromArray = function (arr, cmp) { var heap = new Heap(cmp); heapify(arr); heap.arr = arr; return heap; }; Heap.prototype.push = function (x) { heapPush(this.arr, x, this.cmp); return this; }; Heap.prototype.pop = function () { return heapPop(this.arr, this.cmp); }; Heap.prototype.peek = function () { return this.arr[0]; }; Heap.prototype.contains = function (x) { return this.arr.indexOf(x) !== -1; }; Heap.prototype.clear = function () { this.arr.splice(0, this.arr.length); return this; }; Heap.prototype.empty = function () { return this.arr.length === 0; }; Heap.prototype.size = function () { return this.arr.length; }; Heap.prototype.clone = function () { var heap; heap = new Heap(this.cmp); heap.arr = this.arr.slice(0); return heap; }; Heap.prototype.toArray = function () { return this.arr.slice(0); }; Heap.prototype.toSortedArray = function () { var res = []; var heap = this.clone(); while (!heap.empty()) res.push(heap.pop()); return res; }; Heap.prototype.insert = Heap.prototype.push; Heap.prototype.top = Heap.prototype.peek; Heap.prototype.front = Heap.prototype.peek; Heap.prototype.has = Heap.prototype.contains; Heap.prototype.copy = Heap.prototype.clone; /* harmony default export */ __webpack_exports__["a"] = (Heap); /***/ }), /* 21 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MILLIS_PER_DAY", function() { return MILLIS_PER_DAY; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MILLIS_PER_HOUR", function() { return MILLIS_PER_HOUR; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MILLIS_PER_MINUTE", function() { return MILLIS_PER_MINUTE; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ddmmyyyy", function() { return ddmmyyyy; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "language2LocalDateFormat", function() { return language2LocalDateFormat; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "dateFormat2LocationList", function() { return dateFormat2LocationList; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "dateFormatList", function() { return dateFormatList; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "yyymmdd", function() { return yyymmdd; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "dayNames", function() { return dayNames; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "shortDayNames", function() { return shortDayNames; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "monthNames", function() { return monthNames; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "shortMonthNames", function() { return shortMonthNames; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "formatTokenRegex", function() { return formatTokenRegex; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DATE_TIME_TOKEN_RGX", function() { return DATE_TIME_TOKEN_RGX; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "formatDateString", function() { return formatDateString; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LOCAL_DATE_FORMAT", function() { return LOCAL_DATE_FORMAT; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LOCAL_DATE_TIME_FORMAT", function() { return LOCAL_DATE_TIME_FORMAT; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "formartDateString", function() { return formartDateString; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "parseDateString", function() { return parseDateString; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "prevDate", function() { return prevDate; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "nextDate", function() { return nextDate; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "beginOfHour", function() { return beginOfHour; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "beginOfDay", function() { return beginOfDay; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "beginOfWeek", function() { return beginOfWeek; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "beginOfMonth", function() { return beginOfMonth; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "beginOfYear", function() { return beginOfYear; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "compareDate", function() { return compareDate; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "compareMonth", function() { return compareMonth; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "compareYear", function() { return compareYear; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "nextMonth", function() { return nextMonth; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "prevMonth", function() { return prevMonth; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "daysInMonth", function() { return daysInMonth; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "parseDateTime", function() { return parseDateTime; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "formatDateTime", function() { return formatDateTime; }); /* harmony import */ var _String_stringFormat__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6); /* harmony import */ var _Math_int__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1); var MILLIS_PER_DAY = 24 * 3600000; var MILLIS_PER_HOUR = 3600000; var MILLIS_PER_MINUTE = 60000; /** * * @param {Date} date * @returns {String} */ function ddmmyyyy(date) { var mm = date.getMonth() + 1; // getMonth() is zero-based var dd = date.getDate(); return [(dd > 9 ? '' : '0') + dd, (mm > 9 ? '' : '0') + mm, date.getFullYear() ].join('/'); }; var language2LocalDateFormat = { "af-ZA": "yyyy/mm/dd", "am-ET": "d/m/yyyy", "ar-AE": "dd/mm/yyyy", "ar-BH": "dd/mm/yyyy", "ar-DZ": "dd-mm-yyyy", "ar-EG": "dd/mm/yyyy", "ar-IQ": "dd/mm/yyyy", "ar-JO": "dd/mm/yyyy", "ar-KW": "dd/mm/yyyy", "ar-LB": "dd/mm/yyyy", "ar-LY": "dd/mm/yyyy", "ar-MA": "dd-mm-yyyy", "ar-OM": "dd/mm/yyyy", "ar-QA": "dd/mm/yyyy", "ar-SA": "dd/mm/yy", "ar-SY": "dd/mm/yyyy", "ar-TN": "dd-mm-yyyy", "ar-YE": "dd/mm/yyyy", "arn-CL": "dd-mm-yyyy", "as-IN": "dd-mm-yyyy", "az-Cyrl-AZ": "dd.mm.yyyy", "az-Latn-AZ": "dd.mm.yyyy", "ba-RU": "dd.mm.yy", "be-BY": "dd.mm.yyyy", "bg-BG": "dd.m.yyyy", "bn-BD": "dd-mm-yy", "bn-IN": "dd-mm-yy", "bo-CN": "yyyy/m/d", "br-FR": "dd/mm/yyyy", "bs-Cyrl-BA": "d.m.yyyy", "bs-Latn-BA": "d.m.yyyy", "ca-ES": "dd/mm/yyyy", "co-FR": "dd/mm/yyyy", "cs-CZ": "d.m.yyyy", "cy-GB": "dd/mm/yyyy", "da-DK": "dd-mm-yyyy", "de-AT": "dd.mm.yyyy", "de-CH": "dd.mm.yyyy", "de-DE": "dd.mm.yyyy", "de-LI": "dd.mm.yyyy", "de-LU": "dd.mm.yyyy", "dsb-DE": "d. m. yyyy", "dv-MV": "dd/mm/yy", "el-GR": "d/m/yyyy", "en-029": "mm/dd/yyyy", "en-AU": "d/mm/yyyy", "en-BZ": "dd/mm/yyyy", "en-CA": "dd/mm/yyyy", "en-GB": "dd/mm/yyyy", "en-IE": "dd/mm/yyyy", "en-IN": "dd-mm-yyyy", "en-JM": "dd/mm/yyyy", "en-MY": "d/m/yyyy", "en-NZ": "d/mm/yyyy", "en-PH": "m/d/yyyy", "en-SG": "d/m/yyyy", "en-TT": "dd/mm/yyyy", "en-US": "m/d/yyyy", "en-ZA": "yyyy/mm/dd", "en-ZW": "m/d/yyyy", "es-AR": "dd/mm/yyyy", "es-BO": "dd/mm/yyyy", "es-CL": "dd-mm-yyyy", "es-CO": "dd/mm/yyyy", "es-CR": "dd/mm/yyyy", "es-DO": "dd/mm/yyyy", "es-EC": "dd/mm/yyyy", "es-ES": "dd/mm/yyyy", "es-GT": "dd/mm/yyyy", "es-HN": "dd/mm/yyyy", "es-MX": "dd/mm/yyyy", "es-NI": "dd/mm/yyyy", "es-PA": "mm/dd/yyyy", "es-PE": "dd/mm/yyyy", "es-PR": "dd/mm/yyyy", "es-PY": "dd/mm/yyyy", "es-SV": "dd/mm/yyyy", "es-US": "m/d/yyyy", "es-UY": "dd/mm/yyyy", "es-VE": "dd/mm/yyyy", "et-EE": "d.mm.yyyy", "eu-ES": "yyyy/mm/dd", "fa-IR": "mm/dd/yyyy", "fi-FI": "d.m.yyyy", "fil-PH": "m/d/yyyy", "fo-FO": "dd-mm-yyyy", "fr-BE": "d/mm/yyyy", "fr-CA": "yyyy-mm-dd", "fr-CH": "dd.mm.yyyy", "fr-FR": "dd/mm/yyyy", "fr-LU": "dd/mm/yyyy", "fr-MC": "dd/mm/yyyy", "fy-NL": "d-m-yyyy", "ga-IE": "dd/mm/yyyy", "gd-GB": "dd/mm/yyyy", "gl-ES": "dd/mm/yy", "gsw-FR": "dd/mm/yyyy", "gu-IN": "dd-mm-yy", "ha-Latn-NG": "d/m/yyyy", "he-IL": "dd/mm/yyyy", "hi-IN": "dd-mm-yyyy", "hr-BA": "d.m.yyyy.", "hr-HR": "d.m.yyyy", "hsb-DE": "d. m. yyyy", "hu-HU": "yyyy. mm. dd.", "hy-AM": "dd.mm.yyyy", "id-ID": "dd/mm/yyyy", "ig-NG": "d/m/yyyy", "ii-CN": "yyyy/m/d", "is-IS": "d.m.yyyy", "it-CH": "dd.mm.yyyy", "it-IT": "dd/mm/yyyy", "iu-Cans-CA": "d/m/yyyy", "iu-Latn-CA": "d/mm/yyyy", "ja-JP": "yyyy/mm/dd", "ka-GE": "dd.mm.yyyy", "kk-KZ": "dd.mm.yyyy", "kl-GL": "dd-mm-yyyy", "km-KH": "yyyy-mm-dd", "kn-IN": "dd-mm-yy", "ko-KR": "yyyy-mm-dd", "kok-IN": "dd-mm-yyyy", "ky-KG": "dd.mm.yy", "lb-LU": "dd/mm/yyyy", "lo-LA": "dd/mm/yyyy", "lt-LT": "yyyy.mm.dd", "lv-LV": "yyyy.mm.dd.", "mi-NZ": "dd/mm/yyyy", "mk-MK": "dd.mm.yyyy", "ml-IN": "dd-mm-yy", "mn-MN": "yy.mm.dd", "mn-Mong-CN": "yyyy/m/d", "moh-CA": "m/d/yyyy", "mr-IN": "dd-mm-yyyy", "ms-BN": "dd/mm/yyyy", "ms-MY": "dd/mm/yyyy", "mt-MT": "dd/mm/yyyy", "nb-NO": "dd.mm.yyyy", "ne-NP": "m/d/yyyy", "nl-BE": "d/mm/yyyy", "nl-NL": "d-m-yyyy", "nn-NO": "dd.mm.yyyy", "nso-ZA": "yyyy/mm/dd", "oc-FR": "dd/mm/yyyy", "or-IN": "dd-mm-yy", "pa-IN": "dd-mm-yy", "pl-PL": "yyyy-mm-dd", "prs-AF": "dd/mm/yy", "ps-AF": "dd/mm/yy", "pt-BR": "d/m/yyyy", "pt-PT": "dd-mm-yyyy", "qut-GT": "dd/mm/yyyy", "quz-BO": "dd/mm/yyyy", "quz-EC": "dd/mm/yyyy", "quz-PE": "dd/mm/yyyy", "rm-CH": "dd/mm/yyyy", "ro-RO": "dd.mm.yyyy", "ru-RU": "dd.mm.yyyy", "rw-RW": "m/d/yyyy", "sa-IN": "dd-mm-yyyy", "sah-RU": "mm.dd.yyyy", "se-FI": "d.m.yyyy", "se-NO": "dd.mm.yyyy", "se-SE": "yyyy-mm-dd", "si-LK": "yyyy-mm-dd", "sk-SK": "d. m. yyyy", "sl-SI": "d.m.yyyy", "sma-NO": "dd.mm.yyyy", "sma-SE": "yyyy-mm-dd", "smj-NO": "dd.mm.yyyy", "smj-SE": "yyyy-mm-dd", "smn-FI": "d.m.yyyy", "sms-FI": "d.m.yyyy", "sq-AL": "yyyy-mm-dd", "sr-Cyrl-BA": "d.m.yyyy", "sr-Cyrl-CS": "d.m.yyyy", "sr-Cyrl-ME": "d.m.yyyy", "sr-Cyrl-RS": "d.m.yyyy", "sr-Latn-BA": "d.m.yyyy", "sr-Latn-CS": "d.m.yyyy", "sr-Latn-ME": "d.m.yyyy", "sr-Latn-RS": "d.m.yyyy", "sv-FI": "d.m.yyyy", "sv-SE": "yyyy-mm-dd", "sw-KE": "m/d/yyyy", "syr-SY": "dd/mm/yyyy", "ta-IN": "dd-mm-yyyy", "te-IN": "dd-mm-yy", "tg-Cyrl-TJ": "dd.mm.yy", "th-TH": "d/m/yyyy", "tk-TM": "dd.mm.yy", "tn-ZA": "yyyy/mm/dd", "tr-TR": "dd.mm.yyyy", "tt-RU": "dd.mm.yyyy", "tzm-Latn-DZ": "dd-mm-yyyy", "ug-CN": "yyyy-m-d", "uk-UA": "dd.mm.yyyy", "ur-PK": "dd/mm/yyyy", "uz-Cyrl-UZ": "dd.mm.yyyy", "uz-Latn-UZ": "dd/mm yyyy", "vi-VN": "dd/mm/yyyy", "wo-SN": "dd/mm/yyyy", "xh-ZA": "yyyy/mm/dd", "yo-NG": "d/m/yyyy", "zh-CN": "yyyy/m/d", "zh-HK": "d/m/yyyy", "zh-MO": "d/m/yyyy", "zh-SG": "d/m/yyyy", "zh-TW": "yyyy/m/d", "zu-ZA": "yyyy/mm/dd", }; var dateFormat2LocationList = Object.keys(language2LocalDateFormat).reduce(function (ac, cr) { ac[language2LocalDateFormat[cr]] = ac[language2LocalDateFormat[cr]] || []; ac[language2LocalDateFormat[cr]].push(cr); return ac; }, {}); var dateFormatList = Object.keys(dateFormat2LocationList); /** * * @param {Date} date * @returns {String} */ function yyymmdd(date) { var mm = date.getMonth() + 1; // getMonth() is zero-based var dd = date.getDate(); return [ date.getFullYear(), (mm > 9 ? '' : '0') + mm, (dd > 9 ? '' : '0') + dd ].join('/'); }; var dayNames = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']; var shortDayNames = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']; var monthNames = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ]; var shortMonthNames = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]; var formatTokenRegex = /([,.\-\/])|([a-zA-Z0-9]+)/g;//more var DATE_TIME_TOKEN_RGX = /([^\s.\/:\-,]+)|([.\/:\-,]+)/i; /** * * @param {Date} date * @param {String=} format * @returns {String} */ function formatDateString(date, format) { format = format || 'dd/mm/yyyy'; var dt = date.getDate(); var day = date.getDay(); var month = date.getMonth(); var year = date.getFullYear() return format.replace(formatTokenRegex, function (x) { switch (x) { case "dddd": return dayNames[day]; case "ddd": return shortDayNames[day]; case "dd": return dt < 10 ? '0' + dt : '' + dt; case "d": return '' + dt; case "mmmm": return monthNames[month]; case "mmm": return shortMonthNames[month]; case "mm": return (month + 1) < 10 ? '0' + (month + 1) : '' + (month + 1); case "m": return '' + (month + 1); case 'yy': return (year + '').match(/..$/)[0]; case 'yyyy': return year + ''; default: return x; } }); } var LOCAL_DATE_FORMAT = (function () { var d = new Date(2021, 4, 4); var s = d.toLocaleDateString(); var fm = s.replace(new RegExp(DATE_TIME_TOKEN_RGX.source, 'g'), function (token) { switch (token) { case '2021': return 'yyyy'; case '5': return 'M'; case '05': return 'MM'; case '4': return 'd'; case '04': return 'dd'; default: return token; } }); return fm; })(); var LOCAL_DATE_TIME_FORMAT = (function () { var d = new Date(2021, 4, 4, 6, 7, 3); var s = d.toLocaleString(); var fm = s.replace(new RegExp(DATE_TIME_TOKEN_RGX.source, 'g'), function (token) { switch (token) { case '2021': return 'yyyy'; case '5': return 'M'; case '05': return 'MM'; case '4': return 'd'; case '04': return 'dd'; case '06': if (new Date(2021, 4, 4, 18, 7, 3).toLocaleString().indexOf(18) >= 0) return 'HH'; return 'hh'; case '6': return 'h'; case '07': return 'mm'; case '7': return 'm'; case '03': return 'ss'; case '3': return 's'; case 'AM': return 'a' default: return token; } }); return fm; })(); function formartDateString() { window.ALogger.warn("spelled incorrectly: formartDateString"); return formatDateString.apply(null, arguments); } /** * * @param {String} text * @param {String} format * @returns {Date} */ function parseDateString(text, format) { text = Object(_String_stringFormat__WEBPACK_IMPORTED_MODULE_0__["nonAccentVietnamese"])(text).toLowerCase(); format = Object(_String_stringFormat__WEBPACK_IMPORTED_MODULE_0__["nonAccentVietnamese"])(format).toLowerCase(); var textTokens = text.match(formatTokenRegex) || []; var formatTokens = format.match(formatTokenRegex) || []; var year = new Date().getFullYear(); var month = 0; var day = 1; var n = Math.min(textTokens.length, formatTokens.length); var textToken; var formatToken; for (var i = 0; i < n; ++i) { textToken = textTokens[i]; formatToken = formatTokens[i]; switch (formatToken) { case "dd": day = parseInt(textToken); break; case "d": day = parseInt(textToken); break; case "mmmm": month = monthNames.indexOf(textToken.substr(0, 1).toUpperCase() + textToken.substr(1).toLowerCase()); break; case "mmm": month = shortMonthNames.indexOf(textToken.substr(0, 1).toUpperCase() + textToken.substr(1).toLowerCase()); break; case "mm": month = parseInt(textToken) - 1; break; case "m": month = parseInt(textToken) - 1; break; case 'yy': year = Math.floor((new Date().getFullYear()) / 100) * 100 + parseInt(textToken); break; case 'yyyy': year = parseInt(textToken); break; default: if (textToken !== formatToken) throw new Error('Unexpected token ' + textToken); } } if (isNaN(year)) throw new Error('Invalid year'); if (isNaN(month) && month !== -1) { throw new Error('Invalid month'); } else { month = Math.max(0, Math.min(11, month)); } if (!isNaN(day)) { day = Math.max(1, Math.min(31, day)); if (!isNaN(month)) { day = Math.min(daysInMonth(2000, month), day); if (!isNaN(year)) day = Math.min(daysInMonth(year, month), day); } } else { throw new Error('Invalid day'); } return new Date(year, month, day); } /** * @param {Date} date * @return {Date} */ function prevDate(date) { return new Date(date.getTime() - MILLIS_PER_DAY); } /** * @param {Date} date * @return {Date} */ function nextDate(date) { return new Date(date.getTime() + MILLIS_PER_DAY); } /** * @param {Date} date * @return {Date} date at 00:00 */ function beginOfHour(date) { var res = new Date(date.getTime()); res.setMilliseconds(0); res.setSeconds(0); res.setMinutes(0); return res; } /** * @param {Date} date * @param {Boolean=} gmt default:false * @return {Date} date at 00:00 */ function beginOfDay(date, gmt) { var res = new Date(date.getTime()); res.setMilliseconds(0); res.setSeconds(0); res.setMinutes(0); if (gmt) res.setUTCHours(0); else res.setHours(0); return res; }; /** * @param {Date} date * @param {Boolean=} gmt default:false * @param {number=} begin default:0 * @return {Date} date at 00:00 */ function beginOfWeek(date, gmt, begin) { begin = begin || 0; var res = beginOfDay(date, gmt); while ((gmt ? res.getUTCDay() : res.getDay()) !== begin) { res = prevDate(res); } return res; }; /** * @param {Date} date * @param {Boolean=} gmt default:false * @return {Date} date at 00:00 AM */ function beginOfMonth(date, gmt) { gmt = !!gmt; var d = gmt ? date.getUTCDate() : date.getDate(); var m = gmt ? date.getUTCMonth() : date.getMonth(); var y = gmt ? date.getUTCFullYear() : date.getFullYear(); var res = new Date(); if (gmt) res.setUTCFullYear(y, m, 1); else res.setFullYear(y, m, 1); return beginOfDay(res, gmt); }; /** * @param {Date} date * @param {Boolean=} gmt default:false * @return {Date} date at 00:00 AM */ function beginOfYear(date, gmt) { gmt = !!gmt; var d = gmt ? date.getUTCDate() : date.getDate(); var m = gmt ? date.getUTCMonth() : date.getMonth(); var y = gmt ? date.getUTCFullYear() : date.getFullYear(); var res = new Date(); if (gmt) res.setUTCFullYear(y, 0, 1); else res.setFullYear(y, 0, 1); return beginOfDay(res, gmt); }; /** * @param {Date} date0 * @param {Date} date1 * @param {Boolean=} gmt default:false * @return {number} */ function compareDate(date0, date1, gmt) { var date0 = beginOfDay(date0, !!gmt); var date1 = beginOfDay(date1, !!gmt); return (date0.getTime() - date1.getTime()) / (86400000); } /** * @param {Date} date0 * @param {Date} date1 * @param {Boolean=} gmt default:false * @return {number} */ function compareMonth(date0, date1, gmt) { gmt = !!gmt; var m0 = gmt ? date0.getUTCMonth() : date0.getMonth(); var y0 = gmt ? date0.getUTCFullYear() : date0.getFullYear(); var m1 = gmt ? date1.getUTCMonth() : date1.getMonth(); var y1 = gmt ? date1.getUTCFullYear() : date1.getFullYear(); return (y0 - y1) * 12 + (m0 - m1); } /*** * * @param {Date} date0 * @param {Date} date1 * @param {boolean=}gmt * @returns {number} */ function compareYear(date0, date1, gmt) { gmt = !!gmt; var y0 = gmt ? date0.getUTCFullYear() : date0.getFullYear(); var y1 = gmt ? date1.getUTCFullYear() : date1.getFullYear(); return y0 - y1; } /** * * @param {Date} date * @returns {Date} */ function nextMonth(date) { var m = date.getMonth(); var y = date.getFullYear(); if (m == 11) { return new Date(y + 1, 0, 1, 0, 0, 0, 0); } else { return new Date(y, m + 1, 1, 0, 0, 0, 0); } } /** * * @param {Date} date * @returns {Date} */ function prevMonth(date) { var m = date.getMonth(); var y = date.getFullYear(); if (m == 0) { return new Date(y - 1, 11, 1, 0, 0, 0, 0); } else { return new Date(y, m - 1, 1, 0, 0, 0, 0); } } /** * * @param {Number} year * @param {Number} month * @returns {Number} */ function daysInMonth(year, month) { var start = new Date(year, month, 1); var end = nextMonth(start); return compareDate(end, start); } /**** * * @param text * @param format support d, M, Y, Q * @returns {Date} */ function parseDateTime(text, format) { var tokenMap = {}; var txtRgx = new RegExp(DATE_TIME_TOKEN_RGX.source, 'g'); var fmRgx = new RegExp(DATE_TIME_TOKEN_RGX.source, 'g'); var tkMatched, fmMatched; tkMatched = txtRgx.exec(text); fmMatched = fmRgx.exec(format); var tkText, fmText; while (tkMatched && fmMatched) { tkText = tkMatched[0]; fmText = fmMatched[0]; switch (fmText) { case 'd': case 'dd': tokenMap.day = parseInt(tkText, 10); break; case 'M': case 'MM': tokenMap.month = parseInt(tkText, 10) - 1; break; case 'y': case 'yyyy': tokenMap.year = parseInt(tkText, 10); break; case 'h': case 'hh': case 'H': case 'HH': tokenMap.hour = parseInt(tkText, 10); break; case 'm': case 'mm': tokenMap.minute = parseInt(tkText, 10); break; case 'a': if (tkText === 'AM' || tkText === 'PM') tokenMap.period = tkText; else throw new Error('Invalid period(a):' + tkText) break; case 'Q': case 'QQ': tokenMap.month = (parseInt(tkText, 10) - 1) * 3; break; default: if (tkText !== fmText) { throw new Error('Unexpected token ' + JSON.stringify(tkText) + ' at ' + tkMatched.index + ', expected ' + fmText); } } tkMatched = txtRgx.exec(text); fmMatched = fmRgx.exec(format); } if (tokenMap.period) { if (tokenMap.period === 'AM' && tokenMap.hour === 12) tokenMap.hour = 0; else if (tokenMap.period === "PM" && tokenMap.hour < 12) tokenMap.hour += 12; } var paramNames = ['year', 'month', 'day', 'hour', 'minute', 'second']; var paramShortNames = ['y', 'M', 'd', 'h', 'm', 's']; var paramDefaultValues = [new Date().getFullYear(), 0, 1, 0, 0, 0]; var resParam = paramDefaultValues.slice(); var paramList = paramNames.reduce(function (ac, cr, i) { var sN = paramShortNames[i]; if (cr in tokenMap) { ac += sN; } return ac; }, ''); var paramName; for (var i = 0; i < paramNames.length; ++i) { paramName = paramNames[i]; resParam[i] = tokenMap[paramName] === undefined ? paramDefaultValues[i] : tokenMap[paramName]; } switch (paramList) { case 'hm': resParam.splice(1, 2, new Date().getMonth(), new Date().getDate()); break; } return new Date(resParam[0], resParam[1], resParam[2], resParam[3], resParam[4], resParam[5]); } function formatDateTime(date, format) { var fmRgx = new RegExp(DATE_TIME_TOKEN_RGX.source, 'g'); return format.replace(fmRgx, function (s) { var res = s; switch (s) { case 'd': case 'dd': res = Object(_Math_int__WEBPACK_IMPORTED_MODULE_1__["integerZeroPadding"])(date.getDate(), s.length); break; case 'M': case 'MM': res = Object(_Math_int__WEBPACK_IMPORTED_MODULE_1__["integerZeroPadding"])(date.getMonth() + 1, s.length); break; case 'MMM': res = shortMonthNames[date.getMonth()]; break; case 'MMMM': res = monthNames[date.getMonth()]; break; case 'y': case 'yyyy': res = Object(_Math_int__WEBPACK_IMPORTED_MODULE_1__["integerZeroPadding"])(date.getFullYear(), s.length); break; case 'yy': res = Object(_Math_int__WEBPACK_IMPORTED_MODULE_1__["integerZeroPadding"])(date.getFullYear() % 100, s.length); break; case 'a': res = date.getHours() < 12 ? "AM" : "PM"; break; case "H": case 'HH': res = Object(_Math_int__WEBPACK_IMPORTED_MODULE_1__["integerZeroPadding"])(date.getHours(), s.length); break; case 'h': case 'hh': res = Object(_Math_int__WEBPACK_IMPORTED_MODULE_1__["integerZeroPadding"])(1 + (date.getHours() - 1) % 12, s.length); break; case 'm': case 'mm': res = Object(_Math_int__WEBPACK_IMPORTED_MODULE_1__["integerZeroPadding"])(date.getMinutes(), s.length); break; case 'Q': case 'QQ': res = Object(_Math_int__WEBPACK_IMPORTED_MODULE_1__["integerZeroPadding"])(Math.floor(date.getMonth() / 3) + 1, s.length) break; } return res; }); } function test() { var y = new Date().getFullYear(); var M = new Date().getMonth(); var d = new Date().getDate(); [['22/12/2021', 'dd/MM/yyyy', new Date(2021, 11, 22)], ['12:55 AM', 'hh:mm a', new Date(y, M, d, 0, 55)], ['12:55 PM', 'hh:mm a', new Date(y, M, d, 12, 55)], ['22-12', 'dd-MM', new Date(y, 11, 22, 0, 0)], ['2020-11', 'yyyy-MM', new Date(2020, 10, 1, 0, 0)], ['11-2020', 'MM-yyyy', new Date(2020, 10, 1, 0, 0)], ['quarter 04, 2020', 'quarter QQ, yyyy', new Date(2020, 9, 1, 0, 0)], ].forEach(function (pr) { var d = parseDateTime(pr[0], pr[1]); if ((d && d.getTime()) === pr[2].getTime()) { console.info("Pass ", pr); } else { console.error("Text fail with ", pr.slice(0, 2), ', expect ', pr[2], ', return ' + d); } }); console.log(formatDateTime(new Date(), "Mùa QQ, năm y, H giờ m phút")); } // setTimeout(test, 100); /***/ }), /* 22 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; function CMDRunner(_this, commands) { this._this = _this; this.commands = {}; this.assign(commands); } CMDRunner.prototype.has = function (cmdName) { return !!this.commands[cmdName]; }; CMDRunner.prototype.add = function (cmdName, handler) { this.commands[cmdName] = handler; return this; }; CMDRunner.prototype.remove = function (cmdName) { delete this.commands[cmdName]; return this; }; CMDRunner.prototype.assign = function (obj) { for (var cmdName in obj) { if (typeof obj[cmdName] == 'function') { this.add(cmdName, obj[cmdName]); } } }; CMDRunner.prototype.invoke = function () { if (this.commands[arguments[0]]) { var args = Array.prototype.slice.call(arguments, 1); return this.commands[arguments[0]].apply(this._this, args); } else { throw new Error('No command: ' + arguments[0]); } }; /* harmony default export */ __webpack_exports__["a"] = (CMDRunner); /***/ }), /* 23 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var _Vec2__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0); function Mat3(data) { this.data = data || Array(6).fill(0); } Mat3.identity = function () { return new Mat3([1, 0, 0, 0, 1, 0, 0, 0, 1]); }; /** * * @returns {Mat3|null} */ Mat3.prototype.invert = function () { var a = this.data; var out = Array(9); var a00 = a[0], a01 = a[1], a02 = a[2]; var a10 = a[3], a11 = a[4], a12 = a[5]; var a20 = a[6], a21 = a[7], a22 = a[8]; var b01 = a22 * a11 - a12 * a21; var b11 = -a22 * a10 + a12 * a20; var b21 = a21 * a10 - a11 * a20; // Calculate the determinant var det = a00 * b01 + a01 * b11 + a02 * b21; if (!det) return null; det = 1.0 / det; out[0] = b01 * det; out[1] = (-a22 * a01 + a02 * a21) * det; out[2] = (a12 * a01 - a02 * a11) * det; out[3] = b11 * det; out[4] = (a22 * a00 - a02 * a20) * det; out[5] = (-a12 * a00 + a02 * a10) * det; out[6] = b21 * det; out[7] = (-a21 * a00 + a01 * a20) * det; out[8] = (a11 * a00 - a01 * a10) * det; return new Mat3(out); }; /** * * @param {Vec2} v * @return {Mat3} */ Mat3.prototype.translate = function (v) { var out = Array(9); var a = this.data; var a00 = a[0], a01 = a[1], a02 = a[2]; var a10 = a[3], a11 = a[4], a12 = a[5]; var a20 = a[6], a21 = a[7], a22 = a[8]; var x = v.x, y = v.y; out[0] = a00; out[1] = a01; out[2] = a02; out[3] = a10; out[4] = a11; out[5] = a12; out[6] = x * a00 + y * a10 + a20; out[7] = x * a01 + y * a11 + a21; out[8] = x * a02 + y * a12 + a22; return new Mat3(out); }; /** * * @param {Mat3} mat * @returns {Mat3} */ Mat3.prototype.multiply = function (mat) { var a = this.data; var b = mat.data; var a00 = a[0], a01 = a[1], a02 = a[2]; var a10 = a[3], a11 = a[4], a12 = a[5]; var a20 = a[6], a21 = a[7], a22 = a[8]; var b00 = b[0], b01 = b[1], b02 = b[2]; var b10 = b[3], b11 = b[4], b12 = b[5]; var b20 = b[6], b21 = b[7], b22 = b[8]; var out = Array(9); out[0] = b00 * a00 + b01 * a10 + b02 * a20; out[1] = b00 * a01 + b01 * a11 + b02 * a21; out[2] = b00 * a02 + b01 * a12 + b02 * a22; out[3] = b10 * a00 + b11 * a10 + b12 * a20; out[4] = b10 * a01 + b11 * a11 + b12 * a21; out[5] = b10 * a02 + b11 * a12 + b12 * a22; out[6] = b20 * a00 + b21 * a10 + b22 * a20; out[7] = b20 * a01 + b21 * a11 + b22 * a21; out[8] = b20 * a02 + b21 * a12 + b22 * a22; return new Mat3(out); } /*** * * @param {Number} rad * @return {Mat3} */ Mat3.prototype.rotate = function (rad) { var a = this.data; var a00 = a[0], a01 = a[1], a02 = a[2]; var a10 = a[3], a11 = a[4], a12 = a[5]; var a20 = a[6], a21 = a[7], a22 = a[8]; var s = Math.sin(rad); var c = Math.cos(rad); var out = Array(9); out[0] = c * a00 + s * a10; out[1] = c * a01 + s * a11; out[2] = c * a02 + s * a12; out[3] = c * a10 - s * a00; out[4] = c * a11 - s * a01; out[5] = c * a12 - s * a02; out[6] = a20; out[7] = a21; out[8] = a22; return new Mat3(out); }; /*** * * @param {Vec2} v * @returns {Mat3} */ Mat3.prototype.scale = function (v) { var x = v.x; var y = v.y; var out = Array(9); out[0] = x * a[0]; out[1] = x * a[1]; out[2] = x * a[2]; out[3] = y * a[3]; out[4] = y * a[4]; out[5] = y * a[5]; out[6] = a[6]; out[7] = a[7]; out[8] = a[8]; return new Mat3(out); }; /*** * * @return {Mat3} */ Mat3.prototype.transpose = function (){ var a = this.data; var out = Array(9); out[0] = a[0]; out[1] = a[3]; out[2] = a[6]; out[3] = a[1]; out[4] = a[4]; out[5] = a[7]; out[6] = a[2]; out[7] = a[5]; out[8] = a[8]; return new Mat3(out); }; /** * * @param {Vec2}v */ Mat3.prototype.apply2DTransform = function (v) { var a = this.data; var x0 = v.x; var y0 = v.y; var x = x0 * a[0] + y0 * a[3] + a[6]; var y = x0 * a[1] + y0 * a[4] + a[7]; return new _Vec2__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"](x, y); } /* harmony default export */ __webpack_exports__["a"] = (Mat3); /***/ }), /* 24 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var _HTML5_EventEmitter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2); /*** * @augments EventEmitter * @extends Array * @constructor */ function ObservableArray(array) { _HTML5_EventEmitter__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"].call(this); Object.defineProperty(this, '_array', { configurable: false, enumerable: false, value: array }); this._makeArrIndex(0, array.length); } Object.defineProperty(ObservableArray.prototype, 'unshift', { enumerable: false, value: function () { var newItems = Array.prototype.slice.call(arguments); var cN = this._array.length; this._makeArrIndex(cN, this._array.length + newItems.length); this._array.unshift.apply(this._array, newItems); this.emit("additem", { target: this, items: newItems, type: 'additem', offset: 0, action: 'unshift' }, this); } }); Object.defineProperty(ObservableArray.prototype, 'shift', { enumerable: false, value: function () { var res = undefined; if (this._array.length > 0) { res = this._array.shift(); this._removeIndex(this._array.length); this.emit("removeitem", { target: this, type: 'additem', offset: 0, action: 'shift', items: [res], item: res }, this); } return res; } }); Object.defineProperty(ObservableArray.prototype, 'push', { enumerable: false, value: function () { var newItems = Array.prototype.slice.call(arguments); var cN = this._array.length; this._makeArrIndex(this._array.length, this._array.length + newItems.length); this._array.push.apply(this._array, newItems); this.emit("additem", { target: this, items: newItems, type: 'additem', offset: cN, action: 'push' }, this); } }); Object.defineProperty(ObservableArray.prototype, 'pop', { enumerable: false, value: function () { var res = undefined; if (this._array.length > 0) { res = this._array.pop(); this._removeIndex(this._array.length); this.emit("removeitem", { target: this, type: 'additem', offset: this._array.length, action: 'shift', items: [res], item: res }, this); } return res; } }); Object.defineProperty(ObservableArray.prototype, 'replace', { enumerable: false, value: function (offset, items) { for (var i = 0; i < items.length && offset < this._array.length; ++i, ++offset) { this._array[offset] = items[i]; } } }); Object.defineProperty(ObservableArray.prototype, 'toJSON', { enumerable: false, value: function () { return this._array; } }); Object.defineProperty(ObservableArray.prototype, 'valueOf', { enumerable: false, value: function () { return this._array; } }); Object.defineProperty(ObservableArray.prototype, '_makeArrIndex', { enumerable: false, value: function (cN, nN) { var i; if (nN > cN) { for (i = cN; i < nN; ++i) this._defineIndex(i); } else { for (i = cN - 1; i >= nN; --i) this._removeIndex(i); } } }); /*** * * @param {number} idx * @private */ Object.defineProperty(ObservableArray.prototype, '_defineIndex', { enumerable: false, value: function (idx) { if (!(idx in this)) { Object.defineProperty(this, idx, { set: function (value) { var oldValue = this._array[idx] this._array[idx] = value; this.emit('setitem', { type: 'setitem', target: this, oldValue: oldValue, vale: value, offset: idx }, this); }, get: function () { return this._array[idx]; }, configurable: true, enumerable: true }); } } }); Object.defineProperty(ObservableArray.prototype, '_removeIndex', { enumerable: false, value: function (idx) { delete this[idx]; } }); Object.defineProperty(ObservableArray.prototype, 'splice', { enumerable: false, value: function (index, howMany) { var res = []; var newItems = Array.prototype.slice.call(arguments, 2); index = index == null ? 0 : index < 0 ? this._array.length + index : index; howMany = howMany == null ? this._array.length - index : howMany > 0 ? howMany : 0; if (howMany > 0) { this._makeArrIndex(this._array.length, this._array.length - howMany); res = this._array.splice(index, howMany); if (newItems.length > 0) { if (res.length > 0) { this.emit('replaceitem', { type: 'replaceitem', offset: index, oldItems: res, newItems: newItems, target: this, action: 'splice' }, this); } else { this.emit('additem', { type: 'additem', offset: index, items: newItems, target: this }, this); } } else { if (res.length > 0) { this.emit('removeitem', { target: this, type: 'additem', offset: 0, action: 'splice', items: res, }, this); } } } return res; } }); Object.defineProperty(ObservableArray.prototype, 'length', { set: function (value) { var n = Number(value); var length = this._array.length; if (n % 1 === 0 && n >= 0) { if (n < length) { this.splice(n); } else if (n > length) { this.push.apply(this, new Array(n - length)); } } else { throw new RangeError("Invalid array length"); } this._array.length = n; }, get: function () { return this._array.length; } }); Object.getOwnPropertyNames(Array.prototype).forEach(function (name) { if (!(name in ObservableArray.prototype)) { Object.defineProperty(ObservableArray.prototype, name, { configurable: false, enumerable: false, writable: false, value: Array.prototype[name] }); } }); Object.getOwnPropertyNames(_HTML5_EventEmitter__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"].prototype).forEach(function (name) { if (!(name in ObservableArray.prototype)) { Object.defineProperty(ObservableArray.prototype, name, { configurable: false, enumerable: false, writable: false, value: _HTML5_EventEmitter__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"].prototype[name] }); } }); /* harmony default export */ __webpack_exports__["a"] = (ObservableArray); /***/ }), /* 25 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var _HTML5_EventEmitter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2); /*** * @extends EventEmitter * @param {Object} o * @constructor */ function ObservableStruct(o) { _HTML5_EventEmitter__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"].call(this); Object.defineProperty(this, '__o__', { configurable: false, enumerable: false, value: o }); for (var key in o) this.defineProperty(key); } Object.defineProperty(ObservableStruct.prototype, 'defineProperty', { configurable: false, enumerable: false, writable: false, /*** * * @param {string} name * @param {*=} value */ value: function (name, value) { if (!(name in this)) { Object.defineProperty(this, name, { set: function (value) { var oldValue = this.__o__[name] this.__o__[name] = value; this.emit('setproperty', { type: 'setproperty', target: this, oldValue: oldValue, vale: value, name: name }, this); }, get: function () { return this.__o__[name]; }, configurable: true, enumerable: true }); } } }); Object.getOwnPropertyNames(_HTML5_EventEmitter__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"].prototype).forEach(function (name) { if (!(name in ObservableStruct.prototype)) { Object.defineProperty(ObservableStruct.prototype, name, { configurable: false, enumerable: false, writable: false, value: _HTML5_EventEmitter__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"].prototype[name] }); } }); /* harmony default export */ __webpack_exports__["a"] = (ObservableStruct); /***/ }), /* 26 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var _String_stringGenerate__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3); /*** * * @param {{id?:string}=} opt * @constructor */ function CCBlock(opt) { opt = opt || {}; this.id = opt.id || Object(_String_stringGenerate__WEBPACK_IMPORTED_MODULE_0__["randomIdent"])(16); Object.defineProperty(this, '__cc_listener__', { enumerable: false, configurable: true, writable: false, value: {} }); Object.defineProperty(this, '__cc_line_list_by_id__', { enumerable: false, configurable: true, writable: false, value: {} }); } /*** * * @param {string} pinName * @param {function} listener * @return {CCBlock} */ CCBlock.prototype.pinOn = function (pinName, listener) { var cbList; if (this.__cc_listener__[pinName]) { cbList = this.__cc_listener__[pinName]; } else { cbList = []; this.__cc_listener__[pinName] = cbList; } if (cbList.indexOf(listener) < 0) { cbList.push(listener); } else { console.warn("Duplicate pin listener!"); } return this; }; CCBlock.prototype.pinOff = function (pinName, listener) { if (!this.__cc_listener__[pinName]) return this; var cbList = this.__cc_listener__[pinName]; var cbIdx = cbList.indexOf(listener); if (cbIdx >= 0) { cbList.splice(cbIdx); } return this; }; CCBlock.prototype.pinFire = function (pinName) { if (!this.__cc_listener__[pinName]) return this; var cbList = this.__cc_listener__[pinName].slice(); var args = Array.prototype.slice.call(arguments, 1); if (args.length === 0 && this.pinHandlers[pinName] && this.pinHandlers[pinName].get) args.push(this.pinGetValue(pinName)); for (var i = 0; i < cbList.length; ++i) { try { cbList[i].apply(this, args); } catch (e) { console.error(e); } } }; CCBlock.prototype.pinFireAll = function () { var pinNames = Object.keys(this.pinHandlers); var pinName; for (var i = 0; i < pinNames.length; ++i) { pinName = pinNames[i]; if (this.pinHandlers[pinName] && this.pinHandlers[pinName].get) this.pinFire(pinName); } }; CCBlock.prototype.pinReceives = function (pinName) { var args = Array.prototype.slice.call(arguments, 1); if (this.pinHandlers[pinName] && this.pinHandlers[pinName].receives) { this.pinHandlers[pinName].receives.apply(this, args); } }; CCBlock.prototype.pinGetValue = function (pinName) { var args = Array.prototype.slice.call(arguments, 1); if (this.pinHandlers[pinName] && this.pinHandlers[pinName].get) { return this.pinHandlers[pinName].get.apply(this, args); } return undefined; }; CCBlock.prototype.pinGetDescriptor = function (pinName) { var args = Array.prototype.slice.call(arguments, 1); var descriptor = this.pinHandlers[pinName] && this.pinHandlers[pinName].descriptor; if (descriptor) { if (typeof descriptor === "function") return this.pinHandlers[pinName].get.apply(this, args); return descriptor; } return undefined; }; Object.defineProperty(CCBlock.prototype, 'pinLines', { get: function () { var lineList = this.__cc_line_list_by_id__; return Object.keys(lineList).map(function (id) { return lineList[id]; }); } }); CCBlock.prototype.pinHandlers = {}; /* harmony default export */ __webpack_exports__["a"] = (CCBlock); /***/ }), /* 27 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var _String_stringGenerate__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3); /*** * * @param {CCBlock} u * @param {string} uPinName * @param {CCBlock} v * @param {string} vPinName * @param {boolean=} twoWay * @param {{id?:string}=} opt * @constructor */ function CCLine(u, uPinName, v, vPinName, twoWay, opt) { opt = opt || {}; twoWay = !!twoWay; Object.defineProperty(this, 'id', { enumerable: true, writable: false, value: opt.id || Object(_String_stringGenerate__WEBPACK_IMPORTED_MODULE_0__["randomIdent"])(32) }); Object.defineProperty(this, 'u', { enumerable: true, writable: false, value: u }); Object.defineProperty(this, 'v', { enumerable: true, writable: false, value: v }); Object.defineProperty(this, 'uPinName', { enumerable: true, writable: false, value: uPinName }); Object.defineProperty(this, 'vPinName', { enumerable: true, writable: false, value: vPinName }); Object.defineProperty(this, 'twoWay', { enumerable: true, writable: false, value: twoWay }); this.vToU = this.vToU.bind(this); this.uToV = this.uToV.bind(this); this.u.pinOn(this.uPinName, this.uToV); if (this.twoWay) this.v.pinOn(this.vPinName, this.vToU); this.u.__cc_line_list_by_id__[this.id] = this; this.v.__cc_line_list_by_id__[this.id] = this; } CCLine.prototype.remove = function () { this.u.pinOff(this.uPinName, this.uToV); if (this.twoWay) this.v.pinOff(this.vPinName, this.vToU); delete this.u.__cc_line_list_by_id__[this.id]; delete this.v.__cc_line_list_by_id__[this.id]; }; CCLine.prototype.uToV = function () { var args = [this.vPinName].concat(Array.prototype.slice.call(arguments)); this.v.pinReceives.apply(this.v, args); }; CCLine.prototype.vToU = function () { var args = [this.uPinName].concat(Array.prototype.slice.call(arguments)); this.u.pinReceives.apply(this.u, args); }; /* harmony default export */ __webpack_exports__["a"] = (CCLine); /***/ }), /* 28 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; // CONCATENATED MODULE: ./node_modules/absol/src/JSMaker/TemplateString.js function TemplateString(props) { this.parts = props.parts; } TemplateString.prototype.toJSCode = function () { return this.parts.map(function (e) { if (e.type == TemplateString.TYPE_EXPRESSION) { return '(' + e.data + ')'; } else { return JSON.stringify(e.data); } }).join('+'); }; TemplateString.__partRegex = /(\{\{(([^\}]|(\}[^\}]))*)\}\})|(([^\{]|(\{[^\{]))+)/g; /** * @param {String} text */ TemplateString.__matchExpression = function (text) { if (text[0] == '{' && text[1] == '{' && text[text.length - 1] == '}' && text[text.length - 2] == '}') { return [text, text.substr(2, text.length - 4).trim()]; } else { return false; } }; TemplateString.TYPE_STRING = 0; TemplateString.TYPE_EXPRESSION = 1; TemplateString.parse = function (text) { text = text+''; var matchedParts = text.match(this.__partRegex); if (matchedParts) { var parts = matchedParts.map(function (e) { var matchedExp = this.__matchExpression(e); if (matchedExp) { return { type: this.TYPE_EXPRESSION, data: matchedExp[1] }; } else { return { type: this.TYPE_STRING, data: e }; } }.bind(this)); return new TemplateString({ parts: parts }); } else { return undefined; } }; /* harmony default export */ var JSMaker_TemplateString = (TemplateString); // CONCATENATED MODULE: ./node_modules/absol/src/Color/Color.js function Color(rgba) { this.rgba = rgba.slice(); } Color.prototype.toHex6 = function () { return this.rgba.slice(0, 3).map(function (b) { b = b * 255 >> 0; return (b < 16 ? '0' : '') + b.toString(16); }).join(''); }; Color.prototype.toHex8 = function () { return this.rgba.map(function (b) { b = b * 255 >> 0; return (b < 16 ? '0' : '') + b.toString(16); }).join(''); }; Color.prototype.toHex3 = function () { return this.rgba.slice(0, 3).map(function (b) { b = b * 255 / 17 >> 0; return b.toString(16); }).join(''); }; Color.prototype.toHex4 = function () { return this.rgba.map(function (b) { b = b * 255 / 17 >> 0; return b.toString(16); }).join(''); }; Color.prototype.toHSLA = function () { return Color.rgbaToHSLA(this.rgba); }; Color.prototype.toHSBA = function () { return Color.rgbaToHSBA(this.rgba); }; Color.prototype.toHWBA = function () { return Color.rgbaToHWBA(this.rgba); }; Color.prototype.getHightContrastColor = function () { var hsba = this.toHSBA(); var h, s, b; h = hsba[0] > 0.5 ? hsba[0] - 0.5 : hsba[0] + 0.5; s = hsba[1] > 0.5 ? hsba[1] - 0.5 : hsba[1] + 0.5; b = hsba[2] > 0.5 ? hsba[2] - 0.5 : hsba[2] + 0.5; return Color.fromHSB(h, s, b); }; Color.prototype.getContrastYIQ = function () { var r = this.rgba[0] * 255; var g = this.rgba[1] * 255; var b = this.rgba[2] * 255; var yiq = ((r * 299) + (g * 587) + (b * 114)) / 1000; return (yiq >= 128) ? new Color([0, 0, 0, 1]) : new Color([1, 1, 1, 1]); }; Color.prototype.clone = function () { return new Color(this.rgba.slice()); }; Color.prototype.toString = function (mode) { mode = mode || 'rgba'; mode = mode.toLocaleLowerCase(); return Color.templates[mode](this); }; /*** * */ Color.prototype.nearestNamedColor = function (notStandard, hsbWeight) { hsbWeight = hsbWeight ||[5, 3, 1] var hsba = this.toHSBA(); var bestMatch = null; var dist = 1000; Object.keys(Color.namedColors).concat(notStandard ? Object.keys(Color.nonStandarNamedColors) : []).forEach(function (name) { var c = Color.parse(Color.namedColors[name] || Color.nonStandarNamedColors[name]); var cHSBA = c.toHSBA(); var cDist = Math.abs(hsba[0] - cHSBA[0]) * hsbWeight[0] + Math.abs(hsba[1] - cHSBA[1]) * hsbWeight[1] + Math.abs(hsba[2] - cHSBA[2])* hsbWeight[2]; if (cDist < dist) { dist = cDist; bestMatch = name; } }); return bestMatch; }; Color.templates = [ ['rgba', 'rgba', 'rgba({{x[0]*255>>0}}, {{x[1]*255>>0}}, {{x[2]*255>>0}}, {{x[3]}})'], ['rgb', 'rgba', 'rgb({{x[0]*255>>0}}, {{x[1]*255>>0}}, {{x[2]*255>>0}})'], ['hsl', 'toHSLA()', 'hsl({{x[0] * 360}}, {{x[1] * 100}}%, {{x[2] * 100}}%)'], ['hsla', 'toHSLA()', 'hsla({{x[0] * 360}}, {{x[1] * 100}}%, {{x[2] * 100}}%, {{x[3]}})'], ['hsb', 'toHSBA()', 'hsb({{x[0] * 360}}, {{x[1] * 100}}%, {{x[2] * 100}}%)'], ['hsba', 'toHSBA()', 'hsba({{x[0] * 360}}, {{x[1] * 100}}%, {{x[2] * 100}}%, {{x[3]}})'], ['hex3', 'toHex3()', '#{{x}}'], ['hex4', 'toHex4()', '#{{x}}'], ['hex6', 'toHex6()', '#{{x}}'], ['hex8', 'toHex8()', '#{{x}}'], ['hwb', 'toHWBA()', 'hwb({{x[0] * 360}}, {{x[1] * 100}}%, {{x[2] * 100}}%)'], ['hwba', 'toHWBA()', 'hwba({{x[0] * 360}}, {{x[1] * 100}}%, {{x[2] * 100}}%, {{x[3]}})'] ].reduce(function (ac, cr) { ac[cr[0]] = new Function('color', [ 'var x = color.' + cr[1] + ';', 'return ' + JSMaker_TemplateString.parse(cr[2]).toJSCode() + ';' ].join('\n')); return ac; }, {}); Color.regexes = { whiteSpace: /\s*/, // Match zero or more whitespace characters. integer: /(\d{1,3})/, // Match integers: 79, 255, etc. decimal: /((?:\d+(?:\.\d+)?)|(?:\.\d+))/, // Match 129.6, 79, .9, etc. percent: /((?:\d+(?:\.\d+)?)|(?:\.\d+))%/, // Match 12.9%, 79%, .9%, etc. hex3: /^#([a-f0-9])([a-f0-9])([a-f0-9])$/i, // Match colors in format #XXXX, e.g. #5123. hex4: /^#([a-f0-9])([a-f0-9])([a-f0-9])([a-f0-9])$/i, // Match colors in format #XXXXXX, e.g. #b4d455. hex6: /^#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})$/i, // Match colors in format #XXXXXXXX, e.g. #b4d45535. hex8: /^#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})$/i }; Color.regexes.percent = new RegExp(Color.regexes.decimal.source + '%'); Color.regexes.rgb = new RegExp( [ '^rgb\\(', Color.regexes.integer.source, ',', Color.regexes.integer.source, ',', Color.regexes.integer.source, '\\)$' ].join(Color.regexes.whiteSpace.source), 'i' ); Color.regexes.rgbPercent = new RegExp( [ '^rgb\\(', Color.regexes.percent.source, ',', Color.regexes.percent.source, ',', Color.regexes.percent.source, '\\)$' ].join(Color.regexes.whiteSpace.source), 'i' ); // Match colors in format rgb(R, G, B, A), e.g. rgb(255, 0, 128, 0.25). Color.regexes.rgba = new RegExp( [ '^rgba\\(', Color.regexes.integer.source, ',', Color.regexes.integer.source, ',', Color.regexes.integer.source, ',', Color.regexes.decimal.source, '\\)$' ].join(Color.regexes.whiteSpace.source), 'i' ); // Match colors in format rgb(R%, G%, B%, A), e.g. rgb(100%, 0%, 28.9%, 0.5). Color.regexes.rgbaPercent = new RegExp( [ '^rgba\\(', Color.regexes.percent.source, ',', Color.regexes.percent.source, ',', Color.regexes.percent.source, ',', Color.regexes.decimal.source, '\\)$' ].join(Color.regexes.whiteSpace.source), 'i' ); // Match colors in format hsla(H, S%, L%), e.g. hsl(100, 40%, 28.9%). Color.regexes.hsl = new RegExp( [ '^hsl\\(', Color.regexes.integer.source, '[deg]*', ',', Color.regexes.percent.source, ',', Color.regexes.percent.source, '\\)$' ].join(Color.regexes.whiteSpace.source), 'i' ); // Match colors in format hsla(H, S%, L%, A), e.g. hsla(100, 40%, 28.9%, 0.5). Color.regexes.hsla = new RegExp( [ '^hsla\\(', Color.regexes.integer.source, '[deg]*', ',', Color.regexes.percent.source, ',', Color.regexes.percent.source, ',', Color.regexes.decimal.source, '\\)$' ].join(Color.regexes.whiteSpace.source), 'i' ); // Match colors in format hsb(H, S%, B%), e.g. hsb(100, 40%, 28.9%). Color.regexes.hsb = new RegExp( [ '^hsb\\(', Color.regexes.integer.source, '[deg]*', ',', Color.regexes.percent.source, ',', Color.regexes.percent.source, '\\)$' ].join(Color.regexes.whiteSpace.source), 'i' ); // Match colors in format hsba(H, S%, B%, A), e.g. hsba(100, 40%, 28.9%, 0.5). Color.regexes.hsba = new RegExp( [ '^hsba\\(', Color.regexes.integer.source, '[deg]*', ',', Color.regexes.percent.source, ',', Color.regexes.percent.source, ',', Color.regexes.decimal.source, '\\)$' ].join(Color.regexes.whiteSpace.source), 'i' ); Color.regexes.hwb = new RegExp( [ '^hwb\\(', Color.regexes.integer.source, '[deg]*', ',', Color.regexes.percent.source, ',', Color.regexes.percent.source, '\\)$' ].join(Color.regexes.whiteSpace.source), 'i' ); // Match colors in format hsba(H, S%, B%, A), e.g. hsba(100, 40%, 28.9%, 0.5). Color.regexes.hwba = new RegExp( [ '^hwba\\(', Color.regexes.integer.source, '[deg]*', ',', Color.regexes.percent.source, ',', Color.regexes.percent.source, ',', Color.regexes.decimal.source, '\\)$' ].join(Color.regexes.whiteSpace.source), 'i' ); Color.fromInt = function (code, bits) { var r, g, b, a; if (bits == 32) { b = (code & 0xff) / 255; g = ((code & 0xff00) >> 8) / 255; r = ((code & 0xff0000) >> 16) / 255; a = (code >> 24) / 255; } else if (bits == 24) { b = (code & 0xff) / 255; g = ((code & 0xff00) >> 8) / 255; r = ((code & 0xff0000) >> 16) / 255; a = 1; } else if (bits == 16) { b = (code & 0x1f) / 0x1f; g = ((code & 0x7e0) >> 5) / 0x3f; b = (code >> 10) / 0x1f; a = 1; } else if (bits == 8) {//gray-scale b = (code & 0x3) / 0x3; g = ((code & 0x1c) >> 2) / 0x7; b = (code >> 5) / 0x7; a = 1; } return new Color([r, g, b, a]); }; Color.fromRGB = function (r, g, b) { return new Color([r, g, b, 1]); }; Color.fromRGBA = function (r, g, b, a) { return new Color([r, g, b, a]); }; Color.fromHSL = function (h, s, l) { var rgba = this.hslaToRGBA([h, s, l, 1]); return new Color(rgba); }; Color.fromHSLA = function (h, s, l, a) { var rgba = this.hslaToRGBA([h, s, l, a]); return new Color(rgba); }; Color.fromHSB = function (h, s, b) { var rgba = this.hsbaToRGBA([h, s, b, 1]); return new Color(rgba); }; Color.fromHSBA = function (h, s, b, a) { var rgba = this.hsbaToRGBA([h, s, b, a]); return new Color(rgba); }; Color.fromHWB = function (h, s, b) { var rgba = this.hwbaToRGBA([h, s, b, 1]); return new Color(rgba); }; Color.fromHWBA = function (h, s, b, a) { var rgba = this.hwbaToRGBA([h, s, b, a]); return new Color(rgba); }; /** * @param {String} text * @returns {Color} */ Color.parse = function (text) { if (this.namedColors[text]) text = this.namedColors[text]; if (this.nonStandarNamedColors[text]) text = this.nonStandarNamedColors[text]; if (this.regexes.hex8.test(text)) { return this.fromRGBA.apply(this, this.regexes.hex8.exec(text) .slice(1) .map(function (v) { return parseInt(v, 16) / 255; })); } else if (this.regexes.hex6.test(text)) { return this.fromRGB.apply(this, this.regexes.hex6.exec(text) .slice(1) .map(function (v) { return parseInt(v, 16) / 255; })); } else if (this.regexes.hex4.test(text)) { return this.fromRGBA.apply(this, this.regexes.hex4.exec(text) .slice(1) .map(function (v) { return parseInt(v + v, 16) / 255; })); } else if (this.regexes.hex3.test(text)) { return this.fromRGB.apply(this, this.regexes.hex3.exec(text) .slice(1) .map(function (v) { return parseInt(v + v, 16) / 255; })); } else if (this.regexes.rgba.test(text)) { return this.fromRGBA.apply(this, this.regexes.rgba.exec(text) .slice(1) .map(function (v, i) { return i < 3 ? parseFloat(v, 10) / 255 : parseFloat(v, 10); })); } else if (this.regexes.rgb.test(text)) { return this.fromRGB.apply(this, this.regexes.rgb.exec(text) .slice(1) .map(function (v, i) { return parseFloat(v, 10) / 255; })); } else if (this.regexes.rgbPercent.test(text)) { return this.fromRGB.apply(this, this.regexes.rgbPercent.exec(text) .slice(1) .map(function (v, i) { return parseFloat(v, 10) / 100; })); } else if (this.regexes.rgbaPercent.test(text)) { return this.fromRGBA.apply(this, this.regexes.rgbaPercent.exec(text) .slice(1) .map(function (v, i) { return parseFloat(v, 10) / (i < 3 ? 100 : 1); })); } else if (this.regexes.hsl.test(text)) { return this.fromHSL.apply(this, this.regexes.hsl.exec(text) .slice(1) .map(function (v, i) { return parseFloat(v, 10) / (i == 0 ? 360 : 100); })); } else if (this.regexes.hsla.test(text)) { return this.fromHSLA.apply(this, this.regexes.hsla.exec(text) .slice(1) .map(function (v, i) { return parseFloat(v, 10) / (i == 0 ? 360 : i < 3 ? 100 : 1); })); } else if (this.regexes.hsb.test(text)) { return this.fromHSB.apply(this, this.regexes.hsb.exec(text) .slice(1) .map(function (v, i) { return parseFloat(v, 10) / (i == 0 ? 360 : 100); })); } else if (this.regexes.hsba.test(text)) { return this.fromHSBA.apply(this, this.regexes.hsba.exec(text) .slice(1) .map(function (v, i) { return parseFloat(v, 10) / (i == 0 ? 360 : i < 3 ? 100 : 1); })); } else if (this.regexes.hwb.test(text)) { return this.fromHWB.apply(this, this.regexes.hwb.exec(text) .slice(1) .map(function (v, i) { return parseFloat(v, 10) / (i == 0 ? 360 : 100); })); } else if (this.regexes.hwba.test(text)) { return this.fromHWBA.apply(this, this.regexes.hwba.exec(text) .slice(1) .map(function (v, i) { return parseFloat(v, 10) / (i == 0 ? 360 : i < 3 ? 100 : 1); })); } else { throw new Error("Fail to parse " + text); } }; /*** * @typedef {"aliceblue"|"antiquewhite"|"aqua"|"aquamarine"|"azure"|"beige"|"bisque"|"black"|"blanchedalmond"|"blue"|"blueviolet"|"brown"|"burlywood"|"cadetblue"|"chartreuse"|"chocolate"|"coral"|"cornflowerblue"|"cornsilk"|"crimson"|"cyan"|"darkblue"|"darkcyan"|"darkgoldenrod"|"darkgray"|"darkgreen"|"darkgrey"|"darkkhaki"|"darkmagenta"|"darkolivegreen"|"darkorange"|"darkorchid"|"darkred"|"darksalmon"|"darkseagreen"|"darkslateblue"|"darkslategray"|"darkslategrey"|"darkturquoise"|"darkviolet"|"deeppink"|"deepskyblue"|"dimgray"|"dimgrey"|"dodgerblue"|"firebrick"|"floralwhite"|"forestgreen"|"fuchsia"|"gainsboro"|"ghostwhite"|"gold"|"goldenrod"|"gray"|"green"|"greenyellow"|"grey"|"honeydew"|"hotpink"|"indianred"|"indigo"|"ivory"|"khaki"|"lavender"|"lavenderblush"|"lawngreen"|"lemonchiffon"|"lightblue"|"lightcoral"|"lightcyan"|"lightgoldenrodyellow"|"lightgray"|"lightgreen"|"lightgrey"|"lightpink"|"lightsalmon"|"lightseagreen"|"lightskyblue"|"lightslategray"|"lightslategrey"|"lightsteelblue"|"lightyellow"|"lime"|"limegreen"|"linen"|"magenta"|"maroon"|"mediumaquamarine"|"mediumblue"|"mediumorchid"|"mediumpurple"|"mediumseagreen"|"mediumslateblue"|"mediumspringgreen"|"mediumturquoise"|"mediumvioletred"|"midnightblue"|"mintcream"|"mistyrose"|"moccasin"|"navajowhite"|"navy"|"oldlace"|"olive"|"olivedrab"|"orange"|"orangered"|"orchid"|"palegoldenrod"|"palegreen"|"paleturquoise"|"palevioletred"|"papayawhip"|"peachpuff"|"peru"|"pink"|"plum"|"powderblue"|"purple"|"red"|"rosybrown"|"royalblue"|"saddlebrown"|"salmon"|"sandybrown"|"seagreen"|"seashell"|"sienna"|"silver"|"skyblue"|"slateblue"|"slategray"|"slategrey"|"snow"|"springgreen"|"steelblue"|"tan"|"teal"|"thistle"|"tomato"|"turquoise"|"violet"|"wheat"|"white"|"whitesmoke"|"yellow"|"yellowgreen"|"transparent"} NamedColor */ Color.namedColors = { aliceblue: '#f0f8ff', antiquewhite: '#faebd7', aqua: '#00ffff', aquamarine: '#7fffd4', azure: '#f0ffff', beige: '#f5f5dc', bisque: '#ffe4c4', black: '#000000', blanchedalmond: '#ffebcd', blue: '#0000ff', blueviolet: '#8a2be2', brown: '#a52a2a', burlywood: '#deb887', cadetblue: '#5f9ea0', chartreuse: '#7fff00', chocolate: '#d2691e', coral: '#ff7f50', cornflowerblue: '#6495ed', cornsilk: '#fff8dc', crimson: '#dc143c', cyan: '#00ffff', 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: '#ff00ff', 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: '#778899', lightslategrey: '#778899', lightsteelblue: '#b0c4de', lightyellow: '#ffffe0', lime: '#00ff00', limegreen: '#32cd32', linen: '#faf0e6', magenta: '#ff00ff', 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', red: '#ff0000', 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: '#ffffff', whitesmoke: '#f5f5f5', yellow: '#ffff00', yellowgreen: '#9acd32', transparent: '#00000000' }; Color.nonStandarNamedColors = { night: '#0C090A', gunmetal: '#2C3539', midnight: '#2B1B17', charcoal: '#34282C', oil: '#3B3131', blackcat: '#413839', iridium: '#3D3C3A', blackeel: '#463E3F', blackcow: '#4C4646', graywolf: '#504A4B', vampiregray: '#565051', graydolphin: '#5C5858', carbongray: '#625D5D', ashgray: '#666362', cloudygray: '#6D6968', smokeygray: '#726E6D', granite: '#837E7C', battleshipgray: '#848482', graycloud: '#B6B6B4', graygoose: '#D1D0CE', platinum: '#E5E4E2', metallicsilver: '#BCC6CC', bluegray: '#98AFC7', raven: '#657383', jetgray: '#616D7E', mistblue: '#646D7E', marbleblue: '#566D7E', shipcove: '#737CA1', mariner: '#4863A0', bluejay: '#2B547E', biscay: '#2B3856', navyblue: '#000080', bluewhale: '#342D7E', lapisblue: '#15317E', denimdarkblue: '#151B8D', earthblue: '#0000A0', cobaltblue: '#0020C2', blueberryblue: '#0041C2', sapphireblue: '#2554C7', blueeyes: '#1569C7', blueorchid: '#1F45FC', bluelotus: '#6960EC', lightslateblue: '#736AFF', windowsblue: '#357EC7', glacialblueice: '#368BC1', silkblue: '#488AC7', blueivy: '#3090C7', bluekoi: '#659EC7', columbiablue: '#87AFC7', babyblue: '#95B9C7', oceanblue: '#2B65EC', blueribbon: '#306EFF', bluedress: '#157DEC', butterflyblue: '#38ACEC', iceberg: '#56A5EC', crystalblue: '#5CB3FF', denimblue: '#79BAEC', dayskyblue: '#82CAFF', jeansblue: '#A0CFEC', blueangel: '#B7CEEC', pastelblue: '#B4CFEC', seablue: '#C2DFFF', coralblue: '#AFDCEC', robineggblue: '#BDEDFF', palebluelily: '#CFECEC', water: '#EBF4FA', lightslate: '#CCFFFF', lightaquamarine: '#93FFE8', electricblue: '#9AFEFF', cyanoraqua: '#00FFFF', tronblue: '#7DFDFE', bluezircon: '#57FEFF', bluelagoon: '#8EEBEC', celeste: '#50EBEC', bluediamond: '#4EE2EC', tiffanyblue: '#81D8D0', cyanopaque: '#92C7C7', bluehosta: '#77BFC7', northernlightsblue: '#78C7C7', jellyfish: '#46C7C7', bluegreen: '#7BCCB5', macawbluegreen: '#43BFC7', seaturtlegreen: '#438D80', greenishblue: '#307D7E', grayishturquoise: '#5E7D7E', beetlegreen: '#4C787E', camouflagegreen: '#78866B', sagegreen: '#848b79', hazelgreen: '#617C58', venomgreen: '#728C00', ferngreen: '#667C26', darkforestgreen: '#254117', mediumforestgreen: '#347235', seaweedgreen: '#437C17', pinegreen: '#387C44', junglegreen: '#347C2C', shamrockgreen: '#347C17', greenonion: '#6AA121', clovergreen: '#3EA055', greensnake: '#6CBB3C', aliengreen: '#6CC417', greenapple: '#4CC417', kellygreen: '#4CC552', zombiegreen: '#54C571', froggreen: '#99C68E', greenpeas: '#89C35C', dollarbillgreen: '#85BB65', iguanagreen: '#9CB071', avocadogreen: '#B2C248', pistachiogreen: '#9DC209', saladgreen: '#A1C935', hummingbirdgreen: '#7FE817', nebulagreen: '#59E817', stoplightgogreen: '#57E964', algaegreen: '#64E986', jadegreen: '#5EFB6E', emeraldgreen: '#5FFB17', dragongreen: '#6AFB92', mintgreen: '#98FF98', greenthumb: '#B5EAAA', lightjade: '#C3FDB8', teagreen: '#CCFB5D', slimegreen: '#BCE954', harvestgold: '#EDE275', sunyellow: '#FFE87C', cornyellow: '#FFF380', parchment: '#FFFFC2', cream: '#FFFFCC', blonde: '#FBF6D9', champagne: '#F7E7CE', vanilla: '#F3E5AB', tanbrown: '#ECE5B6', peach: '#FFE5B4', mustard: '#FFDB58', rubberduckyyellow: '#FFD801', brightgold: '#FDD017', goldenbrown: '#EAC117', macaroniandcheese: '#F2BB66', saffron: '#FBB917', beer: '#FBB117', cantaloupe: '#FFA62F', beeyellow: '#E9AB17', brownsugar: '#E2A76F', deeppeach: '#FFCBA4', gingerbrown: '#C9BE62', schoolbusyellow: '#E8A317', fallleafbrown: '#C8B560', orangegold: '#D4A017', sand: '#C2B280', cookiebrown: '#C7A317', caramel: '#C68E17', brass: '#B5A642', camelbrown: '#C19A6B', bronze: '#CD7F32', tigerorange: '#C88141', cinnamon: '#C58917', bulletshell: '#AF9B60', copper: '#B87333', wood: '#966F33', oakbrown: '#806517', armybrown: '#827B60', sandstone: '#786D5F', mocha: '#493D26', taupe: '#483C32', coffee: '#6F4E37', brownbear: '#835C3B', reddirt: '#7F5217', sepia: '#7F462C', orangesalmon: '#C47451', rust: '#C36241', redfox: '#C35817', sedona: '#CC6600', papayaorange: '#E56717', halloweenorange: '#E66C2C', pumpkinorange: '#F87217', constructionconeorange: '#F87431', sunriseorange: '#E67451', mangoorange: '#FF8040', basketballorange: '#F88158', tangerine: '#E78A61', beanred: '#F75D59', valentinered: '#E55451', shockingorange: '#E55B3C', scarlet: '#FF2400', rubyred: '#F62217', ferrarired: '#F70D1A', fireenginered: '#F62817', lavared: '#E42217', lovered: '#E41B17', grapefruit: '#DC381F', chestnutred: '#C34A2C', cherryred: '#C24641', mahogany: '#C04000', chillipepper: '#C11B17', cranberry: '#9F000F', redwine: '#990012', burgundy: '#8C001A', chestnut: '#954535', bloodred: '#7E3517', sangria: '#7E3817', plumpie: '#7D0541', velvetmaroon: '#7E354D', plumvelvet: '#7D0552', rosyfinch: '#7F4E52', puce: '#7F5A58', dullpurple: '#7F525D', khakirose: '#C5908E', pinkbow: '#C48189', lipstickpink: '#C48793', rose: '#E8ADAA', rosegold: '#ECC5C0', desertsand: '#EDC9AF', pigpink: '#FDD7E4', cottoncandy: '#FCDFFF', pinkbubblegum: '#FFDFDD', flamingopink: '#F9A7B0', pinkrose: '#E7A1B0', pinkdaisy: '#E799A3', cadillacpink: '#E38AAE', carnationpink: '#F778A1', blushred: '#E56E94', watermelonpink: '#FC6C85', violetred: '#F6358A', pinkcupcake: '#E45E9D', pinklemonade: '#E4287C', neonpink: '#F535AA', dimorphothecamagenta: '#E3319D', brightneonpink: '#F433FF', tulippink: '#C25A7C', roguepink: '#C12869', burntpink: '#C12267', bashfulpink: '#C25283', darkcarnationpink: '#C12283', violapurple: '#7E587E', purpleiris: '#571B7E', plumpurple: '#583759', purplemonster: '#461B7E', purplehaze: '#4E387E', eggplant: '#614051', grape: '#5E5A80', purplejam: '#6A287E', purpleflower: '#A74AC7', purpleamethyst: '#6C2DC7', purplesagebush: '#7A5DC7', lovelypurple: '#7F38EC', aztechpurple: '#893BFF', jasminepurple: '#A23BEC', purpledaffodil: '#B041FF', tyrianpurple: '#C45AEC', crocuspurple: '#9172EC', purplemimosa: '#9E7BFF', heliotropepurple: '#D462FF', purpledragon: '#C38EC7', lilac: '#C8A2C8', blushpink: '#E6A9EC', mauve: '#E0B0FF', wisteriapurple: '#C6AEC7', blossompink: '#F9B7FF', periwinkle: '#E9CFEC', lavenderpinocchio: '#EBDDE2', lavenderblue: '#E3E4FA', pearl: '#FDEEF4', milkwhite: '#FEFCFF' }; /********************** COLOR CONVERTER *******************/ Color.rgbToHex = function (rgb) { return '#' + rgb.slice(0, 3).map(function (c) { var res = ((c * 255) >> 0).toString(16); if (res < 10) res = '0' + res; return res.toUpperCase(); }).join(''); }; Color.rgbaToHex = function (rgb) { return '#' + rgb.map(function (c) { var res = ((c * 255) >> 0).toString(16); if (res < 10) res = '0' + res; return res.toUpperCase(); }).join(''); }; Color.hsbaToText = function (hsba) { return 'hsba(' + (hsba[0] * 360 >> 0) + 'deg, ' + (hsba[1] * 100 >> 0) + '%, ' + (hsba[2] * 100 >> 0) + '%, ' + (hsba[3].toFixed(3)) + ')'; }; Color.hslaToText = function (hsla) { return 'hsla(' + (hsla[0] * 360 >> 0) + 'deg, ' + (hsla[1] * 100 >> 0) + '%, ' + (hsla[2] * 100 >> 0) + '%, ' + (hsla[3].toFixed(3)) + ')'; }; Color.rgbaToText = function (rgba) { return 'rgba(' + (rgba[0] * 255 >> 0) + ', ' + (rgba[1] * 255 >> 0) + ', ' + (rgba[2] * 255 >> 0) + ', ' + (rgba[3].toFixed(3)) + ')'; }; Color.hsbToText = function (hsba) { return 'hsb(' + (hsba[0] * 360 >> 0) + 'deg, ' + (hsba[1] * 100 >> 0) + '%, ' + (hsba[2] * 100 >> 0) + '%)'; }; Color.hslToText = function (hsl) { return 'hsl(' + (hsl[0] * 360 >> 0) + 'deg, ' + (hsl[1] * 100 >> 0) + '%, ' + (hsl[2] * 100 >> 0) + '%)'; }; Color.rgbToText = function (rgba) { return 'rgb(' + (rgba[0] * 255 >> 0) + ', ' + (rgba[1] * 255 >> 0) + ', ' + (rgba[2] * 255 >> 0) + ')'; }; Color.hsbaToHSLA = function (hsba) { var hue = hsba[0]; var sat = hsba[1]; var val = hsba[2]; // Calculate lightness. var li = (2 - sat) * val / 2; // Convert saturation. if (li !== 0) { if (li === 1) { sat = 0; } else if (li < 0.5) { sat = sat / (2 - sat); } else { sat = sat * val / (2 - li * 2); } } // Hue and alpha stay the same. return [hue, sat, li, hsba[3]]; }; Color.hsbaToRGBA = function (hsba) { var hue = hsba[0] * 6; // We will split hue into 6 sectors. var sat = hsba[1]; var val = hsba[2]; var RGBA = []; if (sat === 0) { RGBA = [val, val, val, hsba[3]]; // Return early if grayscale. } else { var sector = Math.floor(hue); var tint1 = val * (1 - sat); var tint2 = val * (1 - sat * (hue - sector)); var tint3 = val * (1 - sat * (1 + sector - hue)); var red, green, blue; if (sector === 1) { // Yellow to green. red = tint2; green = val; blue = tint1; } else if (sector === 2) { // Green to cyan. red = tint1; green = val; blue = tint3; } else if (sector === 3) { // Cyan to blue. red = tint1; green = tint2; blue = val; } else if (sector === 4) { // Blue to magenta. red = tint3; green = tint1; blue = val; } else if (sector === 5) { // Magenta to red. red = val; green = tint1; blue = tint2; } else { // Red to yellow (sector could be 0 or 6). red = val; green = tint3; blue = tint1; } RGBA = [red, green, blue, hsba[3]]; } return RGBA; }; Color.hslaToHSBA = function (hsla) { var hue = hsla[0]; var sat = hsla[1]; var li = hsla[2]; // Calculate brightness. var val; if (li < 0.5) { val = (1 + sat) * li; } else { val = li + sat - li * sat; } // Convert saturation. sat = 2 * (val - li) / val; // Hue and alpha stay the same. return [hue, sat, val, hsla[3]]; }; Color.hslaToRGBA = function (hsla) { var hue = hsla[0] * 6; // We will split hue into 6 sectors. var sat = hsla[1]; var li = hsla[2]; var RGBA = []; if (sat === 0) { RGBA = [li, li, li, hsla[3]]; // Return early if grayscale. } else { // Calculate brightness. var val; if (li < 0.5) { val = (1 + sat) * li; } else { val = li + sat - li * sat; } // Define zest. var zest = 2 * li - val; // Implement projection (project onto green by default). var hzvToRGB = function (hue, zest, val) { if (hue < 0) { // Hue must wrap to allow projection onto red and blue. hue += 6; } else if (hue >= 6) { hue -= 6; } if (hue < 1) { // Red to yellow (increasing green). return zest + (val - zest) * hue; } else if (hue < 3) { // Yellow to cyan (greatest green). return val; } else if (hue < 4) { // Cyan to blue (decreasing green). return zest + (val - zest) * (4 - hue); } else { // Blue to red (least green). return zest; } }; // Perform projections, offsetting hue as necessary. RGBA = [ hzvToRGB(hue + 2, zest, val), hzvToRGB(hue, zest, val), hzvToRGB(hue - 2, zest, val), hsla[3] ]; } return RGBA; }; Color.rgbaToHSBA = function (rgba) { var red = rgba[0]; var green = rgba[1]; var blue = rgba[2]; var val = Math.max(red, green, blue); var chroma = val - Math.min(red, green, blue); var hue, sat; if (chroma === 0) { // Return early if grayscale. hue = 0; sat = 0; } else { sat = chroma / val; if (red === val) { // Magenta to yellow. hue = (green - blue) / chroma; } else if (green === val) { // Yellow to cyan. hue = 2 + (blue - red) / chroma; } else if (blue === val) { // Cyan to magenta. hue = 4 + (red - green) / chroma; } if (hue < 0) { // Confine hue to the interval [0, 1). hue += 6; } else if (hue >= 6) { hue -= 6; } } return [hue / 6, sat, val, rgba[3]]; }; Color.rgbaToHSLA = function (rgba) { var red = rgba[0]; var green = rgba[1]; var blue = rgba[2]; var val = Math.max(red, green, blue); var min = Math.min(red, green, blue); var li = val + min; // We will halve this later. var chroma = val - min; var hue, sat; if (chroma === 0) { // Return early if grayscale. hue = 0; sat = 0; } else { if (li < 1) { sat = chroma / li; } else { sat = chroma / (2 - li); } if (red === val) { // Magenta to yellow. hue = (green - blue) / chroma; } else if (green === val) { // Yellow to cyan. hue = 2 + (blue - red) / chroma; } else if (blue === val) { // Cyan to magenta. hue = 4 + (red - green) / chroma; } if (hue < 0) { // Confine hue to the interval [0, 1). hue += 6; } else if (hue >= 6) { hue -= 6; } } return [hue / 6, sat, li / 2, rgba[3]]; }; Color.hwbaToHSBA = function (hwba) { return [hwba[0], 1 - hwba[1] / (1 - hwba[2]), 1 - hwba[2], hwba[3]]; }; Color.hsbaToHWBA = function (hsla) { return [hsla[0], (1 - hsla[1]) * hsla[2], 1 - hsla[2], hsla[3]]; }; Color.rgbaToHWBA = function (rgba) { return this.hsbaToHWBA(this.rgbaToHSBA(rgba)); }; Color.hwbaToRGBA = function (hwba) { return this.hsbaToRGBA(this.hwbaToHSBA(hwba)); }; /* harmony default export */ var Color_Color = __webpack_exports__["a"] = (Color); /***/ }), /* 29 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; // EXTERNAL MODULE: ./node_modules/absol/src/Network/IFrameBridge.js var IFrameBridge = __webpack_require__(5); // EXTERNAL MODULE: ./node_modules/absol/src/HTML5/OOP.js var OOP = __webpack_require__(7); // CONCATENATED MODULE: ./node_modules/absol/src/Network/RemoteThread.tpl /* harmony default export */ var RemoteThread = ("function EventEmitter() {\r\n if (!this._azar_extendEvents) {\r\n Object.defineProperty(this, '_azar_extendEvents', {\r\n enumerable: false,\r\n value: this._azar_extendEvents || { supported: {}, prioritize: {}, nonprioritize: {} }\r\n });\r\n Object.defineProperty(this, '__azar_force', {\r\n value: true,\r\n enumerable: false\r\n });\r\n }\r\n}\r\n\r\n\r\nEventEmitter.prototype.defineEvent = function (name) {\r\n if (name instanceof Array) {\r\n for (var i = 0; i < name.length; ++i)\r\n this._azar_extendEvents.supported[name[i]] = true;\r\n }\r\n else\r\n this._azar_extendEvents.supported[name] = true;\r\n return this;\r\n};\r\n\r\nEventEmitter.prototype.isSupportedEvent = function (name) {\r\n return true;\r\n};\r\n\r\n\r\nEventEmitter.prototype.emit = function (eventName, data) {\r\n this.fire.apply(this, arguments);\r\n};\r\n\r\nEventEmitter.prototype.fire = function (eventName, data) {\r\n var others = Array.prototype.slice.call(arguments, 1);\r\n if (this.isSupportedEvent(eventName)) {\r\n var listenerList;\r\n var i;\r\n if (this._azar_extendEvents.prioritize[eventName]) {\r\n listenerList = this._azar_extendEvents.prioritize[eventName].slice();\r\n for (i = 0; i < listenerList.length; ++i) {\r\n try {\r\n listenerList[i].wrappedCallback.apply(this, others);\r\n } catch (e) {\r\n console.error(e);\r\n }\r\n }\r\n }\r\n\r\n if (this._azar_extendEvents.nonprioritize[eventName]) {\r\n listenerList = this._azar_extendEvents.nonprioritize[eventName].slice();\r\n for (i = 0; i < listenerList.length; ++i) {\r\n try {\r\n listenerList[i].wrappedCallback.apply(this, others);\r\n } catch (e) {\r\n console.error(e);\r\n }\r\n }\r\n }\r\n }\r\n else {\r\n if (this.dispatchEvent) {\r\n var event = new Event(eventName);\r\n data && Object.assign(event, data);\r\n this.dispatchEvent(event);\r\n }\r\n else\r\n throw new Error(\"Not support event \" + eventName);\r\n }\r\n return this;\r\n};\r\n\r\n\r\nEventEmitter.prototype.eventEmittorOnWithTime = function (isOnce, arg0, arg1, arg2) {\r\n if (typeof arg0 == 'object') {\r\n for (var key in arg0) {\r\n this.eventEmittorOnWithTime(isOnce, key, arg0[key]);\r\n }\r\n return this;\r\n }\r\n else {\r\n if (typeof arg1 == 'object') {\r\n return this.eventEmittorOnWithTime(isOnce, arg0, arg1.callback, arg1.cap);\r\n }\r\n else {\r\n var eventArr = this._azar_extendEvents[arg2 ? 'prioritize' : 'nonprioritize'][arg0] || [];\r\n var eventIndex = -1;\r\n for (var i = 0; i < eventArr.length; ++i) {\r\n if (eventArr[i].wrappedCallback == arg1) {\r\n eventIndex = i;\r\n break;\r\n }\r\n }\r\n if (eventIndex < 0) {\r\n var event = { isOnce: isOnce, eventName: arg0, callback: arg1, cap: !!arg2 };\r\n //wrappedCallback will be call\r\n if (isOnce) {\r\n event.wrappedCallback = function () {\r\n event.callback.apply(this, arguments);\r\n this.off(event.eventName, event.wrappedCallback, event.cap);\r\n };\r\n }\r\n else {\r\n event.wrappedCallback = event.callback;\r\n }\r\n\r\n if (!this.isSupportedEvent(arg0)) {\r\n if (this.addEventListener) {\r\n this.addEventListener(arg0, event.wrappedCallback, !!arg2);\r\n }\r\n else {\r\n this.attachEvent('on' + arg0, arg1, !!arg2);\r\n }\r\n }\r\n\r\n eventArr.push(event);\r\n this._azar_extendEvents[arg2 ? 'prioritize' : 'nonprioritize'][arg0] = eventArr;\r\n }\r\n else {\r\n console.warn(\"dupplicate event\");\r\n }\r\n\r\n }\r\n return this;\r\n }\r\n};\r\n\r\n\r\nEventEmitter.prototype.on = function (arg0, arg1, arg2) {\r\n this.eventEmittorOnWithTime(false, arg0, arg1, arg2);\r\n return this;\r\n};\r\n\r\n\r\nEventEmitter.prototype.once = function (arg0, arg1, arg2) {\r\n this.eventEmittorOnWithTime(true, arg0, arg1, arg2);\r\n return this;\r\n};\r\n\r\nEventEmitter.prototype.off = function (arg0, arg1, arg2) {\r\n if (typeof arg0 == 'object') {\r\n for (var key in arg0) {\r\n this.off(key, arg0[key]);\r\n }\r\n return this;\r\n }\r\n else {\r\n if (typeof arg1 == 'object') {\r\n return this.off(arg0, arg1.callback, arg1.cap);\r\n }\r\n else {\r\n var eventArr = this._azar_extendEvents[arg2 ? 'prioritize' : 'nonprioritize'][arg0] || [];\r\n var newEventArray = [];\r\n for (var i = 0; i < eventArr.length; ++i) {\r\n var event = eventArr[i];\r\n if (event.wrappedCallback == arg1) {\r\n //Dont add to newEventArray\r\n if (this.isSupportedEvent(arg0)) {\r\n }\r\n else {\r\n if (this.removeEventListener) {\r\n this.removeEventListener(event.eventName, event.wrappedCallback, !!event.cap);\r\n }\r\n else {\r\n this.detachEvent('on' + event.eventName, event.wrappedCallback, !!event.cap);\r\n }\r\n }\r\n }\r\n else {\r\n newEventArray.push(event);\r\n }\r\n }\r\n this._azar_extendEvents[arg2 ? 'prioritize' : 'nonprioritize'][arg0] = newEventArray;\r\n return this;\r\n }\r\n }\r\n\r\n};\r\n\r\n\r\n/**\r\n *\r\n * @param {Worker} host\r\n */\r\nfunction IFrameBridge(host, origin) {\r\n EventEmitter.call(this);\r\n this.detach();\r\n this.origin = origin;\r\n if (host) this.attach(host);\r\n this.__azarResolveCallbacks = {};\r\n}\r\n\r\nIFrameBridge.prototype.attach = function (host) {\r\n this.host = host;\r\n if (this.host.addEventListener) {\r\n this.host.addEventListener(\"message\", this.__azarMessageListener.bind(this), false);\r\n }\r\n else if (this.host.attachEvent) {\r\n this.host.attachEvent(\"onmessage\", this.__azarMessageListener.bind(this));\r\n }\r\n else {\r\n this.host.onmessage = this.__azarMessageListener.bind(this);\r\n }\r\n this.__IFrameBridge_resolve();\r\n};\r\n\r\nIFrameBridge.prototype.detach = function () {\r\n this.sync = new Promise(function (resolve) {\r\n this.__IFrameBridge_resolve = resolve;\r\n }.bind(this));\r\n};\r\n\r\nObject.defineProperties(IFrameBridge.prototype, Object.getOwnPropertyDescriptors(EventEmitter.prototype));\r\nIFrameBridge.prototype.constructor = IFrameBridge;\r\n\r\nIFrameBridge.prototype.__azarMessageListener = function (event) {\r\n this.__azarHandleData(event.data);\r\n};\r\n\r\n\r\nIFrameBridge.prototype.__azarHandleData = function (data) {\r\n if (data.type) {\r\n if (data.type == \"INVOKE\") {\r\n try {\r\n var result = this.__azarSelfInvoke(data.name, data.params);\r\n if (result && typeof result.then == 'function') {\r\n result.then(function (result) {\r\n this.__azarResolve(data.taskId, result);\r\n }.bind(this))\r\n .catch(function (err) {\r\n console.error(err);\r\n this.__azarResolve(data.taskId, null, { message: err.message, stack: err.stack });\r\n }.bind(this));\r\n }\r\n else {\r\n this.__azarResolve(data.taskId, result);\r\n }\r\n } catch (err) {\r\n console.error(err);\r\n this.__azarResolve(data.taskId, null, { message: err.message, stack: err.stack });\r\n }\r\n\r\n\r\n }\r\n else if (data.type == \"INVOKE_RESULT\") {\r\n if (this.__azarResolveCallbacks[data.taskId]) {\r\n if (data.error) {\r\n this.__azarRejectCallbacks[data.taskId](data.error);\r\n }\r\n else {\r\n this.__azarResolveCallbacks[data.taskId](data.result);\r\n }\r\n delete this.__azarResolveCallbacks[data.taskId];\r\n delete this.__azarRejectCallbacks[data.taskId];\r\n }\r\n }\r\n else if (data.type == \"EMIT\") {\r\n this.fire.apply(this, data.params);\r\n }\r\n else this.fire('message', data, this);\r\n }\r\n};\r\n\r\n\r\nIFrameBridge.prototype.__azarResolve = function (taskId, result, error) {\r\n var data = {\r\n type: \"INVOKE_RESULT\",\r\n taskId: taskId,\r\n result: result,\r\n error: error\r\n };\r\n\r\n if (this.origin) {\r\n this.host.postMessage(data, this.origin);\r\n }\r\n else {\r\n this.host.postMessage(data);\r\n }\r\n};\r\n\r\n\r\nIFrameBridge.prototype.__azarSelfInvoke = function (name, params) {\r\n if (typeof this[name] == 'function') {\r\n return this[name].apply(this, params);\r\n }\r\n else {\r\n return this[name];\r\n }\r\n};\r\n\r\n\r\nIFrameBridge.prototype.emit = function () {\r\n var params = [];\r\n params.push.apply(params, arguments);\r\n this.sync.then(function () {\r\n var data = {\r\n type: \"EMIT\",\r\n params: params\r\n };\r\n if (this.origin) {\r\n this.host.postMessage(data, this.origin);\r\n }\r\n else {\r\n this.host.postMessage(data);\r\n }\r\n }.bind(this));\r\n return this;\r\n};\r\n\r\n\r\nIFrameBridge.prototype.invoke = function (name) {\r\n var params = [];\r\n params.push.apply(params, arguments);\r\n params.shift();\r\n return this.sync.then(function () {\r\n var indent = randomIdent(32);\r\n var data = {\r\n type: 'INVOKE',\r\n params: params,\r\n taskId: indent,\r\n name: name\r\n };\r\n if (this.origin) {\r\n this.host.postMessage(data, this.origin);\r\n }\r\n else {\r\n this.host.postMessage(data);\r\n }\r\n return new Promise(function (resolve) {\r\n this.__azarResolveCallbacks[indent] = resolve;\r\n }.bind(this));\r\n }.bind(this));\r\n};\r\n\r\nIFrameBridge.prototype.importScriptURLs = function () {\r\n return this.invoke.apply(this, ['_receiveScriptURLs'].concat(Array.prototype.slice.call(arguments)));\r\n};\r\n\r\nIFrameBridge.prototype._receiveScriptURLs = function () {\r\n if (self.importScripts) {\r\n self.importScripts.apply(self, arguments);\r\n }\r\n};\r\n\r\n\r\nIFrameBridge.prototype._receiveMethod = function (name, code) {\r\n this[name] = (new Function('return ' + code))();\r\n};\r\n\r\nObject.defineProperties(self, Object.getOwnPropertyDescriptors(IFrameBridge.prototype));\r\nIFrameBridge.call(self, self);"); // CONCATENATED MODULE: ./node_modules/absol/src/Network/Thread.js /*** * * @param {{methods?:Object, extendCode: string}} opt * @constructor */ function Thread(opt) { this.worker = new Worker(this._makeCodeUrl(opt)); IFrameBridge["a" /* default */].call(this, this.worker); this._attachClientMethods(opt.methods); } Thread.prototype._makeCodeUrl = function (opt) { var code = [ this._makeLibCode(opt.libs), RemoteThread, this._makeMethodCode(opt.methods), this._makePropCode(opt.props), opt.extendCode || '', ].join('\n\n'); var blob = new Blob([code], { type: 'application/javascript' }); var url = URL.createObjectURL(blob); return url; }; Thread.prototype._makePropCode = function (props) { if (!props) return ''; return 'Object.assign(self, ' + JSON.stringify(props) + ');'; }; Thread.prototype._makeLibCode = function (libs) { if (!libs) return ''; return libs.map(function (lib) { return 'self.importScripts(' + JSON.stringify(lib) + ');' }).join('\n'); } Thread.prototype._makeMethodCode = function (methods) { if (!methods) return ''; return Object.keys(methods).map(function (key) { var fx = methods[key]; if (typeof fx === "function") { fx = fx.toString(); return 'self[' + JSON.stringify(key) + '] = ' + fx; } }).join('\n\n'); }; Thread.prototype._attachClientMethods = function (methods) { if (!methods) return ''; Object.keys(methods).reduce(function (ac, name) { ac[name] = function () { return this.invoke.apply(this, [name].concat(Array.prototype.slice.call(arguments))) } return ac; }, this); }; OOP["a" /* default */].mixClass(Thread, IFrameBridge["a" /* default */]); /* harmony default export */ var Network_Thread = __webpack_exports__["a"] = (Thread); /***/ }), /* 30 */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(31); /***/ }), /* 31 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* WEBPACK VAR INJECTION */(function(global) {/* harmony import */ var _workerPolifyfill__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(32); /* harmony import */ var _workerPolifyfill__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_workerPolifyfill__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var absol_src_Polyfill_polyfill__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(33); /* harmony import */ var absol_src_HTML5_EventEmitter__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(2); /* harmony import */ var absol_src_HTML5_OOP__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(7); /* harmony import */ var absol_src_Color_Color__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(28); /* harmony import */ var absol_src_Network_IFrameBridge__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(5); /* harmony import */ var absol_src_Converter_file__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(11); /* harmony import */ var absol_src_Converter_base64__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(12); /* harmony import */ var absol_src_Time_Alarm__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(13); /* harmony import */ var absol_src_AppPattern_Ref__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(14); /* harmony import */ var absol_src_Network_XHR__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(15); /* harmony import */ var absol_src_String_stringGenerate__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(3); /* harmony import */ var absol_src_String_stringFormat__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(6); /* harmony import */ var absol_src_AppPattern_VarScope__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(16); /* harmony import */ var absol_src_Math_Rectangle__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(17); /* harmony import */ var absol_src_Math_Arc__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(18); /* harmony import */ var absol_src_Math_NumRange__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(19); /* harmony import */ var absol_src_DataStructure_Heap__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(20); /* harmony import */ var absol_src_Time_datetime__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(21); /* harmony import */ var absol_src_AppPattern_CMDRunner__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(22); /* harmony import */ var absol_src_Math_Vec2__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(0); /* harmony import */ var absol_src_Math_Mat3__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(23); /* harmony import */ var absol_src_Math_int__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(1); /* harmony import */ var absol_src_AppPattern_ObservableArray__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(24); /* harmony import */ var absol_src_AppPattern_ObservableStruct__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(25); /* harmony import */ var absol_src_AppPattern_circuit_CCBlock__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(26); /* harmony import */ var absol_src_AppPattern_circuit_CCLine__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(27); /* harmony import */ var absol_src_Network_Thread__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(29); global.absol = { "int": absol_src_Math_int__WEBPACK_IMPORTED_MODULE_22__, Rectangle: absol_src_Math_Rectangle__WEBPACK_IMPORTED_MODULE_14__[/* default */ "a"], Arc: absol_src_Math_Arc__WEBPACK_IMPORTED_MODULE_15__[/* default */ "a"], NumRange: absol_src_Math_NumRange__WEBPACK_IMPORTED_MODULE_16__[/* default */ "a"], CMDRunner: absol_src_AppPattern_CMDRunner__WEBPACK_IMPORTED_MODULE_19__[/* default */ "a"], VarScope: absol_src_AppPattern_VarScope__WEBPACK_IMPORTED_MODULE_13__[/* default */ "a"], OOP: absol_src_HTML5_OOP__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"], Color: absol_src_Color_Color__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"], EventEmitter: absol_src_HTML5_EventEmitter__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"], JSZip: window.JSZip, IFrameBridge: absol_src_Network_IFrameBridge__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"], file: absol_src_Converter_file__WEBPACK_IMPORTED_MODULE_6__, base64: absol_src_Converter_base64__WEBPACK_IMPORTED_MODULE_7__, Alarm: absol_src_Time_Alarm__WEBPACK_IMPORTED_MODULE_8__[/* default */ "a"], Ref: absol_src_AppPattern_Ref__WEBPACK_IMPORTED_MODULE_9__[/* default */ "a"], XHR: absol_src_Network_XHR__WEBPACK_IMPORTED_MODULE_10__[/* default */ "a"], string: Object.assign({}, absol_src_String_stringFormat__WEBPACK_IMPORTED_MODULE_12__, absol_src_String_stringGenerate__WEBPACK_IMPORTED_MODULE_11__), dataStructure: { Heap: absol_src_DataStructure_Heap__WEBPACK_IMPORTED_MODULE_17__[/* default */ "a"] }, datetime: absol_src_Time_datetime__WEBPACK_IMPORTED_MODULE_18__, Vec2: absol_src_Math_Vec2__WEBPACK_IMPORTED_MODULE_20__[/* default */ "a"], Mat3: absol_src_Math_Mat3__WEBPACK_IMPORTED_MODULE_21__[/* default */ "a"], ObservableArray: absol_src_AppPattern_ObservableArray__WEBPACK_IMPORTED_MODULE_23__[/* default */ "a"], ObservableStruct: absol_src_AppPattern_ObservableStruct__WEBPACK_IMPORTED_MODULE_24__[/* default */ "a"], circuit: { CCBlock: absol_src_AppPattern_circuit_CCBlock__WEBPACK_IMPORTED_MODULE_25__[/* default */ "a"], CCLine: absol_src_AppPattern_circuit_CCLine__WEBPACK_IMPORTED_MODULE_26__[/* default */ "a"] }, Thread: absol_src_Network_Thread__WEBPACK_IMPORTED_MODULE_27__[/* default */ "a"] }; /* harmony default export */ __webpack_exports__["default"] = (absol); /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(4))) /***/ }), /* 32 */ /***/ (function(module, exports) { self.window = self.window || self; /***/ }), /* 33 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(setImmediate, global) {/* harmony import */ var atob__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(9); /* harmony import */ var atob__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(atob__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var btoa__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(10); /* harmony import */ var btoa__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(btoa__WEBPACK_IMPORTED_MODULE_1__); if (!('atob' in window)) { window.atob = atob__WEBPACK_IMPORTED_MODULE_0___default.a; } if (!('btoa' in window)) { window.btoa = btoa__WEBPACK_IMPORTED_MODULE_1___default.a; } !function (e, n) { "object" == typeof exports && "undefined" != typeof module ? n() : "function" == typeof define && __webpack_require__(41) ? define(n) : n() }(0, function () { "use strict"; function e(e) { var n = this.constructor; return this.then(function (t) { return n.resolve(e()).then(function () { return t }) }, function (t) { return n.resolve(e()).then(function () { return n.reject(t) }) }) } function n() { } function t(e) { if (!(this instanceof t)) throw new TypeError("Promises must be constructed via new"); if ("function" != typeof e) throw new TypeError("not a function"); this._state = 0, this._handled = !1, this._value = undefined, this._deferreds = [], u(e, this) } function o(e, n) { for (; 3 === e._state;) e = e._value; 0 !== e._state ? (e._handled = !0, t._immediateFn(function () { var t = 1 === e._state ? n.onFulfilled : n.onRejected; if (null !== t) { var o; try { o = t(e._value) } catch (f) { return void i(n.promise, f) } r(n.promise, o) } else (1 === e._state ? r : i)(n.promise, e._value) })) : e._deferreds.push(n) } function r(e, n) { try { if (n === e) throw new TypeError("A promise cannot be resolved with itself."); if (n && ("object" == typeof n || "function" == typeof n)) { var o = n.then; if (n instanceof t) return e._state = 3, e._value = n, void f(e); if ("function" == typeof o) return void u(function (e, n) { return function () { e.apply(n, arguments) } }(o, n), e) } e._state = 1, e._value = n, f(e) } catch (r) { i(e, r) } } function i(e, n) { e._state = 2, e._value = n, f(e) } function f(e) { 2 === e._state && 0 === e._deferreds.length && t._immediateFn(function () { e._handled || t._unhandledRejectionFn(e._value) }); for (var n = 0, r = e._deferreds.length; r > n; n++) o(e, e._deferreds[n]); e._deferreds = null } function u(e, n) { var t = !1; try { e(function (e) { t || (t = !0, r(n, e)) }, function (e) { t || (t = !0, i(n, e)) }) } catch (o) { if (t) return; t = !0, i(n, o) } } var c = setTimeout; t.prototype["catch"] = function (e) { return this.then(null, e) }, t.prototype.then = function (e, t) { var r = new this.constructor(n); return o(this, new function (e, n, t) { this.onFulfilled = "function" == typeof e ? e : null, this.onRejected = "function" == typeof n ? n : null, this.promise = t }(e, t, r)), r }, t.prototype["finally"] = e, t.all = function (e) { return new t(function (n, t) { function o(e, f) { try { if (f && ("object" == typeof f || "function" == typeof f)) { var u = f.then; if ("function" == typeof u) return void u.call(f, function (n) { o(e, n) }, t) } r[e] = f, 0 == --i && n(r) } catch (c) { t(c) } } if (!e || "undefined" == typeof e.length) throw new TypeError("Promise.all accepts an array"); var r = Array.prototype.slice.call(e); if (0 === r.length) return n([]); for (var i = r.length, f = 0; r.length > f; f++) o(f, r[f]) }) }, t.resolve = function (e) { return e && "object" == typeof e && e.constructor === t ? e : new t(function (n) { n(e) }) }, t.reject = function (e) { return new t(function (n, t) { t(e) }) }, t.race = function (e) { return new t(function (n, t) { for (var o = 0, r = e.length; r > o; o++) e[o].then(n, t) }) }, t._immediateFn = "function" == typeof setImmediate && function (e) { setImmediate(e) } || function (e) { c(e, 0) }, t._unhandledRejectionFn = function (e) { void 0 !== console && console && console.warn("Possible Unhandled Promise Rejection:", e) }; var l = function () { if ("undefined" != typeof self) return self; if ("undefined" != typeof window) return window; if ("undefined" != typeof global) return global; throw Error("unable to locate global object") }(); "Promise" in l ? l.Promise.prototype["finally"] || (l.Promise.prototype["finally"] = e) : l.Promise = t }); !(function () { var vendors = ['ms', 'moz', 'webkit', 'o']; for (var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) { window.requestAnimationFrame = window[vendors[x] + 'RequestAnimationFrame']; window.cancelAnimationFrame = window[vendors[x] + 'CancelAnimationFrame'] || window[vendors[x] + 'CancelRequestAnimationFrame']; } if (!window.requestAnimationFrame) window.requestAnimationFrame = function (callback, element) { var id = window.setTimeout(function () { callback(element); }, 1000 / 60); return id; }; if (!window.cancelAnimationFrame) window.cancelAnimationFrame = function (id) { clearTimeout(id); }; }()); //Object (function () { 'use strict'; var ObjectProto = Object.prototype, defineGetter = ObjectProto.__defineGetter__, defineSetter = ObjectProto.__defineSetter__, lookupGetter = ObjectProto.__lookupGetter__, lookupSetter = ObjectProto.__lookupSetter__, hasOwnProp = ObjectProto.hasOwnProperty; var supportDom = true; try { if (Object.defineProperty) { Object.defineProperty(document.createElement('div'), 'theRandomName', { set: function () { }, get: function () { } }); } } catch (error) { supportDom = false; } if ((!supportDom || !Object.defineProperty) && defineGetter && defineSetter && lookupGetter && lookupSetter) { var originObjetDefineProperty = Object.defineProperty; Object.defineProperty = function (obj, prop, descriptor) { if (!originObjetDefineProperty || (typeof obj.nodeType === "number" && typeof obj.nodeName === "string")) { if (arguments.length < 3) { // all arguments required throw new TypeError("Arguments not optional"); } prop += ""; // convert prop to string if (hasOwnProp.call(descriptor, "value")) { if (!lookupGetter.call(obj, prop) && !lookupSetter.call(obj, prop)) { // data property defined and no pre-existing accessors obj[prop] = descriptor.value; } if ((hasOwnProp.call(descriptor, "get") || hasOwnProp.call(descriptor, "set"))) { // descriptor has a value prop but accessor already exists throw new TypeError("Cannot specify an accessor and a value"); } } if (descriptor.get) { defineGetter.call(obj, prop, descriptor.get); } if (descriptor.set) { defineSetter.call(obj, prop, descriptor.set); } return obj; } else { return originObjetDefineProperty.call(this, obj, prop, descriptor); } }; var originObjectGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; Object.getOwnPropertyDescriptor = function (obj, prop) { if (!originObjectGetOwnPropertyDescriptor || typeof obj.nodeType === "number" && typeof obj.nodeName === "string") { if (arguments.length < 2) { // all arguments required throw new TypeError("Arguments not optional."); } prop += ""; // convert prop to string var descriptor = { configurable: true, enumerable: true, writable: true }, getter = lookupGetter.call(obj, prop), setter = lookupSetter.call(obj, prop); if (!hasOwnProp.call(obj, prop)) { // property doesn't exist or is inherited return descriptor; } if (!getter && !setter) { // not an accessor so return prop descriptor.value = obj[prop]; return descriptor; } // there is an accessor, remove descriptor.writable; // populate descriptor.get and descriptor.set (IE's behavior) delete descriptor.writable; descriptor.get = descriptor.set = undefined; if (getter) { descriptor.get = getter; } if (setter) { descriptor.set = setter; } return descriptor; } else { return originObjectGetOwnPropertyDescriptor(obj, prop); } }; } if (!supportDom || !Object.getOwnPropertyDescriptors) { Object.getOwnPropertyDescriptors = function (o) { var res = {}; for (var key in o) { res[key] = Object.getOwnPropertyDescriptor(o, key); } return res; }; } if (!supportDom || !Object.defineProperties) { Object.defineProperties = function (obj, props) { var prop; for (prop in props) { if (hasOwnProp.call(props, prop)) { Object.defineProperty(obj, prop, props[prop]); } } }; } if (typeof Object.assign != 'function') { Object.assign = function (target, varArgs) { 'use strict'; if (target == null) { throw new TypeError('Cannot convert undefined or null to object'); } var to = Object(target); for (var index = 1; index < arguments.length; index++) { var nextSource = arguments[index]; if (nextSource != null) { for (var nextKey in nextSource) { if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) { to[nextKey] = nextSource[nextKey]; } } } } return to; }; } }()); //string !(function () { if (!String.prototype.startsWith) { String.prototype.startsWith = function (searchString, position) { position = position || 0; return this.indexOf(searchString, position) === position; }; } if (!String.prototype.replaceAll) { String.prototype.replaceAll = function () { var find = arguments[0]; if (!find) return this; if (typeof find == "string") { return this.split(find).join(arguments[1]); } else if (find instanceof RegExp) { return this.replace(new RegExp(find.source, 'g'), arguments[1]); } } } })(); //array !(function () { if (!Array.prototype.fill) { Object.defineProperty(Array.prototype, 'fill', { value: function (value) { // Steps 1-2. if (this == null) { throw new TypeError('this is null or not defined'); } var O = Object(this); // Steps 3-5. var len = O.length >>> 0; // Steps 6-7. var start = arguments[1]; var relativeStart = start >> 0; // Step 8. var k = relativeStart < 0 ? Math.max(len + relativeStart, 0) : Math.min(relativeStart, len); // Steps 9-10. var end = arguments[2]; var relativeEnd = end === undefined ? len : end >> 0; // Step 11. var final = relativeEnd < 0 ? Math.max(len + relativeEnd, 0) : Math.min(relativeEnd, len); // Step 12. while (k < final) { O[k] = value; k++; } // Step 13. return O; } }); } if (!Array.prototype.some) { Array.prototype.some = function (fun /*, thisp */) { "use strict"; if (this == null) throw new TypeError(); var t = Object(this), len = t.length >>> 0; if (typeof fun != "function") throw new TypeError(); var thisp = arguments[1]; for (var i = 0; i < len; i++) { if (i in t && fun.call(thisp, t[i], i, t)) return true; } return false; }; } })(); //function !(function () { if (!Function.prototype.bind) { var ArrayPrototypeSlice = Array.prototype.slice; Function.prototype.bind = function (otherThis) { if (typeof this !== 'function') { // closest thing possible to the ECMAScript 5 // internal IsCallable function throw new TypeError('Function.prototype.bind - what is trying to be bound is not callable'); } var baseArgs = ArrayPrototypeSlice.call(arguments, 1), baseArgsLength = baseArgs.length, fToBind = this, fNOP = function () { }, fBound = function () { baseArgs.length = baseArgsLength; // reset to default base arguments baseArgs.push.apply(baseArgs, arguments); return fToBind.apply( fNOP.prototype.isPrototypeOf(this) ? this : otherThis, baseArgs ); }; if (this.prototype) { // Function.prototype doesn't have a prototype property fNOP.prototype = this.prototype; } fBound.prototype = new fNOP(); return fBound; }; } })(); /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(34).setImmediate, __webpack_require__(4))) /***/ }), /* 34 */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(global) {var scope = (typeof global !== "undefined" && global) || (typeof self !== "undefined" && self) || window; var apply = Function.prototype.apply; // DOM APIs, for completeness exports.setTimeout = function() { return new Timeout(apply.call(setTimeout, scope, arguments), clearTimeout); }; exports.setInterval = function() { return new Timeout(apply.call(setInterval, scope, arguments), clearInterval); }; exports.clearTimeout = exports.clearInterval = function(timeout) { if (timeout) { timeout.close(); } }; function Timeout(id, clearFn) { this._id = id; this._clearFn = clearFn; } Timeout.prototype.unref = Timeout.prototype.ref = function() {}; Timeout.prototype.close = function() { this._clearFn.call(scope, this._id); }; // Does not start the time, just sets up the members needed. exports.enroll = function(item, msecs) { clearTimeout(item._idleTimeoutId); item._idleTimeout = msecs; }; exports.unenroll = function(item) { clearTimeout(item._idleTimeoutId); item._idleTimeout = -1; }; exports._unrefActive = exports.active = function(item) { clearTimeout(item._idleTimeoutId); var msecs = item._idleTimeout; if (msecs >= 0) { item._idleTimeoutId = setTimeout(function onTimeout() { if (item._onTimeout) item._onTimeout(); }, msecs); } }; // setimmediate attaches itself to the global object __webpack_require__(35); // On some exotic environments, it's not clear which object `setimmediate` was // able to install onto. Search each possibility in the same order as the // `setimmediate` library. exports.setImmediate = (typeof self !== "undefined" && self.setImmediate) || (typeof global !== "undefined" && global.setImmediate) || (this && this.setImmediate); exports.clearImmediate = (typeof self !== "undefined" && self.clearImmediate) || (typeof global !== "undefined" && global.clearImmediate) || (this && this.clearImmediate); /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(4))) /***/ }), /* 35 */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(global, process) {(function (global, undefined) { "use strict"; if (global.setImmediate) { return; } var nextHandle = 1; // Spec says greater than zero var tasksByHandle = {}; var currentlyRunningATask = false; var doc = global.document; var registerImmediate; function setImmediate(callback) { // Callback can either be a function or a string if (typeof callback !== "function") { callback = new Function("" + callback); } // Copy function arguments var args = new Array(arguments.length - 1); for (var i = 0; i < args.length; i++) { args[i] = arguments[i + 1]; } // Store and register the task var task = { callback: callback, args: args }; tasksByHandle[nextHandle] = task; registerImmediate(nextHandle); return nextHandle++; } function clearImmediate(handle) { delete tasksByHandle[handle]; } function run(task) { var callback = task.callback; var args = task.args; switch (args.length) { case 0: callback(); break; case 1: callback(args[0]); break; case 2: callback(args[0], args[1]); break; case 3: callback(args[0], args[1], args[2]); break; default: callback.apply(undefined, args); break; } } function runIfPresent(handle) { // From the spec: "Wait until any invocations of this algorithm started before this one have completed." // So if we're currently running a task, we'll need to delay this invocation. if (currentlyRunningATask) { // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a // "too much recursion" error. setTimeout(runIfPresent, 0, handle); } else { var task = tasksByHandle[handle]; if (task) { currentlyRunningATask = true; try { run(task); } finally { clearImmediate(handle); currentlyRunningATask = false; } } } } function installNextTickImplementation() { registerImmediate = function(handle) { process.nextTick(function () { runIfPresent(handle); }); }; } function canUsePostMessage() { // The test against `importScripts` prevents this implementation from being installed inside a web worker, // where `global.postMessage` means something completely different and can't be used for this purpose. if (global.postMessage && !global.importScripts) { var postMessageIsAsynchronous = true; var oldOnMessage = global.onmessage; global.onmessage = function() { postMessageIsAsynchronous = false; }; global.postMessage("", "*"); global.onmessage = oldOnMessage; return postMessageIsAsynchronous; } } function installPostMessageImplementation() { // Installs an event handler on `global` for the `message` event: see // * https://developer.mozilla.org/en/DOM/window.postMessage // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages var messagePrefix = "setImmediate$" + Math.random() + "$"; var onGlobalMessage = function(event) { if (event.source === global && typeof event.data === "string" && event.data.indexOf(messagePrefix) === 0) { runIfPresent(+event.data.slice(messagePrefix.length)); } }; if (global.addEventListener) { global.addEventListener("message", onGlobalMessage, false); } else { global.attachEvent("onmessage", onGlobalMessage); } registerImmediate = function(handle) { global.postMessage(messagePrefix + handle, "*"); }; } function installMessageChannelImplementation() { var channel = new MessageChannel(); channel.port1.onmessage = function(event) { var handle = event.data; runIfPresent(handle); }; registerImmediate = function(handle) { channel.port2.postMessage(handle); }; } function installReadyStateChangeImplementation() { var html = doc.documentElement; registerImmediate = function(handle) { // Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called. var script = doc.createElement("script"); script.onreadystatechange = function () { runIfPresent(handle); script.onreadystatechange = null; html.removeChild(script); script = null; }; html.appendChild(script); }; } function installSetTimeoutImplementation() { registerImmediate = function(handle) { setTimeout(runIfPresent, 0, handle); }; } // If supported, we should attach to the prototype of global, since that is where setTimeout et al. live. var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global); attachTo = attachTo && attachTo.setTimeout ? attachTo : global; // Don't get fooled by e.g. browserify environments. if ({}.toString.call(global.process) === "[object process]") { // For Node.js before 0.9 installNextTickImplementation(); } else if (canUsePostMessage()) { // For non-IE10 modern browsers installPostMessageImplementation(); } else if (global.MessageChannel) { // For web workers, where supported installMessageChannelImplementation(); } else if (doc && "onreadystatechange" in doc.createElement("script")) { // For IE 6–8 installReadyStateChangeImplementation(); } else { // For older browsers installSetTimeoutImplementation(); } attachTo.setImmediate = setImmediate; attachTo.clearImmediate = clearImmediate; }(typeof self === "undefined" ? typeof global === "undefined" ? this : global : self)); /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(4), __webpack_require__(36))) /***/ }), /* 36 */ /***/ (function(module, exports) { // shim for using process in browser var process = module.exports = {}; // cached from whatever global is present so that test runners that stub it // don't break things. But we need to wrap it in a try catch in case it is // wrapped in strict mode code which doesn't define any globals. It's inside a // function because try/catches deoptimize in certain engines. var cachedSetTimeout; var cachedClearTimeout; function defaultSetTimout() { throw new Error('setTimeout has not been defined'); } function defaultClearTimeout () { throw new Error('clearTimeout has not been defined'); } (function () { try { if (typeof setTimeout === 'function') { cachedSetTimeout = setTimeout; } else { cachedSetTimeout = defaultSetTimout; } } catch (e) { cachedSetTimeout = defaultSetTimout; } try { if (typeof clearTimeout === 'function') { cachedClearTimeout = clearTimeout; } else { cachedClearTimeout = defaultClearTimeout; } } catch (e) { cachedClearTimeout = defaultClearTimeout; } } ()) function runTimeout(fun) { if (cachedSetTimeout === setTimeout) { //normal enviroments in sane situations return setTimeout(fun, 0); } // if setTimeout wasn't available but was latter defined if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { cachedSetTimeout = setTimeout; return setTimeout(fun, 0); } try { // when when somebody has screwed with setTimeout but no I.E. maddness return cachedSetTimeout(fun, 0); } catch(e){ try { // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally return cachedSetTimeout.call(null, fun, 0); } catch(e){ // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error return cachedSetTimeout.call(this, fun, 0); } } } function runClearTimeout(marker) { if (cachedClearTimeout === clearTimeout) { //normal enviroments in sane situations return clearTimeout(marker); } // if clearTimeout wasn't available but was latter defined if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { cachedClearTimeout = clearTimeout; return clearTimeout(marker); } try { // when when somebody has screwed with setTimeout but no I.E. maddness return cachedClearTimeout(marker); } catch (e){ try { // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally return cachedClearTimeout.call(null, marker); } catch (e){ // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. // Some versions of I.E. have different rules for clearTimeout vs setTimeout return cachedClearTimeout.call(this, marker); } } } var queue = []; var draining = false; var currentQueue; var queueIndex = -1; function cleanUpNextTick() { if (!draining || !currentQueue) { return; } draining = false; if (currentQueue.length) { queue = currentQueue.concat(queue); } else { queueIndex = -1; } if (queue.length) { drainQueue(); } } function drainQueue() { if (draining) { return; } var timeout = runTimeout(cleanUpNextTick); draining = true; var len = queue.length; while(len) { currentQueue = queue; queue = []; while (++queueIndex < len) { if (currentQueue) { currentQueue[queueIndex].run(); } } queueIndex = -1; len = queue.length; } currentQueue = null; draining = false; runClearTimeout(timeout); } process.nextTick = function (fun) { var args = new Array(arguments.length - 1); if (arguments.length > 1) { for (var i = 1; i < arguments.length; i++) { args[i - 1] = arguments[i]; } } queue.push(new Item(fun, args)); if (queue.length === 1 && !draining) { runTimeout(drainQueue); } }; // v8 likes predictible objects function Item(fun, array) { this.fun = fun; this.array = array; } Item.prototype.run = function () { this.fun.apply(null, this.array); }; process.title = 'browser'; process.browser = true; process.env = {}; process.argv = []; process.version = ''; // empty string to avoid regexp issues process.versions = {}; function noop() {} process.on = noop; process.addListener = noop; process.once = noop; process.off = noop; process.removeListener = noop; process.removeAllListeners = noop; process.emit = noop; process.prependListener = noop; process.prependOnceListener = noop; process.listeners = function (name) { return [] } process.binding = function (name) { throw new Error('process.binding is not supported'); }; process.cwd = function () { return '/' }; process.chdir = function (dir) { throw new Error('process.chdir is not supported'); }; process.umask = function() { return 0; }; /***/ }), /* 37 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.byteLength = byteLength exports.toByteArray = toByteArray exports.fromByteArray = fromByteArray var lookup = [] var revLookup = [] var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' for (var i = 0, len = code.length; i < len; ++i) { lookup[i] = code[i] revLookup[code.charCodeAt(i)] = i } // Support decoding URL-safe base64 strings, as Node.js does. // See: https://en.wikipedia.org/wiki/Base64#URL_applications revLookup['-'.charCodeAt(0)] = 62 revLookup['_'.charCodeAt(0)] = 63 function getLens (b64) { var len = b64.length if (len % 4 > 0) { throw new Error('Invalid string. Length must be a multiple of 4') } // Trim off extra bytes after placeholder bytes are found // See: https://github.com/beatgammit/base64-js/issues/42 var validLen = b64.indexOf('=') if (validLen === -1) validLen = len var placeHoldersLen = validLen === len ? 0 : 4 - (validLen % 4) return [validLen, placeHoldersLen] } // base64 is 4/3 + up to two characters of the original data function byteLength (b64) { var lens = getLens(b64) var validLen = lens[0] var placeHoldersLen = lens[1] return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen } function _byteLength (b64, validLen, placeHoldersLen) { return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen } function toByteArray (b64) { var tmp var lens = getLens(b64) var validLen = lens[0] var placeHoldersLen = lens[1] var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen)) var curByte = 0 // if there are placeholders, only get up to the last complete 4 chars var len = placeHoldersLen > 0 ? validLen - 4 : validLen var i for (i = 0; i < len; i += 4) { tmp = (revLookup[b64.charCodeAt(i)] << 18) | (revLookup[b64.charCodeAt(i + 1)] << 12) | (revLookup[b64.charCodeAt(i + 2)] << 6) | revLookup[b64.charCodeAt(i + 3)] arr[curByte++] = (tmp >> 16) & 0xFF arr[curByte++] = (tmp >> 8) & 0xFF arr[curByte++] = tmp & 0xFF } if (placeHoldersLen === 2) { tmp = (revLookup[b64.charCodeAt(i)] << 2) | (revLookup[b64.charCodeAt(i + 1)] >> 4) arr[curByte++] = tmp & 0xFF } if (placeHoldersLen === 1) { tmp = (revLookup[b64.charCodeAt(i)] << 10) | (revLookup[b64.charCodeAt(i + 1)] << 4) | (revLookup[b64.charCodeAt(i + 2)] >> 2) arr[curByte++] = (tmp >> 8) & 0xFF arr[curByte++] = tmp & 0xFF } return arr } function tripletToBase64 (num) { return lookup[num >> 18 & 0x3F] + lookup[num >> 12 & 0x3F] + lookup[num >> 6 & 0x3F] + lookup[num & 0x3F] } function encodeChunk (uint8, start, end) { var tmp var output = [] for (var i = start; i < end; i += 3) { tmp = ((uint8[i] << 16) & 0xFF0000) + ((uint8[i + 1] << 8) & 0xFF00) + (uint8[i + 2] & 0xFF) output.push(tripletToBase64(tmp)) } return output.join('') } function fromByteArray (uint8) { var tmp var len = uint8.length var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes var parts = [] var maxChunkLength = 16383 // must be multiple of 3 // go through the array every three bytes, we'll deal with trailing stuff later for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) { parts.push(encodeChunk( uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength) )) } // pad the end with zeros, but make sure to not forget the extra bytes if (extraBytes === 1) { tmp = uint8[len - 1] parts.push( lookup[tmp >> 2] + lookup[(tmp << 4) & 0x3F] + '==' ) } else if (extraBytes === 2) { tmp = (uint8[len - 2] << 8) + uint8[len - 1] parts.push( lookup[tmp >> 10] + lookup[(tmp >> 4) & 0x3F] + lookup[(tmp << 2) & 0x3F] + '=' ) } return parts.join('') } /***/ }), /* 38 */ /***/ (function(module, exports) { exports.read = function (buffer, offset, isLE, mLen, nBytes) { var e, m var eLen = (nBytes * 8) - mLen - 1 var eMax = (1 << eLen) - 1 var eBias = eMax >> 1 var nBits = -7 var i = isLE ? (nBytes - 1) : 0 var d = isLE ? -1 : 1 var s = buffer[offset + i] i += d e = s & ((1 << (-nBits)) - 1) s >>= (-nBits) nBits += eLen for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {} m = e & ((1 << (-nBits)) - 1) e >>= (-nBits) nBits += mLen for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {} if (e === 0) { e = 1 - eBias } else if (e === eMax) { return m ? NaN : ((s ? -1 : 1) * Infinity) } else { m = m + Math.pow(2, mLen) e = e - eBias } return (s ? -1 : 1) * m * Math.pow(2, e - mLen) } exports.write = function (buffer, value, offset, isLE, mLen, nBytes) { var e, m, c var eLen = (nBytes * 8) - mLen - 1 var eMax = (1 << eLen) - 1 var eBias = eMax >> 1 var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0) var i = isLE ? 0 : (nBytes - 1) var d = isLE ? 1 : -1 var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0 value = Math.abs(value) if (isNaN(value) || value === Infinity) { m = isNaN(value) ? 1 : 0 e = eMax } else { e = Math.floor(Math.log(value) / Math.LN2) if (value * (c = Math.pow(2, -e)) < 1) { e-- c *= 2 } if (e + eBias >= 1) { value += rt / c } else { value += rt * Math.pow(2, 1 - eBias) } if (value * c >= 2) { e++ c /= 2 } if (e + eBias >= eMax) { m = 0 e = eMax } else if (e + eBias >= 1) { m = ((value * c) - 1) * Math.pow(2, mLen) e = e + eBias } else { m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen) e = 0 } } for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {} e = (e << mLen) | m eLen += mLen for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {} buffer[offset + i - d] |= s * 128 } /***/ }), /* 39 */ /***/ (function(module, exports) { var toString = {}.toString; module.exports = Array.isArray || function (arr) { return toString.call(arr) == '[object Array]'; }; /***/ }), /* 40 */ /***/ (function(module, exports) { module.exports = function(module) { if (!module.webpackPolyfill) { module.deprecate = function() {}; module.paths = []; // module.parent = undefined by default if (!module.children) module.children = []; Object.defineProperty(module, "loaded", { enumerable: true, get: function() { return module.l; } }); Object.defineProperty(module, "id", { enumerable: true, get: function() { return module.i; } }); module.webpackPolyfill = 1; } return module; }; /***/ }), /* 41 */ /***/ (function(module, exports) { /* WEBPACK VAR INJECTION */(function(__webpack_amd_options__) {/* globals __webpack_amd_options__ */ module.exports = __webpack_amd_options__; /* WEBPACK VAR INJECTION */}.call(this, {})) /***/ }) /******/ ]);