![]() 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/formeditor/v0.4.0/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 = 71); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var absol_src_HTML5_Dom__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1); var Acore = new absol_src_HTML5_Dom__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"]({ creator: Object.assign({}, absol_src_HTML5_Dom__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"].ShareInstance.creator) }); /* harmony default export */ __webpack_exports__["a"] = (Acore); /***/ }), /* 1 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; // EXTERNAL MODULE: ./node_modules/absol/src/HTML5/Element.js var Element = __webpack_require__(6); // EXTERNAL MODULE: ./node_modules/absol/src/HTML5/JSPath.js var JSPath = __webpack_require__(23); // EXTERNAL MODULE: ./node_modules/absol/src/HTML5/OOP.js var OOP = __webpack_require__(3); // CONCATENATED MODULE: ./node_modules/absol/src/String/getFunctionName.js /** * * @param {Function} func */ function getFunctionName(func) { var ret = func.toString(); ret = ret.substr('function '.length); ret = ret.substr(0, ret.indexOf('(')); return ret; } // CONCATENATED MODULE: ./node_modules/absol/src/HTML5/Dom.js var attachhookCreator = function () { var res = Dom.ShareInstance._({ tag: 'img', class: 'absol-attachhook', style: { display: 'none' }, attr: { src: '' } }); return res; }; var svgCreator = function () { var temp = document.createElement('div'); temp.innerHTML = '<svg version="1.1" xmlns="http://www.w3.org/2000/svg"></svg>'; var element = temp.childNodes[0]; var prototypes = Object.getOwnPropertyDescriptors(Element["a" /* default */].prototype); Object.defineProperties(element, prototypes); Element["a" /* default */].call(element); return element; }; function Dom(option) { this.defaultTag = 'div'; option = option || {}; this.creator = option.creator || {}; Object.defineProperties(this.creator, { svg: { set: function () { //do nothing }, get: function () { return svgCreator; } }, attachhook: { set: function () { //do nothing }, get: function () { return attachhookCreator; } } }); this.$ = this.selectAttacth.bind(this); this._ = this.create.bind(this); this.buildDom = this._; } Dom.prototype.fromCode = function (code) { code = code.trim().replace(/>\s+</gm, '><'); var temTag = 'div'; if (code.startsWith('<td')) temTag = 'tr'; if (code.startsWith('<tr')) temTag = 'tbody'; var tempDiv = document.createElement(temTag); tempDiv.innerHTML = code; var element = tempDiv.childNodes[0]; var prototypes = Object.getOwnPropertyDescriptors(Element["a" /* default */].prototype); Object.defineProperties(element, prototypes); Element["a" /* default */].call(element); return element; }; /** * DFS * @param {string} query * @param {Element} root * @param {function} onFound - return true to stop find */ Dom.prototype.selectAttacth = function (query, root, onFound) { var res; if (Dom.isDomNode(query)) res = query; else res = this.select(query, root, onFound); if (res) this.attach(res); return res; }; /** * DFS * @param {string} query * @param {Element} root * @param {function} onFound - return true to stop find */ Dom.prototype.select = function (query, root, onFound) { root = root || document.documentElement; var matcher = JSPath["a" /* default */].compileJSPath(query); return matcher.findFirst(root, onFound); }; /** * * @param {Element} element */ Dom.prototype.attach = function (element) { if (typeof element.attr == 'function') return; var prototypes = Object.getOwnPropertyDescriptors(Element["a" /* default */].prototype); Object.defineProperties(element, prototypes); Element["a" /* default */].call(element); }; Dom.prototype.makeNewElement = function (tagName) { return document.createElement(tagName); }; Dom.prototype.makeNewTextNode = function (data) { return document.createTextNode(data); }; /** * * @param {Object} option * @returns {Element} */ Dom.prototype.create = function (option, isInherited) { var res; var creator; if (Dom.isDomNode(option)) { res = option; option = {}; } else { var optionType = typeof option; if (optionType == 'string') { option = option.trim(); if (option[0] == '<') { res = this.fromCode(option); option = {}; } else { var queryObj = JSPath["a" /* default */].parseQuery(option); option = {}; option.tag = queryObj.tagName || this.defaultTag; if (queryObj.classList && queryObj.classList.length > 0) option.class = queryObj.classList; if (queryObj.id) option.id = queryObj.id; if (queryObj.attributes) option.attr = queryObj.attributes; } } } if (typeof (option.text) == 'string') {//is textNode return this.makeNewTextNode(option.text); } option.tag = option.tag || this.defaultTag; creator = this.creator[option.tag]; if (option.elt) { res = option.elt; } else{ if (!res) { if (creator) { if (creator.render) { res = creator.render(option.data); } else { res = creator(option.data); } } else { res = this.makeNewElement(option.tag); Object.assign(res, option.data); } } } this.attach(res); if (creator) { res._azar_extendTags = res._azar_extendTags || {}; res._azar_extendTags[option.tag] = true; creator.property && Object.defineProperties(res, creator.property); creator.prototype && OOP["a" /* default */].extends(res, creator.prototype); creator.attribute && res.defineAttributes(creator.attribute); if (creator.render) { if (creator.eventHandler) res.eventHandler = OOP["a" /* default */].bindFunctions(res, creator.eventHandler); creator.call(res); } } option.extendEvent && res.defineEvent(option.extendEvent); option.attr && res.attr(option.attr); option.on && res.on(option.on); option.once && res.once(option.once); option.class && res.addClass(option.class); option.style && res.addStyle(option.style); option.id && res.attr('id', option.id); if (!isInherited) res.init(option.props); //todo:attach option if (option.child) { option.child = option.child instanceof Array ? option.child : [option.child]; for (var i = 0; i < option.child.length; ++i) { res.addChild(this.create(option.child[i])); } } return res; }; Dom.prototype.install = function (arg0, arg1) { var _this = this; if (arguments.length == 1) { if (arg0.creator && arg0.create && arg0.select) { // is a dom core var creator = arg0.creator; Object.keys(creator).forEach(function (key) { if (key.startsWith('_') || key.startsWith('$')) return; var func = creator[key]; if (typeof (func) == 'function') if (_this.creator[key] != func) _this.creator[key] = func; }); } else if (typeof (arg0) == 'function') { var name = getFunctionName(arg0) || arg0.name; if (name) { this.creator[name.toLowerCase()] = arg0; } else { console.error('No ident name of creator function', arg0); } } else if (typeof arg0 == 'object') { Object.keys(arg0).forEach(function (key) { if (key.startsWith('_') || key.startsWith('$')) return; var func = arg0[key]; if (typeof (func) == 'function') if (_this.creator[key] != func) _this.creator[key] = func; }); } else if (arg0 instanceof Array) { arg0.forEach(function (func) { var name = getFunctionName(func) || func.name; if (name) { _this.creator[name.toLowerCase()] = func; } }); } else { console.error('Unknow data', arg0); } } else if (arguments.length == 2) { if (arg0 instanceof Array) { arg0.forEach(function (key) { if (key.match(arg0)) { var func = arg1[key]; if (typeof (func) == 'function') if (_this.create[key] != func) _this.create[key] = func; } }); } else if (arg0 instanceof RegExp) { Object.keys(arg1).forEach(function (key) { if (key.match(arg0)) { var func = arg1[key]; if (typeof (func) == 'function') if (_this.create[key] != func) _this.create[key] = func; } }); } else if (typeof (arg0) == 'string' && arg0.length > 0) { if (typeof (arg1) == 'function') { this.creator[arg0] = arg1; } else { console.error('arg1 is not a function'); } } } else { console.error('Invalid param'); } return this; }; /** * * @param {*} o * @returns {Boolean} */ Dom.isDomNode = function (o) { return ( typeof Node === "object" ? o instanceof Node : o && typeof o === "object" && typeof o.nodeType === "number" && typeof o.nodeName === "string" ); }; /** * @param {HTMLElement} element */ Dom.activeFullScreen = function (element) { if (element.requestFullscreen) { element.requestFullscreen(); } else if (element.mozRequestFullScreen) { element.mozRequestFullScreen(); } else if (element.webkitRequestFullscreen) { element.webkitRequestFullscreen(Element["a" /* default */].ALLOW_KEYBOARD_INPUT); } else if (element.msRequestFullscreen) { element.msRequestFullscreen(); } }; Dom.deactiveFullScreen = function () { if (document.exitFullscreen) { document.exitFullscreen(); } else if (document.mozCancelFullScreen) { document.mozCancelFullScreen(); } else if (document.webkitExitFullscreen) { document.webkitExitFullscreen(); } else if (document.msExitFullscreen) { document.msExitFullscreen(); } }; Dom.isFullScreen = function () { var fullScreenElement = document.fullscreenElement || document.webkitFullscreenElement || document.mozFullScreenElement || document.msFullscreenElement; return !!fullScreenElement; }; /** * @param {HTMLElement} element * @returns {ClientRect} */ Dom.traceOutBoundingClientRect = function (current) { var screenSize = Dom.getScreenSize(); var left = 0; var right = screenSize.width; var top = 0; var bottom = screenSize.height; while (current) { var ox = Element["a" /* default */].prototype.getComputedStyleValue.call(current, 'overflow-x') != "visible"; var oy = Element["a" /* default */].prototype.getComputedStyleValue.call(current, 'overflow-y') != "visible"; var isHtml = current.tagName.toLowerCase() == 'html'; if (ox || oy || isHtml) { var bound = current.getBoundingClientRect(); if (ox || isHtml) { left = Math.max(left, bound.left); right = Math.min(right, bound.right); } if (oy || isHtml) { top = Math.max(top, bound.top); bottom = Math.min(bottom, bound.bottom); } } if (isHtml) break; current = current.parentElement; } return { left: left, right: right, top: top, bottom: bottom, width: right - left, height: bottom - top }; }; Dom.fontFaceIsLoaded = function (fontFace, timeout) { timeout = timeout || 0; var element = this.ShareInstance._({ tag: 'span', style: { visibility: 'hidden', position: 'fixed', top: '-9999px', left: '-9999px', 'font-size': '256px' }, props: { innerHTML: "Test string long long long" } }); element.addTo(document.body); return element.afterAttached().then(function () { var lastOffsetWidth = element.getBoundingClientRect().width; element.addStyle('font-family', fontFace); return new Promise(function (resolve, reject) { function check(remainTime) { if (remainTime < 0) { resolve(false); element.selfRemove(); } else requestAnimationFrame(function () { var currentOffsetWidth = element.getBoundingClientRect().width; if (currentOffsetWidth != lastOffsetWidth) { resolve(true); element.selfRemove(); } else check(remainTime - 10); }, 10); } check(timeout); }); }); }; Dom.getScreenSize = function () { var width = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth; var height = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight; return { WIDTH: width, HEIGHT: height, width: width, height: height }; }; Dom.waitImageLoaded = function (img) { var isLoaded = true; if (!img.complete) { isLoaded = false; } if (img.naturalWidth === 0) { isLoaded = false; } if (isLoaded) return Promise.resolve(); return new Promise(function (rs) { if (img.addEventListener) { img.addEventListener('load', rs, false); } else { img.attachEvent('onload', rs, false); } setTimeout(rs, 5000); }); // No other way of checking: assume it’s ok. }; Dom.waitIFrameLoaded = function (iframe) { return new Promise(function (rs, rj) { if (document.all) { iframe.onreadystatechange = function () { if (iframe.readyState == "complete" || iframe.readyState == "loaded") rs(); }; } else { iframe.onload = rs; } setTimeout(rs, 5000) }); }; Dom.imageToCanvas = function (element) { if (typeof element == 'string') { element = Dom.ShareInstance.$(element); } if (element.tagName.toLowerCase() == 'img') { var preRender = Dom.ShareInstance._('div'); preRender.addStyle({ position: 'fixed', top: '0', left: '0', zIndex: '-10000', opacity: '0' }).addTo(document.body); var canvas = document.createElement("canvas"); preRender.addChild(canvas); return Dom.waitImageLoaded(element).then(function () { canvas.width = element.width; canvas.height = element.height; var context = canvas.getContext("2d"); context.drawImage(element, 0, 0); preRender.selfRemove(); return canvas; }); } else { throw new Error("Element must be image"); } }; Dom.ShareInstance = new Dom(); Dom.scrollWidthPromise; Dom.documentReady = new Promise(function (resolve) { if (document.body) { resolve(); } else { window.addEventListener("load", resolve); } }); Dom.getScrollSize = function () { if (!Dom.scrollWidthPromise) Dom.scrollWidthPromise = new Promise(function (resolve) { function prerender() { var parent = Dom.ShareInstance._({ style: { 'z-index': '-100', opacity: '0', width: '100px', height: '100px', overflow: 'scroll', top: '0', left: '0', 'box-sizing': 'content-box', position: 'fixed' } }) .addTo(document.body); var child = Dom.ShareInstance._({ style: { width: '100%', height: '100%' } }).addTo(parent); requestAnimationFrame(function () { var parentBound = parent.getBoundingClientRect(); var childBound = child.getBoundingClientRect(); resolve({ width: parentBound.width - childBound.width, height: parentBound.height - childBound.height }); parent.selfRemove(); }); } Dom.documentReady.then(prerender); }); return Dom.scrollWidthPromise; }; Dom.depthCloneWithStyle = function (originElt) { var newElt = originElt.cloneNode();//no deep if (!originElt.getAttribute && !originElt.getAttributeNS) return newElt;//is text node var cssRules = Element["a" /* default */].prototype.getCSSRules.call(originElt); var cssKey = cssRules.reduce(function (ac, rule) { for (var i = 0; i < rule.style.length; ++i) { ac[rule.style[i]] = true; } return ac; }, {}); for (var key in cssKey) { newElt.style[key] = Element["a" /* default */].prototype.getComputedStyleValue.call(originElt, key); } var children = Array.prototype.map.call(originElt.childNodes, Dom.depthCloneWithStyle); for (var i = 0; i < children.length; ++i) { newElt.appendChild(children[i]); } return newElt; }; Dom.copyStyleRule = function (sourceElt, destElt) { if (!sourceElt.getAttribute && !sourceElt.getAttributeNS) return destElt;//is text node if (!destElt.getAttribute && !destElt.getAttributeNS) return destElt;//is text node, nothing to copy var cssRules = Element["a" /* default */].prototype.getCSSRules.call(sourceElt); var cssKey = cssRules.reduce(function (ac, rule) { for (var i = 0; i < rule.style.length; ++i) { ac[rule.style[i]] = true; } return ac; }, {}); for (var key in cssKey) { destElt.style[key] = Element["a" /* default */].prototype.getComputedStyleValue.call(sourceElt, key); } return destElt; }; Dom.$printStyle = Dom.ShareInstance._('style[id="absol-print-preparing"]').addTo(document.head); Dom.$printStyle.innerHTML = [ '.absol-export-canvas-image{', ' display: none !important;', '}' ].join('\n'); Dom.lastResizeTime = 0; Dom.ResizeSystemElts = []; Dom.ResizeSystemCacheElts = undefined; Dom.removeResizeSystemTrash = function () { Dom.ResizeSystemElts = Dom.ResizeSystemElts.filter(function (element) { return Element["a" /* default */].prototype.isDescendantOf.call(element, document.body); }); }; Dom.addToResizeSystem = function (element) { for (var i = 0; i < Dom.ResizeSystemElts.length; ++i) if (Element["a" /* default */].prototype.isDescendantOf.call(element, Dom.ResizeSystemElts[i])) { return false; } Dom.ResizeSystemElts = Dom.ResizeSystemElts.filter(function (e) { return !Element["a" /* default */].prototype.isDescendantOf.call(e, element); }); Dom.ResizeSystemElts.push(element); return true; }; Dom.updateResizeSystem = function () { var now = new Date().getTime(); if (now - 100 > Dom.lastResizeTime) { Dom.removeResizeSystemTrash(); Dom.ResizeSystemCacheElts = undefined; } Dom.lastResizeTime = now; function visitor(child) { if (typeof child.requestUpdateSize == 'function') { child.requestUpdateSize(); return true; } else if (typeof child.updateSize == 'function') { child.updateSize(); return true; } else if (typeof child.onresize == 'function') { child.onresize(); return true; } } if (Dom.ResizeSystemCacheElts === undefined) { Dom.ResizeSystemCacheElts = []; Dom.ResizeSystemElts.forEach(function (e) { Dom.ShareInstance.$('', e, function (child) { if (visitor(child)) Dom.ResizeSystemCacheElts.push(child); }); }); } else { Dom.ResizeSystemCacheElts.forEach(visitor); } }; window.addEventListener('resize', Dom.updateResizeSystem); /* harmony default export */ var HTML5_Dom = __webpack_exports__["a"] = (Dom); /***/ }), /* 2 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; function EventEmitter() { this._azar_extendEvents = this._azar_extendEvents || { supported: {}, prioritize: {}, nonprioritize: {} }; this.__azar_force = !(typeof Node === "object" ? this instanceof Node : this && typeof this === "object" && typeof this.nodeType === "number" && typeof this.nodeName === "string"); } 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 (data) { event.callback.call(this, data); 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.call); } else { this.detachEvent('on' + event.eventName, event.wrappedCallback, !!event.call); } } } else { newEventArray.push(event); } } this._azar_extendEvents[arg2 ? 'prioritize' : 'nonprioritize'][arg0] = newEventArray; return this; } } }; EventEmitter.isMouseRight = function (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; }; EventEmitter.hitElement = function (element, event) { var current = event.target; while (current) { if (current == element) return true; current = current.parentElement; } return false; }; EventEmitter.copyEvent = function (event, props) { var result = {}; Object.assign(result, event); for (var key in result) { if (typeof result[key] == 'function') { result[key] = result[key].bind(event); } } if (props) Object.assign(result, props); return result; }; EventEmitter.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"]; /* harmony default export */ __webpack_exports__["a"] = (EventEmitter); /***/ }), /* 3 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; var OOP = {}; /** * @param {Object} object * @param {Sttring} key * @param {Function} method */ OOP.overideMethod = 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.overideMethod(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]); } } }; /* harmony default export */ __webpack_exports__["a"] = (OOP); /***/ }), /* 4 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php Author Tobias Koppers @sokra */ // css base code, injected by the css-loader module.exports = function (useSourceMap) { var list = []; // return the list of modules as css string list.toString = function toString() { return this.map(function (item) { var content = cssWithMappingToString(item, useSourceMap); if (item[2]) { return '@media ' + item[2] + '{' + content + '}'; } else { return content; } }).join(''); }; // import a list of modules into the list list.i = function (modules, mediaQuery) { if (typeof modules === 'string') { modules = [[null, modules, '']]; } var alreadyImportedModules = {}; for (var i = 0; i < this.length; i++) { var id = this[i][0]; if (id != null) { alreadyImportedModules[id] = true; } } for (i = 0; i < modules.length; i++) { var item = modules[i]; // skip already imported module // this implementation is not 100% perfect for weird media query combinations // when a module is imported multiple times with different media queries. // I hope this will never occur (Hey this way we have smaller bundles) if (item[0] == null || !alreadyImportedModules[item[0]]) { if (mediaQuery && !item[2]) { item[2] = mediaQuery; } else if (mediaQuery) { item[2] = '(' + item[2] + ') and (' + mediaQuery + ')'; } list.push(item); } } }; return list; }; function cssWithMappingToString(item, useSourceMap) { var content = item[1] || ''; var cssMapping = item[3]; if (!cssMapping) { return content; } if (useSourceMap && typeof btoa === 'function') { var sourceMapping = toComment(cssMapping); var sourceURLs = cssMapping.sources.map(function (source) { return '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */'; }); return [content].concat(sourceURLs).concat([sourceMapping]).join('\n'); } return [content].join('\n'); } // Adapted from convert-source-map (MIT) function toComment(sourceMap) { // eslint-disable-next-line no-undef var base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))); var data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64; return '/*# ' + data + ' */'; } /***/ }), /* 5 */ /***/ (function(module, exports, __webpack_require__) { /* MIT License http://www.opensource.org/licenses/mit-license.php Author Tobias Koppers @sokra */ var stylesInDom = {}; var memoize = function (fn) { var memo; return function () { if (typeof memo === "undefined") memo = fn.apply(this, arguments); return memo; }; }; var isOldIE = memoize(function () { // Test for IE <= 9 as proposed by Browserhacks // @see http://browserhacks.com/#hack-e71d8692f65334173fee715c222cb805 // Tests for existence of standard globals is to allow style-loader // to operate correctly into non-standard environments // @see https://github.com/webpack-contrib/style-loader/issues/177 return window && document && document.all && !window.atob; }); var getTarget = function (target, parent) { if (parent){ return parent.querySelector(target); } return document.querySelector(target); }; var getElement = (function (fn) { var memo = {}; return function(target, parent) { // If passing function in options, then use it for resolve "head" element. // Useful for Shadow Root style i.e // { // insertInto: function () { return document.querySelector("#foo").shadowRoot } // } if (typeof target === 'function') { return target(); } if (typeof memo[target] === "undefined") { var styleTarget = getTarget.call(this, target, parent); // Special case to return head of iframe instead of iframe itself if (window.HTMLIFrameElement && styleTarget instanceof window.HTMLIFrameElement) { try { // This will throw an exception if access to iframe is blocked // due to cross-origin restrictions styleTarget = styleTarget.contentDocument.head; } catch(e) { styleTarget = null; } } memo[target] = styleTarget; } return memo[target] }; })(); var singleton = null; var singletonCounter = 0; var stylesInsertedAtTop = []; var fixUrls = __webpack_require__(114); module.exports = function(list, options) { if (typeof DEBUG !== "undefined" && DEBUG) { if (typeof document !== "object") throw new Error("The style-loader cannot be used in a non-browser environment"); } options = options || {}; options.attrs = typeof options.attrs === "object" ? options.attrs : {}; // Force single-tag solution on IE6-9, which has a hard limit on the # of <style> // tags it will allow on a page if (!options.singleton && typeof options.singleton !== "boolean") options.singleton = isOldIE(); // By default, add <style> tags to the <head> element if (!options.insertInto) options.insertInto = "head"; // By default, add <style> tags to the bottom of the target if (!options.insertAt) options.insertAt = "bottom"; var styles = listToStyles(list, options); addStylesToDom(styles, options); return function update (newList) { var mayRemove = []; for (var i = 0; i < styles.length; i++) { var item = styles[i]; var domStyle = stylesInDom[item.id]; domStyle.refs--; mayRemove.push(domStyle); } if(newList) { var newStyles = listToStyles(newList, options); addStylesToDom(newStyles, options); } for (var i = 0; i < mayRemove.length; i++) { var domStyle = mayRemove[i]; if(domStyle.refs === 0) { for (var j = 0; j < domStyle.parts.length; j++) domStyle.parts[j](); delete stylesInDom[domStyle.id]; } } }; }; function addStylesToDom (styles, options) { for (var i = 0; i < styles.length; i++) { var item = styles[i]; var domStyle = stylesInDom[item.id]; if(domStyle) { domStyle.refs++; for(var j = 0; j < domStyle.parts.length; j++) { domStyle.parts[j](item.parts[j]); } for(; j < item.parts.length; j++) { domStyle.parts.push(addStyle(item.parts[j], options)); } } else { var parts = []; for(var j = 0; j < item.parts.length; j++) { parts.push(addStyle(item.parts[j], options)); } stylesInDom[item.id] = {id: item.id, refs: 1, parts: parts}; } } } function listToStyles (list, options) { var styles = []; var newStyles = {}; for (var i = 0; i < list.length; i++) { var item = list[i]; var id = options.base ? item[0] + options.base : item[0]; var css = item[1]; var media = item[2]; var sourceMap = item[3]; var part = {css: css, media: media, sourceMap: sourceMap}; if(!newStyles[id]) styles.push(newStyles[id] = {id: id, parts: [part]}); else newStyles[id].parts.push(part); } return styles; } function insertStyleElement (options, style) { var target = getElement(options.insertInto) if (!target) { throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid."); } var lastStyleElementInsertedAtTop = stylesInsertedAtTop[stylesInsertedAtTop.length - 1]; if (options.insertAt === "top") { if (!lastStyleElementInsertedAtTop) { target.insertBefore(style, target.firstChild); } else if (lastStyleElementInsertedAtTop.nextSibling) { target.insertBefore(style, lastStyleElementInsertedAtTop.nextSibling); } else { target.appendChild(style); } stylesInsertedAtTop.push(style); } else if (options.insertAt === "bottom") { target.appendChild(style); } else if (typeof options.insertAt === "object" && options.insertAt.before) { var nextSibling = getElement(options.insertAt.before, target); target.insertBefore(style, nextSibling); } else { throw new Error("[Style Loader]\n\n Invalid value for parameter 'insertAt' ('options.insertAt') found.\n Must be 'top', 'bottom', or Object.\n (https://github.com/webpack-contrib/style-loader#insertat)\n"); } } function removeStyleElement (style) { if (style.parentNode === null) return false; style.parentNode.removeChild(style); var idx = stylesInsertedAtTop.indexOf(style); if(idx >= 0) { stylesInsertedAtTop.splice(idx, 1); } } function createStyleElement (options) { var style = document.createElement("style"); if(options.attrs.type === undefined) { options.attrs.type = "text/css"; } if(options.attrs.nonce === undefined) { var nonce = getNonce(); if (nonce) { options.attrs.nonce = nonce; } } addAttrs(style, options.attrs); insertStyleElement(options, style); return style; } function createLinkElement (options) { var link = document.createElement("link"); if(options.attrs.type === undefined) { options.attrs.type = "text/css"; } options.attrs.rel = "stylesheet"; addAttrs(link, options.attrs); insertStyleElement(options, link); return link; } function addAttrs (el, attrs) { Object.keys(attrs).forEach(function (key) { el.setAttribute(key, attrs[key]); }); } function getNonce() { if (false) {} return __webpack_require__.nc; } function addStyle (obj, options) { var style, update, remove, result; // If a transform function was defined, run it on the css if (options.transform && obj.css) { result = typeof options.transform === 'function' ? options.transform(obj.css) : options.transform.default(obj.css); if (result) { // If transform returns a value, use that instead of the original css. // This allows running runtime transformations on the css. obj.css = result; } else { // If the transform function returns a falsy value, don't add this css. // This allows conditional loading of css return function() { // noop }; } } if (options.singleton) { var styleIndex = singletonCounter++; style = singleton || (singleton = createStyleElement(options)); update = applyToSingletonTag.bind(null, style, styleIndex, false); remove = applyToSingletonTag.bind(null, style, styleIndex, true); } else if ( obj.sourceMap && typeof URL === "function" && typeof URL.createObjectURL === "function" && typeof URL.revokeObjectURL === "function" && typeof Blob === "function" && typeof btoa === "function" ) { style = createLinkElement(options); update = updateLink.bind(null, style, options); remove = function () { removeStyleElement(style); if(style.href) URL.revokeObjectURL(style.href); }; } else { style = createStyleElement(options); update = applyToTag.bind(null, style); remove = function () { removeStyleElement(style); }; } update(obj); return function updateStyle (newObj) { if (newObj) { if ( newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap ) { return; } update(obj = newObj); } else { remove(); } }; } var replaceText = (function () { var textStore = []; return function (index, replacement) { textStore[index] = replacement; return textStore.filter(Boolean).join('\n'); }; })(); function applyToSingletonTag (style, index, remove, obj) { var css = remove ? "" : obj.css; if (style.styleSheet) { style.styleSheet.cssText = replaceText(index, css); } else { var cssNode = document.createTextNode(css); var childNodes = style.childNodes; if (childNodes[index]) style.removeChild(childNodes[index]); if (childNodes.length) { style.insertBefore(cssNode, childNodes[index]); } else { style.appendChild(cssNode); } } } function applyToTag (style, obj) { var css = obj.css; var media = obj.media; if(media) { style.setAttribute("media", media) } if(style.styleSheet) { style.styleSheet.cssText = css; } else { while(style.firstChild) { style.removeChild(style.firstChild); } style.appendChild(document.createTextNode(css)); } } function updateLink (link, options, obj) { var css = obj.css; var sourceMap = obj.sourceMap; /* If convertToAbsoluteUrls isn't defined, but sourcemaps are enabled and there is no publicPath defined then lets turn convertToAbsoluteUrls on by default. Otherwise default to the convertToAbsoluteUrls option directly */ var autoFixUrls = options.convertToAbsoluteUrls === undefined && sourceMap; if (options.convertToAbsoluteUrls || autoFixUrls) { css = fixUrls(css); } if (sourceMap) { // http://stackoverflow.com/a/26603875 css += "\n/*# sourceMappingURL=data:application/json;base64," + btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))) + " */"; } var blob = new Blob([css], { type: "text/css" }); var oldSrc = link.href; link.href = URL.createObjectURL(blob); if(oldSrc) URL.revokeObjectURL(oldSrc); } /***/ }), /* 6 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var _EventEmitter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2); /* harmony import */ var _Detector_BrowserDetector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(19); /* harmony import */ var _String_stringFormat__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(7); function Element() { _EventEmitter__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"].call(this); this._azar_extendAttributes = this._azar_extendAttributes || {}; } Object.defineProperties(Element.prototype, Object.getOwnPropertyDescriptors(_EventEmitter__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"].prototype)); Element.prototype.init = function (props) { Object.assign(this, props || {}); }; /** * @typedef {Object} AttributeDefiner * @property {Function} set * @property {Function} get * @property {Function} remove * * @param {String} key * @param {AttributeDefiner} def */ Element.prototype.defineAttribute = function (key, def) { this._azar_extendAttributes[key] = def; }; Element.prototype.defineAttributes = function (defs) { for (var key in defs) { this.defineAttribute(key, defs[key]); } }; Element.prototype.attr = function () { if (arguments.length == 1) { if (typeof (arguments[0]) == 'string') { if (this._azar_extendAttributes[arguments[0]]) { return this._azar_extendAttributes[arguments[0]].get.call(this); } else return this.getAttribute(arguments[0]); } else { for (var key in arguments[0]) { this.attr(key, arguments[0][key]); } } } else { if (arguments.length == 2) { if (arguments[1] === null || arguments[1] === undefined) { if (this._azar_extendAttributes[arguments[0]]) { this._azar_extendAttributes[arguments[0]].remove.call(this, arguments[1]); } else this.removeAttribute(arguments[0]); } else { if (this._azar_extendAttributes[arguments[0]]) { this._azar_extendAttributes[arguments[0]].set.call(this, arguments[1]); } else { this.setAttribute(arguments[0], arguments[1]); } } } } return this; }; Element.prototype.addStyle = function (arg0, arg1) { if (typeof arg0 == 'string') this.style[Object(_String_stringFormat__WEBPACK_IMPORTED_MODULE_2__["kebabCaseToCamelCase"])(arg0)] = arg1; else { for (var key in arg0) this.addStyle(key, arg0[key]); } return this; }; Element.prototype.removeStyle = function (arg0) { var key; if (typeof arg0 == 'string') { key = Object(_String_stringFormat__WEBPACK_IMPORTED_MODULE_2__["kebabCaseToCamelCase"])(arg0); this.style[key] = null; delete this.style[key]; } else { if (typeof arg0 instanceof Array) { for (var i = 0; i < arg0.length; ++i) this.removeStyle(arg0[i]); } else { for (key in arg0) this.removeStyle(key); } } return this; }; Element.prototype.addChild = function (child) { if (child instanceof Array) { for (var i = 0; i < child.length; ++i) this.appendChild(child[i]); } else this.appendChild(child); return this; }; Element.prototype.addTo = function (parent) { if (parent && parent.appendChild) { if (parent.addChild) parent.addChild(this); else parent.appendChild(this); } else throw Error("Can not append to " + parent + "!"); return this; }; Element.prototype.selfRemove = function () { if (this.parentElement) this.parentElement.removeChild(this); return this; }; Element.prototype.selfReplace = function (newNode) { if (this.parentElement) this.parentElement.replaceChild(newNode, this); return this; }; Element.prototype.clearChild = function () { while (this.firstChild) { this.removeChild(this.firstChild); } return this; }; /** * * @param {string} className * @returns {Boolean} */ Element.prototype.containsClass = function (className) { if (className instanceof Array) { for (var i = 0; i < className.length; ++i) if (!this.classList.containsClass(className[i])) return false; return true; } else return this.classList.contains(className); }; /** * * @param {string} className * @returns {Element} */ Element.prototype.addClass = function (className) { if (className instanceof Array) { for (var i = 0; i < className.length; ++i) this.classList.add(className[i]); } else this.classList.add(className); return this; }; /** * * @param {string} className * @returns {Element} */ Element.prototype.removeClass = function (className) { if (className instanceof Array) { for (var i = 0; i < className.length; ++i) this.classList.remove(className[i]); } else this.classList.remove(className); return this; }; Element.prototype.getComputedStyleValue = function (key) { return window.getComputedStyle(this).getPropertyValue(key); }; Element.prototype.getFontSize = function () { return parseFloat(this.getComputedStyleValue('font-size').replace('px', '')); }; Element.prototype.findChildAfter = function (obj) { var r = 0; for (var i = 0; i < this.childNodes.length; ++i) { if (obj == this.childNodes[i]) { r = i + 1; break; } } if (this.childNodes[r]) return this.childNodes[r]; return undefined; }; Element.prototype.findChildBefore = function (obj) { var r = 0; for (var i = 0; i < this.childNodes.length; ++i) { if (obj == this.childNodes[i]) { r = i - 1; break; } } if (this.childNodes[r]) return this.childNodes[r]; return undefined; }; Element.prototype.addChildBefore = function (newItem, bf) { this.insertBefore(newItem, bf); return this; }; Element.prototype.addChildAfter = function (newItem, at) { var bf = this.findChildAfter(at); if (bf) return this.addChildBefore(newItem, bf); return this.addChild(newItem); }; /** * @returns {DOMRect} */ Element.prototype.getBoundingRecursiveRect = function (depth) { if (depth === undefined) depth = 10000; var current, next; var oo = 1000000; var ac = { left: oo, right: -oo, top: oo, bottom: -oo, width: 0, height: 0 }; var stacks = [{ e: this, d: 0 }]; while (stacks.length > 0) { current = stacks.pop(); if (current.e.getBoundingClientRect) { var cRect = current.e.getBoundingClientRect(); if (!cRect || !(cRect.width || cRect.height || cRect.left || cRect.right)) continue; ac.left = Math.min(ac.left, cRect.left); ac.top = Math.min(ac.top, cRect.top); ac.bottom = Math.max(ac.bottom, cRect.bottom); ac.right = Math.max(ac.right, cRect.right); ac.height = ac.bottom - ac.top; ac.width = ac.right - ac.left; var childNodes = current.e.childNodes; if (childNodes && childNodes.length > 0 && current.d < depth) { for (var i = 0; i < childNodes.length; ++i) { next = { e: childNodes[i], d: current.d + 1 }; stacks.push(next); } } } } return ac; }; Element.prototype.isDescendantOf = function (parent) { var child = this; while (child) { if (child == parent) return true; child = child.parentNode; } return false; }; /*************************** **********************/ Element.prototype.getCSSRules = function () { var sheets = document.styleSheets; var ret = []; this.matches = this.matches || this.webkitMatchesSelector || this.mozMatchesSelector || this.msMatchesSelector || this.oMatchesSelector; for (var i in sheets) { if (sheets[i].href) continue;//because can not access, you must clone link node instead var rules = sheets[i].rules || sheets[i].cssRules; for (var r in rules) { if (this.matches(rules[r].selectorText)) { ret.push(rules[r]); } } } return ret; }; /*** * WARNING: this function may be unsafe */ Element.prototype.afterAttached = function (frameTimeOut) { if (!frameTimeOut) frameTimeOut = 25; // var tracer = new Error(); var current = this; return new Promise(function (resolve, reject) { var delayTime = 0; function trace() { if (frameTimeOut < 0) { // reject(tracer); // if (absol.BUILD && absol.BUILD.version == "DEBUG") // console.warn("Element not attached", trace); } else { frameTimeOut--; while (true) { if (current == document.body) { resolve(); return; } else { if (current.parentNode) { current = current.parentNode; } else { if (delayTime < 25) delayTime += 1; else if (delayTime < 100) { delayTime += 5; } else if (delayTime < 1000) { delayTime += 10; } setTimeout(trace, delayTime); return; } } } } } setTimeout(trace, 0); }); }; /*** * WARNING: this function may be unsafe */ Element.prototype.afterDisplayed = function (requestTimesOut) { if (!requestTimesOut) requestTimesOut = 24 * 3600 * 33; // var tracer = new Error(); var current = this; return new Promise(function (resolve, reject) { function trace() { if (requestTimesOut < 0) { // reject(tracer); // if (absol.BUILD && absol.BUILD.version == "DEBUG") // console.warn("Element not displayed", trace); } else { requestTimesOut--; var bound = current.getBoundingClientRect(); if (bound.width > 0 || bound.height > 0) { resolve(); } else { setTimeout(trace, 33); return; } } } trace(); }); }; !(function () { var origin = Element.prototype.on; if (_Detector_BrowserDetector__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"].isSafari && !_Detector_BrowserDetector__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"].isMobile) { Element.prototype.on = function () { if (!this.isSupportedEvent('mouseleave') && arguments[0] == 'mouseleave') { this.defineEvent('mouseleave'); var mouseLeaveEventHandler = function (event) { var bound = this.getBoundingClientRect(); var ok = false; ok |= event.clientX < bound.left + 1; ok |= event.clientX >= bound.right - 1; ok |= event.clientY < bound.top + 1; ok |= event.clientY >= bound.bottom - 1; if (ok) this.emit('mouseleave', event); }; this.addEventListener('mouseleave', mouseLeaveEventHandler, true); } origin.apply(this, arguments); return this; }; } if (_Detector_BrowserDetector__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"].isFirefox) { Element.prototype.on = function () { if (!this.isSupportedEvent('wheel') && arguments[0] == 'wheel') { this.defineEvent('wheel'); var wheelEventHandler = function (oldEvent) { //clone event to avoid some lib fix it var event = oldEvent.absolEvent; if (!event) { event = Object.assign({}, oldEvent); for (var i = 0; i < Element.eventProperties.length; ++i) { var key = Element.eventProperties[i]; if (typeof (event[key]) == 'function') { event[key] = event[key].bind(oldEvent); } } event.preventDefault = function () { oldEvent.preventDefault(); }; if (!event.mozFixWheelScale) { event.mozDeltaY = oldEvent.deltaY; event.mozFixWheelScale = true; Object.defineProperty(event, 'deltaY', { get: function () { return this.mozDeltaY * 100 / 3; } }); } oldEvent.absolEvent = event; } this.emit('wheel', event); }; this.addEventListener('wheel', wheelEventHandler); } origin.apply(this, arguments); return this; }; } }()); Element.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"]; /* harmony default export */ __webpack_exports__["a"] = (Element); /***/ }), /* 7 */ /***/ (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; } 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); }; /***/ }), /* 8 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var support = __webpack_require__(14); var base64 = __webpack_require__(45); var nodejsUtils = __webpack_require__(29); var setImmediate = __webpack_require__(87); var external = __webpack_require__(21); /** * Convert a string that pass as a "binary string": it should represent a byte * array but may have > 255 char codes. Be sure to take only the first byte * and returns the byte array. * @param {String} str the string to transform. * @return {Array|Uint8Array} the string in a binary format. */ function string2binary(str) { var result = null; if (support.uint8array) { result = new Uint8Array(str.length); } else { result = new Array(str.length); } return stringToArrayLike(str, result); } /** * Create a new blob with the given content and the given type. * @param {String|ArrayBuffer} part the content to put in the blob. DO NOT use * an Uint8Array because the stock browser of android 4 won't accept it (it * will be silently converted to a string, "[object Uint8Array]"). * * Use only ONE part to build the blob to avoid a memory leak in IE11 / Edge: * when a large amount of Array is used to create the Blob, the amount of * memory consumed is nearly 100 times the original data amount. * * @param {String} type the mime type of the blob. * @return {Blob} the created blob. */ exports.newBlob = function(part, type) { exports.checkSupport("blob"); try { // Blob constructor return new Blob([part], { type: type }); } catch (e) { try { // deprecated, browser only, old way var Builder = self.BlobBuilder || self.WebKitBlobBuilder || self.MozBlobBuilder || self.MSBlobBuilder; var builder = new Builder(); builder.append(part); return builder.getBlob(type); } catch (e) { // well, fuck ?! throw new Error("Bug : can't construct the Blob."); } } }; /** * The identity function. * @param {Object} input the input. * @return {Object} the same input. */ function identity(input) { return input; } /** * Fill in an array with a string. * @param {String} str the string to use. * @param {Array|ArrayBuffer|Uint8Array|Buffer} array the array to fill in (will be mutated). * @return {Array|ArrayBuffer|Uint8Array|Buffer} the updated array. */ function stringToArrayLike(str, array) { for (var i = 0; i < str.length; ++i) { array[i] = str.charCodeAt(i) & 0xFF; } return array; } /** * An helper for the function arrayLikeToString. * This contains static informations and functions that * can be optimized by the browser JIT compiler. */ var arrayToStringHelper = { /** * Transform an array of int into a string, chunk by chunk. * See the performances notes on arrayLikeToString. * @param {Array|ArrayBuffer|Uint8Array|Buffer} array the array to transform. * @param {String} type the type of the array. * @param {Integer} chunk the chunk size. * @return {String} the resulting string. * @throws Error if the chunk is too big for the stack. */ stringifyByChunk: function(array, type, chunk) { var result = [], k = 0, len = array.length; // shortcut if (len <= chunk) { return String.fromCharCode.apply(null, array); } while (k < len) { if (type === "array" || type === "nodebuffer") { result.push(String.fromCharCode.apply(null, array.slice(k, Math.min(k + chunk, len)))); } else { result.push(String.fromCharCode.apply(null, array.subarray(k, Math.min(k + chunk, len)))); } k += chunk; } return result.join(""); }, /** * Call String.fromCharCode on every item in the array. * This is the naive implementation, which generate A LOT of intermediate string. * This should be used when everything else fail. * @param {Array|ArrayBuffer|Uint8Array|Buffer} array the array to transform. * @return {String} the result. */ stringifyByChar: function(array){ var resultStr = ""; for(var i = 0; i < array.length; i++) { resultStr += String.fromCharCode(array[i]); } return resultStr; }, applyCanBeUsed : { /** * true if the browser accepts to use String.fromCharCode on Uint8Array */ uint8array : (function () { try { return support.uint8array && String.fromCharCode.apply(null, new Uint8Array(1)).length === 1; } catch (e) { return false; } })(), /** * true if the browser accepts to use String.fromCharCode on nodejs Buffer. */ nodebuffer : (function () { try { return support.nodebuffer && String.fromCharCode.apply(null, nodejsUtils.allocBuffer(1)).length === 1; } catch (e) { return false; } })() } }; /** * Transform an array-like object to a string. * @param {Array|ArrayBuffer|Uint8Array|Buffer} array the array to transform. * @return {String} the result. */ function arrayLikeToString(array) { // Performances notes : // -------------------- // String.fromCharCode.apply(null, array) is the fastest, see // see http://jsperf.com/converting-a-uint8array-to-a-string/2 // but the stack is limited (and we can get huge arrays !). // // result += String.fromCharCode(array[i]); generate too many strings ! // // This code is inspired by http://jsperf.com/arraybuffer-to-string-apply-performance/2 // TODO : we now have workers that split the work. Do we still need that ? var chunk = 65536, type = exports.getTypeOf(array), canUseApply = true; if (type === "uint8array") { canUseApply = arrayToStringHelper.applyCanBeUsed.uint8array; } else if (type === "nodebuffer") { canUseApply = arrayToStringHelper.applyCanBeUsed.nodebuffer; } if (canUseApply) { while (chunk > 1) { try { return arrayToStringHelper.stringifyByChunk(array, type, chunk); } catch (e) { chunk = Math.floor(chunk / 2); } } } // no apply or chunk error : slow and painful algorithm // default browser on android 4.* return arrayToStringHelper.stringifyByChar(array); } exports.applyFromCharCode = arrayLikeToString; /** * Copy the data from an array-like to an other array-like. * @param {Array|ArrayBuffer|Uint8Array|Buffer} arrayFrom the origin array. * @param {Array|ArrayBuffer|Uint8Array|Buffer} arrayTo the destination array which will be mutated. * @return {Array|ArrayBuffer|Uint8Array|Buffer} the updated destination array. */ function arrayLikeToArrayLike(arrayFrom, arrayTo) { for (var i = 0; i < arrayFrom.length; i++) { arrayTo[i] = arrayFrom[i]; } return arrayTo; } // a matrix containing functions to transform everything into everything. var transform = {}; // string to ? transform["string"] = { "string": identity, "array": function(input) { return stringToArrayLike(input, new Array(input.length)); }, "arraybuffer": function(input) { return transform["string"]["uint8array"](input).buffer; }, "uint8array": function(input) { return stringToArrayLike(input, new Uint8Array(input.length)); }, "nodebuffer": function(input) { return stringToArrayLike(input, nodejsUtils.allocBuffer(input.length)); } }; // array to ? transform["array"] = { "string": arrayLikeToString, "array": identity, "arraybuffer": function(input) { return (new Uint8Array(input)).buffer; }, "uint8array": function(input) { return new Uint8Array(input); }, "nodebuffer": function(input) { return nodejsUtils.newBufferFrom(input); } }; // arraybuffer to ? transform["arraybuffer"] = { "string": function(input) { return arrayLikeToString(new Uint8Array(input)); }, "array": function(input) { return arrayLikeToArrayLike(new Uint8Array(input), new Array(input.byteLength)); }, "arraybuffer": identity, "uint8array": function(input) { return new Uint8Array(input); }, "nodebuffer": function(input) { return nodejsUtils.newBufferFrom(new Uint8Array(input)); } }; // uint8array to ? transform["uint8array"] = { "string": arrayLikeToString, "array": function(input) { return arrayLikeToArrayLike(input, new Array(input.length)); }, "arraybuffer": function(input) { return input.buffer; }, "uint8array": identity, "nodebuffer": function(input) { return nodejsUtils.newBufferFrom(input); } }; // nodebuffer to ? transform["nodebuffer"] = { "string": arrayLikeToString, "array": function(input) { return arrayLikeToArrayLike(input, new Array(input.length)); }, "arraybuffer": function(input) { return transform["nodebuffer"]["uint8array"](input).buffer; }, "uint8array": function(input) { return arrayLikeToArrayLike(input, new Uint8Array(input.length)); }, "nodebuffer": identity }; /** * Transform an input into any type. * The supported output type are : string, array, uint8array, arraybuffer, nodebuffer. * If no output type is specified, the unmodified input will be returned. * @param {String} outputType the output type. * @param {String|Array|ArrayBuffer|Uint8Array|Buffer} input the input to convert. * @throws {Error} an Error if the browser doesn't support the requested output type. */ exports.transformTo = function(outputType, input) { if (!input) { // undefined, null, etc // an empty string won't harm. input = ""; } if (!outputType) { return input; } exports.checkSupport(outputType); var inputType = exports.getTypeOf(input); var result = transform[inputType][outputType](input); return result; }; /** * Return the type of the input. * The type will be in a format valid for JSZip.utils.transformTo : string, array, uint8array, arraybuffer. * @param {Object} input the input to identify. * @return {String} the (lowercase) type of the input. */ exports.getTypeOf = function(input) { if (typeof input === "string") { return "string"; } if (Object.prototype.toString.call(input) === "[object Array]") { return "array"; } if (support.nodebuffer && nodejsUtils.isBuffer(input)) { return "nodebuffer"; } if (support.uint8array && input instanceof Uint8Array) { return "uint8array"; } if (support.arraybuffer && input instanceof ArrayBuffer) { return "arraybuffer"; } }; /** * Throw an exception if the type is not supported. * @param {String} type the type to check. * @throws {Error} an Error if the browser doesn't support the requested type. */ exports.checkSupport = function(type) { var supported = support[type.toLowerCase()]; if (!supported) { throw new Error(type + " is not supported by this platform"); } }; exports.MAX_VALUE_16BITS = 65535; exports.MAX_VALUE_32BITS = -1; // well, "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" is parsed as -1 /** * Prettify a string read as binary. * @param {string} str the string to prettify. * @return {string} a pretty string. */ exports.pretty = function(str) { var res = '', code, i; for (i = 0; i < (str || "").length; i++) { code = str.charCodeAt(i); res += '\\x' + (code < 16 ? "0" : "") + code.toString(16).toUpperCase(); } return res; }; /** * Defer the call of a function. * @param {Function} callback the function to call asynchronously. * @param {Array} args the arguments to give to the callback. */ exports.delay = function(callback, args, self) { setImmediate(function () { callback.apply(self || null, args || []); }); }; /** * Extends a prototype with an other, without calling a constructor with * side effects. Inspired by nodejs' `utils.inherits` * @param {Function} ctor the constructor to augment * @param {Function} superCtor the parent constructor to use */ exports.inherits = function (ctor, superCtor) { var Obj = function() {}; Obj.prototype = superCtor.prototype; ctor.prototype = new Obj(); }; /** * Merge the objects passed as parameters into a new one. * @private * @param {...Object} var_args All objects to merge. * @return {Object} a new object with the data of the others. */ exports.extend = function() { var result = {}, i, attr; for (i = 0; i < arguments.length; i++) { // arguments is not enumerable in some browsers for (attr in arguments[i]) { if (arguments[i].hasOwnProperty(attr) && typeof result[attr] === "undefined") { result[attr] = arguments[i][attr]; } } } return result; }; /** * Transform arbitrary content into a Promise. * @param {String} name a name for the content being processed. * @param {Object} inputData the content to process. * @param {Boolean} isBinary true if the content is not an unicode string * @param {Boolean} isOptimizedBinaryString true if the string content only has one byte per character. * @param {Boolean} isBase64 true if the string content is encoded with base64. * @return {Promise} a promise in a format usable by JSZip. */ exports.prepareContent = function(name, inputData, isBinary, isOptimizedBinaryString, isBase64) { // if inputData is already a promise, this flatten it. var promise = external.Promise.resolve(inputData).then(function(data) { var isBlob = support.blob && (data instanceof Blob || ['[object File]', '[object Blob]'].indexOf(Object.prototype.toString.call(data)) !== -1); if (isBlob && typeof FileReader !== "undefined") { return new external.Promise(function (resolve, reject) { var reader = new FileReader(); reader.onload = function(e) { resolve(e.target.result); }; reader.onerror = function(e) { reject(e.target.error); }; reader.readAsArrayBuffer(data); }); } else { return data; } }); return promise.then(function(data) { var dataType = exports.getTypeOf(data); if (!dataType) { return external.Promise.reject( new Error("Can't read the data of '" + name + "'. Is it " + "in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?") ); } // special case : it's way easier to work with Uint8Array than with ArrayBuffer if (dataType === "arraybuffer") { data = exports.transformTo("uint8array", data); } else if (dataType === "string") { if (isBase64) { data = base64.decode(data); } else if (isBinary) { // optimizedBinaryString === true means that the file has already been filtered with a 0xFF mask if (isOptimizedBinaryString !== true) { // this is a string, not in a base64 format. // Be sure that this is a correct "binary string" data = string2binary(data); } } } return data; }); }; /***/ }), /* 9 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; // EXTERNAL MODULE: ./node_modules/absol/src/HTML5/Dom.js + 1 modules var Dom = __webpack_require__(1); // EXTERNAL MODULE: ./node_modules/absol/src/HTML5/Element.js var Element = __webpack_require__(6); // CONCATENATED MODULE: ./node_modules/absol/src/HTML5/ElementNS.js function ElementNS() { Element["a" /* default */].call(this); } Object.defineProperties(ElementNS.prototype, Object.getOwnPropertyDescriptors(Element["a" /* default */].prototype)); ElementNS.prototype.attr = function () { if (arguments.length == 1) { if (typeof (arguments[0]) == 'string') { if (this._azar_extendAttributes[arguments[0]]) { return this._azar_extendAttributes[arguments[0]].get.call(this); } else return this.getAttributeNS(null,arguments[0]); } else { for (var key in arguments[0]) { this.attr(key, arguments[0][key]); } } } else { if (arguments.length == 2) { if (arguments[1] === null || arguments[1] === undefined) { if (this._azar_extendAttributes[arguments[0]]) { this._azar_extendAttributes[arguments[0]].remove.call(this, arguments[1]); } else this.removeAttributeNS(null,arguments[0]); } else { if (this._azar_extendAttributes[arguments[0]]) { this._azar_extendAttributes[arguments[0]].set.call(this, arguments[1]); } else{ this.setAttributeNS(null,arguments[0], arguments[1]); } } } } return this; }; /* harmony default export */ var HTML5_ElementNS = (ElementNS); // CONCATENATED MODULE: ./node_modules/absol/src/HTML5/Svg.js var sattachhookCreator = function () { return Svg.ShareInstance._('<image class="absol-attachhook" style:"display: none" xlink:href=""/>'); }; function Svg(option) { Dom["a" /* default */].call(this, option); this.defaultTag = 'g'; this.svgNS = "http://www.w3.org/2000/svg"; Object.defineProperties(this.creator, { sattachhook: { set: function () { //do nothing }, get: function () { return sattachhookCreator; } } }); delete this.buidDom; this.buildSvg = this.create.bind(this); } Object.defineProperties(Svg.prototype, Object.getOwnPropertyDescriptors(Dom["a" /* default */].prototype)); Svg.prototype.fromCode = function (code) { code = code.trim(); var receptacle = document.createElement('div'); var element; var prototypes; if (code.startsWith('<svg')) { receptacle.innerHTML = code; element = receptacle.childNodes[0]; prototypes = Object.getOwnPropertyDescriptors(Element["a" /* default */].prototype); Object.defineProperties(element, prototypes); Element["a" /* default */].call(element); } else { var svgfragment = '<svg version="1.1" xmlns="http://www.w3.org/2000/svg">' + code + '</svg>'; receptacle.innerHTML = '' + svgfragment; element = receptacle.childNodes[0].childNodes[0]; prototypes = Object.getOwnPropertyDescriptors(HTML5_ElementNS.prototype); Object.defineProperties(element, prototypes); HTML5_ElementNS.call(element); } return element; }; Svg.prototype.makeNewElement = function (tagName) { return document.createElementNS(this.svgNS, tagName); }; /** * * @param {Element} element */ Svg.prototype.attach = function (element) { if (typeof element.attr == 'function') return; var prototypes = Object.getOwnPropertyDescriptors(HTML5_ElementNS.prototype); Object.defineProperties(element, prototypes); HTML5_ElementNS.call(element); }; Svg.ShareInstance = new Svg(); Svg.svgToCanvas = function (element) { if (typeof element == 'string') { element = Dom["a" /* default */].ShareInstance.$(element); } if (element && element.tagName == 'svg') { var cssTexts = {}; var depthClone = function (originElt) { var newElt = originElt.cloneNode();//no deep if (!originElt.getAttributeNS) return newElt;//is text node var cssRules = Element["a" /* default */].prototype.getCSSRules.call(originElt); var cssKey = cssRules.reduce(function (ac, rule) { for (var i = 0; i < rule.style.length; ++i) { ac[rule.style[i]] = true; } return ac; }, {}); for (var key in cssKey) { newElt.style[key] = Element["a" /* default */].prototype.getComputedStyleValue.call(originElt, key); } var children = Array.prototype.map.call(originElt.childNodes, depthClone); for (var i = 0; i < children.length; ++i) { newElt.appendChild(children[i]); } return newElt; }; var cloneElement = depthClone(element); var renderSpace = Dom["a" /* default */].ShareInstance._({ style: { // opacity:0, zIndex: -1000, position: 'fixed', top: 0, bottom: 0 } }).addTo(document.body); renderSpace.addChild(cloneElement); var svgCode = renderSpace.innerHTML; renderSpace.clearChild(); var mBlob = new Blob([svgCode], { type: "image/svg+xml;charset=utf-8" }); var src = (URL || webkitURL).createObjectURL(mBlob); var image = Dom["a" /* default */].ShareInstance._('img'); image.attr('src', src) .addTo(renderSpace); var canvas = document.createElement("canvas"); renderSpace.addChild(canvas); return Dom["a" /* default */].waitImageLoaded(image).then(function () { canvas.width = image.width; canvas.height = image.height; var context = canvas.getContext("2d"); context.drawImage(image, 0, 0); renderSpace.selfRemove(); return canvas; }); } else { throw new Error('Element must be svg'); } }; Svg.svgToRasterImageUrl = function (element) { return Svg.svgToCanvas(element).then(function (canvas) { return canvas.toDataURL(); }); } Svg.svgToExportedString = function (element) { if (typeof element == 'string') { element = Dom["a" /* default */].ShareInstance.$(element); } if (element && element.tagName == 'svg') { var depthClone = function (originElt) { var newElt = originElt.cloneNode();//no deep if (!originElt.getAttributeNS) return newElt;//is text node var cssRules = Element["a" /* default */].prototype.getCSSRules.call(originElt); var cssKey = cssRules.reduce(function (ac, rule) { for (var i = 0; i < rule.style.length; ++i) { ac[rule.style[i]] = true; } return ac; }, {}); for (var key in cssKey) { newElt.style[key] = Element["a" /* default */].prototype.getComputedStyleValue.call(originElt, key); } var children = Array.prototype.map.call(originElt.childNodes, depthClone); for (var i = 0; i < children.length; ++i) { newElt.appendChild(children[i]); } return newElt; }; var cloneElement = depthClone(element); var renderSpace = Dom["a" /* default */].ShareInstance._({ style: { // opacity:0, zIndex: -1000, position: 'fixed', top: 0, bottom: 0 } }).addTo(document.body); renderSpace.addChild(cloneElement); var svgCode = renderSpace.innerHTML; renderSpace.selfRemove(); return svgCode; } else { throw new Error('Element must be svg'); } }; Svg.svgToSvgUrl = function (element) { var svg = Svg.svgToExportedString(element); svg = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>\n' + svg; var blob = new Blob([svg], { type: 'image/svg+xml' }); var url = URL.createObjectURL(blob); return url; } Dom["a" /* default */].printElement = function (option) { var _ = Dom["a" /* default */].ShareInstance._; var $ = Dom["a" /* default */].ShareInstance.$; option = option || {}; if (typeof option == 'string') { option = { elt: Dom["a" /* default */].ShareInstance.$(option) }; } else if (typeof option.elt == 'string') { option.elt = $(option.elt); } else if (Dom["a" /* default */].isDomNode(option)) { option = { elt: option }; } if (Dom["a" /* default */].isDomNode(option.elt)) { var canvases = [], imageExported = []; var canvas, images, img, src, scripts, i; if (option.elt.querySelectorAll) { canvases = option.elt.querySelectorAll('canvas'); } else { $('canvas', option.elt, function (elt) { canvases.push(elt); }); } for (i = 0; i < canvases.length; ++i) { canvas = canvases[i]; src = canvas.toDataURL(); img = _({ tag: 'img', class: 'absol-export-canvas-image', attr: { src: src } }); imageExported.push(img); Dom["a" /* default */].copyStyleRule(canvas, img); canvas.parentElement.insertBefore(img, canvas); } var newElt = option.computeStyle ? Dom["a" /* default */].depthCloneWithStyle(option.elt) : option.elt.cloneNode(true); //remove canvas that will be empty when clone canvas = []; if (newElt.querySelectorAll) { canvases = newElt.querySelectorAll('canvas'); } else { $('canvas', newElt, function (elt) { canvases.push(elt); }); } for (i = 0; i < canvases.length; ++i) { canvases[i].remove(); } scripts = []; if (newElt.querySelectorAll) { scripts = newElt.querySelectorAll('script'); } else { $('canvas', newElt, function (elt) { scripts.push(elt); }); } for (i = 0; i < scripts.length; ++i) { scripts[i].remove(); } images = []; //for performance if (newElt.querySelectorAll) { images = newElt.querySelectorAll('img'); } else { $('img', newElt, function (elt) { images.push(elt); }); } for (i = 0; i < images.length; ++i) { if (images[i].classList.contains('absol-export-canvas-image')) continue; src = images[i].src; images[i].setAttribute('src', src); } var renderSpace = _({ style: { position: 'fixed', top: '0', left: '0', right: '0', bottom: '0', overflow: 'auto', zIndex: '10', opacity: '0', visibility: 'hidden' } }); $('link', document.head, function (elt) { renderSpace.addChild(elt.cloneNode(false)); }); if (!option.computeStyle) { $('style', document.head, function (elt) { if (elt == Dom["a" /* default */].$printStyle) return; renderSpace.addChild(elt.cloneNode(true)); }); } renderSpace.addChild(newElt); var eltCode = renderSpace.innerHTML; renderSpace.clearChild(); option.title = option.title || ($('title', document.head) || { innerHTML: 'absol.js' }).innerHTML; var htmlCode = ['<ht' + 'ml>', ' <h' + 'ead><title>' + option.title + '</title><meta charset="UTF-8">', '<style>', 'html, body{width:initial !important; height:initial !important; overflow: initial !important; overflow-x: initial !important;overflow-y: initial !important; }', '@media print {',//still not work ' body{', ' -webkit-print-color-adjust: exact;', ' color-adjust: exact;', ' } ', ' div, tr, td, table{', ' }', ' }', 'div, table, tr, td{', ' page-break-inside: initial;', ' page-break-before: avoid;', ' page-break-after: avoid;', '}', '</style>', '</he' + 'ad>', '<bod' + 'y>', eltCode, '<scr' + 'ipt>setTimeout(function(){ window.print();},1000);</scri' + 'pt>',//browser parse script tag fail '</bod' + 'y>', '</ht' + 'ml>'].join('\n'); var blob = new Blob([htmlCode], { type: 'text/html; charset=UTF-8' }); renderSpace.addTo(document.body); var iframe = _('iframe').attr('src', URL.createObjectURL(blob)).addStyle({ width: '100%', height: '100%' }).addTo(renderSpace); return new Promise(function (rs, rj) { function waitLoad() { if (iframe.contentWindow && iframe.contentWindow.document && iframe.contentWindow.document.body) { if (typeof option.onLoad == 'function') option.onLoad(); iframe.contentWindow.focus(); setTimeout(function () { function waitFocusBack() { if (!document.hasFocus || document.hasFocus()) { renderSpace.remove(); if (typeof option.onFinish == 'function') option.onFinish(); rs(); } else { setTimeout(waitFocusBack, 300) } } waitFocusBack(); }, 4000); } else setTimeout(waitLoad, 1000) } waitLoad(); }); } else { throw new Error('Invalid param!'); } }; /* harmony default export */ var HTML5_Svg = __webpack_exports__["a"] = (Svg); /***/ }), /* 10 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; 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 */ __webpack_exports__["a"] = (TemplateString); /***/ }), /* 11 */ /***/ (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; /***/ }), /* 12 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * A worker that does nothing but passing chunks to the next one. This is like * a nodejs stream but with some differences. On the good side : * - it works on IE 6-9 without any issue / polyfill * - it weights less than the full dependencies bundled with browserify * - it forwards errors (no need to declare an error handler EVERYWHERE) * * A chunk is an object with 2 attributes : `meta` and `data`. The former is an * object containing anything (`percent` for example), see each worker for more * details. The latter is the real data (String, Uint8Array, etc). * * @constructor * @param {String} name the name of the stream (mainly used for debugging purposes) */ function GenericWorker(name) { // the name of the worker this.name = name || "default"; // an object containing metadata about the workers chain this.streamInfo = {}; // an error which happened when the worker was paused this.generatedError = null; // an object containing metadata to be merged by this worker into the general metadata this.extraStreamInfo = {}; // true if the stream is paused (and should not do anything), false otherwise this.isPaused = true; // true if the stream is finished (and should not do anything), false otherwise this.isFinished = false; // true if the stream is locked to prevent further structure updates (pipe), false otherwise this.isLocked = false; // the event listeners this._listeners = { 'data':[], 'end':[], 'error':[] }; // the previous worker, if any this.previous = null; } GenericWorker.prototype = { /** * Push a chunk to the next workers. * @param {Object} chunk the chunk to push */ push : function (chunk) { this.emit("data", chunk); }, /** * End the stream. * @return {Boolean} true if this call ended the worker, false otherwise. */ end : function () { if (this.isFinished) { return false; } this.flush(); try { this.emit("end"); this.cleanUp(); this.isFinished = true; } catch (e) { this.emit("error", e); } return true; }, /** * End the stream with an error. * @param {Error} e the error which caused the premature end. * @return {Boolean} true if this call ended the worker with an error, false otherwise. */ error : function (e) { if (this.isFinished) { return false; } if(this.isPaused) { this.generatedError = e; } else { this.isFinished = true; this.emit("error", e); // in the workers chain exploded in the middle of the chain, // the error event will go downward but we also need to notify // workers upward that there has been an error. if(this.previous) { this.previous.error(e); } this.cleanUp(); } return true; }, /** * Add a callback on an event. * @param {String} name the name of the event (data, end, error) * @param {Function} listener the function to call when the event is triggered * @return {GenericWorker} the current object for chainability */ on : function (name, listener) { this._listeners[name].push(listener); return this; }, /** * Clean any references when a worker is ending. */ cleanUp : function () { this.streamInfo = this.generatedError = this.extraStreamInfo = null; this._listeners = []; }, /** * Trigger an event. This will call registered callback with the provided arg. * @param {String} name the name of the event (data, end, error) * @param {Object} arg the argument to call the callback with. */ emit : function (name, arg) { if (this._listeners[name]) { for(var i = 0; i < this._listeners[name].length; i++) { this._listeners[name][i].call(this, arg); } } }, /** * Chain a worker with an other. * @param {Worker} next the worker receiving events from the current one. * @return {worker} the next worker for chainability */ pipe : function (next) { return next.registerPrevious(this); }, /** * Same as `pipe` in the other direction. * Using an API with `pipe(next)` is very easy. * Implementing the API with the point of view of the next one registering * a source is easier, see the ZipFileWorker. * @param {Worker} previous the previous worker, sending events to this one * @return {Worker} the current worker for chainability */ registerPrevious : function (previous) { if (this.isLocked) { throw new Error("The stream '" + this + "' has already been used."); } // sharing the streamInfo... this.streamInfo = previous.streamInfo; // ... and adding our own bits this.mergeStreamInfo(); this.previous = previous; var self = this; previous.on('data', function (chunk) { self.processChunk(chunk); }); previous.on('end', function () { self.end(); }); previous.on('error', function (e) { self.error(e); }); return this; }, /** * Pause the stream so it doesn't send events anymore. * @return {Boolean} true if this call paused the worker, false otherwise. */ pause : function () { if(this.isPaused || this.isFinished) { return false; } this.isPaused = true; if(this.previous) { this.previous.pause(); } return true; }, /** * Resume a paused stream. * @return {Boolean} true if this call resumed the worker, false otherwise. */ resume : function () { if(!this.isPaused || this.isFinished) { return false; } this.isPaused = false; // if true, the worker tried to resume but failed var withError = false; if(this.generatedError) { this.error(this.generatedError); withError = true; } if(this.previous) { this.previous.resume(); } return !withError; }, /** * Flush any remaining bytes as the stream is ending. */ flush : function () {}, /** * Process a chunk. This is usually the method overridden. * @param {Object} chunk the chunk to process. */ processChunk : function(chunk) { this.push(chunk); }, /** * Add a key/value to be added in the workers chain streamInfo once activated. * @param {String} key the key to use * @param {Object} value the associated value * @return {Worker} the current worker for chainability */ withStreamInfo : function (key, value) { this.extraStreamInfo[key] = value; this.mergeStreamInfo(); return this; }, /** * Merge this worker's streamInfo into the chain's streamInfo. */ mergeStreamInfo : function () { for(var key in this.extraStreamInfo) { if (!this.extraStreamInfo.hasOwnProperty(key)) { continue; } this.streamInfo[key] = this.extraStreamInfo[key]; } }, /** * Lock the stream to prevent further updates on the workers chain. * After calling this method, all calls to pipe will fail. */ lock: function () { if (this.isLocked) { throw new Error("The stream '" + this + "' has already been used."); } this.isLocked = true; if (this.previous) { this.previous.lock(); } }, /** * * Pretty print the workers chain. */ toString : function () { var me = "Worker " + this.name; if (this.previous) { return this.previous + " -> " + me; } else { return me; } } }; module.exports = GenericWorker; /***/ }), /* 13 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(global) {/*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org> * @license MIT */ /* eslint-disable no-proto */ var base64 = __webpack_require__(72) var ieee754 = __webpack_require__(73) var isArray = __webpack_require__(38) 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__(11))) /***/ }), /* 14 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(Buffer) { exports.base64 = true; exports.array = true; exports.string = true; exports.arraybuffer = typeof ArrayBuffer !== "undefined" && typeof Uint8Array !== "undefined"; exports.nodebuffer = typeof Buffer !== "undefined"; // contains true if JSZip can read/generate Uint8Array, false otherwise. exports.uint8array = typeof Uint8Array !== "undefined"; if (typeof ArrayBuffer === "undefined") { exports.blob = false; } else { var buffer = new ArrayBuffer(0); try { exports.blob = new Blob([buffer], { type: "application/zip" }).size === 0; } catch (e) { try { var Builder = self.BlobBuilder || self.WebKitBlobBuilder || self.MozBlobBuilder || self.MSBlobBuilder; var builder = new Builder(); builder.append(buffer); exports.blob = builder.getBlob('application/zip').size === 0; } catch (e) { exports.blob = false; } } } try { exports.nodestream = !!__webpack_require__(39).Readable; } catch(e) { exports.nodestream = false; } /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(13).Buffer)) /***/ }), /* 15 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var TYPED_OK = (typeof Uint8Array !== 'undefined') && (typeof Uint16Array !== 'undefined') && (typeof Int32Array !== 'undefined'); function _has(obj, key) { return Object.prototype.hasOwnProperty.call(obj, key); } exports.assign = function (obj /*from1, from2, from3, ...*/) { var sources = Array.prototype.slice.call(arguments, 1); while (sources.length) { var source = sources.shift(); if (!source) { continue; } if (typeof source !== 'object') { throw new TypeError(source + 'must be non-object'); } for (var p in source) { if (_has(source, p)) { obj[p] = source[p]; } } } return obj; }; // reduce buffer size, avoiding mem copy exports.shrinkBuf = function (buf, size) { if (buf.length === size) { return buf; } if (buf.subarray) { return buf.subarray(0, size); } buf.length = size; return buf; }; var fnTyped = { arraySet: function (dest, src, src_offs, len, dest_offs) { if (src.subarray && dest.subarray) { dest.set(src.subarray(src_offs, src_offs + len), dest_offs); return; } // Fallback to ordinary array for (var i = 0; i < len; i++) { dest[dest_offs + i] = src[src_offs + i]; } }, // Join array of chunks to single array. flattenChunks: function (chunks) { var i, l, len, pos, chunk, result; // calculate data length len = 0; for (i = 0, l = chunks.length; i < l; i++) { len += chunks[i].length; } // join chunks result = new Uint8Array(len); pos = 0; for (i = 0, l = chunks.length; i < l; i++) { chunk = chunks[i]; result.set(chunk, pos); pos += chunk.length; } return result; } }; var fnUntyped = { arraySet: function (dest, src, src_offs, len, dest_offs) { for (var i = 0; i < len; i++) { dest[dest_offs + i] = src[src_offs + i]; } }, // Join array of chunks to single array. flattenChunks: function (chunks) { return [].concat.apply([], chunks); } }; // Enable/Disable typed arrays use, for testing // exports.setTyped = function (on) { if (on) { exports.Buf8 = Uint8Array; exports.Buf16 = Uint16Array; exports.Buf32 = Int32Array; exports.assign(exports, fnTyped); } else { exports.Buf8 = Array; exports.Buf16 = Array; exports.Buf32 = Array; exports.assign(exports, fnUntyped); } }; exports.setTyped(TYPED_OK); /***/ }), /* 16 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to permit // persons to whom the Software is furnished to do so, subject to the // following conditions: // // The above copyright notice and this permission notice shall be included // in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. // a duplex stream is just a stream that is both readable and writable. // Since JS doesn't have multiple prototypal inheritance, this class // prototypally inherits from Readable, and then parasitically from // Writable. /*<replacement>*/ var pna = __webpack_require__(27); /*</replacement>*/ /*<replacement>*/ var objectKeys = Object.keys || function (obj) { var keys = []; for (var key in obj) { keys.push(key); }return keys; }; /*</replacement>*/ module.exports = Duplex; /*<replacement>*/ var util = __webpack_require__(20); util.inherits = __webpack_require__(18); /*</replacement>*/ var Readable = __webpack_require__(40); var Writable = __webpack_require__(33); util.inherits(Duplex, Readable); { // avoid scope creep, the keys array can then be collected var keys = objectKeys(Writable.prototype); for (var v = 0; v < keys.length; v++) { var method = keys[v]; if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method]; } } function Duplex(options) { if (!(this instanceof Duplex)) return new Duplex(options); Readable.call(this, options); Writable.call(this, options); if (options && options.readable === false) this.readable = false; if (options && options.writable === false) this.writable = false; this.allowHalfOpen = true; if (options && options.allowHalfOpen === false) this.allowHalfOpen = false; this.once('end', onend); } Object.defineProperty(Duplex.prototype, 'writableHighWaterMark', { // making it explicit this property is not enumerable // because otherwise some prototype manipulation in // userland will fail enumerable: false, get: function () { return this._writableState.highWaterMark; } }); // the no-half-open enforcer function onend() { // if we allow half-open state, or if the writable side ended, // then we're ok. if (this.allowHalfOpen || this._writableState.ended) return; // no more data can be written. // But allow more writes to happen in this tick. pna.nextTick(onEndNT, this); } function onEndNT(self) { self.end(); } Object.defineProperty(Duplex.prototype, 'destroyed', { get: function () { if (this._readableState === undefined || this._writableState === undefined) { return false; } return this._readableState.destroyed && this._writableState.destroyed; }, set: function (value) { // we ignore the value if the stream // has not been initialized yet if (this._readableState === undefined || this._writableState === undefined) { return; } // backward compatibility, the user is explicitly // managing destroyed this._readableState.destroyed = value; this._writableState.destroyed = value; } }); Duplex.prototype._destroy = function (err, cb) { this.push(null); this.end(); pna.nextTick(cb, err); }; /***/ }), /* 17 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var utils = __webpack_require__(8); var support = __webpack_require__(14); var nodejsUtils = __webpack_require__(29); var GenericWorker = __webpack_require__(12); /** * The following functions come from pako, from pako/lib/utils/strings * released under the MIT license, see pako https://github.com/nodeca/pako/ */ // Table with utf8 lengths (calculated by first byte of sequence) // Note, that 5 & 6-byte values and some 4-byte values can not be represented in JS, // because max possible codepoint is 0x10ffff var _utf8len = new Array(256); for (var i=0; i<256; i++) { _utf8len[i] = (i >= 252 ? 6 : i >= 248 ? 5 : i >= 240 ? 4 : i >= 224 ? 3 : i >= 192 ? 2 : 1); } _utf8len[254]=_utf8len[254]=1; // Invalid sequence start // convert string to array (typed, when possible) var string2buf = function (str) { var buf, c, c2, m_pos, i, str_len = str.length, buf_len = 0; // count binary size for (m_pos = 0; m_pos < str_len; m_pos++) { c = str.charCodeAt(m_pos); if ((c & 0xfc00) === 0xd800 && (m_pos+1 < str_len)) { c2 = str.charCodeAt(m_pos+1); if ((c2 & 0xfc00) === 0xdc00) { c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00); m_pos++; } } buf_len += c < 0x80 ? 1 : c < 0x800 ? 2 : c < 0x10000 ? 3 : 4; } // allocate buffer if (support.uint8array) { buf = new Uint8Array(buf_len); } else { buf = new Array(buf_len); } // convert for (i=0, m_pos = 0; i < buf_len; m_pos++) { c = str.charCodeAt(m_pos); if ((c & 0xfc00) === 0xd800 && (m_pos+1 < str_len)) { c2 = str.charCodeAt(m_pos+1); if ((c2 & 0xfc00) === 0xdc00) { c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00); m_pos++; } } if (c < 0x80) { /* one byte */ buf[i++] = c; } else if (c < 0x800) { /* two bytes */ buf[i++] = 0xC0 | (c >>> 6); buf[i++] = 0x80 | (c & 0x3f); } else if (c < 0x10000) { /* three bytes */ buf[i++] = 0xE0 | (c >>> 12); buf[i++] = 0x80 | (c >>> 6 & 0x3f); buf[i++] = 0x80 | (c & 0x3f); } else { /* four bytes */ buf[i++] = 0xf0 | (c >>> 18); buf[i++] = 0x80 | (c >>> 12 & 0x3f); buf[i++] = 0x80 | (c >>> 6 & 0x3f); buf[i++] = 0x80 | (c & 0x3f); } } return buf; }; // Calculate max possible position in utf8 buffer, // that will not break sequence. If that's not possible // - (very small limits) return max size as is. // // buf[] - utf8 bytes array // max - length limit (mandatory); var utf8border = function(buf, max) { var pos; max = max || buf.length; if (max > buf.length) { max = buf.length; } // go back from last position, until start of sequence found pos = max-1; while (pos >= 0 && (buf[pos] & 0xC0) === 0x80) { pos--; } // Fuckup - very small and broken sequence, // return max, because we should return something anyway. if (pos < 0) { return max; } // If we came to start of buffer - that means vuffer is too small, // return max too. if (pos === 0) { return max; } return (pos + _utf8len[buf[pos]] > max) ? pos : max; }; // convert array to string var buf2string = function (buf) { var str, i, out, c, c_len; var len = buf.length; // Reserve max possible length (2 words per char) // NB: by unknown reasons, Array is significantly faster for // String.fromCharCode.apply than Uint16Array. var utf16buf = new Array(len*2); for (out=0, i=0; i<len;) { c = buf[i++]; // quick process ascii if (c < 0x80) { utf16buf[out++] = c; continue; } c_len = _utf8len[c]; // skip 5 & 6 byte codes if (c_len > 4) { utf16buf[out++] = 0xfffd; i += c_len-1; continue; } // apply mask on first byte c &= c_len === 2 ? 0x1f : c_len === 3 ? 0x0f : 0x07; // join the rest while (c_len > 1 && i < len) { c = (c << 6) | (buf[i++] & 0x3f); c_len--; } // terminated by end of string? if (c_len > 1) { utf16buf[out++] = 0xfffd; continue; } if (c < 0x10000) { utf16buf[out++] = c; } else { c -= 0x10000; utf16buf[out++] = 0xd800 | ((c >> 10) & 0x3ff); utf16buf[out++] = 0xdc00 | (c & 0x3ff); } } // shrinkBuf(utf16buf, out) if (utf16buf.length !== out) { if(utf16buf.subarray) { utf16buf = utf16buf.subarray(0, out); } else { utf16buf.length = out; } } // return String.fromCharCode.apply(null, utf16buf); return utils.applyFromCharCode(utf16buf); }; // That's all for the pako functions. /** * Transform a javascript string into an array (typed if possible) of bytes, * UTF-8 encoded. * @param {String} str the string to encode * @return {Array|Uint8Array|Buffer} the UTF-8 encoded string. */ exports.utf8encode = function utf8encode(str) { if (support.nodebuffer) { return nodejsUtils.newBufferFrom(str, "utf-8"); } return string2buf(str); }; /** * Transform a bytes array (or a representation) representing an UTF-8 encoded * string into a javascript string. * @param {Array|Uint8Array|Buffer} buf the data de decode * @return {String} the decoded string. */ exports.utf8decode = function utf8decode(buf) { if (support.nodebuffer) { return utils.transformTo("nodebuffer", buf).toString("utf-8"); } buf = utils.transformTo(support.uint8array ? "uint8array" : "array", buf); return buf2string(buf); }; /** * A worker to decode utf8 encoded binary chunks into string chunks. * @constructor */ function Utf8DecodeWorker() { GenericWorker.call(this, "utf-8 decode"); // the last bytes if a chunk didn't end with a complete codepoint. this.leftOver = null; } utils.inherits(Utf8DecodeWorker, GenericWorker); /** * @see GenericWorker.processChunk */ Utf8DecodeWorker.prototype.processChunk = function (chunk) { var data = utils.transformTo(support.uint8array ? "uint8array" : "array", chunk.data); // 1st step, re-use what's left of the previous chunk if (this.leftOver && this.leftOver.length) { if(support.uint8array) { var previousData = data; data = new Uint8Array(previousData.length + this.leftOver.length); data.set(this.leftOver, 0); data.set(previousData, this.leftOver.length); } else { data = this.leftOver.concat(data); } this.leftOver = null; } var nextBoundary = utf8border(data); var usableData = data; if (nextBoundary !== data.length) { if (support.uint8array) { usableData = data.subarray(0, nextBoundary); this.leftOver = data.subarray(nextBoundary, data.length); } else { usableData = data.slice(0, nextBoundary); this.leftOver = data.slice(nextBoundary, data.length); } } this.push({ data : exports.utf8decode(usableData), meta : chunk.meta }); }; /** * @see GenericWorker.flush */ Utf8DecodeWorker.prototype.flush = function () { if(this.leftOver && this.leftOver.length) { this.push({ data : exports.utf8decode(this.leftOver), meta : {} }); this.leftOver = null; } }; exports.Utf8DecodeWorker = Utf8DecodeWorker; /** * A worker to endcode string chunks into utf8 encoded binary chunks. * @constructor */ function Utf8EncodeWorker() { GenericWorker.call(this, "utf-8 encode"); } utils.inherits(Utf8EncodeWorker, GenericWorker); /** * @see GenericWorker.processChunk */ Utf8EncodeWorker.prototype.processChunk = function (chunk) { this.push({ data : exports.utf8encode(chunk.data), meta : chunk.meta }); }; exports.Utf8EncodeWorker = Utf8EncodeWorker; /***/ }), /* 18 */ /***/ (function(module, exports) { if (typeof Object.create === 'function') { // implementation from standard node.js 'util' module module.exports = function inherits(ctor, superCtor) { if (superCtor) { ctor.super_ = superCtor ctor.prototype = Object.create(superCtor.prototype, { constructor: { value: ctor, enumerable: false, writable: true, configurable: true } }) } }; } else { // old school shim for old browsers module.exports = function inherits(ctor, superCtor) { if (superCtor) { ctor.super_ = superCtor var TempCtor = function () {} TempCtor.prototype = superCtor.prototype ctor.prototype = new TempCtor() ctor.prototype.constructor = ctor } } } /***/ }), /* 19 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(global) {/* harmony import */ var _BrowserRules__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(65); /* harmony import */ var _BrowserRules__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_BrowserRules__WEBPACK_IMPORTED_MODULE_0__); /** * * @param {BrowserRules} rulesheet */ function BrowserDetector(rulesheet) { this.au = global.navigator ? (navigator.userAgent || '') : ''; this.rulesheet = rulesheet; this.os = this.detectByRules(this.rulesheet.os); this.device = this.detectByRules(this.rulesheet.device); this.engine = this.detectByRules(this.rulesheet.engine); this.browser = this.detectByRules(this.rulesheet.browser); this.isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1; this.isCococ = navigator.userAgent.toLowerCase().indexOf('coc_coc_browser') >= 1; this.isSafari = !this.isCococ && navigator.userAgent.toLowerCase().indexOf('safari') > -1 && navigator.userAgent.toLowerCase().indexOf('win') < 0 &&navigator.userAgent.toLowerCase().indexOf('android')<0; this.isMobile = navigator.userAgent.indexOf('KFFOWI') > -1 || navigator.userAgent.toLowerCase().indexOf('mobile') > -1; } BrowserDetector.prototype.detectByRules = function (rules) { var result = {}; for (var i = 0; i < rules.length; ++i) { var os = rules[i]; var type = os[0]; var rgx = os[1]; if (typeof (rgx) == 'function') { rgx = rgx(this.au.toLowerCase()); } if (Object.prototype.toString.call(rgx).indexOf('RegExp')) { var matched = this.au.toLowerCase().match(rgx); if (matched) { result.type = type; if (matched[1]) { result.version = matched[1]; } break; } } else if (typeof (rgx) == 'string') { if (this.au.toLowerCase().indexOf(rgx) >= 0) { result.type = type; } } } return result; }; /* harmony default export */ __webpack_exports__["a"] = (new BrowserDetector(_BrowserRules__WEBPACK_IMPORTED_MODULE_0___default.a)); /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(11))) /***/ }), /* 20 */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(Buffer) {// Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to permit // persons to whom the Software is furnished to do so, subject to the // following conditions: // // The above copyright notice and this permission notice shall be included // in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. // NOTE: These type checking functions intentionally don't use `instanceof` // because it is fragile and can be easily faked with `Object.create()`. function isArray(arg) { if (Array.isArray) { return Array.isArray(arg); } return objectToString(arg) === '[object Array]'; } exports.isArray = isArray; function isBoolean(arg) { return typeof arg === 'boolean'; } exports.isBoolean = isBoolean; function isNull(arg) { return arg === null; } exports.isNull = isNull; function isNullOrUndefined(arg) { return arg == null; } exports.isNullOrUndefined = isNullOrUndefined; function isNumber(arg) { return typeof arg === 'number'; } exports.isNumber = isNumber; function isString(arg) { return typeof arg === 'string'; } exports.isString = isString; function isSymbol(arg) { return typeof arg === 'symbol'; } exports.isSymbol = isSymbol; function isUndefined(arg) { return arg === void 0; } exports.isUndefined = isUndefined; function isRegExp(re) { return objectToString(re) === '[object RegExp]'; } exports.isRegExp = isRegExp; function isObject(arg) { return typeof arg === 'object' && arg !== null; } exports.isObject = isObject; function isDate(d) { return objectToString(d) === '[object Date]'; } exports.isDate = isDate; function isError(e) { return (objectToString(e) === '[object Error]' || e instanceof Error); } exports.isError = isError; function isFunction(arg) { return typeof arg === 'function'; } exports.isFunction = isFunction; function isPrimitive(arg) { return arg === null || typeof arg === 'boolean' || typeof arg === 'number' || typeof arg === 'string' || typeof arg === 'symbol' || // ES6 symbol typeof arg === 'undefined'; } exports.isPrimitive = isPrimitive; exports.isBuffer = Buffer.isBuffer; function objectToString(o) { return Object.prototype.toString.call(o); } /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(13).Buffer)) /***/ }), /* 21 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* global Promise */ // load the global object first: // - it should be better integrated in the system (unhandledRejection in node) // - the environment may have a custom Promise implementation (see zone.js) var ES6Promise = null; if (typeof Promise !== "undefined") { ES6Promise = Promise; } else { ES6Promise = __webpack_require__(88); } /** * Let the user use/change some implementations. */ module.exports = { Promise: ES6Promise }; /***/ }), /* 22 */ /***/ (function(module, exports, __webpack_require__) { var content = __webpack_require__(211); if(typeof content === 'string') content = [[module.i, content, '']]; var transform; var insertInto; var options = {"hmr":true} options.transform = transform options.insertInto = undefined; var update = __webpack_require__(5)(content, options); if(content.locals) module.exports = content.locals; if(false) {} /***/ }), /* 23 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; function JSPath(props) { this.path = props.path; } /** * * @param {Element} element * @returns {Boolean} */ JSPath.prototype.match = function (element, query) { if (query.id) { if (!element.getAttribute || element.getAttribute('id') != query.id) return false; } if (query.tagName) { var matchTag = false; if (element._azar_extendTags && element._azar_extendTags[query.tagName]) matchTag = true; matchTag = matchTag || ((element.tagName || '').toUpperCase() == query.tagName.toUpperCase()); if (!matchTag) return false; } if (query.classList) for (var i = 0; i < query.classList.length; ++i) { if (!element.classList || !element.classList.contains(query.classList[i])) return false; } if (query.attributes) { for (var key in query.attributes) { var value; if (element.attr) { value = element.attr(key); if (value != query.attributes[key]) return false; } else if (element.getAttribute) { value = element.getAttribute(key); if (value != query.attributes[key]) return false; } } } return true; }; /** * Warning : still fail in some testcase */ JSPath.prototype.findFirst = function (root, onFound) { var queue = [{ e: root, i: 0 }]; var current; while (queue.length > 0) { current = queue.shift(); var isMathed = false; var currentElt = current.e; var currentI = current.i; if (this.match(currentElt, this.path[currentI])) { if (this.path[currentI].childCombinate) { var trackI = currentI; var trackElement = currentElt; var isTrackMatch = true; while (isTrackMatch && trackI > 0 && this.path[trackI].childCombinate) { if (!trackElement.parentNode || !this.match(trackElement.parentNode, this.path[trackI - 1])) { isTrackMatch = false; } else{ trackElement = trackElement.parentNode; trackI--; } } if (isTrackMatch) isMathed = true; } else { isMathed = true; } } if (isMathed && currentI + 1 == this.path.length) { if (!onFound || (onFound && onFound(currentElt))) return currentElt; } if (currentElt.childNodes) { var l = currentElt.childNodes.length; for (var i = 0; i < l; ++i) { if (currentElt.childNodes[i].tagName) queue.push({ e: currentElt.childNodes[i], i: currentI + (isMathed && currentI + 1 < this.path.length ? 1 : 0) }); } } } return undefined; }; JSPath.prototype.findAll = function (root, onFound) { var res = []; var queue = [{ e: root, i: 0 }]; var current; while (queue.length > 0) { current = queue.shift(); var isMathed = false; var currentElt = current.e; var currentI = current.i; if (this.match(currentElt, this.path[currentI])) { if (this.path[currentI].childCombinate) { var trackI = currentI; var trackElement = currentElt; var isTrackMatch = true; while (isTrackMatch && trackI > 0 && this.path[trackI].childCombinate) { if (!trackElement.parentNode || !this.match(trackElement.parentNode, this.path[trackI - 1])) { isTrackMatch = false; } else{ trackElement = trackElement.parentNode; trackI--; } } if (isTrackMatch) isMathed = true; } else { isMathed = true; } } if (isMathed && currentI + 1 == this.path.length) { if (!onFound || (onFound && onFound(currentElt))) res.push(currentElt); } if (currentElt.childNodes) { var l = currentElt.childNodes.length; for (var i = 0; i < l; ++i) { if (currentElt.childNodes[i].tagName) queue.push({ e: currentElt.childNodes[i], i: currentI + (isMathed && currentI + 1 < this.path.length ? 1 : 0) }); } } } return res; }; JSPath.__tagRegex = /((([^\s\>\(])|(\([^\)]*\)))+)|(\>)/g; JSPath.__tagNameRegex = /^[a-zA-Z0-9\-\_]+/i; JSPath.__classRegex = /\.[a-zA-Z0-9\-\_]+/g; JSPath.__idRegex = /\#[a-zA-Z0-9\-\_]+/i; JSPath.__attrRegex = /\[\s*([a-zA-Z-0-9\-]+)\s*\=\"\s*(((\\.)|([^\"]))+)\"\s*\]/g; JSPath.__attrParseRegex = /\[\s*([a-zA-Z-0-9\-]+)\s*\=\"\s*(((\\.)|([^\"]))+)\"\s*\]/i; JSPath.parseQuery = function (s) { var tag = {}; var classList = s.match(this.__classRegex); var idList = s.match(this.__idRegex); var tagList = s.match(this.__tagNameRegex); var attributeList = s.match(this.__attrRegex); if (idList && idList.length > 0) { tag.id = idList[0].substring(1); } if (tagList && tagList.length > 0) { tag.tagName = tagList[0].trim(); } if (classList && classList.length > 0) { tag.classList = classList.map(function (s) { return s.substring(1) }); } var attrParseRegex = this.__attrParseRegex; if (attributeList && attributeList.length > 0) { tag.attributes = attributeList.reduce(function (ac, s) { var tokens = s.match(attrParseRegex); var key = tokens[1]; var value = tokens[2]; ac[key] = value; return ac; }, {}); } return tag; }; /** * @param {String} text * @returns {JSPath} */ JSPath.compileJSPath = function (text) { var tagTexts = text.match(this.__tagRegex)||['']; var path = []; var childCombinate = false; for (var i = 0; i < tagTexts.length; ++i) { var s = tagTexts[i]; if (s == '>') { childCombinate = true; } else { var tag = this.parseQuery(s); tag.childCombinate = childCombinate; path.push(tag); childCombinate = false; } } return new JSPath({ path: path }); }; /* harmony default export */ __webpack_exports__["a"] = (JSPath); /***/ }), /* 24 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(global) {/* harmony import */ var _ACore__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0); /* harmony import */ var absol_src_HTML5_Dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1); var _ = _ACore__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"]._; var $ = _ACore__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"].$; var originSetTimeout = setTimeout; var originClearTimeout = setTimeout; var originSetInterval = setInterval; var originClearInterval = clearInterval; var pendingTimeout = 0; var pendingInterval = 0; var timeoutDict = {}; var intervalDict = {}; function DebugTask() { var res = _({ class: 'absol-debug-task', child: [ { child: [{ tag: 'span', class: 'absol-debug-task-name', child: { text: 'settimeout ' } }, { tag: 'span', class: ['absol-debug-task-value', 'settimeout'], child: { text: '0' } }] }, { child: [{ tag: 'span', class: 'absol-debug-task-name', child: { text: 'setintervel ' } }, { tag: 'span', class: ['absol-debug-task-value', 'setinterval'], child: { text: '0' } }, ] }, { child: [{ tag: 'span', class: 'absol-debug-task-name', child: { text: 'Work ' } }, { tag: 'span', class: ['absol-debug-task-value', 'work'], child: { text: '0%' } }, ] } ] }); res._timeout = 0; res._interval = 0; res._work = 0; res.$setTimeOutValue = $('.absol-debug-task-value.settimeout', res); res.$setIntervalValue = $('.absol-debug-task-value.setinterval', res); res.$setWorkValue = $('.absol-debug-task-value.work', res); return res; } DebugTask.property = {}; DebugTask.property.timeout = { set: function (value) { this._timeout = value; this.$setTimeOutValue.innerHTML = value + ''; }, get: function () { return this._timeout; } }; DebugTask.property.interval = { set: function (value) { this._interval = value; this.$setIntervalValue.innerHTML = value + ''; }, get: function () { return this._interval; } }; DebugTask.property.work = { set: function (value) { this._work = value; value = (value * 100).toFixed(1); this.$setWorkValue.innerHTML = value + '%'; }, get: function () { return this._work; } }; DebugTask.start = function () { if (DebugTask.started) return; if (!DebugTask.$view) { DebugTask.$view = _('debugtask'); } var times = []; originSetInterval(function(){ var now = performance.now(); while (times.length > 0 && times[0].end < now - 2000) { times.shift(); } if (times.length == 0) DebugTask.$view.work = 0; },3000); global.setTimeout = function () { var args = Array.prototype.map.call(arguments, function (x) { return x; }); var originCallback = arguments[0]; if (typeof originCallback == 'undefined') return; if (typeof originCallback == 'string') { originCallback = new Function(originCallback); } args[0] = function () { var ret; try { var now = performance.now(); while (times.length > 0 && times[0].end < now - 1000) { times.shift(); } ret = originCallback.apply(null, arguments); var now1 = performance.now(); var long = now1 - now; times.push({ long:long, start:now, end:now1 }); var sTime = 0; for (var i = 0; i< times.length; ++i ){ sTime+= times[i].long; } DebugTask.$view.work = sTime/(Math.max(now1 - times[0].start, 1000)); } catch (e) { console.error(e); } if (timeoutDict[timeoutId]) { pendingTimeout--; delete timeoutDict[timeoutId]; DebugTask.$view.timeout = pendingTimeout; } return ret; } var timeoutId = originSetTimeout.apply(global, args) pendingTimeout++; timeoutDict[timeoutId] = true; DebugTask.$view.timeout = pendingTimeout; return timeoutId; } global.clearTimeout = function (timeoutId) { var args = Array.prototype.map.call(arguments, function (x) { return x; }); if (timeoutDict[timeoutId]) { pendingTimeout--; delete timeoutDict[timeoutId]; DebugTask.$view.timeout = pendingTimeout; } return originClearTimeout.apply(global, args); }; global.setInterval = function () { var args = Array.prototype.map.call(arguments, function (x) { return x; }); var originCallback = arguments[0]; if (typeof originCallback == 'undefined') return; if (typeof originCallback == 'string') { originCallback = new Function(originCallback); } args[0] = function () { var ret; try { var now = performance.now(); while (times.length > 0 && times[0].end < now - 1000) { times.shift(); } ret = originCallback.apply(null, arguments); var now1 = performance.now(); var long = now1 - now; times.push({ long:long, start:now, end:now1 }); var sTime = 0; for (var i = 0; i< times.length; ++i ){ sTime+= times[i].long; } DebugTask.$view.work = sTime/(Math.max(now1 - times[0].start, 1000)); } catch (e) { console.error(e); } return ret; } var intervalId = originSetInterval.apply(global, args) pendingInterval++; intervalDict[intervalId] = true; DebugTask.$view.interval = pendingInterval; return intervalId; } global.clearInterval = function (intervalId) { var args = Array.prototype.map.call(arguments, function (x) { return x; }); if (intervalDict[intervalId]) { pendingInterval--; delete intervalDict[intervalId]; DebugTask.$view.interval = pendingInterval; } return originClearInterval.apply(global, args); }; absol_src_HTML5_Dom__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"].documentReady.then(function () { DebugTask.$view.addTo(document.body); }); }; _ACore__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"].install('debugtask', DebugTask); /* harmony default export */ __webpack_exports__["a"] = (DebugTask); /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(11))) /***/ }), /* 25 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; // EXTERNAL MODULE: ./node_modules/absol/src/JSMaker/TemplateString.js var TemplateString = __webpack_require__(10); // CONCATENATED MODULE: ./node_modules/absol/src/JSDocx/templates/document.tpl /* harmony default export */ var templates_document = ("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\r\n<w:document\r\n xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\"\r\n xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\"\r\n xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\"\r\n xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\"\r\n xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\"\r\n xmlns:ns6=\"http://schemas.openxmlformats.org/schemaLibrary/2006/main\"\r\n xmlns:c=\"http://schemas.openxmlformats.org/drawingml/2006/chart\"\r\n xmlns:ns8=\"http://schemas.openxmlformats.org/drawingml/2006/chartDrawing\"\r\n xmlns:dgm=\"http://schemas.openxmlformats.org/drawingml/2006/diagram\"\r\n xmlns:pic=\"http://schemas.openxmlformats.org/drawingml/2006/picture\"\r\n xmlns:ns11=\"http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing\"\r\n xmlns:dsp=\"http://schemas.microsoft.com/office/drawing/2008/diagram\"\r\n xmlns:ns13=\"urn:schemas-microsoft-com:office:excel\"\r\n xmlns:o=\"urn:schemas-microsoft-com:office:office\"\r\n xmlns:v=\"urn:schemas-microsoft-com:vml\"\r\n xmlns:w10=\"urn:schemas-microsoft-com:office:word\"\r\n xmlns:ns17=\"urn:schemas-microsoft-com:office:powerpoint\"\r\n xmlns:odx=\"http://opendope.org/xpaths\"\r\n xmlns:odc=\"http://opendope.org/conditions\"\r\n xmlns:odq=\"http://opendope.org/questions\"\r\n xmlns:odi=\"http://opendope.org/components\"\r\n xmlns:odgm=\"http://opendope.org/SmartArt/DataHierarchy\"\r\n xmlns:ns24=\"http://schemas.openxmlformats.org/officeDocument/2006/bibliography\"\r\n xmlns:ns25=\"http://schemas.openxmlformats.org/drawingml/2006/compatibility\"\r\n xmlns:ns26=\"http://schemas.openxmlformats.org/drawingml/2006/lockedCanvas\">\r\n <w:body>\r\n <w:altChunk r:id=\"htmlChunk\" />\r\n <w:sectPr>\r\n <w:pgSz w:w=\"{{ pageSetting.width }}\" w:h=\"{{ pageSetting.height }}\" w:orient=\"{{ pageSetting.orient }}\" />\r\n <w:pgMar w:top=\"{{ pageSetting.margins.top }}\"\r\n w:right=\"{{ pageSetting.margins.right }}\"\r\n w:bottom=\"{{ pageSetting.margins.bottom }}\"\r\n w:left=\"{{ pageSetting.margins.left }}\"\r\n w:header=\"{{ pageSetting.margins.header }}\"\r\n w:footer=\"{{ pageSetting.margins.footer }}\"\r\n w:gutter=\"{{ pageSetting.margins.gutter }}\"/>\r\n </w:sectPr>\r\n </w:body>\r\n</w:document>\r\n"); // CONCATENATED MODULE: ./node_modules/absol/src/JSDocx/templates/mht_document.tpl /* harmony default export */ var mht_document = ("MIME-Version: 1.0\r\nContent-Type: multipart/related;\r\n type=\"text/html\";\r\n boundary=\"----=mhtDocumentPart\"\r\n\r\n\r\n------=mhtDocumentPart\r\nContent-Type: text/html;\r\n charset=\"utf-8\"\r\nContent-Transfer-Encoding: quoted-printable\r\nContent-Location: file:///C:/fake/document.html\r\n\r\n{{ htmlSource }}\r\n\r\n{{ contentParts }}\r\n\r\n------=mhtDocumentPart--\r\n"); // CONCATENATED MODULE: ./node_modules/absol/src/JSDocx/templates/mht_part.tpl /* harmony default export */ var mht_part = ("------=mhtDocumentPart\r\nContent-Type: {{ contentType }}\r\nContent-Transfer-Encoding: {{ contentEncoding }}\r\nContent-Location: {{ contentLocation }}\r\n\r\n{{ encodedContent }}\r\n"); // CONCATENATED MODULE: ./node_modules/absol/src/JSDocx/DocxTpl.js /* harmony default export */ var DocxTpl = __webpack_exports__["a"] = ({ document: new Function('pageSetting', 'return ' + TemplateString["a" /* default */].parse(templates_document).toJSCode()), mht_document: new Function('htmlSource', 'contentParts', 'return ' + TemplateString["a" /* default */].parse(mht_document).toJSCode()), mht_part: new Function('contentType', 'contentEncoding', 'contentLocation', 'encodedContent', 'return ' + TemplateString["a" /* default */].parse(mht_part).toJSCode()) }); /***/ }), /* 26 */ /***/ (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; }; /***/ }), /* 27 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(process) { if (typeof process === 'undefined' || !process.version || process.version.indexOf('v0.') === 0 || process.version.indexOf('v1.') === 0 && process.version.indexOf('v1.8.') !== 0) { module.exports = { nextTick: nextTick }; } else { module.exports = process } function nextTick(fn, arg1, arg2, arg3) { if (typeof fn !== 'function') { throw new TypeError('"callback" argument must be a function'); } var len = arguments.length; var args, i; switch (len) { case 0: case 1: return process.nextTick(fn); case 2: return process.nextTick(function afterTickOne() { fn.call(null, arg1); }); case 3: return process.nextTick(function afterTickTwo() { fn.call(null, arg1, arg2); }); case 4: return process.nextTick(function afterTickThree() { fn.call(null, arg1, arg2, arg3); }); default: args = new Array(len - 1); i = 0; while (i < args.length) { args[i++] = arguments[i]; } return process.nextTick(function afterTick() { fn.apply(null, args); }); } } /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(26))) /***/ }), /* 28 */ /***/ (function(module, exports, __webpack_require__) { /* eslint-disable node/no-deprecated-api */ var buffer = __webpack_require__(13) var Buffer = buffer.Buffer // alternative to using Object.keys for old browsers function copyProps (src, dst) { for (var key in src) { dst[key] = src[key] } } if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) { module.exports = buffer } else { // Copy properties from require('buffer') copyProps(buffer, exports) exports.Buffer = SafeBuffer } function SafeBuffer (arg, encodingOrOffset, length) { return Buffer(arg, encodingOrOffset, length) } // Copy static methods from Buffer copyProps(Buffer, SafeBuffer) SafeBuffer.from = function (arg, encodingOrOffset, length) { if (typeof arg === 'number') { throw new TypeError('Argument must not be a number') } return Buffer(arg, encodingOrOffset, length) } SafeBuffer.alloc = function (size, fill, encoding) { if (typeof size !== 'number') { throw new TypeError('Argument must be a number') } var buf = Buffer(size) if (fill !== undefined) { if (typeof encoding === 'string') { buf.fill(fill, encoding) } else { buf.fill(fill) } } else { buf.fill(0) } return buf } SafeBuffer.allocUnsafe = function (size) { if (typeof size !== 'number') { throw new TypeError('Argument must be a number') } return Buffer(size) } SafeBuffer.allocUnsafeSlow = function (size) { if (typeof size !== 'number') { throw new TypeError('Argument must be a number') } return buffer.SlowBuffer(size) } /***/ }), /* 29 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(Buffer) { module.exports = { /** * True if this is running in Nodejs, will be undefined in a browser. * In a browser, browserify won't include this file and the whole module * will be resolved an empty object. */ isNode : typeof Buffer !== "undefined", /** * Create a new nodejs Buffer from an existing content. * @param {Object} data the data to pass to the constructor. * @param {String} encoding the encoding to use. * @return {Buffer} a new Buffer. */ newBufferFrom: function(data, encoding) { if (Buffer.from && Buffer.from !== Uint8Array.from) { return Buffer.from(data, encoding); } else { if (typeof data === "number") { // Safeguard for old Node.js versions. On newer versions, // Buffer.from(number) / Buffer(number, encoding) already throw. throw new Error("The \"data\" argument must not be a number"); } return new Buffer(data, encoding); } }, /** * Create a new nodejs Buffer with the specified size. * @param {Integer} size the size of the buffer. * @return {Buffer} a new Buffer. */ allocBuffer: function (size) { if (Buffer.alloc) { return Buffer.alloc(size); } else { var buf = new Buffer(size); buf.fill(0); return buf; } }, /** * Find out if an object is a Buffer. * @param {Object} b the object to test. * @return {Boolean} true if the object is a Buffer, false otherwise. */ isBuffer : function(b){ return Buffer.isBuffer(b); }, isStream : function (obj) { return obj && typeof obj.on === "function" && typeof obj.pause === "function" && typeof obj.resume === "function"; } }; /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(13).Buffer)) /***/ }), /* 30 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * Representation a of zip file in js * @constructor */ function JSZip() { // if this constructor is used without `new`, it adds `new` before itself: if(!(this instanceof JSZip)) { return new JSZip(); } if(arguments.length) { throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide."); } // object containing the files : // { // "folder/" : {...}, // "folder/data.txt" : {...} // } this.files = {}; this.comment = null; // Where we are in the hierarchy this.root = ""; this.clone = function() { var newObj = new JSZip(); for (var i in this) { if (typeof this[i] !== "function") { newObj[i] = this[i]; } } return newObj; }; } JSZip.prototype = __webpack_require__(75); JSZip.prototype.loadAsync = __webpack_require__(106); JSZip.support = __webpack_require__(14); JSZip.defaults = __webpack_require__(47); // TODO find a better way to handle this version, // a require('package.json').version doesn't work with webpack, see #327 JSZip.version = "3.2.0"; JSZip.loadAsync = function (content, options) { return new JSZip().loadAsync(content, options); }; JSZip.external = __webpack_require__(21); module.exports = JSZip; /***/ }), /* 31 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to permit // persons to whom the Software is furnished to do so, subject to the // following conditions: // // The above copyright notice and this permission notice shall be included // in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. var R = typeof Reflect === 'object' ? Reflect : null var ReflectApply = R && typeof R.apply === 'function' ? R.apply : function ReflectApply(target, receiver, args) { return Function.prototype.apply.call(target, receiver, args); } var ReflectOwnKeys if (R && typeof R.ownKeys === 'function') { ReflectOwnKeys = R.ownKeys } else if (Object.getOwnPropertySymbols) { ReflectOwnKeys = function ReflectOwnKeys(target) { return Object.getOwnPropertyNames(target) .concat(Object.getOwnPropertySymbols(target)); }; } else { ReflectOwnKeys = function ReflectOwnKeys(target) { return Object.getOwnPropertyNames(target); }; } function ProcessEmitWarning(warning) { if (console && console.warn) console.warn(warning); } var NumberIsNaN = Number.isNaN || function NumberIsNaN(value) { return value !== value; } function EventEmitter() { EventEmitter.init.call(this); } module.exports = EventEmitter; // Backwards-compat with node 0.10.x EventEmitter.EventEmitter = EventEmitter; EventEmitter.prototype._events = undefined; EventEmitter.prototype._eventsCount = 0; EventEmitter.prototype._maxListeners = undefined; // By default EventEmitters will print a warning if more than 10 listeners are // added to it. This is a useful default which helps finding memory leaks. var defaultMaxListeners = 10; Object.defineProperty(EventEmitter, 'defaultMaxListeners', { enumerable: true, get: function() { return defaultMaxListeners; }, set: function(arg) { if (typeof arg !== 'number' || arg < 0 || NumberIsNaN(arg)) { throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + arg + '.'); } defaultMaxListeners = arg; } }); EventEmitter.init = function() { if (this._events === undefined || this._events === Object.getPrototypeOf(this)._events) { this._events = Object.create(null); this._eventsCount = 0; } this._maxListeners = this._maxListeners || undefined; }; // Obviously not all Emitters should be limited to 10. This function allows // that to be increased. Set to zero for unlimited. EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) { if (typeof n !== 'number' || n < 0 || NumberIsNaN(n)) { throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + n + '.'); } this._maxListeners = n; return this; }; function $getMaxListeners(that) { if (that._maxListeners === undefined) return EventEmitter.defaultMaxListeners; return that._maxListeners; } EventEmitter.prototype.getMaxListeners = function getMaxListeners() { return $getMaxListeners(this); }; EventEmitter.prototype.emit = function emit(type) { var args = []; for (var i = 1; i < arguments.length; i++) args.push(arguments[i]); var doError = (type === 'error'); var events = this._events; if (events !== undefined) doError = (doError && events.error === undefined); else if (!doError) return false; // If there is no 'error' event listener then throw. if (doError) { var er; if (args.length > 0) er = args[0]; if (er instanceof Error) { // Note: The comments on the `throw` lines are intentional, they show // up in Node's output if this results in an unhandled exception. throw er; // Unhandled 'error' event } // At least give some kind of context to the user var err = new Error('Unhandled error.' + (er ? ' (' + er.message + ')' : '')); err.context = er; throw err; // Unhandled 'error' event } var handler = events[type]; if (handler === undefined) return false; if (typeof handler === 'function') { ReflectApply(handler, this, args); } else { var len = handler.length; var listeners = arrayClone(handler, len); for (var i = 0; i < len; ++i) ReflectApply(listeners[i], this, args); } return true; }; function _addListener(target, type, listener, prepend) { var m; var events; var existing; if (typeof listener !== 'function') { throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof listener); } events = target._events; if (events === undefined) { events = target._events = Object.create(null); target._eventsCount = 0; } else { // To avoid recursion in the case that type === "newListener"! Before // adding it to the listeners, first emit "newListener". if (events.newListener !== undefined) { target.emit('newListener', type, listener.listener ? listener.listener : listener); // Re-assign `events` because a newListener handler could have caused the // this._events to be assigned to a new object events = target._events; } existing = events[type]; } if (existing === undefined) { // Optimize the case of one listener. Don't need the extra array object. existing = events[type] = listener; ++target._eventsCount; } else { if (typeof existing === 'function') { // Adding the second element, need to change to array. existing = events[type] = prepend ? [listener, existing] : [existing, listener]; // If we've already got an array, just append. } else if (prepend) { existing.unshift(listener); } else { existing.push(listener); } // Check for listener leak m = $getMaxListeners(target); if (m > 0 && existing.length > m && !existing.warned) { existing.warned = true; // No error code for this since it is a Warning // eslint-disable-next-line no-restricted-syntax var w = new Error('Possible EventEmitter memory leak detected. ' + existing.length + ' ' + String(type) + ' listeners ' + 'added. Use emitter.setMaxListeners() to ' + 'increase limit'); w.name = 'MaxListenersExceededWarning'; w.emitter = target; w.type = type; w.count = existing.length; ProcessEmitWarning(w); } } return target; } EventEmitter.prototype.addListener = function addListener(type, listener) { return _addListener(this, type, listener, false); }; EventEmitter.prototype.on = EventEmitter.prototype.addListener; EventEmitter.prototype.prependListener = function prependListener(type, listener) { return _addListener(this, type, listener, true); }; function onceWrapper() { var args = []; for (var i = 0; i < arguments.length; i++) args.push(arguments[i]); if (!this.fired) { this.target.removeListener(this.type, this.wrapFn); this.fired = true; ReflectApply(this.listener, this.target, args); } } function _onceWrap(target, type, listener) { var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener }; var wrapped = onceWrapper.bind(state); wrapped.listener = listener; state.wrapFn = wrapped; return wrapped; } EventEmitter.prototype.once = function once(type, listener) { if (typeof listener !== 'function') { throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof listener); } this.on(type, _onceWrap(this, type, listener)); return this; }; EventEmitter.prototype.prependOnceListener = function prependOnceListener(type, listener) { if (typeof listener !== 'function') { throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof listener); } this.prependListener(type, _onceWrap(this, type, listener)); return this; }; // Emits a 'removeListener' event if and only if the listener was removed. EventEmitter.prototype.removeListener = function removeListener(type, listener) { var list, events, position, i, originalListener; if (typeof listener !== 'function') { throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof listener); } events = this._events; if (events === undefined) return this; list = events[type]; if (list === undefined) return this; if (list === listener || list.listener === listener) { if (--this._eventsCount === 0) this._events = Object.create(null); else { delete events[type]; if (events.removeListener) this.emit('removeListener', type, list.listener || listener); } } else if (typeof list !== 'function') { position = -1; for (i = list.length - 1; i >= 0; i--) { if (list[i] === listener || list[i].listener === listener) { originalListener = list[i].listener; position = i; break; } } if (position < 0) return this; if (position === 0) list.shift(); else { spliceOne(list, position); } if (list.length === 1) events[type] = list[0]; if (events.removeListener !== undefined) this.emit('removeListener', type, originalListener || listener); } return this; }; EventEmitter.prototype.off = EventEmitter.prototype.removeListener; EventEmitter.prototype.removeAllListeners = function removeAllListeners(type) { var listeners, events, i; events = this._events; if (events === undefined) return this; // not listening for removeListener, no need to emit if (events.removeListener === undefined) { if (arguments.length === 0) { this._events = Object.create(null); this._eventsCount = 0; } else if (events[type] !== undefined) { if (--this._eventsCount === 0) this._events = Object.create(null); else delete events[type]; } return this; } // emit removeListener for all listeners on all events if (arguments.length === 0) { var keys = Object.keys(events); var key; for (i = 0; i < keys.length; ++i) { key = keys[i]; if (key === 'removeListener') continue; this.removeAllListeners(key); } this.removeAllListeners('removeListener'); this._events = Object.create(null); this._eventsCount = 0; return this; } listeners = events[type]; if (typeof listeners === 'function') { this.removeListener(type, listeners); } else if (listeners !== undefined) { // LIFO order for (i = listeners.length - 1; i >= 0; i--) { this.removeListener(type, listeners[i]); } } return this; }; function _listeners(target, type, unwrap) { var events = target._events; if (events === undefined) return []; var evlistener = events[type]; if (evlistener === undefined) return []; if (typeof evlistener === 'function') return unwrap ? [evlistener.listener || evlistener] : [evlistener]; return unwrap ? unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length); } EventEmitter.prototype.listeners = function listeners(type) { return _listeners(this, type, true); }; EventEmitter.prototype.rawListeners = function rawListeners(type) { return _listeners(this, type, false); }; EventEmitter.listenerCount = function(emitter, type) { if (typeof emitter.listenerCount === 'function') { return emitter.listenerCount(type); } else { return listenerCount.call(emitter, type); } }; EventEmitter.prototype.listenerCount = listenerCount; function listenerCount(type) { var events = this._events; if (events !== undefined) { var evlistener = events[type]; if (typeof evlistener === 'function') { return 1; } else if (evlistener !== undefined) { return evlistener.length; } } return 0; } EventEmitter.prototype.eventNames = function eventNames() { return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : []; }; function arrayClone(arr, n) { var copy = new Array(n); for (var i = 0; i < n; ++i) copy[i] = arr[i]; return copy; } function spliceOne(list, index) { for (; index + 1 < list.length; index++) list[index] = list[index + 1]; list.pop(); } function unwrapListeners(arr) { var ret = new Array(arr.length); for (var i = 0; i < ret.length; ++i) { ret[i] = arr[i].listener || arr[i]; } return ret; } /***/ }), /* 32 */ /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__(40); exports.Stream = exports; exports.Readable = exports; exports.Writable = __webpack_require__(33); exports.Duplex = __webpack_require__(16); exports.Transform = __webpack_require__(44); exports.PassThrough = __webpack_require__(82); /***/ }), /* 33 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(process, setImmediate, global) {// Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to permit // persons to whom the Software is furnished to do so, subject to the // following conditions: // // The above copyright notice and this permission notice shall be included // in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. // A bit simpler than readable streams. // Implement an async ._write(chunk, encoding, cb), and it'll handle all // the drain event emission and buffering. /*<replacement>*/ var pna = __webpack_require__(27); /*</replacement>*/ module.exports = Writable; /* <replacement> */ function WriteReq(chunk, encoding, cb) { this.chunk = chunk; this.encoding = encoding; this.callback = cb; this.next = null; } // It seems a linked list but it is not // there will be only 2 of these for each stream function CorkedRequest(state) { var _this = this; this.next = null; this.entry = null; this.finish = function () { onCorkedFinish(_this, state); }; } /* </replacement> */ /*<replacement>*/ var asyncWrite = !process.browser && ['v0.10', 'v0.9.'].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : pna.nextTick; /*</replacement>*/ /*<replacement>*/ var Duplex; /*</replacement>*/ Writable.WritableState = WritableState; /*<replacement>*/ var util = __webpack_require__(20); util.inherits = __webpack_require__(18); /*</replacement>*/ /*<replacement>*/ var internalUtil = { deprecate: __webpack_require__(81) }; /*</replacement>*/ /*<replacement>*/ var Stream = __webpack_require__(41); /*</replacement>*/ /*<replacement>*/ var Buffer = __webpack_require__(28).Buffer; var OurUint8Array = global.Uint8Array || function () {}; function _uint8ArrayToBuffer(chunk) { return Buffer.from(chunk); } function _isUint8Array(obj) { return Buffer.isBuffer(obj) || obj instanceof OurUint8Array; } /*</replacement>*/ var destroyImpl = __webpack_require__(42); util.inherits(Writable, Stream); function nop() {} function WritableState(options, stream) { Duplex = Duplex || __webpack_require__(16); options = options || {}; // Duplex streams are both readable and writable, but share // the same options object. // However, some cases require setting options to different // values for the readable and the writable sides of the duplex stream. // These options can be provided separately as readableXXX and writableXXX. var isDuplex = stream instanceof Duplex; // object stream flag to indicate whether or not this stream // contains buffers or objects. this.objectMode = !!options.objectMode; if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode; // the point at which write() starts returning false // Note: 0 is a valid value, means that we always return false if // the entire buffer is not flushed immediately on write() var hwm = options.highWaterMark; var writableHwm = options.writableHighWaterMark; var defaultHwm = this.objectMode ? 16 : 16 * 1024; if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (writableHwm || writableHwm === 0)) this.highWaterMark = writableHwm;else this.highWaterMark = defaultHwm; // cast to ints. this.highWaterMark = Math.floor(this.highWaterMark); // if _final has been called this.finalCalled = false; // drain event flag. this.needDrain = false; // at the start of calling end() this.ending = false; // when end() has been called, and returned this.ended = false; // when 'finish' is emitted this.finished = false; // has it been destroyed this.destroyed = false; // should we decode strings into buffers before passing to _write? // this is here so that some node-core streams can optimize string // handling at a lower level. var noDecode = options.decodeStrings === false; this.decodeStrings = !noDecode; // Crypto is kind of old and crusty. Historically, its default string // encoding is 'binary' so we have to make this configurable. // Everything else in the universe uses 'utf8', though. this.defaultEncoding = options.defaultEncoding || 'utf8'; // not an actual buffer we keep track of, but a measurement // of how much we're waiting to get pushed to some underlying // socket or file. this.length = 0; // a flag to see when we're in the middle of a write. this.writing = false; // when true all writes will be buffered until .uncork() call this.corked = 0; // a flag to be able to tell if the onwrite cb is called immediately, // or on a later tick. We set this to true at first, because any // actions that shouldn't happen until "later" should generally also // not happen before the first write call. this.sync = true; // a flag to know if we're processing previously buffered items, which // may call the _write() callback in the same tick, so that we don't // end up in an overlapped onwrite situation. this.bufferProcessing = false; // the callback that's passed to _write(chunk,cb) this.onwrite = function (er) { onwrite(stream, er); }; // the callback that the user supplies to write(chunk,encoding,cb) this.writecb = null; // the amount that is being written when _write is called. this.writelen = 0; this.bufferedRequest = null; this.lastBufferedRequest = null; // number of pending user-supplied write callbacks // this must be 0 before 'finish' can be emitted this.pendingcb = 0; // emit prefinish if the only thing we're waiting for is _write cbs // This is relevant for synchronous Transform streams this.prefinished = false; // True if the error was already emitted and should not be thrown again this.errorEmitted = false; // count buffered requests this.bufferedRequestCount = 0; // allocate the first CorkedRequest, there is always // one allocated and free to use, and we maintain at most two this.corkedRequestsFree = new CorkedRequest(this); } WritableState.prototype.getBuffer = function getBuffer() { var current = this.bufferedRequest; var out = []; while (current) { out.push(current); current = current.next; } return out; }; (function () { try { Object.defineProperty(WritableState.prototype, 'buffer', { get: internalUtil.deprecate(function () { return this.getBuffer(); }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003') }); } catch (_) {} })(); // Test _writableState for inheritance to account for Duplex streams, // whose prototype chain only points to Readable. var realHasInstance; if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') { realHasInstance = Function.prototype[Symbol.hasInstance]; Object.defineProperty(Writable, Symbol.hasInstance, { value: function (object) { if (realHasInstance.call(this, object)) return true; if (this !== Writable) return false; return object && object._writableState instanceof WritableState; } }); } else { realHasInstance = function (object) { return object instanceof this; }; } function Writable(options) { Duplex = Duplex || __webpack_require__(16); // Writable ctor is applied to Duplexes, too. // `realHasInstance` is necessary because using plain `instanceof` // would return false, as no `_writableState` property is attached. // Trying to use the custom `instanceof` for Writable here will also break the // Node.js LazyTransform implementation, which has a non-trivial getter for // `_writableState` that would lead to infinite recursion. if (!realHasInstance.call(Writable, this) && !(this instanceof Duplex)) { return new Writable(options); } this._writableState = new WritableState(options, this); // legacy. this.writable = true; if (options) { if (typeof options.write === 'function') this._write = options.write; if (typeof options.writev === 'function') this._writev = options.writev; if (typeof options.destroy === 'function') this._destroy = options.destroy; if (typeof options.final === 'function') this._final = options.final; } Stream.call(this); } // Otherwise people can pipe Writable streams, which is just wrong. Writable.prototype.pipe = function () { this.emit('error', new Error('Cannot pipe, not readable')); }; function writeAfterEnd(stream, cb) { var er = new Error('write after end'); // TODO: defer error events consistently everywhere, not just the cb stream.emit('error', er); pna.nextTick(cb, er); } // Checks that a user-supplied chunk is valid, especially for the particular // mode the stream is in. Currently this means that `null` is never accepted // and undefined/non-string values are only allowed in object mode. function validChunk(stream, state, chunk, cb) { var valid = true; var er = false; if (chunk === null) { er = new TypeError('May not write null values to stream'); } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) { er = new TypeError('Invalid non-string/buffer chunk'); } if (er) { stream.emit('error', er); pna.nextTick(cb, er); valid = false; } return valid; } Writable.prototype.write = function (chunk, encoding, cb) { var state = this._writableState; var ret = false; var isBuf = !state.objectMode && _isUint8Array(chunk); if (isBuf && !Buffer.isBuffer(chunk)) { chunk = _uint8ArrayToBuffer(chunk); } if (typeof encoding === 'function') { cb = encoding; encoding = null; } if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding; if (typeof cb !== 'function') cb = nop; if (state.ended) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) { state.pendingcb++; ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb); } return ret; }; Writable.prototype.cork = function () { var state = this._writableState; state.corked++; }; Writable.prototype.uncork = function () { var state = this._writableState; if (state.corked) { state.corked--; if (!state.writing && !state.corked && !state.finished && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state); } }; Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) { // node::ParseEncoding() requires lower case. if (typeof encoding === 'string') encoding = encoding.toLowerCase(); if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new TypeError('Unknown encoding: ' + encoding); this._writableState.defaultEncoding = encoding; return this; }; function decodeChunk(state, chunk, encoding) { if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') { chunk = Buffer.from(chunk, encoding); } return chunk; } Object.defineProperty(Writable.prototype, 'writableHighWaterMark', { // making it explicit this property is not enumerable // because otherwise some prototype manipulation in // userland will fail enumerable: false, get: function () { return this._writableState.highWaterMark; } }); // if we're already writing something, then just put this // in the queue, and wait our turn. Otherwise, call _write // If we return false, then we need a drain event, so set that flag. function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) { if (!isBuf) { var newChunk = decodeChunk(state, chunk, encoding); if (chunk !== newChunk) { isBuf = true; encoding = 'buffer'; chunk = newChunk; } } var len = state.objectMode ? 1 : chunk.length; state.length += len; var ret = state.length < state.highWaterMark; // we must ensure that previous needDrain will not be reset to false. if (!ret) state.needDrain = true; if (state.writing || state.corked) { var last = state.lastBufferedRequest; state.lastBufferedRequest = { chunk: chunk, encoding: encoding, isBuf: isBuf, callback: cb, next: null }; if (last) { last.next = state.lastBufferedRequest; } else { state.bufferedRequest = state.lastBufferedRequest; } state.bufferedRequestCount += 1; } else { doWrite(stream, state, false, len, chunk, encoding, cb); } return ret; } function doWrite(stream, state, writev, len, chunk, encoding, cb) { state.writelen = len; state.writecb = cb; state.writing = true; state.sync = true; if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite); state.sync = false; } function onwriteError(stream, state, sync, er, cb) { --state.pendingcb; if (sync) { // defer the callback if we are being called synchronously // to avoid piling up things on the stack pna.nextTick(cb, er); // this can emit finish, and it will always happen // after error pna.nextTick(finishMaybe, stream, state); stream._writableState.errorEmitted = true; stream.emit('error', er); } else { // the caller expect this to happen before if // it is async cb(er); stream._writableState.errorEmitted = true; stream.emit('error', er); // this can emit finish, but finish must // always follow error finishMaybe(stream, state); } } function onwriteStateUpdate(state) { state.writing = false; state.writecb = null; state.length -= state.writelen; state.writelen = 0; } function onwrite(stream, er) { var state = stream._writableState; var sync = state.sync; var cb = state.writecb; onwriteStateUpdate(state); if (er) onwriteError(stream, state, sync, er, cb);else { // Check if we're actually ready to finish, but don't emit yet var finished = needFinish(state); if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) { clearBuffer(stream, state); } if (sync) { /*<replacement>*/ asyncWrite(afterWrite, stream, state, finished, cb); /*</replacement>*/ } else { afterWrite(stream, state, finished, cb); } } } function afterWrite(stream, state, finished, cb) { if (!finished) onwriteDrain(stream, state); state.pendingcb--; cb(); finishMaybe(stream, state); } // Must force callback to be called on nextTick, so that we don't // emit 'drain' before the write() consumer gets the 'false' return // value, and has a chance to attach a 'drain' listener. function onwriteDrain(stream, state) { if (state.length === 0 && state.needDrain) { state.needDrain = false; stream.emit('drain'); } } // if there's something in the buffer waiting, then process it function clearBuffer(stream, state) { state.bufferProcessing = true; var entry = state.bufferedRequest; if (stream._writev && entry && entry.next) { // Fast case, write everything using _writev() var l = state.bufferedRequestCount; var buffer = new Array(l); var holder = state.corkedRequestsFree; holder.entry = entry; var count = 0; var allBuffers = true; while (entry) { buffer[count] = entry; if (!entry.isBuf) allBuffers = false; entry = entry.next; count += 1; } buffer.allBuffers = allBuffers; doWrite(stream, state, true, state.length, buffer, '', holder.finish); // doWrite is almost always async, defer these to save a bit of time // as the hot path ends with doWrite state.pendingcb++; state.lastBufferedRequest = null; if (holder.next) { state.corkedRequestsFree = holder.next; holder.next = null; } else { state.corkedRequestsFree = new CorkedRequest(state); } state.bufferedRequestCount = 0; } else { // Slow case, write chunks one-by-one while (entry) { var chunk = entry.chunk; var encoding = entry.encoding; var cb = entry.callback; var len = state.objectMode ? 1 : chunk.length; doWrite(stream, state, false, len, chunk, encoding, cb); entry = entry.next; state.bufferedRequestCount--; // if we didn't call the onwrite immediately, then // it means that we need to wait until it does. // also, that means that the chunk and cb are currently // being processed, so move the buffer counter past them. if (state.writing) { break; } } if (entry === null) state.lastBufferedRequest = null; } state.bufferedRequest = entry; state.bufferProcessing = false; } Writable.prototype._write = function (chunk, encoding, cb) { cb(new Error('_write() is not implemented')); }; Writable.prototype._writev = null; Writable.prototype.end = function (chunk, encoding, cb) { var state = this._writableState; if (typeof chunk === 'function') { cb = chunk; chunk = null; encoding = null; } else if (typeof encoding === 'function') { cb = encoding; encoding = null; } if (chunk !== null && chunk !== undefined) this.write(chunk, encoding); // .end() fully uncorks if (state.corked) { state.corked = 1; this.uncork(); } // ignore unnecessary end() calls. if (!state.ending && !state.finished) endWritable(this, state, cb); }; function needFinish(state) { return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing; } function callFinal(stream, state) { stream._final(function (err) { state.pendingcb--; if (err) { stream.emit('error', err); } state.prefinished = true; stream.emit('prefinish'); finishMaybe(stream, state); }); } function prefinish(stream, state) { if (!state.prefinished && !state.finalCalled) { if (typeof stream._final === 'function') { state.pendingcb++; state.finalCalled = true; pna.nextTick(callFinal, stream, state); } else { state.prefinished = true; stream.emit('prefinish'); } } } function finishMaybe(stream, state) { var need = needFinish(state); if (need) { prefinish(stream, state); if (state.pendingcb === 0) { state.finished = true; stream.emit('finish'); } } return need; } function endWritable(stream, state, cb) { state.ending = true; finishMaybe(stream, state); if (cb) { if (state.finished) pna.nextTick(cb);else stream.once('finish', cb); } state.ended = true; stream.writable = false; } function onCorkedFinish(corkReq, state, err) { var entry = corkReq.entry; corkReq.entry = null; while (entry) { var cb = entry.callback; state.pendingcb--; cb(err); entry = entry.next; } if (state.corkedRequestsFree) { state.corkedRequestsFree.next = corkReq; } else { state.corkedRequestsFree = corkReq; } } Object.defineProperty(Writable.prototype, 'destroyed', { get: function () { if (this._writableState === undefined) { return false; } return this._writableState.destroyed; }, set: function (value) { // we ignore the value if the stream // has not been initialized yet if (!this._writableState) { return; } // backward compatibility, the user is explicitly // managing destroyed this._writableState.destroyed = value; } }); Writable.prototype.destroy = destroyImpl.destroy; Writable.prototype._undestroy = destroyImpl.undestroy; Writable.prototype._destroy = function (err, cb) { this.end(); cb(err); }; /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(26), __webpack_require__(34).setImmediate, __webpack_require__(11))) /***/ }), /* 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__(80); // 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__(11))) /***/ }), /* 35 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var external = __webpack_require__(21); var DataWorker = __webpack_require__(48); var DataLengthProbe = __webpack_require__(49); var Crc32Probe = __webpack_require__(50); var DataLengthProbe = __webpack_require__(49); /** * Represent a compressed object, with everything needed to decompress it. * @constructor * @param {number} compressedSize the size of the data compressed. * @param {number} uncompressedSize the size of the data after decompression. * @param {number} crc32 the crc32 of the decompressed file. * @param {object} compression the type of compression, see lib/compressions.js. * @param {String|ArrayBuffer|Uint8Array|Buffer} data the compressed data. */ function CompressedObject(compressedSize, uncompressedSize, crc32, compression, data) { this.compressedSize = compressedSize; this.uncompressedSize = uncompressedSize; this.crc32 = crc32; this.compression = compression; this.compressedContent = data; } CompressedObject.prototype = { /** * Create a worker to get the uncompressed content. * @return {GenericWorker} the worker. */ getContentWorker : function () { var worker = new DataWorker(external.Promise.resolve(this.compressedContent)) .pipe(this.compression.uncompressWorker()) .pipe(new DataLengthProbe("data_length")); var that = this; worker.on("end", function () { if(this.streamInfo['data_length'] !== that.uncompressedSize) { throw new Error("Bug : uncompressed data size mismatch"); } }); return worker; }, /** * Create a worker to get the compressed content. * @return {GenericWorker} the worker. */ getCompressedWorker : function () { return new DataWorker(external.Promise.resolve(this.compressedContent)) .withStreamInfo("compressedSize", this.compressedSize) .withStreamInfo("uncompressedSize", this.uncompressedSize) .withStreamInfo("crc32", this.crc32) .withStreamInfo("compression", this.compression) ; } }; /** * Chain the given worker with other workers to compress the content with the * given compresion. * @param {GenericWorker} uncompressedWorker the worker to pipe. * @param {Object} compression the compression object. * @param {Object} compressionOptions the options to use when compressing. * @return {GenericWorker} the new worker compressing the content. */ CompressedObject.createWorkerFrom = function (uncompressedWorker, compression, compressionOptions) { return uncompressedWorker .pipe(new Crc32Probe()) .pipe(new DataLengthProbe("uncompressedSize")) .pipe(compression.compressWorker(compressionOptions)) .pipe(new DataLengthProbe("compressedSize")) .withStreamInfo("compression", compression); }; module.exports = CompressedObject; /***/ }), /* 36 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var utils = __webpack_require__(8); /** * The following functions come from pako, from pako/lib/zlib/crc32.js * released under the MIT license, see pako https://github.com/nodeca/pako/ */ // Use ordinary array, since untyped makes no boost here function makeTable() { var c, table = []; for(var n =0; n < 256; n++){ c = n; for(var k =0; k < 8; k++){ c = ((c&1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1)); } table[n] = c; } return table; } // Create table on load. Just 255 signed longs. Not a problem. var crcTable = makeTable(); function crc32(crc, buf, len, pos) { var t = crcTable, end = pos + len; crc = crc ^ (-1); for (var i = pos; i < end; i++ ) { crc = (crc >>> 8) ^ t[(crc ^ buf[i]) & 0xFF]; } return (crc ^ (-1)); // >>> 0; } // That's all for the pako functions. /** * Compute the crc32 of a string. * This is almost the same as the function crc32, but for strings. Using the * same function for the two use cases leads to horrible performances. * @param {Number} crc the starting value of the crc. * @param {String} str the string to use. * @param {Number} len the length of the string. * @param {Number} pos the starting position for the crc32 computation. * @return {Number} the computed crc32. */ function crc32str(crc, str, len, pos) { var t = crcTable, end = pos + len; crc = crc ^ (-1); for (var i = pos; i < end; i++ ) { crc = (crc >>> 8) ^ t[(crc ^ str.charCodeAt(i)) & 0xFF]; } return (crc ^ (-1)); // >>> 0; } module.exports = function crc32wrapper(input, crc) { if (typeof input === "undefined" || !input.length) { return 0; } var isArray = utils.getTypeOf(input) !== "string"; if(isArray) { return crc32(crc|0, input, input.length, 0); } else { return crc32str(crc|0, input, input.length, 0); } }; /***/ }), /* 37 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // (C) 1995-2013 Jean-loup Gailly and Mark Adler // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would be // appreciated but is not required. // 2. Altered source versions must be plainly marked as such, and must not be // misrepresented as being the original software. // 3. This notice may not be removed or altered from any source distribution. module.exports = { 2: 'need dictionary', /* Z_NEED_DICT 2 */ 1: 'stream end', /* Z_STREAM_END 1 */ 0: '', /* Z_OK 0 */ '-1': 'file error', /* Z_ERRNO (-1) */ '-2': 'stream error', /* Z_STREAM_ERROR (-2) */ '-3': 'data error', /* Z_DATA_ERROR (-3) */ '-4': 'insufficient memory', /* Z_MEM_ERROR (-4) */ '-5': 'buffer error', /* Z_BUF_ERROR (-5) */ '-6': 'incompatible version' /* Z_VERSION_ERROR (-6) */ }; /***/ }), /* 38 */ /***/ (function(module, exports) { var toString = {}.toString; module.exports = Array.isArray || function (arr) { return toString.call(arr) == '[object Array]'; }; /***/ }), /* 39 */ /***/ (function(module, exports, __webpack_require__) { /* * This file is used by module bundlers (browserify/webpack/etc) when * including a stream implementation. We use "readable-stream" to get a * consistent behavior between nodejs versions but bundlers often have a shim * for "stream". Using this shim greatly improve the compatibility and greatly * reduce the final size of the bundle (only one stream implementation, not * two). */ module.exports = __webpack_require__(76); /***/ }), /* 40 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(global, process) {// Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to permit // persons to whom the Software is furnished to do so, subject to the // following conditions: // // The above copyright notice and this permission notice shall be included // in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. /*<replacement>*/ var pna = __webpack_require__(27); /*</replacement>*/ module.exports = Readable; /*<replacement>*/ var isArray = __webpack_require__(38); /*</replacement>*/ /*<replacement>*/ var Duplex; /*</replacement>*/ Readable.ReadableState = ReadableState; /*<replacement>*/ var EE = __webpack_require__(31).EventEmitter; var EElistenerCount = function (emitter, type) { return emitter.listeners(type).length; }; /*</replacement>*/ /*<replacement>*/ var Stream = __webpack_require__(41); /*</replacement>*/ /*<replacement>*/ var Buffer = __webpack_require__(28).Buffer; var OurUint8Array = global.Uint8Array || function () {}; function _uint8ArrayToBuffer(chunk) { return Buffer.from(chunk); } function _isUint8Array(obj) { return Buffer.isBuffer(obj) || obj instanceof OurUint8Array; } /*</replacement>*/ /*<replacement>*/ var util = __webpack_require__(20); util.inherits = __webpack_require__(18); /*</replacement>*/ /*<replacement>*/ var debugUtil = __webpack_require__(77); var debug = void 0; if (debugUtil && debugUtil.debuglog) { debug = debugUtil.debuglog('stream'); } else { debug = function () {}; } /*</replacement>*/ var BufferList = __webpack_require__(78); var destroyImpl = __webpack_require__(42); var StringDecoder; util.inherits(Readable, Stream); var kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume']; function prependListener(emitter, event, fn) { // Sadly this is not cacheable as some libraries bundle their own // event emitter implementation with them. if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn); // This is a hack to make sure that our error handler is attached before any // userland ones. NEVER DO THIS. This is here only because this code needs // to continue to work with older versions of Node.js that do not include // the prependListener() method. The goal is to eventually remove this hack. if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]]; } function ReadableState(options, stream) { Duplex = Duplex || __webpack_require__(16); options = options || {}; // Duplex streams are both readable and writable, but share // the same options object. // However, some cases require setting options to different // values for the readable and the writable sides of the duplex stream. // These options can be provided separately as readableXXX and writableXXX. var isDuplex = stream instanceof Duplex; // object stream flag. Used to make read(n) ignore n and to // make all the buffer merging and length checks go away this.objectMode = !!options.objectMode; if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode; // the point at which it stops calling _read() to fill the buffer // Note: 0 is a valid value, means "don't call _read preemptively ever" var hwm = options.highWaterMark; var readableHwm = options.readableHighWaterMark; var defaultHwm = this.objectMode ? 16 : 16 * 1024; if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (readableHwm || readableHwm === 0)) this.highWaterMark = readableHwm;else this.highWaterMark = defaultHwm; // cast to ints. this.highWaterMark = Math.floor(this.highWaterMark); // A linked list is used to store data chunks instead of an array because the // linked list can remove elements from the beginning faster than // array.shift() this.buffer = new BufferList(); this.length = 0; this.pipes = null; this.pipesCount = 0; this.flowing = null; this.ended = false; this.endEmitted = false; this.reading = false; // a flag to be able to tell if the event 'readable'/'data' is emitted // immediately, or on a later tick. We set this to true at first, because // any actions that shouldn't happen until "later" should generally also // not happen before the first read call. this.sync = true; // whenever we return null, then we set a flag to say // that we're awaiting a 'readable' event emission. this.needReadable = false; this.emittedReadable = false; this.readableListening = false; this.resumeScheduled = false; // has it been destroyed this.destroyed = false; // Crypto is kind of old and crusty. Historically, its default string // encoding is 'binary' so we have to make this configurable. // Everything else in the universe uses 'utf8', though. this.defaultEncoding = options.defaultEncoding || 'utf8'; // the number of writers that are awaiting a drain event in .pipe()s this.awaitDrain = 0; // if true, a maybeReadMore has been scheduled this.readingMore = false; this.decoder = null; this.encoding = null; if (options.encoding) { if (!StringDecoder) StringDecoder = __webpack_require__(43).StringDecoder; this.decoder = new StringDecoder(options.encoding); this.encoding = options.encoding; } } function Readable(options) { Duplex = Duplex || __webpack_require__(16); if (!(this instanceof Readable)) return new Readable(options); this._readableState = new ReadableState(options, this); // legacy this.readable = true; if (options) { if (typeof options.read === 'function') this._read = options.read; if (typeof options.destroy === 'function') this._destroy = options.destroy; } Stream.call(this); } Object.defineProperty(Readable.prototype, 'destroyed', { get: function () { if (this._readableState === undefined) { return false; } return this._readableState.destroyed; }, set: function (value) { // we ignore the value if the stream // has not been initialized yet if (!this._readableState) { return; } // backward compatibility, the user is explicitly // managing destroyed this._readableState.destroyed = value; } }); Readable.prototype.destroy = destroyImpl.destroy; Readable.prototype._undestroy = destroyImpl.undestroy; Readable.prototype._destroy = function (err, cb) { this.push(null); cb(err); }; // Manually shove something into the read() buffer. // This returns true if the highWaterMark has not been hit yet, // similar to how Writable.write() returns true if you should // write() some more. Readable.prototype.push = function (chunk, encoding) { var state = this._readableState; var skipChunkCheck; if (!state.objectMode) { if (typeof chunk === 'string') { encoding = encoding || state.defaultEncoding; if (encoding !== state.encoding) { chunk = Buffer.from(chunk, encoding); encoding = ''; } skipChunkCheck = true; } } else { skipChunkCheck = true; } return readableAddChunk(this, chunk, encoding, false, skipChunkCheck); }; // Unshift should *always* be something directly out of read() Readable.prototype.unshift = function (chunk) { return readableAddChunk(this, chunk, null, true, false); }; function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) { var state = stream._readableState; if (chunk === null) { state.reading = false; onEofChunk(stream, state); } else { var er; if (!skipChunkCheck) er = chunkInvalid(state, chunk); if (er) { stream.emit('error', er); } else if (state.objectMode || chunk && chunk.length > 0) { if (typeof chunk !== 'string' && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) { chunk = _uint8ArrayToBuffer(chunk); } if (addToFront) { if (state.endEmitted) stream.emit('error', new Error('stream.unshift() after end event'));else addChunk(stream, state, chunk, true); } else if (state.ended) { stream.emit('error', new Error('stream.push() after EOF')); } else { state.reading = false; if (state.decoder && !encoding) { chunk = state.decoder.write(chunk); if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state); } else { addChunk(stream, state, chunk, false); } } } else if (!addToFront) { state.reading = false; } } return needMoreData(state); } function addChunk(stream, state, chunk, addToFront) { if (state.flowing && state.length === 0 && !state.sync) { stream.emit('data', chunk); stream.read(0); } else { // update the buffer info. state.length += state.objectMode ? 1 : chunk.length; if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk); if (state.needReadable) emitReadable(stream); } maybeReadMore(stream, state); } function chunkInvalid(state, chunk) { var er; if (!_isUint8Array(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) { er = new TypeError('Invalid non-string/buffer chunk'); } return er; } // if it's past the high water mark, we can push in some more. // Also, if we have no data yet, we can stand some // more bytes. This is to work around cases where hwm=0, // such as the repl. Also, if the push() triggered a // readable event, and the user called read(largeNumber) such that // needReadable was set, then we ought to push more, so that another // 'readable' event will be triggered. function needMoreData(state) { return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0); } Readable.prototype.isPaused = function () { return this._readableState.flowing === false; }; // backwards compatibility. Readable.prototype.setEncoding = function (enc) { if (!StringDecoder) StringDecoder = __webpack_require__(43).StringDecoder; this._readableState.decoder = new StringDecoder(enc); this._readableState.encoding = enc; return this; }; // Don't raise the hwm > 8MB var MAX_HWM = 0x800000; function computeNewHighWaterMark(n) { if (n >= MAX_HWM) { n = MAX_HWM; } else { // Get the next highest power of 2 to prevent increasing hwm excessively in // tiny amounts n--; n |= n >>> 1; n |= n >>> 2; n |= n >>> 4; n |= n >>> 8; n |= n >>> 16; n++; } return n; } // This function is designed to be inlinable, so please take care when making // changes to the function body. function howMuchToRead(n, state) { if (n <= 0 || state.length === 0 && state.ended) return 0; if (state.objectMode) return 1; if (n !== n) { // Only flow one buffer at a time if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length; } // If we're asking for more than the current hwm, then raise the hwm. if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n); if (n <= state.length) return n; // Don't have enough if (!state.ended) { state.needReadable = true; return 0; } return state.length; } // you can override either this method, or the async _read(n) below. Readable.prototype.read = function (n) { debug('read', n); n = parseInt(n, 10); var state = this._readableState; var nOrig = n; if (n !== 0) state.emittedReadable = false; // if we're doing read(0) to trigger a readable event, but we // already have a bunch of data in the buffer, then just trigger // the 'readable' event and move on. if (n === 0 && state.needReadable && (state.length >= state.highWaterMark || state.ended)) { debug('read: emitReadable', state.length, state.ended); if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this); return null; } n = howMuchToRead(n, state); // if we've ended, and we're now clear, then finish it up. if (n === 0 && state.ended) { if (state.length === 0) endReadable(this); return null; } // All the actual chunk generation logic needs to be // *below* the call to _read. The reason is that in certain // synthetic stream cases, such as passthrough streams, _read // may be a completely synchronous operation which may change // the state of the read buffer, providing enough data when // before there was *not* enough. // // So, the steps are: // 1. Figure out what the state of things will be after we do // a read from the buffer. // // 2. If that resulting state will trigger a _read, then call _read. // Note that this may be asynchronous, or synchronous. Yes, it is // deeply ugly to write APIs this way, but that still doesn't mean // that the Readable class should behave improperly, as streams are // designed to be sync/async agnostic. // Take note if the _read call is sync or async (ie, if the read call // has returned yet), so that we know whether or not it's safe to emit // 'readable' etc. // // 3. Actually pull the requested chunks out of the buffer and return. // if we need a readable event, then we need to do some reading. var doRead = state.needReadable; debug('need readable', doRead); // if we currently have less than the highWaterMark, then also read some if (state.length === 0 || state.length - n < state.highWaterMark) { doRead = true; debug('length less than watermark', doRead); } // however, if we've ended, then there's no point, and if we're already // reading, then it's unnecessary. if (state.ended || state.reading) { doRead = false; debug('reading or ended', doRead); } else if (doRead) { debug('do read'); state.reading = true; state.sync = true; // if the length is currently zero, then we *need* a readable event. if (state.length === 0) state.needReadable = true; // call internal read method this._read(state.highWaterMark); state.sync = false; // If _read pushed data synchronously, then `reading` will be false, // and we need to re-evaluate how much data we can return to the user. if (!state.reading) n = howMuchToRead(nOrig, state); } var ret; if (n > 0) ret = fromList(n, state);else ret = null; if (ret === null) { state.needReadable = true; n = 0; } else { state.length -= n; } if (state.length === 0) { // If we have nothing in the buffer, then we want to know // as soon as we *do* get something into the buffer. if (!state.ended) state.needReadable = true; // If we tried to read() past the EOF, then emit end on the next tick. if (nOrig !== n && state.ended) endReadable(this); } if (ret !== null) this.emit('data', ret); return ret; }; function onEofChunk(stream, state) { if (state.ended) return; if (state.decoder) { var chunk = state.decoder.end(); if (chunk && chunk.length) { state.buffer.push(chunk); state.length += state.objectMode ? 1 : chunk.length; } } state.ended = true; // emit 'readable' now to make sure it gets picked up. emitReadable(stream); } // Don't emit readable right away in sync mode, because this can trigger // another read() call => stack overflow. This way, it might trigger // a nextTick recursion warning, but that's not so bad. function emitReadable(stream) { var state = stream._readableState; state.needReadable = false; if (!state.emittedReadable) { debug('emitReadable', state.flowing); state.emittedReadable = true; if (state.sync) pna.nextTick(emitReadable_, stream);else emitReadable_(stream); } } function emitReadable_(stream) { debug('emit readable'); stream.emit('readable'); flow(stream); } // at this point, the user has presumably seen the 'readable' event, // and called read() to consume some data. that may have triggered // in turn another _read(n) call, in which case reading = true if // it's in progress. // However, if we're not ended, or reading, and the length < hwm, // then go ahead and try to read some more preemptively. function maybeReadMore(stream, state) { if (!state.readingMore) { state.readingMore = true; pna.nextTick(maybeReadMore_, stream, state); } } function maybeReadMore_(stream, state) { var len = state.length; while (!state.reading && !state.flowing && !state.ended && state.length < state.highWaterMark) { debug('maybeReadMore read 0'); stream.read(0); if (len === state.length) // didn't get any data, stop spinning. break;else len = state.length; } state.readingMore = false; } // abstract method. to be overridden in specific implementation classes. // call cb(er, data) where data is <= n in length. // for virtual (non-string, non-buffer) streams, "length" is somewhat // arbitrary, and perhaps not very meaningful. Readable.prototype._read = function (n) { this.emit('error', new Error('_read() is not implemented')); }; Readable.prototype.pipe = function (dest, pipeOpts) { var src = this; var state = this._readableState; switch (state.pipesCount) { case 0: state.pipes = dest; break; case 1: state.pipes = [state.pipes, dest]; break; default: state.pipes.push(dest); break; } state.pipesCount += 1; debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts); var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr; var endFn = doEnd ? onend : unpipe; if (state.endEmitted) pna.nextTick(endFn);else src.once('end', endFn); dest.on('unpipe', onunpipe); function onunpipe(readable, unpipeInfo) { debug('onunpipe'); if (readable === src) { if (unpipeInfo && unpipeInfo.hasUnpiped === false) { unpipeInfo.hasUnpiped = true; cleanup(); } } } function onend() { debug('onend'); dest.end(); } // when the dest drains, it reduces the awaitDrain counter // on the source. This would be more elegant with a .once() // handler in flow(), but adding and removing repeatedly is // too slow. var ondrain = pipeOnDrain(src); dest.on('drain', ondrain); var cleanedUp = false; function cleanup() { debug('cleanup'); // cleanup event handlers once the pipe is broken dest.removeListener('close', onclose); dest.removeListener('finish', onfinish); dest.removeListener('drain', ondrain); dest.removeListener('error', onerror); dest.removeListener('unpipe', onunpipe); src.removeListener('end', onend); src.removeListener('end', unpipe); src.removeListener('data', ondata); cleanedUp = true; // if the reader is waiting for a drain event from this // specific writer, then it would cause it to never start // flowing again. // So, if this is awaiting a drain, then we just call it now. // If we don't know, then assume that we are waiting for one. if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain(); } // If the user pushes more data while we're writing to dest then we'll end up // in ondata again. However, we only want to increase awaitDrain once because // dest will only emit one 'drain' event for the multiple writes. // => Introduce a guard on increasing awaitDrain. var increasedAwaitDrain = false; src.on('data', ondata); function ondata(chunk) { debug('ondata'); increasedAwaitDrain = false; var ret = dest.write(chunk); if (false === ret && !increasedAwaitDrain) { // If the user unpiped during `dest.write()`, it is possible // to get stuck in a permanently paused state if that write // also returned false. // => Check whether `dest` is still a piping destination. if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) { debug('false write response, pause', src._readableState.awaitDrain); src._readableState.awaitDrain++; increasedAwaitDrain = true; } src.pause(); } } // if the dest has an error, then stop piping into it. // however, don't suppress the throwing behavior for this. function onerror(er) { debug('onerror', er); unpipe(); dest.removeListener('error', onerror); if (EElistenerCount(dest, 'error') === 0) dest.emit('error', er); } // Make sure our error handler is attached before userland ones. prependListener(dest, 'error', onerror); // Both close and finish should trigger unpipe, but only once. function onclose() { dest.removeListener('finish', onfinish); unpipe(); } dest.once('close', onclose); function onfinish() { debug('onfinish'); dest.removeListener('close', onclose); unpipe(); } dest.once('finish', onfinish); function unpipe() { debug('unpipe'); src.unpipe(dest); } // tell the dest that it's being piped to dest.emit('pipe', src); // start the flow if it hasn't been started already. if (!state.flowing) { debug('pipe resume'); src.resume(); } return dest; }; function pipeOnDrain(src) { return function () { var state = src._readableState; debug('pipeOnDrain', state.awaitDrain); if (state.awaitDrain) state.awaitDrain--; if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) { state.flowing = true; flow(src); } }; } Readable.prototype.unpipe = function (dest) { var state = this._readableState; var unpipeInfo = { hasUnpiped: false }; // if we're not piping anywhere, then do nothing. if (state.pipesCount === 0) return this; // just one destination. most common case. if (state.pipesCount === 1) { // passed in one, but it's not the right one. if (dest && dest !== state.pipes) return this; if (!dest) dest = state.pipes; // got a match. state.pipes = null; state.pipesCount = 0; state.flowing = false; if (dest) dest.emit('unpipe', this, unpipeInfo); return this; } // slow case. multiple pipe destinations. if (!dest) { // remove all. var dests = state.pipes; var len = state.pipesCount; state.pipes = null; state.pipesCount = 0; state.flowing = false; for (var i = 0; i < len; i++) { dests[i].emit('unpipe', this, unpipeInfo); }return this; } // try to find the right one. var index = indexOf(state.pipes, dest); if (index === -1) return this; state.pipes.splice(index, 1); state.pipesCount -= 1; if (state.pipesCount === 1) state.pipes = state.pipes[0]; dest.emit('unpipe', this, unpipeInfo); return this; }; // set up data events if they are asked for // Ensure readable listeners eventually get something Readable.prototype.on = function (ev, fn) { var res = Stream.prototype.on.call(this, ev, fn); if (ev === 'data') { // Start flowing on next tick if stream isn't explicitly paused if (this._readableState.flowing !== false) this.resume(); } else if (ev === 'readable') { var state = this._readableState; if (!state.endEmitted && !state.readableListening) { state.readableListening = state.needReadable = true; state.emittedReadable = false; if (!state.reading) { pna.nextTick(nReadingNextTick, this); } else if (state.length) { emitReadable(this); } } } return res; }; Readable.prototype.addListener = Readable.prototype.on; function nReadingNextTick(self) { debug('readable nexttick read 0'); self.read(0); } // pause() and resume() are remnants of the legacy readable stream API // If the user uses them, then switch into old mode. Readable.prototype.resume = function () { var state = this._readableState; if (!state.flowing) { debug('resume'); state.flowing = true; resume(this, state); } return this; }; function resume(stream, state) { if (!state.resumeScheduled) { state.resumeScheduled = true; pna.nextTick(resume_, stream, state); } } function resume_(stream, state) { if (!state.reading) { debug('resume read 0'); stream.read(0); } state.resumeScheduled = false; state.awaitDrain = 0; stream.emit('resume'); flow(stream); if (state.flowing && !state.reading) stream.read(0); } Readable.prototype.pause = function () { debug('call pause flowing=%j', this._readableState.flowing); if (false !== this._readableState.flowing) { debug('pause'); this._readableState.flowing = false; this.emit('pause'); } return this; }; function flow(stream) { var state = stream._readableState; debug('flow', state.flowing); while (state.flowing && stream.read() !== null) {} } // wrap an old-style stream as the async data source. // This is *not* part of the readable stream interface. // It is an ugly unfortunate mess of history. Readable.prototype.wrap = function (stream) { var _this = this; var state = this._readableState; var paused = false; stream.on('end', function () { debug('wrapped end'); if (state.decoder && !state.ended) { var chunk = state.decoder.end(); if (chunk && chunk.length) _this.push(chunk); } _this.push(null); }); stream.on('data', function (chunk) { debug('wrapped data'); if (state.decoder) chunk = state.decoder.write(chunk); // don't skip over falsy values in objectMode if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return; var ret = _this.push(chunk); if (!ret) { paused = true; stream.pause(); } }); // proxy all the other methods. // important when wrapping filters and duplexes. for (var i in stream) { if (this[i] === undefined && typeof stream[i] === 'function') { this[i] = function (method) { return function () { return stream[method].apply(stream, arguments); }; }(i); } } // proxy certain important events. for (var n = 0; n < kProxyEvents.length; n++) { stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n])); } // when we try to consume some more bytes, simply unpause the // underlying stream. this._read = function (n) { debug('wrapped _read', n); if (paused) { paused = false; stream.resume(); } }; return this; }; Object.defineProperty(Readable.prototype, 'readableHighWaterMark', { // making it explicit this property is not enumerable // because otherwise some prototype manipulation in // userland will fail enumerable: false, get: function () { return this._readableState.highWaterMark; } }); // exposed for testing purposes only. Readable._fromList = fromList; // Pluck off n bytes from an array of buffers. // Length is the combined lengths of all the buffers in the list. // This function is designed to be inlinable, so please take care when making // changes to the function body. function fromList(n, state) { // nothing buffered if (state.length === 0) return null; var ret; if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) { // read it all, truncate the list if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.head.data;else ret = state.buffer.concat(state.length); state.buffer.clear(); } else { // read part of list ret = fromListPartial(n, state.buffer, state.decoder); } return ret; } // Extracts only enough buffered data to satisfy the amount requested. // This function is designed to be inlinable, so please take care when making // changes to the function body. function fromListPartial(n, list, hasStrings) { var ret; if (n < list.head.data.length) { // slice is the same for buffers and strings ret = list.head.data.slice(0, n); list.head.data = list.head.data.slice(n); } else if (n === list.head.data.length) { // first chunk is a perfect match ret = list.shift(); } else { // result spans more than one buffer ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list); } return ret; } // Copies a specified amount of characters from the list of buffered data // chunks. // This function is designed to be inlinable, so please take care when making // changes to the function body. function copyFromBufferString(n, list) { var p = list.head; var c = 1; var ret = p.data; n -= ret.length; while (p = p.next) { var str = p.data; var nb = n > str.length ? str.length : n; if (nb === str.length) ret += str;else ret += str.slice(0, n); n -= nb; if (n === 0) { if (nb === str.length) { ++c; if (p.next) list.head = p.next;else list.head = list.tail = null; } else { list.head = p; p.data = str.slice(nb); } break; } ++c; } list.length -= c; return ret; } // Copies a specified amount of bytes from the list of buffered data chunks. // This function is designed to be inlinable, so please take care when making // changes to the function body. function copyFromBuffer(n, list) { var ret = Buffer.allocUnsafe(n); var p = list.head; var c = 1; p.data.copy(ret); n -= p.data.length; while (p = p.next) { var buf = p.data; var nb = n > buf.length ? buf.length : n; buf.copy(ret, ret.length - n, 0, nb); n -= nb; if (n === 0) { if (nb === buf.length) { ++c; if (p.next) list.head = p.next;else list.head = list.tail = null; } else { list.head = p; p.data = buf.slice(nb); } break; } ++c; } list.length -= c; return ret; } function endReadable(stream) { var state = stream._readableState; // If we get here before consuming all the bytes, then that is a // bug in node. Should never happen. if (state.length > 0) throw new Error('"endReadable()" called on non-empty stream'); if (!state.endEmitted) { state.ended = true; pna.nextTick(endReadableNT, state, stream); } } function endReadableNT(state, stream) { // Check that we didn't get one last unshift. if (!state.endEmitted && state.length === 0) { state.endEmitted = true; stream.readable = false; stream.emit('end'); } } function indexOf(xs, x) { for (var i = 0, l = xs.length; i < l; i++) { if (xs[i] === x) return i; } return -1; } /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(11), __webpack_require__(26))) /***/ }), /* 41 */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(31).EventEmitter; /***/ }), /* 42 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /*<replacement>*/ var pna = __webpack_require__(27); /*</replacement>*/ // undocumented cb() API, needed for core, not for public API function destroy(err, cb) { var _this = this; var readableDestroyed = this._readableState && this._readableState.destroyed; var writableDestroyed = this._writableState && this._writableState.destroyed; if (readableDestroyed || writableDestroyed) { if (cb) { cb(err); } else if (err && (!this._writableState || !this._writableState.errorEmitted)) { pna.nextTick(emitErrorNT, this, err); } return this; } // we set destroyed to true before firing error callbacks in order // to make it re-entrance safe in case destroy() is called within callbacks if (this._readableState) { this._readableState.destroyed = true; } // if this is a duplex stream mark the writable part as destroyed as well if (this._writableState) { this._writableState.destroyed = true; } this._destroy(err || null, function (err) { if (!cb && err) { pna.nextTick(emitErrorNT, _this, err); if (_this._writableState) { _this._writableState.errorEmitted = true; } } else if (cb) { cb(err); } }); return this; } function undestroy() { if (this._readableState) { this._readableState.destroyed = false; this._readableState.reading = false; this._readableState.ended = false; this._readableState.endEmitted = false; } if (this._writableState) { this._writableState.destroyed = false; this._writableState.ended = false; this._writableState.ending = false; this._writableState.finished = false; this._writableState.errorEmitted = false; } } function emitErrorNT(self, err) { self.emit('error', err); } module.exports = { destroy: destroy, undestroy: undestroy }; /***/ }), /* 43 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to permit // persons to whom the Software is furnished to do so, subject to the // following conditions: // // The above copyright notice and this permission notice shall be included // in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. /*<replacement>*/ var Buffer = __webpack_require__(28).Buffer; /*</replacement>*/ var isEncoding = Buffer.isEncoding || function (encoding) { encoding = '' + encoding; switch (encoding && encoding.toLowerCase()) { case 'hex':case 'utf8':case 'utf-8':case 'ascii':case 'binary':case 'base64':case 'ucs2':case 'ucs-2':case 'utf16le':case 'utf-16le':case 'raw': return true; default: return false; } }; function _normalizeEncoding(enc) { if (!enc) return 'utf8'; var retried; while (true) { switch (enc) { case 'utf8': case 'utf-8': return 'utf8'; case 'ucs2': case 'ucs-2': case 'utf16le': case 'utf-16le': return 'utf16le'; case 'latin1': case 'binary': return 'latin1'; case 'base64': case 'ascii': case 'hex': return enc; default: if (retried) return; // undefined enc = ('' + enc).toLowerCase(); retried = true; } } }; // Do not cache `Buffer.isEncoding` when checking encoding names as some // modules monkey-patch it to support additional encodings function normalizeEncoding(enc) { var nenc = _normalizeEncoding(enc); if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc); return nenc || enc; } // StringDecoder provides an interface for efficiently splitting a series of // buffers into a series of JS strings without breaking apart multi-byte // characters. exports.StringDecoder = StringDecoder; function StringDecoder(encoding) { this.encoding = normalizeEncoding(encoding); var nb; switch (this.encoding) { case 'utf16le': this.text = utf16Text; this.end = utf16End; nb = 4; break; case 'utf8': this.fillLast = utf8FillLast; nb = 4; break; case 'base64': this.text = base64Text; this.end = base64End; nb = 3; break; default: this.write = simpleWrite; this.end = simpleEnd; return; } this.lastNeed = 0; this.lastTotal = 0; this.lastChar = Buffer.allocUnsafe(nb); } StringDecoder.prototype.write = function (buf) { if (buf.length === 0) return ''; var r; var i; if (this.lastNeed) { r = this.fillLast(buf); if (r === undefined) return ''; i = this.lastNeed; this.lastNeed = 0; } else { i = 0; } if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i); return r || ''; }; StringDecoder.prototype.end = utf8End; // Returns only complete characters in a Buffer StringDecoder.prototype.text = utf8Text; // Attempts to complete a partial non-UTF-8 character using bytes from a Buffer StringDecoder.prototype.fillLast = function (buf) { if (this.lastNeed <= buf.length) { buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed); return this.lastChar.toString(this.encoding, 0, this.lastTotal); } buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length); this.lastNeed -= buf.length; }; // Checks the type of a UTF-8 byte, whether it's ASCII, a leading byte, or a // continuation byte. If an invalid byte is detected, -2 is returned. function utf8CheckByte(byte) { if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4; return byte >> 6 === 0x02 ? -1 : -2; } // Checks at most 3 bytes at the end of a Buffer in order to detect an // incomplete multi-byte UTF-8 character. The total number of bytes (2, 3, or 4) // needed to complete the UTF-8 character (if applicable) are returned. function utf8CheckIncomplete(self, buf, i) { var j = buf.length - 1; if (j < i) return 0; var nb = utf8CheckByte(buf[j]); if (nb >= 0) { if (nb > 0) self.lastNeed = nb - 1; return nb; } if (--j < i || nb === -2) return 0; nb = utf8CheckByte(buf[j]); if (nb >= 0) { if (nb > 0) self.lastNeed = nb - 2; return nb; } if (--j < i || nb === -2) return 0; nb = utf8CheckByte(buf[j]); if (nb >= 0) { if (nb > 0) { if (nb === 2) nb = 0;else self.lastNeed = nb - 3; } return nb; } return 0; } // Validates as many continuation bytes for a multi-byte UTF-8 character as // needed or are available. If we see a non-continuation byte where we expect // one, we "replace" the validated continuation bytes we've seen so far with // a single UTF-8 replacement character ('\ufffd'), to match v8's UTF-8 decoding // behavior. The continuation byte check is included three times in the case // where all of the continuation bytes for a character exist in the same buffer. // It is also done this way as a slight performance increase instead of using a // loop. function utf8CheckExtraBytes(self, buf, p) { if ((buf[0] & 0xC0) !== 0x80) { self.lastNeed = 0; return '\ufffd'; } if (self.lastNeed > 1 && buf.length > 1) { if ((buf[1] & 0xC0) !== 0x80) { self.lastNeed = 1; return '\ufffd'; } if (self.lastNeed > 2 && buf.length > 2) { if ((buf[2] & 0xC0) !== 0x80) { self.lastNeed = 2; return '\ufffd'; } } } } // Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer. function utf8FillLast(buf) { var p = this.lastTotal - this.lastNeed; var r = utf8CheckExtraBytes(this, buf, p); if (r !== undefined) return r; if (this.lastNeed <= buf.length) { buf.copy(this.lastChar, p, 0, this.lastNeed); return this.lastChar.toString(this.encoding, 0, this.lastTotal); } buf.copy(this.lastChar, p, 0, buf.length); this.lastNeed -= buf.length; } // Returns all complete UTF-8 characters in a Buffer. If the Buffer ended on a // partial character, the character's bytes are buffered until the required // number of bytes are available. function utf8Text(buf, i) { var total = utf8CheckIncomplete(this, buf, i); if (!this.lastNeed) return buf.toString('utf8', i); this.lastTotal = total; var end = buf.length - (total - this.lastNeed); buf.copy(this.lastChar, 0, end); return buf.toString('utf8', i, end); } // For UTF-8, a replacement character is added when ending on a partial // character. function utf8End(buf) { var r = buf && buf.length ? this.write(buf) : ''; if (this.lastNeed) return r + '\ufffd'; return r; } // UTF-16LE typically needs two bytes per character, but even if we have an even // number of bytes available, we need to check if we end on a leading/high // surrogate. In that case, we need to wait for the next two bytes in order to // decode the last character properly. function utf16Text(buf, i) { if ((buf.length - i) % 2 === 0) { var r = buf.toString('utf16le', i); if (r) { var c = r.charCodeAt(r.length - 1); if (c >= 0xD800 && c <= 0xDBFF) { this.lastNeed = 2; this.lastTotal = 4; this.lastChar[0] = buf[buf.length - 2]; this.lastChar[1] = buf[buf.length - 1]; return r.slice(0, -1); } } return r; } this.lastNeed = 1; this.lastTotal = 2; this.lastChar[0] = buf[buf.length - 1]; return buf.toString('utf16le', i, buf.length - 1); } // For UTF-16LE we do not explicitly append special replacement characters if we // end on a partial character, we simply let v8 handle that. function utf16End(buf) { var r = buf && buf.length ? this.write(buf) : ''; if (this.lastNeed) { var end = this.lastTotal - this.lastNeed; return r + this.lastChar.toString('utf16le', 0, end); } return r; } function base64Text(buf, i) { var n = (buf.length - i) % 3; if (n === 0) return buf.toString('base64', i); this.lastNeed = 3 - n; this.lastTotal = 3; if (n === 1) { this.lastChar[0] = buf[buf.length - 1]; } else { this.lastChar[0] = buf[buf.length - 2]; this.lastChar[1] = buf[buf.length - 1]; } return buf.toString('base64', i, buf.length - n); } function base64End(buf) { var r = buf && buf.length ? this.write(buf) : ''; if (this.lastNeed) return r + this.lastChar.toString('base64', 0, 3 - this.lastNeed); return r; } // Pass bytes on through for single-byte encodings (e.g. ascii, latin1, hex) function simpleWrite(buf) { return buf.toString(this.encoding); } function simpleEnd(buf) { return buf && buf.length ? this.write(buf) : ''; } /***/ }), /* 44 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to permit // persons to whom the Software is furnished to do so, subject to the // following conditions: // // The above copyright notice and this permission notice shall be included // in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. // a transform stream is a readable/writable stream where you do // something with the data. Sometimes it's called a "filter", // but that's not a great name for it, since that implies a thing where // some bits pass through, and others are simply ignored. (That would // be a valid example of a transform, of course.) // // While the output is causally related to the input, it's not a // necessarily symmetric or synchronous transformation. For example, // a zlib stream might take multiple plain-text writes(), and then // emit a single compressed chunk some time in the future. // // Here's how this works: // // The Transform stream has all the aspects of the readable and writable // stream classes. When you write(chunk), that calls _write(chunk,cb) // internally, and returns false if there's a lot of pending writes // buffered up. When you call read(), that calls _read(n) until // there's enough pending readable data buffered up. // // In a transform stream, the written data is placed in a buffer. When // _read(n) is called, it transforms the queued up data, calling the // buffered _write cb's as it consumes chunks. If consuming a single // written chunk would result in multiple output chunks, then the first // outputted bit calls the readcb, and subsequent chunks just go into // the read buffer, and will cause it to emit 'readable' if necessary. // // This way, back-pressure is actually determined by the reading side, // since _read has to be called to start processing a new chunk. However, // a pathological inflate type of transform can cause excessive buffering // here. For example, imagine a stream where every byte of input is // interpreted as an integer from 0-255, and then results in that many // bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in // 1kb of data being output. In this case, you could write a very small // amount of input, and end up with a very large amount of output. In // such a pathological inflating mechanism, there'd be no way to tell // the system to stop doing the transform. A single 4MB write could // cause the system to run out of memory. // // However, even in such a pathological case, only a single written chunk // would be consumed, and then the rest would wait (un-transformed) until // the results of the previous transformed chunk were consumed. module.exports = Transform; var Duplex = __webpack_require__(16); /*<replacement>*/ var util = __webpack_require__(20); util.inherits = __webpack_require__(18); /*</replacement>*/ util.inherits(Transform, Duplex); function afterTransform(er, data) { var ts = this._transformState; ts.transforming = false; var cb = ts.writecb; if (!cb) { return this.emit('error', new Error('write callback called multiple times')); } ts.writechunk = null; ts.writecb = null; if (data != null) // single equals check for both `null` and `undefined` this.push(data); cb(er); var rs = this._readableState; rs.reading = false; if (rs.needReadable || rs.length < rs.highWaterMark) { this._read(rs.highWaterMark); } } function Transform(options) { if (!(this instanceof Transform)) return new Transform(options); Duplex.call(this, options); this._transformState = { afterTransform: afterTransform.bind(this), needTransform: false, transforming: false, writecb: null, writechunk: null, writeencoding: null }; // start out asking for a readable event once data is transformed. this._readableState.needReadable = true; // we have implemented the _read method, and done the other things // that Readable wants before the first _read call, so unset the // sync guard flag. this._readableState.sync = false; if (options) { if (typeof options.transform === 'function') this._transform = options.transform; if (typeof options.flush === 'function') this._flush = options.flush; } // When the writable side finishes, then flush out anything remaining. this.on('prefinish', prefinish); } function prefinish() { var _this = this; if (typeof this._flush === 'function') { this._flush(function (er, data) { done(_this, er, data); }); } else { done(this, null, null); } } Transform.prototype.push = function (chunk, encoding) { this._transformState.needTransform = false; return Duplex.prototype.push.call(this, chunk, encoding); }; // This is the part where you do stuff! // override this function in implementation classes. // 'chunk' is an input chunk. // // Call `push(newChunk)` to pass along transformed output // to the readable side. You may call 'push' zero or more times. // // Call `cb(err)` when you are done with this chunk. If you pass // an error, then that'll put the hurt on the whole operation. If you // never call cb(), then you'll never get another chunk. Transform.prototype._transform = function (chunk, encoding, cb) { throw new Error('_transform() is not implemented'); }; Transform.prototype._write = function (chunk, encoding, cb) { var ts = this._transformState; ts.writecb = cb; ts.writechunk = chunk; ts.writeencoding = encoding; if (!ts.transforming) { var rs = this._readableState; if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark); } }; // Doesn't matter what the args are here. // _transform does all the work. // That we got here means that the readable side wants more data. Transform.prototype._read = function (n) { var ts = this._transformState; if (ts.writechunk !== null && ts.writecb && !ts.transforming) { ts.transforming = true; this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform); } else { // mark that we need a transform, so that any data that comes in // will get processed, now that we've asked for it. ts.needTransform = true; } }; Transform.prototype._destroy = function (err, cb) { var _this2 = this; Duplex.prototype._destroy.call(this, err, function (err2) { cb(err2); _this2.emit('close'); }); }; function done(stream, er, data) { if (er) return stream.emit('error', er); if (data != null) // single equals check for both `null` and `undefined` stream.push(data); // if there's nothing in the write buffer, then that means // that nothing more will ever be provided if (stream._writableState.length) throw new Error('Calling transform done when ws.length != 0'); if (stream._transformState.transforming) throw new Error('Calling transform done when still transforming'); return stream.push(null); } /***/ }), /* 45 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var utils = __webpack_require__(8); var support = __webpack_require__(14); // private property var _keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; // public method for encoding exports.encode = function(input) { var output = []; var chr1, chr2, chr3, enc1, enc2, enc3, enc4; var i = 0, len = input.length, remainingBytes = len; var isArray = utils.getTypeOf(input) !== "string"; while (i < input.length) { remainingBytes = len - i; if (!isArray) { chr1 = input.charCodeAt(i++); chr2 = i < len ? input.charCodeAt(i++) : 0; chr3 = i < len ? input.charCodeAt(i++) : 0; } else { chr1 = input[i++]; chr2 = i < len ? input[i++] : 0; chr3 = i < len ? input[i++] : 0; } enc1 = chr1 >> 2; enc2 = ((chr1 & 3) << 4) | (chr2 >> 4); enc3 = remainingBytes > 1 ? (((chr2 & 15) << 2) | (chr3 >> 6)) : 64; enc4 = remainingBytes > 2 ? (chr3 & 63) : 64; output.push(_keyStr.charAt(enc1) + _keyStr.charAt(enc2) + _keyStr.charAt(enc3) + _keyStr.charAt(enc4)); } return output.join(""); }; // public method for decoding exports.decode = function(input) { var chr1, chr2, chr3; var enc1, enc2, enc3, enc4; var i = 0, resultIndex = 0; var dataUrlPrefix = "data:"; if (input.substr(0, dataUrlPrefix.length) === dataUrlPrefix) { // This is a common error: people give a data url // (data:image/png;base64,iVBOR...) with a {base64: true} and // wonders why things don't work. // We can detect that the string input looks like a data url but we // *can't* be sure it is one: removing everything up to the comma would // be too dangerous. throw new Error("Invalid base64 input, it looks like a data url."); } input = input.replace(/[^A-Za-z0-9\+\/\=]/g, ""); var totalLength = input.length * 3 / 4; if(input.charAt(input.length - 1) === _keyStr.charAt(64)) { totalLength--; } if(input.charAt(input.length - 2) === _keyStr.charAt(64)) { totalLength--; } if (totalLength % 1 !== 0) { // totalLength is not an integer, the length does not match a valid // base64 content. That can happen if: // - the input is not a base64 content // - the input is *almost* a base64 content, with a extra chars at the // beginning or at the end // - the input uses a base64 variant (base64url for example) throw new Error("Invalid base64 input, bad content length."); } var output; if (support.uint8array) { output = new Uint8Array(totalLength|0); } else { output = new Array(totalLength|0); } while (i < input.length) { enc1 = _keyStr.indexOf(input.charAt(i++)); enc2 = _keyStr.indexOf(input.charAt(i++)); enc3 = _keyStr.indexOf(input.charAt(i++)); enc4 = _keyStr.indexOf(input.charAt(i++)); chr1 = (enc1 << 2) | (enc2 >> 4); chr2 = ((enc2 & 15) << 4) | (enc3 >> 2); chr3 = ((enc3 & 3) << 6) | enc4; output[resultIndex++] = chr1; if (enc3 !== 64) { output[resultIndex++] = chr2; } if (enc4 !== 64) { output[resultIndex++] = chr3; } } return output; }; /***/ }), /* 46 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(Buffer) { var utils = __webpack_require__(8); var ConvertWorker = __webpack_require__(90); var GenericWorker = __webpack_require__(12); var base64 = __webpack_require__(45); var support = __webpack_require__(14); var external = __webpack_require__(21); var NodejsStreamOutputAdapter = null; if (support.nodestream) { try { NodejsStreamOutputAdapter = __webpack_require__(91); } catch(e) {} } /** * Apply the final transformation of the data. If the user wants a Blob for * example, it's easier to work with an U8intArray and finally do the * ArrayBuffer/Blob conversion. * @param {String} type the name of the final type * @param {String|Uint8Array|Buffer} content the content to transform * @param {String} mimeType the mime type of the content, if applicable. * @return {String|Uint8Array|ArrayBuffer|Buffer|Blob} the content in the right format. */ function transformZipOutput(type, content, mimeType) { switch(type) { case "blob" : return utils.newBlob(utils.transformTo("arraybuffer", content), mimeType); case "base64" : return base64.encode(content); default : return utils.transformTo(type, content); } } /** * Concatenate an array of data of the given type. * @param {String} type the type of the data in the given array. * @param {Array} dataArray the array containing the data chunks to concatenate * @return {String|Uint8Array|Buffer} the concatenated data * @throws Error if the asked type is unsupported */ function concat (type, dataArray) { var i, index = 0, res = null, totalLength = 0; for(i = 0; i < dataArray.length; i++) { totalLength += dataArray[i].length; } switch(type) { case "string": return dataArray.join(""); case "array": return Array.prototype.concat.apply([], dataArray); case "uint8array": res = new Uint8Array(totalLength); for(i = 0; i < dataArray.length; i++) { res.set(dataArray[i], index); index += dataArray[i].length; } return res; case "nodebuffer": return Buffer.concat(dataArray); default: throw new Error("concat : unsupported type '" + type + "'"); } } /** * Listen a StreamHelper, accumulate its content and concatenate it into a * complete block. * @param {StreamHelper} helper the helper to use. * @param {Function} updateCallback a callback called on each update. Called * with one arg : * - the metadata linked to the update received. * @return Promise the promise for the accumulation. */ function accumulate(helper, updateCallback) { return new external.Promise(function (resolve, reject){ var dataArray = []; var chunkType = helper._internalType, resultType = helper._outputType, mimeType = helper._mimeType; helper .on('data', function (data, meta) { dataArray.push(data); if(updateCallback) { updateCallback(meta); } }) .on('error', function(err) { dataArray = []; reject(err); }) .on('end', function (){ try { var result = transformZipOutput(resultType, concat(chunkType, dataArray), mimeType); resolve(result); } catch (e) { reject(e); } dataArray = []; }) .resume(); }); } /** * An helper to easily use workers outside of JSZip. * @constructor * @param {Worker} worker the worker to wrap * @param {String} outputType the type of data expected by the use * @param {String} mimeType the mime type of the content, if applicable. */ function StreamHelper(worker, outputType, mimeType) { var internalType = outputType; switch(outputType) { case "blob": case "arraybuffer": internalType = "uint8array"; break; case "base64": internalType = "string"; break; } try { // the type used internally this._internalType = internalType; // the type used to output results this._outputType = outputType; // the mime type this._mimeType = mimeType; utils.checkSupport(internalType); this._worker = worker.pipe(new ConvertWorker(internalType)); // the last workers can be rewired without issues but we need to // prevent any updates on previous workers. worker.lock(); } catch(e) { this._worker = new GenericWorker("error"); this._worker.error(e); } } StreamHelper.prototype = { /** * Listen a StreamHelper, accumulate its content and concatenate it into a * complete block. * @param {Function} updateCb the update callback. * @return Promise the promise for the accumulation. */ accumulate : function (updateCb) { return accumulate(this, updateCb); }, /** * Add a listener on an event triggered on a stream. * @param {String} evt the name of the event * @param {Function} fn the listener * @return {StreamHelper} the current helper. */ on : function (evt, fn) { var self = this; if(evt === "data") { this._worker.on(evt, function (chunk) { fn.call(self, chunk.data, chunk.meta); }); } else { this._worker.on(evt, function () { utils.delay(fn, arguments, self); }); } return this; }, /** * Resume the flow of chunks. * @return {StreamHelper} the current helper. */ resume : function () { utils.delay(this._worker.resume, [], this._worker); return this; }, /** * Pause the flow of chunks. * @return {StreamHelper} the current helper. */ pause : function () { this._worker.pause(); return this; }, /** * Return a nodejs stream for this helper. * @param {Function} updateCb the update callback. * @return {NodejsStreamOutputAdapter} the nodejs stream. */ toNodejsStream : function (updateCb) { utils.checkSupport("nodestream"); if (this._outputType !== "nodebuffer") { // an object stream containing blob/arraybuffer/uint8array/string // is strange and I don't know if it would be useful. // I you find this comment and have a good usecase, please open a // bug report ! throw new Error(this._outputType + " is not supported by this method"); } return new NodejsStreamOutputAdapter(this, { objectMode : this._outputType !== "nodebuffer" }, updateCb); } }; module.exports = StreamHelper; /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(13).Buffer)) /***/ }), /* 47 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.base64 = false; exports.binary = false; exports.dir = false; exports.createFolders = true; exports.date = null; exports.compression = null; exports.compressionOptions = null; exports.comment = null; exports.unixPermissions = null; exports.dosPermissions = null; /***/ }), /* 48 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var utils = __webpack_require__(8); var GenericWorker = __webpack_require__(12); // the size of the generated chunks // TODO expose this as a public variable var DEFAULT_BLOCK_SIZE = 16 * 1024; /** * A worker that reads a content and emits chunks. * @constructor * @param {Promise} dataP the promise of the data to split */ function DataWorker(dataP) { GenericWorker.call(this, "DataWorker"); var self = this; this.dataIsReady = false; this.index = 0; this.max = 0; this.data = null; this.type = ""; this._tickScheduled = false; dataP.then(function (data) { self.dataIsReady = true; self.data = data; self.max = data && data.length || 0; self.type = utils.getTypeOf(data); if(!self.isPaused) { self._tickAndRepeat(); } }, function (e) { self.error(e); }); } utils.inherits(DataWorker, GenericWorker); /** * @see GenericWorker.cleanUp */ DataWorker.prototype.cleanUp = function () { GenericWorker.prototype.cleanUp.call(this); this.data = null; }; /** * @see GenericWorker.resume */ DataWorker.prototype.resume = function () { if(!GenericWorker.prototype.resume.call(this)) { return false; } if (!this._tickScheduled && this.dataIsReady) { this._tickScheduled = true; utils.delay(this._tickAndRepeat, [], this); } return true; }; /** * Trigger a tick a schedule an other call to this function. */ DataWorker.prototype._tickAndRepeat = function() { this._tickScheduled = false; if(this.isPaused || this.isFinished) { return; } this._tick(); if(!this.isFinished) { utils.delay(this._tickAndRepeat, [], this); this._tickScheduled = true; } }; /** * Read and push a chunk. */ DataWorker.prototype._tick = function() { if(this.isPaused || this.isFinished) { return false; } var size = DEFAULT_BLOCK_SIZE; var data = null, nextIndex = Math.min(this.max, this.index + size); if (this.index >= this.max) { // EOF return this.end(); } else { switch(this.type) { case "string": data = this.data.substring(this.index, nextIndex); break; case "uint8array": data = this.data.subarray(this.index, nextIndex); break; case "array": case "nodebuffer": data = this.data.slice(this.index, nextIndex); break; } this.index = nextIndex; return this.push({ data : data, meta : { percent : this.max ? this.index / this.max * 100 : 0 } }); } }; module.exports = DataWorker; /***/ }), /* 49 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var utils = __webpack_require__(8); var GenericWorker = __webpack_require__(12); /** * A worker which calculate the total length of the data flowing through. * @constructor * @param {String} propName the name used to expose the length */ function DataLengthProbe(propName) { GenericWorker.call(this, "DataLengthProbe for " + propName); this.propName = propName; this.withStreamInfo(propName, 0); } utils.inherits(DataLengthProbe, GenericWorker); /** * @see GenericWorker.processChunk */ DataLengthProbe.prototype.processChunk = function (chunk) { if(chunk) { var length = this.streamInfo[this.propName] || 0; this.streamInfo[this.propName] = length + chunk.data.length; } GenericWorker.prototype.processChunk.call(this, chunk); }; module.exports = DataLengthProbe; /***/ }), /* 50 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var GenericWorker = __webpack_require__(12); var crc32 = __webpack_require__(36); var utils = __webpack_require__(8); /** * A worker which calculate the crc32 of the data flowing through. * @constructor */ function Crc32Probe() { GenericWorker.call(this, "Crc32Probe"); this.withStreamInfo("crc32", 0); } utils.inherits(Crc32Probe, GenericWorker); /** * @see GenericWorker.processChunk */ Crc32Probe.prototype.processChunk = function (chunk) { this.streamInfo.crc32 = crc32(chunk.data, this.streamInfo.crc32 || 0); this.push(chunk); }; module.exports = Crc32Probe; /***/ }), /* 51 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var GenericWorker = __webpack_require__(12); exports.STORE = { magic: "\x00\x00", compressWorker : function (compressionOptions) { return new GenericWorker("STORE compression"); }, uncompressWorker : function () { return new GenericWorker("STORE decompression"); } }; exports.DEFLATE = __webpack_require__(94); /***/ }), /* 52 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // Note: adler32 takes 12% for level 0 and 2% for level 6. // It isn't worth it to make additional optimizations as in original. // Small size is preferable. // (C) 1995-2013 Jean-loup Gailly and Mark Adler // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would be // appreciated but is not required. // 2. Altered source versions must be plainly marked as such, and must not be // misrepresented as being the original software. // 3. This notice may not be removed or altered from any source distribution. function adler32(adler, buf, len, pos) { var s1 = (adler & 0xffff) |0, s2 = ((adler >>> 16) & 0xffff) |0, n = 0; while (len !== 0) { // Set limit ~ twice less than 5552, to keep // s2 in 31-bits, because we force signed ints. // in other case %= will fail. n = len > 2000 ? 2000 : len; len -= n; do { s1 = (s1 + buf[pos++]) |0; s2 = (s2 + s1) |0; } while (--n); s1 %= 65521; s2 %= 65521; } return (s1 | (s2 << 16)) |0; } module.exports = adler32; /***/ }), /* 53 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // Note: we can't get significant speed boost here. // So write code to minimize size - no pregenerated tables // and array tools dependencies. // (C) 1995-2013 Jean-loup Gailly and Mark Adler // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would be // appreciated but is not required. // 2. Altered source versions must be plainly marked as such, and must not be // misrepresented as being the original software. // 3. This notice may not be removed or altered from any source distribution. // Use ordinary array, since untyped makes no boost here function makeTable() { var c, table = []; for (var n = 0; n < 256; n++) { c = n; for (var k = 0; k < 8; k++) { c = ((c & 1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1)); } table[n] = c; } return table; } // Create table on load. Just 255 signed longs. Not a problem. var crcTable = makeTable(); function crc32(crc, buf, len, pos) { var t = crcTable, end = pos + len; crc ^= -1; for (var i = pos; i < end; i++) { crc = (crc >>> 8) ^ t[(crc ^ buf[i]) & 0xFF]; } return (crc ^ (-1)); // >>> 0; } module.exports = crc32; /***/ }), /* 54 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // String encode/decode helpers var utils = __webpack_require__(15); // Quick check if we can use fast array to bin string conversion // // - apply(Array) can fail on Android 2.2 // - apply(Uint8Array) can fail on iOS 5.1 Safari // var STR_APPLY_OK = true; var STR_APPLY_UIA_OK = true; try { String.fromCharCode.apply(null, [ 0 ]); } catch (__) { STR_APPLY_OK = false; } try { String.fromCharCode.apply(null, new Uint8Array(1)); } catch (__) { STR_APPLY_UIA_OK = false; } // Table with utf8 lengths (calculated by first byte of sequence) // Note, that 5 & 6-byte values and some 4-byte values can not be represented in JS, // because max possible codepoint is 0x10ffff var _utf8len = new utils.Buf8(256); for (var q = 0; q < 256; q++) { _utf8len[q] = (q >= 252 ? 6 : q >= 248 ? 5 : q >= 240 ? 4 : q >= 224 ? 3 : q >= 192 ? 2 : 1); } _utf8len[254] = _utf8len[254] = 1; // Invalid sequence start // convert string to array (typed, when possible) exports.string2buf = function (str) { var buf, c, c2, m_pos, i, str_len = str.length, buf_len = 0; // count binary size for (m_pos = 0; m_pos < str_len; m_pos++) { c = str.charCodeAt(m_pos); if ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) { c2 = str.charCodeAt(m_pos + 1); if ((c2 & 0xfc00) === 0xdc00) { c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00); m_pos++; } } buf_len += c < 0x80 ? 1 : c < 0x800 ? 2 : c < 0x10000 ? 3 : 4; } // allocate buffer buf = new utils.Buf8(buf_len); // convert for (i = 0, m_pos = 0; i < buf_len; m_pos++) { c = str.charCodeAt(m_pos); if ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) { c2 = str.charCodeAt(m_pos + 1); if ((c2 & 0xfc00) === 0xdc00) { c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00); m_pos++; } } if (c < 0x80) { /* one byte */ buf[i++] = c; } else if (c < 0x800) { /* two bytes */ buf[i++] = 0xC0 | (c >>> 6); buf[i++] = 0x80 | (c & 0x3f); } else if (c < 0x10000) { /* three bytes */ buf[i++] = 0xE0 | (c >>> 12); buf[i++] = 0x80 | (c >>> 6 & 0x3f); buf[i++] = 0x80 | (c & 0x3f); } else { /* four bytes */ buf[i++] = 0xf0 | (c >>> 18); buf[i++] = 0x80 | (c >>> 12 & 0x3f); buf[i++] = 0x80 | (c >>> 6 & 0x3f); buf[i++] = 0x80 | (c & 0x3f); } } return buf; }; // Helper (used in 2 places) function buf2binstring(buf, len) { // On Chrome, the arguments in a function call that are allowed is `65534`. // If the length of the buffer is smaller than that, we can use this optimization, // otherwise we will take a slower path. if (len < 65534) { if ((buf.subarray && STR_APPLY_UIA_OK) || (!buf.subarray && STR_APPLY_OK)) { return String.fromCharCode.apply(null, utils.shrinkBuf(buf, len)); } } var result = ''; for (var i = 0; i < len; i++) { result += String.fromCharCode(buf[i]); } return result; } // Convert byte array to binary string exports.buf2binstring = function (buf) { return buf2binstring(buf, buf.length); }; // Convert binary string (typed, when possible) exports.binstring2buf = function (str) { var buf = new utils.Buf8(str.length); for (var i = 0, len = buf.length; i < len; i++) { buf[i] = str.charCodeAt(i); } return buf; }; // convert array to string exports.buf2string = function (buf, max) { var i, out, c, c_len; var len = max || buf.length; // Reserve max possible length (2 words per char) // NB: by unknown reasons, Array is significantly faster for // String.fromCharCode.apply than Uint16Array. var utf16buf = new Array(len * 2); for (out = 0, i = 0; i < len;) { c = buf[i++]; // quick process ascii if (c < 0x80) { utf16buf[out++] = c; continue; } c_len = _utf8len[c]; // skip 5 & 6 byte codes if (c_len > 4) { utf16buf[out++] = 0xfffd; i += c_len - 1; continue; } // apply mask on first byte c &= c_len === 2 ? 0x1f : c_len === 3 ? 0x0f : 0x07; // join the rest while (c_len > 1 && i < len) { c = (c << 6) | (buf[i++] & 0x3f); c_len--; } // terminated by end of string? if (c_len > 1) { utf16buf[out++] = 0xfffd; continue; } if (c < 0x10000) { utf16buf[out++] = c; } else { c -= 0x10000; utf16buf[out++] = 0xd800 | ((c >> 10) & 0x3ff); utf16buf[out++] = 0xdc00 | (c & 0x3ff); } } return buf2binstring(utf16buf, out); }; // Calculate max possible position in utf8 buffer, // that will not break sequence. If that's not possible // - (very small limits) return max size as is. // // buf[] - utf8 bytes array // max - length limit (mandatory); exports.utf8border = function (buf, max) { var pos; max = max || buf.length; if (max > buf.length) { max = buf.length; } // go back from last position, until start of sequence found pos = max - 1; while (pos >= 0 && (buf[pos] & 0xC0) === 0x80) { pos--; } // Very small and broken sequence, // return max, because we should return something anyway. if (pos < 0) { return max; } // If we came to start of buffer - that means buffer is too small, // return max too. if (pos === 0) { return max; } return (pos + _utf8len[buf[pos]] > max) ? pos : max; }; /***/ }), /* 55 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // (C) 1995-2013 Jean-loup Gailly and Mark Adler // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would be // appreciated but is not required. // 2. Altered source versions must be plainly marked as such, and must not be // misrepresented as being the original software. // 3. This notice may not be removed or altered from any source distribution. function ZStream() { /* next input byte */ this.input = null; // JS specific, because we have no pointers this.next_in = 0; /* number of bytes available at input */ this.avail_in = 0; /* total number of input bytes read so far */ this.total_in = 0; /* next output byte should be put there */ this.output = null; // JS specific, because we have no pointers this.next_out = 0; /* remaining free space at output */ this.avail_out = 0; /* total number of bytes output so far */ this.total_out = 0; /* last error message, NULL if no error */ this.msg = ''/*Z_NULL*/; /* not visible by applications */ this.state = null; /* best guess about the data type: binary or text */ this.data_type = 2/*Z_UNKNOWN*/; /* adler32 value of the uncompressed data */ this.adler = 0; } module.exports = ZStream; /***/ }), /* 56 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // (C) 1995-2013 Jean-loup Gailly and Mark Adler // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would be // appreciated but is not required. // 2. Altered source versions must be plainly marked as such, and must not be // misrepresented as being the original software. // 3. This notice may not be removed or altered from any source distribution. module.exports = { /* Allowed flush values; see deflate() and inflate() below for details */ Z_NO_FLUSH: 0, Z_PARTIAL_FLUSH: 1, Z_SYNC_FLUSH: 2, Z_FULL_FLUSH: 3, Z_FINISH: 4, Z_BLOCK: 5, Z_TREES: 6, /* Return codes for the compression/decompression functions. Negative values * are errors, positive values are used for special but normal events. */ Z_OK: 0, Z_STREAM_END: 1, Z_NEED_DICT: 2, Z_ERRNO: -1, Z_STREAM_ERROR: -2, Z_DATA_ERROR: -3, //Z_MEM_ERROR: -4, Z_BUF_ERROR: -5, //Z_VERSION_ERROR: -6, /* compression levels */ Z_NO_COMPRESSION: 0, Z_BEST_SPEED: 1, Z_BEST_COMPRESSION: 9, Z_DEFAULT_COMPRESSION: -1, Z_FILTERED: 1, Z_HUFFMAN_ONLY: 2, Z_RLE: 3, Z_FIXED: 4, Z_DEFAULT_STRATEGY: 0, /* Possible values of the data_type field (though see inflate()) */ Z_BINARY: 0, Z_TEXT: 1, //Z_ASCII: 1, // = Z_TEXT (deprecated) Z_UNKNOWN: 2, /* The deflate compression method */ Z_DEFLATED: 8 //Z_NULL: null // Use -1 or null inline, depending on var type }; /***/ }), /* 57 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.LOCAL_FILE_HEADER = "PK\x03\x04"; exports.CENTRAL_FILE_HEADER = "PK\x01\x02"; exports.CENTRAL_DIRECTORY_END = "PK\x05\x06"; exports.ZIP64_CENTRAL_DIRECTORY_LOCATOR = "PK\x06\x07"; exports.ZIP64_CENTRAL_DIRECTORY_END = "PK\x06\x06"; exports.DATA_DESCRIPTOR = "PK\x07\x08"; /***/ }), /* 58 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var utils = __webpack_require__(8); var support = __webpack_require__(14); var ArrayReader = __webpack_require__(59); var StringReader = __webpack_require__(108); var NodeBufferReader = __webpack_require__(109); var Uint8ArrayReader = __webpack_require__(61); /** * Create a reader adapted to the data. * @param {String|ArrayBuffer|Uint8Array|Buffer} data the data to read. * @return {DataReader} the data reader. */ module.exports = function (data) { var type = utils.getTypeOf(data); utils.checkSupport(type); if (type === "string" && !support.uint8array) { return new StringReader(data); } if (type === "nodebuffer") { return new NodeBufferReader(data); } if (support.uint8array) { return new Uint8ArrayReader(utils.transformTo("uint8array", data)); } return new ArrayReader(utils.transformTo("array", data)); }; /***/ }), /* 59 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var DataReader = __webpack_require__(60); var utils = __webpack_require__(8); function ArrayReader(data) { DataReader.call(this, data); for(var i = 0; i < this.data.length; i++) { data[i] = data[i] & 0xFF; } } utils.inherits(ArrayReader, DataReader); /** * @see DataReader.byteAt */ ArrayReader.prototype.byteAt = function(i) { return this.data[this.zero + i]; }; /** * @see DataReader.lastIndexOfSignature */ ArrayReader.prototype.lastIndexOfSignature = function(sig) { var sig0 = sig.charCodeAt(0), sig1 = sig.charCodeAt(1), sig2 = sig.charCodeAt(2), sig3 = sig.charCodeAt(3); for (var i = this.length - 4; i >= 0; --i) { if (this.data[i] === sig0 && this.data[i + 1] === sig1 && this.data[i + 2] === sig2 && this.data[i + 3] === sig3) { return i - this.zero; } } return -1; }; /** * @see DataReader.readAndCheckSignature */ ArrayReader.prototype.readAndCheckSignature = function (sig) { var sig0 = sig.charCodeAt(0), sig1 = sig.charCodeAt(1), sig2 = sig.charCodeAt(2), sig3 = sig.charCodeAt(3), data = this.readData(4); return sig0 === data[0] && sig1 === data[1] && sig2 === data[2] && sig3 === data[3]; }; /** * @see DataReader.readData */ ArrayReader.prototype.readData = function(size) { this.checkOffset(size); if(size === 0) { return []; } var result = this.data.slice(this.zero + this.index, this.zero + this.index + size); this.index += size; return result; }; module.exports = ArrayReader; /***/ }), /* 60 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var utils = __webpack_require__(8); function DataReader(data) { this.data = data; // type : see implementation this.length = data.length; this.index = 0; this.zero = 0; } DataReader.prototype = { /** * Check that the offset will not go too far. * @param {string} offset the additional offset to check. * @throws {Error} an Error if the offset is out of bounds. */ checkOffset: function(offset) { this.checkIndex(this.index + offset); }, /** * Check that the specified index will not be too far. * @param {string} newIndex the index to check. * @throws {Error} an Error if the index is out of bounds. */ checkIndex: function(newIndex) { if (this.length < this.zero + newIndex || newIndex < 0) { throw new Error("End of data reached (data length = " + this.length + ", asked index = " + (newIndex) + "). Corrupted zip ?"); } }, /** * Change the index. * @param {number} newIndex The new index. * @throws {Error} if the new index is out of the data. */ setIndex: function(newIndex) { this.checkIndex(newIndex); this.index = newIndex; }, /** * Skip the next n bytes. * @param {number} n the number of bytes to skip. * @throws {Error} if the new index is out of the data. */ skip: function(n) { this.setIndex(this.index + n); }, /** * Get the byte at the specified index. * @param {number} i the index to use. * @return {number} a byte. */ byteAt: function(i) { // see implementations }, /** * Get the next number with a given byte size. * @param {number} size the number of bytes to read. * @return {number} the corresponding number. */ readInt: function(size) { var result = 0, i; this.checkOffset(size); for (i = this.index + size - 1; i >= this.index; i--) { result = (result << 8) + this.byteAt(i); } this.index += size; return result; }, /** * Get the next string with a given byte size. * @param {number} size the number of bytes to read. * @return {string} the corresponding string. */ readString: function(size) { return utils.transformTo("string", this.readData(size)); }, /** * Get raw data without conversion, <size> bytes. * @param {number} size the number of bytes to read. * @return {Object} the raw data, implementation specific. */ readData: function(size) { // see implementations }, /** * Find the last occurence of a zip signature (4 bytes). * @param {string} sig the signature to find. * @return {number} the index of the last occurence, -1 if not found. */ lastIndexOfSignature: function(sig) { // see implementations }, /** * Read the signature (4 bytes) at the current position and compare it with sig. * @param {string} sig the expected signature * @return {boolean} true if the signature matches, false otherwise. */ readAndCheckSignature: function(sig) { // see implementations }, /** * Get the next date. * @return {Date} the date. */ readDate: function() { var dostime = this.readInt(4); return new Date(Date.UTC( ((dostime >> 25) & 0x7f) + 1980, // year ((dostime >> 21) & 0x0f) - 1, // month (dostime >> 16) & 0x1f, // day (dostime >> 11) & 0x1f, // hour (dostime >> 5) & 0x3f, // minute (dostime & 0x1f) << 1)); // second } }; module.exports = DataReader; /***/ }), /* 61 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var ArrayReader = __webpack_require__(59); var utils = __webpack_require__(8); function Uint8ArrayReader(data) { ArrayReader.call(this, data); } utils.inherits(Uint8ArrayReader, ArrayReader); /** * @see DataReader.readData */ Uint8ArrayReader.prototype.readData = function(size) { this.checkOffset(size); if(size === 0) { // in IE10, when using subarray(idx, idx), we get the array [0x00] instead of []. return new Uint8Array(0); } var result = this.data.subarray(this.zero + this.index, this.zero + this.index + size); this.index += size; return result; }; module.exports = Uint8ArrayReader; /***/ }), /* 62 */ /***/ (function(module, exports, __webpack_require__) { var content = __webpack_require__(212); if(typeof content === 'string') content = [[module.i, content, '']]; var transform; var insertInto; var options = {"hmr":true} options.transform = transform options.insertInto = undefined; var update = __webpack_require__(5)(content, options); if(content.locals) module.exports = content.locals; if(false) {} /***/ }), /* 63 */ /***/ (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__(13).Buffer, __webpack_require__(74)(module))) /***/ }), /* 64 */ /***/ (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__(13).Buffer)) /***/ }), /* 65 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(global) { const external = global.external; const re_msie = /\b(?:msie |ie |trident\/[0-9].*rv[ :])([0-9.]+)/; const re_blackberry_10 = /\bbb10\b.+?\bversion\/([\d.]+)/; const re_blackberry_6_7 = /\bblackberry\b.+\bversion\/([\d.]+)/; const re_blackberry_4_5 = /\bblackberry\d+\/([\d.]+)/; const NA_VERSION = "-1"; const DEVICES = [ ["nokia", function (ua) { // nokia/-1 if (ua.indexOf("nokia ") !== -1) { return /\bnokia ([0-9]+)?/; } else { return /\bnokia([a-z0-9]+)?/; } }], //Android WP ["samsung", function (ua) { if (ua.indexOf("samsung") !== -1) { return /\bsamsung(?:[ \-](?:sgh|gt|sm))?-([a-z0-9]+)/; } else { return /\b(?:sgh|sch|gt|sm)-([a-z0-9]+)/; } }], ["wp", function (ua) { return ua.indexOf("windows phone ") !== -1 || ua.indexOf("xblwp") !== -1 || ua.indexOf("zunewp") !== -1 || ua.indexOf("windows ce") !== -1; }], ["pc", "windows"], ["ipad", "ipad"], // ipod iphone ["ipod", "ipod"], ["iphone", /\biphone\b|\biph(\d)/], ["mac", "macintosh"], ["mi", /\bmi[ \-]?([a-z0-9 ]+(?= build|\)))/], ["hongmi", /\bhm[ \-]?([a-z0-9]+)/], ["aliyun", /\baliyunos\b(?:[\-](\d+))?/], ["meizu", function (ua) { return ua.indexOf("meizu") >= 0 ? /\bmeizu[\/ ]([a-z0-9]+)\b/ : /\bm([0-9cx]{1,4})\b/; }], ["nexus", /\bnexus ([0-9s.]+)/], ["huawei", function (ua) { const re_mediapad = /\bmediapad (.+?)(?= build\/huaweimediapad\b)/; if (ua.indexOf("huawei-huawei") !== -1) { return /\bhuawei\-huawei\-([a-z0-9\-]+)/; } else if (re_mediapad.test(ua)) { return re_mediapad; } else { return /\bhuawei[ _\-]?([a-z0-9]+)/; } }], ["lenovo", function (ua) { if (ua.indexOf("lenovo-lenovo") !== -1) { return /\blenovo\-lenovo[ \-]([a-z0-9]+)/; } else { return /\blenovo[ \-]?([a-z0-9]+)/; } }], ["zte", function (ua) { if (/\bzte\-[tu]/.test(ua)) { return /\bzte-[tu][ _\-]?([a-su-z0-9\+]+)/; } else { return /\bzte[ _\-]?([a-su-z0-9\+]+)/; } }], ["vivo", /\bvivo(?: ([a-z0-9]+))?/], ["htc", function (ua) { if (/\bhtc[a-z0-9 _\-]+(?= build\b)/.test(ua)) { return /\bhtc[ _\-]?([a-z0-9 ]+(?= build))/; } else { return /\bhtc[ _\-]?([a-z0-9 ]+)/; } }], ["oppo", /\boppo[_ ]([a-z0-9]+)/], ["konka", /\bkonka[_\-]([a-z0-9]+)/], ["sonyericsson", /\bmt([a-z0-9]+)/], ["coolpad", /\bcoolpad[_ ]?([a-z0-9]+)/], ["lg", /\blg[\-]([a-z0-9]+)/], ["android", /\bandroid\b|\badr\b/], ["blackberry", function (ua) { if (ua.indexOf("blackberry") >= 0) { return /\bblackberry\s?(\d+)/; } return "bb10"; }], ]; const OS = [ ["wp", function (ua) { if (ua.indexOf("windows phone ") !== -1) { return /\bwindows phone (?:os )?([0-9.]+)/; } else if (ua.indexOf("xblwp") !== -1) { return /\bxblwp([0-9.]+)/; } else if (ua.indexOf("zunewp") !== -1) { return /\bzunewp([0-9.]+)/; } return "windows phone"; }], ["windows", /\bwindows nt ([0-9.]+)/], ["macosx", /\bmac os x ([0-9._]+)/], ["ios", function (ua) { if (/\bcpu(?: iphone)? os /.test(ua)) { return /\bcpu(?: iphone)? os ([0-9._]+)/; } else if (ua.indexOf("iph os ") !== -1) { return /\biph os ([0-9_]+)/; } else { return /\bios\b/; } }], ["yunos", /\baliyunos ([0-9.]+)/], ["android", function (ua) { if (ua.indexOf("android") >= 0) { return /\bandroid[ \/-]?([0-9.x]+)?/; } else if (ua.indexOf("adr") >= 0) { if (ua.indexOf("mqqbrowser") >= 0) { return /\badr[ ]\(linux; u; ([0-9.]+)?/; } else { return /\badr(?:[ ]([0-9.]+))?/; } } return "android"; //return /\b(?:android|\badr)(?:[\/\- ](?:\(linux; u; )?)?([0-9.x]+)?/; }], ["chromeos", /\bcros i686 ([0-9.]+)/], ["linux", "linux"], ["windowsce", /\bwindows ce(?: ([0-9.]+))?/], ["symbian", /\bsymbian(?:os)?\/([0-9.]+)/], ["blackberry", function (ua) { const m = ua.match(re_blackberry_10) || ua.match(re_blackberry_6_7) || ua.match(re_blackberry_4_5); return m ? { version: m[1] } : "blackberry"; }], ['ie', /\rv\:\/([0-9.]+)/] ]; const ENGINE = [ ["edgehtml", /edge\/([0-9.]+)/], ["trident", re_msie], ["blink", function () { return "chrome" in global && "CSS" in global && /\bapplewebkit[\/]?([0-9.+]+)/; }], ["webkit", /\bapplewebkit[\/]?([0-9.+]+)/], ["gecko", function (ua) { const match = ua.match(/\brv:([\d\w.]+).*\bgecko\/(\d+)/); if (match) { return { version: match[1] + "." + match[2], }; } }], ["presto", /\bpresto\/([0-9.]+)/], ["androidwebkit", /\bandroidwebkit\/([0-9.]+)/], ["coolpadwebkit", /\bcoolpadwebkit\/([0-9.]+)/], ["u2", /\bu2\/([0-9.]+)/], ["u3", /\bu3\/([0-9.]+)/], ]; const BROWSER = [ ['coccoc', /coc\_coc\_browser\/([0-9.]+)/], // Microsoft Edge Browser, Default browser in Windows 10. ["edge", /edge\/([0-9.]+)/], ["chrome-edge", /chrome.+edg\/([0-9.]+)/], // Sogou. ["sogou", function (ua) { if (ua.indexOf("sogoumobilebrowser") >= 0) { return /sogoumobilebrowser\/([0-9.]+)/; } else if (ua.indexOf("sogoumse") >= 0) { return true; } return / se ([0-9.x]+)/; }], // Maxthon ["maxthon", function () { try { if (external && (external.mxVersion || external.max_version)) { return { version: external.mxVersion || external.max_version, }; } } catch (ex) { /* */ } return /\b(?:maxthon|mxbrowser)(?:[ \/]([0-9.]+))?/; }], ["micromessenger", /\bmicromessenger\/([\d.]+)/], ["qq", /\bm?qqbrowser\/([0-9.]+)/], ["green", "greenbrowser"], ["tt", /\btencenttraveler ([0-9.]+)/], ["liebao", function (ua) { if (ua.indexOf("liebaofast") >= 0) { return /\bliebaofast\/([0-9.]+)/; } if (ua.indexOf("lbbrowser") === -1) { return false; } var version; try { if (external && external.LiebaoGetVersion) { version = external.LiebaoGetVersion(); } } catch (ex) { /* */ } return { version: version || NA_VERSION, }; }], ["tao", /\btaobrowser\/([0-9.]+)/], ["coolnovo", /\bcoolnovo\/([0-9.]+)/], ["saayaa", "saayaa"], ["baidu", /\b(?:ba?idubrowser|baiduhd)[ \/]([0-9.x]+)/], ["ie", re_msie], ["mi", /\bmiuibrowser\/([0-9.]+)/], ["opera", function (ua) { const re_opera_old = /\bopera.+version\/([0-9.ab]+)/; const re_opera_new = /\bopr\/([0-9.]+)/; return re_opera_old.test(ua) ? re_opera_old : re_opera_new; }], ["oupeng", /\boupeng\/([0-9.]+)/], ["yandex", /yabrowser\/([0-9.]+)/], ["ali-ap", function (ua) { if (ua.indexOf("aliapp") > 0) { return /\baliapp\(ap\/([0-9.]+)\)/; } else { return /\balipayclient\/([0-9.]+)\b/; } }], ["ali-ap-pd", /\baliapp\(ap-pd\/([0-9.]+)\)/], ["ali-am", /\baliapp\(am\/([0-9.]+)\)/], ["ali-tb", /\baliapp\(tb\/([0-9.]+)\)/], ["ali-tb-pd", /\baliapp\(tb-pd\/([0-9.]+)\)/], ["ali-tm", /\baliapp\(tm\/([0-9.]+)\)/], ["ali-tm-pd", /\baliapp\(tm-pd\/([0-9.]+)\)/], ["uc", function (ua) { if (ua.indexOf("ucbrowser/") >= 0) { return /\bucbrowser\/([0-9.]+)/; } else if (ua.indexOf("ubrowser/") >= 0) { return /\bubrowser\/([0-9.]+)/; } else if (/\buc\/[0-9]/.test(ua)) { return /\buc\/([0-9.]+)/; } else if (ua.indexOf("ucweb") >= 0) { // `ucweb/2.0` is compony info. // `UCWEB8.7.2.214/145/800` is browser info. return /\bucweb([0-9.]+)?/; } else { return /\b(?:ucbrowser|uc)\b/; } }], ["baiduboxapp", function (ua) { var back = 0; var a; if (/ baiduboxapp\//i.test(ua)) { a = /([\d+.]+)_(?:diordna|enohpi)_/.exec(ua); if (a) { a = a[1].split("."); back = a.reverse().join("."); } else if ((a = /baiduboxapp\/([\d+.]+)/.exec(ua))) { back = a[1]; } return { version: back, }; } return false; }, ], ["oppobrowser", /\boppobrowser\/([0-9.]+)/], ["chrome", / (?:chrome|crios|crmo)\/([0-9.]+)/], // Android safari ["android", function (ua) { if (ua.indexOf("android") === -1) { return; } return /\bversion\/([0-9.]+(?: beta)?)/; }], ["blackberry", function (ua) { const m = ua.match(re_blackberry_10) || ua.match(re_blackberry_6_7) || ua.match(re_blackberry_4_5); return m ? { version: m[1] } : "blackberry"; }], ["safari", /\bversion\/([0-9.]+(?: beta)?)(?: mobile(?:\/[a-z0-9]+)?)? safari\//], // Safari, WebView ["webview", /\bcpu(?: iphone)? os (?:[0-9._]+).+\bapplewebkit\b/], ["firefox", /\bfirefox\/([0-9.ab]+)/], ["nokia", /\bnokiabrowser\/([0-9.]+)/] ]; module.exports = { device: DEVICES, os: OS, browser: BROWSER, engine: ENGINE, re_msie: re_msie, }; /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(11))) /***/ }), /* 66 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(global, Buffer) {/* harmony import */ var _DocxTpl__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(25); /* harmony import */ var _assets_content_types_xml__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(67); /* harmony import */ var _assets_rels_xml__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(68); /* harmony import */ var _assets_document_xml_rels__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(69); /* harmony import */ var jszip__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(30); /* harmony import */ var jszip__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(jszip__WEBPACK_IMPORTED_MODULE_4__); /* harmony import */ var _HTML5_Dom__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(1); /* harmony import */ var _HTML5_Svg__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(9); function JSDocx(props) { if (props.blob) this.blob = props.blob; if (props.blob) this.buffer = props.buffer; } JSDocx.prototype.saveAs = function (fileName) { var src; if (this.blob) { src = (URL || webkitURL).createObjectURL(this.blob); } else if (this.buffer) { src = "data:application/octet-stream," + encodeURIComponent(this.buffer); } var element = document.createElement('a'); element.setAttribute('href', src); element.setAttribute('download', fileName); element.style.display = 'none'; document.body.appendChild(element); element.click(); document.body.removeChild(element); }; JSDocx._prepareImageParts = function (htmlSource) { var imageContentParts = []; var inlinedSrcPattern = /\"data:(\w+\/\w+);(\w+),(\S+)\"/g; var inlinedReplacer = function (match, contentType, contentEncoding, encodedContent) { var index = imageContentParts.length; var extension = contentType.split('/')[1]; var contentLocation = "file:///C:/fake/image" + index + "." + extension; // mht_part: new Function('contentType', 'contentEncoding', 'contentLocation', 'encodedContent', 'return ' + TemplateString.parse(mht_pathTpl).toJSCode()) imageContentParts.push(_DocxTpl__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"].mht_part(contentType, contentEncoding, contentLocation, encodedContent)); return "\"" + contentLocation + "\""; }; if (typeof htmlSource === 'string') { if (!/<img/g.test(htmlSource)) { return { htmlSource: htmlSource, imageContentParts: imageContentParts }; } htmlSource = htmlSource.replace(inlinedSrcPattern, inlinedReplacer); return { htmlSource: htmlSource, imageContentParts: imageContentParts }; } else { throw new Error("Not a valid source provided!"); } }; JSDocx._getMHTdocument = function (htmlSource) { var imageContentParts, _ref; _ref = this._prepareImageParts(htmlSource), htmlSource = _ref.htmlSource, imageContentParts = _ref.imageContentParts; htmlSource = htmlSource.replace(/\=/g, '=3D'); return _DocxTpl__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"].mht_document(htmlSource, imageContentParts.join('\n') ); }; /** * @param {JSZip} zip */ JSDocx._generateDocument = function (zip) { return zip.generateAsync({ type: 'arraybuffer' }).then(function (buffer) { var props = {}; if (global.Blob) props.blob = new Blob([buffer], { type: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' }); else if (global.Buffer) props.buffer = new Buffer(new Uint8Array(buffer)); else throw new Error("Neither Blob nor Buffer are accessible in this environment. " + "Consider adding Blob.js shim"); return new JSDocx(props); }); }; JSDocx._renderDocumentFile = function (pageSetting) { return _DocxTpl__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"].document(pageSetting); }; JSDocx._createPageSetting = function (documentOptions) { documentOptions = documentOptions || {}; var pageSetting = { margins: { top: 1440, right: 1440, bottom: 1440, left: 1440, header: 720, footer: 720, gutter: 0 } }; if (documentOptions.orientation == 'landscape') { Object.assign(pageSetting, { height: 12240, width: 15840, orient: 'landscape' }); } else { Object.assign(pageSetting, { width: 12240, height: 15840, orient: 'portrait' }); } if (documentOptions.margins) { Object.assign(pageSetting, documentOptions.margins); } return pageSetting; }; JSDocx._addFiles = function (zip, htmlSource, pageSetting) { zip.file('[Content_Types].xml', _assets_content_types_xml__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"]); zip.folder('_rels') .file('.rels', _assets_rels_xml__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"]); zip.folder('word') .file('document.xml', _DocxTpl__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"].document(pageSetting)); zip.folder('word') .file('document.xml', JSDocx._renderDocumentFile(pageSetting)) .file('afchunk.mht', JSDocx._getMHTdocument(htmlSource)) .folder('_rels') .file('document.xml.rels', _assets_document_xml_rels__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"]); return zip; }; JSDocx.fromHTMLCode = function (html, options) { var zip = new jszip__WEBPACK_IMPORTED_MODULE_4___default.a(); JSDocx._addFiles(zip, html, JSDocx._createPageSetting(options)); return JSDocx._generateDocument(zip); }; JSDocx.fromHTMLElement = function (element, options, getOuter, isWorkingElement) { if (typeof element == 'string') { element = _HTML5_Dom__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"].ShareInstance.$(element); } if (!element) throw new Error('@param element must be HTMLElement'); var preRender; if (!isWorkingElement) { preRender = _HTML5_Dom__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"].ShareInstance._('div'); preRender.addStyle({ position: 'fixed', top: '0', left: '0', zIndex: '-10000', opacity: '0' }).addTo(document.body); Array.prototype.forEach.call(element.childNodes, function (e) { if (e.tagName != 'script') preRender.addChild(e.cloneNode(true)); }); } else { preRender = element; } _HTML5_Dom__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"].ShareInstance.$('script', preRender, function (e) { e.parentElement.removeChild(e); return false; }); var imageTask = []; _HTML5_Dom__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"].ShareInstance.$('img', preRender, function (e) { if (e.src && !e.src.match(/data:/)) { var task = _HTML5_Dom__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"].imageToCanvas(e).then(function (canvas) { var newSrc = canvas.toDataURL(); e.src = newSrc; }); imageTask.push(task); } return false; }); _HTML5_Dom__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"].ShareInstance.$('svg', preRender, function (e) { var task = _HTML5_Svg__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"].svgToCanvas(e).then(function (canvas) { var newSrc = canvas.toDataURL(); var image = _HTML5_Dom__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"].ShareInstance._('img'); image.src = newSrc; _HTML5_Dom__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"].ShareInstance.$(e).selfReplace(image); }); imageTask.push(task); return false; }); return Promise.all(imageTask).then(function () { var code; if (getOuter) { code = preRender.outerHTML; if (!code) { var temp = document.createElement('div'); temp.addChild(preRender); code = temp.innerHTML; } } else { code = preRender.innerHTML; } return JSDocx.fromHTMLCode(code, options); }); }; /* harmony default export */ __webpack_exports__["a"] = (JSDocx); /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(11), __webpack_require__(13).Buffer)) /***/ }), /* 67 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony default export */ __webpack_exports__["a"] = ("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\r\n<Types xmlns=\"http://schemas.openxmlformats.org/package/2006/content-types\">\r\n <Default Extension=\"rels\" ContentType=\r\n \"application/vnd.openxmlformats-package.relationships+xml\" />\r\n <Override PartName=\"/word/document.xml\" ContentType=\r\n \"application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml\"/>\r\n <Override PartName=\"/word/afchunk.mht\" ContentType=\"message/rfc822\"/>\r\n</Types>\r\n"); /***/ }), /* 68 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony default export */ __webpack_exports__["a"] = ("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\r\n<Relationships xmlns=\"http://schemas.openxmlformats.org/package/2006/relationships\">\r\n <Relationship\r\n Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument\"\r\n Target=\"/word/document.xml\" Id=\"R09c83fafc067488e\" />\r\n</Relationships>\r\n"); /***/ }), /* 69 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony default export */ __webpack_exports__["a"] = ("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\r\n<Relationships xmlns=\"http://schemas.openxmlformats.org/package/2006/relationships\">\r\n <Relationship Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/aFChunk\"\r\n Target=\"/word/afchunk.mht\" Id=\"htmlChunk\" />\r\n</Relationships>\r\n"); /***/ }), /* 70 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, '__esModule', { value: true }); /* eslint max-len: 0 */ // This is a trick taken from Esprima. It turns out that, on // non-Chrome browsers, to check whether a string is in a set, a // predicate containing a big ugly `switch` statement is faster than // a regular expression, and on Chrome the two are about on par. // This function uses `eval` (non-lexical) to produce such a // predicate from a space-separated string of words. // // It starts by sorting the words by length. function makePredicate(words) { words = words.split(" "); return function (str) { return words.indexOf(str) >= 0; }; } // Reserved word lists for various dialects of the language var reservedWords = { 6: makePredicate("enum await"), strict: makePredicate("implements interface let package private protected public static yield"), strictBind: makePredicate("eval arguments") }; // And the keywords var isKeyword = makePredicate("break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this let const class extends export import yield super"); // ## Character categories // Big ugly regular expressions that match characters in the // whitespace, identifier, and identifier-start categories. These // are only applied when a character is found to actually have a // code point above 128. // Generated by `bin/generate-identifier-regex.js`. var nonASCIIidentifierStartChars = "\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC"; var nonASCIIidentifierChars = "\u200C\u200D\xB7\u0300-\u036F\u0387\u0483-\u0487\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u0669\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u06F0-\u06F9\u0711\u0730-\u074A\u07A6-\u07B0\u07C0-\u07C9\u07EB-\u07F3\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D4-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0966-\u096F\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09E6-\u09EF\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A66-\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AE6-\u0AEF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B66-\u0B6F\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0CE6-\u0CEF\u0D01-\u0D03\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D66-\u0D6F\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0E50-\u0E59\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0ED0-\u0ED9\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1040-\u1049\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F-\u109D\u135D-\u135F\u1369-\u1371\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u18A9\u1920-\u192B\u1930-\u193B\u1946-\u194F\u19D0-\u19DA\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AB0-\u1ABD\u1B00-\u1B04\u1B34-\u1B44\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BB0-\u1BB9\u1BE6-\u1BF3\u1C24-\u1C37\u1C40-\u1C49\u1C50-\u1C59\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF8\u1CF9\u1DC0-\u1DF5\u1DFB-\u1DFF\u203F\u2040\u2054\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA620-\uA629\uA66F\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F1\uA900-\uA909\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9D0-\uA9D9\uA9E5\uA9F0-\uA9F9\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA50-\uAA59\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uABF0-\uABF9\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFF10-\uFF19\uFF3F"; var nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]"); var nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]"); nonASCIIidentifierStartChars = nonASCIIidentifierChars = null; // These are a run-length and offset encoded representation of the // >0xffff code points that are a valid part of identifiers. The // offset starts at 0x10000, and each pair of numbers represents an // offset to the next range, and then a size of the range. They were // generated by `bin/generate-identifier-regex.js`. // eslint-disable-next-line comma-spacing var astralIdentifierStartCodes = [0, 11, 2, 25, 2, 18, 2, 1, 2, 14, 3, 13, 35, 122, 70, 52, 268, 28, 4, 48, 48, 31, 17, 26, 6, 37, 11, 29, 3, 35, 5, 7, 2, 4, 43, 157, 19, 35, 5, 35, 5, 39, 9, 51, 157, 310, 10, 21, 11, 7, 153, 5, 3, 0, 2, 43, 2, 1, 4, 0, 3, 22, 11, 22, 10, 30, 66, 18, 2, 1, 11, 21, 11, 25, 71, 55, 7, 1, 65, 0, 16, 3, 2, 2, 2, 26, 45, 28, 4, 28, 36, 7, 2, 27, 28, 53, 11, 21, 11, 18, 14, 17, 111, 72, 56, 50, 14, 50, 785, 52, 76, 44, 33, 24, 27, 35, 42, 34, 4, 0, 13, 47, 15, 3, 22, 0, 2, 0, 36, 17, 2, 24, 85, 6, 2, 0, 2, 3, 2, 14, 2, 9, 8, 46, 39, 7, 3, 1, 3, 21, 2, 6, 2, 1, 2, 4, 4, 0, 19, 0, 13, 4, 159, 52, 19, 3, 54, 47, 21, 1, 2, 0, 185, 46, 42, 3, 37, 47, 21, 0, 60, 42, 86, 25, 391, 63, 32, 0, 449, 56, 264, 8, 2, 36, 18, 0, 50, 29, 881, 921, 103, 110, 18, 195, 2749, 1070, 4050, 582, 8634, 568, 8, 30, 114, 29, 19, 47, 17, 3, 32, 20, 6, 18, 881, 68, 12, 0, 67, 12, 65, 0, 32, 6124, 20, 754, 9486, 1, 3071, 106, 6, 12, 4, 8, 8, 9, 5991, 84, 2, 70, 2, 1, 3, 0, 3, 1, 3, 3, 2, 11, 2, 0, 2, 6, 2, 64, 2, 3, 3, 7, 2, 6, 2, 27, 2, 3, 2, 4, 2, 0, 4, 6, 2, 339, 3, 24, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 7, 4149, 196, 60, 67, 1213, 3, 2, 26, 2, 1, 2, 0, 3, 0, 2, 9, 2, 3, 2, 0, 2, 0, 7, 0, 5, 0, 2, 0, 2, 0, 2, 2, 2, 1, 2, 0, 3, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 1, 2, 0, 3, 3, 2, 6, 2, 3, 2, 3, 2, 0, 2, 9, 2, 16, 6, 2, 2, 4, 2, 16, 4421, 42710, 42, 4148, 12, 221, 3, 5761, 10591, 541]; // eslint-disable-next-line comma-spacing var astralIdentifierCodes = [509, 0, 227, 0, 150, 4, 294, 9, 1368, 2, 2, 1, 6, 3, 41, 2, 5, 0, 166, 1, 1306, 2, 54, 14, 32, 9, 16, 3, 46, 10, 54, 9, 7, 2, 37, 13, 2, 9, 52, 0, 13, 2, 49, 13, 10, 2, 4, 9, 83, 11, 7, 0, 161, 11, 6, 9, 7, 3, 57, 0, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 193, 17, 10, 9, 87, 19, 13, 9, 214, 6, 3, 8, 28, 1, 83, 16, 16, 9, 82, 12, 9, 9, 84, 14, 5, 9, 423, 9, 838, 7, 2, 7, 17, 9, 57, 21, 2, 13, 19882, 9, 135, 4, 60, 6, 26, 9, 1016, 45, 17, 3, 19723, 1, 5319, 4, 4, 5, 9, 7, 3, 6, 31, 3, 149, 2, 1418, 49, 513, 54, 5, 49, 9, 0, 15, 0, 23, 4, 2, 14, 1361, 6, 2, 16, 3, 6, 2, 1, 2, 4, 2214, 6, 110, 6, 6, 9, 792487, 239]; // This has a complexity linear to the value of the code. The // assumption is that looking up astral identifier characters is // rare. function isInAstralSet(code, set) { var pos = 0x10000; for (var i = 0; i < set.length; i += 2) { pos += set[i]; if (pos > code) return false; pos += set[i + 1]; if (pos >= code) return true; } } // Test whether a given character code starts an identifier. function isIdentifierStart(code) { if (code < 65) return code === 36; if (code < 91) return true; if (code < 97) return code === 95; if (code < 123) return true; if (code <= 0xffff) return code >= 0xaa && nonASCIIidentifierStart.test(String.fromCharCode(code)); return isInAstralSet(code, astralIdentifierStartCodes); } // Test whether a given character is part of an identifier. function isIdentifierChar(code) { if (code < 48) return code === 36; if (code < 58) return true; if (code < 65) return false; if (code < 91) return true; if (code < 97) return code === 95; if (code < 123) return true; if (code <= 0xffff) return code >= 0xaa && nonASCIIidentifier.test(String.fromCharCode(code)); return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes); } // A second optional argument can be given to further configure var defaultOptions = { // Source type ("script" or "module") for different semantics sourceType: "script", // Source filename. sourceFilename: undefined, // Line from which to start counting source. Useful for // integration with other tools. startLine: 1, // When enabled, a return at the top level is not considered an // error. allowReturnOutsideFunction: false, // When enabled, import/export statements are not constrained to // appearing at the top of the program. allowImportExportEverywhere: false, // TODO allowSuperOutsideMethod: false, // An array of plugins to enable plugins: [], // TODO strictMode: null }; // Interpret and default an options object function getOptions(opts) { var options = {}; for (var key in defaultOptions) { options[key] = opts && key in opts ? opts[key] : defaultOptions[key]; } return options; } var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; var classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }; var inherits = function (subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }; var possibleConstructorReturn = function (self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }; // ## Token types // The assignment of fine-grained, information-carrying type objects // allows the tokenizer to store the information it has about a // token in a way that is very cheap for the parser to look up. // All token type variables start with an underscore, to make them // easy to recognize. // The `beforeExpr` property is used to disambiguate between regular // expressions and divisions. It is set on all token types that can // be followed by an expression (thus, a slash after them would be a // regular expression). // // `isLoop` marks a keyword as starting a loop, which is important // to know when parsing a label, in order to allow or disallow // continue jumps to that label. var beforeExpr = true; var startsExpr = true; var isLoop = true; var isAssign = true; var prefix = true; var postfix = true; var TokenType = function TokenType(label) { var conf = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; classCallCheck(this, TokenType); this.label = label; this.keyword = conf.keyword; this.beforeExpr = !!conf.beforeExpr; this.startsExpr = !!conf.startsExpr; this.rightAssociative = !!conf.rightAssociative; this.isLoop = !!conf.isLoop; this.isAssign = !!conf.isAssign; this.prefix = !!conf.prefix; this.postfix = !!conf.postfix; this.binop = conf.binop || null; this.updateContext = null; }; var KeywordTokenType = function (_TokenType) { inherits(KeywordTokenType, _TokenType); function KeywordTokenType(name) { var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; classCallCheck(this, KeywordTokenType); options.keyword = name; return possibleConstructorReturn(this, _TokenType.call(this, name, options)); } return KeywordTokenType; }(TokenType); var BinopTokenType = function (_TokenType2) { inherits(BinopTokenType, _TokenType2); function BinopTokenType(name, prec) { classCallCheck(this, BinopTokenType); return possibleConstructorReturn(this, _TokenType2.call(this, name, { beforeExpr: beforeExpr, binop: prec })); } return BinopTokenType; }(TokenType); var types = { num: new TokenType("num", { startsExpr: startsExpr }), regexp: new TokenType("regexp", { startsExpr: startsExpr }), string: new TokenType("string", { startsExpr: startsExpr }), name: new TokenType("name", { startsExpr: startsExpr }), eof: new TokenType("eof"), // Punctuation token types. bracketL: new TokenType("[", { beforeExpr: beforeExpr, startsExpr: startsExpr }), bracketR: new TokenType("]"), braceL: new TokenType("{", { beforeExpr: beforeExpr, startsExpr: startsExpr }), braceBarL: new TokenType("{|", { beforeExpr: beforeExpr, startsExpr: startsExpr }), braceR: new TokenType("}"), braceBarR: new TokenType("|}"), parenL: new TokenType("(", { beforeExpr: beforeExpr, startsExpr: startsExpr }), parenR: new TokenType(")"), comma: new TokenType(",", { beforeExpr: beforeExpr }), semi: new TokenType(";", { beforeExpr: beforeExpr }), colon: new TokenType(":", { beforeExpr: beforeExpr }), doubleColon: new TokenType("::", { beforeExpr: beforeExpr }), dot: new TokenType("."), question: new TokenType("?", { beforeExpr: beforeExpr }), arrow: new TokenType("=>", { beforeExpr: beforeExpr }), template: new TokenType("template"), ellipsis: new TokenType("...", { beforeExpr: beforeExpr }), backQuote: new TokenType("`", { startsExpr: startsExpr }), dollarBraceL: new TokenType("${", { beforeExpr: beforeExpr, startsExpr: startsExpr }), at: new TokenType("@"), // Operators. These carry several kinds of properties to help the // parser use them properly (the presence of these properties is // what categorizes them as operators). // // `binop`, when present, specifies that this operator is a binary // operator, and will refer to its precedence. // // `prefix` and `postfix` mark the operator as a prefix or postfix // unary operator. // // `isAssign` marks all of `=`, `+=`, `-=` etcetera, which act as // binary operators with a very low precedence, that should result // in AssignmentExpression nodes. eq: new TokenType("=", { beforeExpr: beforeExpr, isAssign: isAssign }), assign: new TokenType("_=", { beforeExpr: beforeExpr, isAssign: isAssign }), incDec: new TokenType("++/--", { prefix: prefix, postfix: postfix, startsExpr: startsExpr }), prefix: new TokenType("prefix", { beforeExpr: beforeExpr, prefix: prefix, startsExpr: startsExpr }), logicalOR: new BinopTokenType("||", 1), logicalAND: new BinopTokenType("&&", 2), bitwiseOR: new BinopTokenType("|", 3), bitwiseXOR: new BinopTokenType("^", 4), bitwiseAND: new BinopTokenType("&", 5), equality: new BinopTokenType("==/!=", 6), relational: new BinopTokenType("</>", 7), bitShift: new BinopTokenType("<</>>", 8), plusMin: new TokenType("+/-", { beforeExpr: beforeExpr, binop: 9, prefix: prefix, startsExpr: startsExpr }), modulo: new BinopTokenType("%", 10), star: new BinopTokenType("*", 10), slash: new BinopTokenType("/", 10), exponent: new TokenType("**", { beforeExpr: beforeExpr, binop: 11, rightAssociative: true }) }; var keywords = { "break": new KeywordTokenType("break"), "case": new KeywordTokenType("case", { beforeExpr: beforeExpr }), "catch": new KeywordTokenType("catch"), "continue": new KeywordTokenType("continue"), "debugger": new KeywordTokenType("debugger"), "default": new KeywordTokenType("default", { beforeExpr: beforeExpr }), "do": new KeywordTokenType("do", { isLoop: isLoop, beforeExpr: beforeExpr }), "else": new KeywordTokenType("else", { beforeExpr: beforeExpr }), "finally": new KeywordTokenType("finally"), "for": new KeywordTokenType("for", { isLoop: isLoop }), "function": new KeywordTokenType("function", { startsExpr: startsExpr }), "if": new KeywordTokenType("if"), "return": new KeywordTokenType("return", { beforeExpr: beforeExpr }), "switch": new KeywordTokenType("switch"), "throw": new KeywordTokenType("throw", { beforeExpr: beforeExpr }), "try": new KeywordTokenType("try"), "var": new KeywordTokenType("var"), "let": new KeywordTokenType("let"), "const": new KeywordTokenType("const"), "while": new KeywordTokenType("while", { isLoop: isLoop }), "with": new KeywordTokenType("with"), "new": new KeywordTokenType("new", { beforeExpr: beforeExpr, startsExpr: startsExpr }), "this": new KeywordTokenType("this", { startsExpr: startsExpr }), "super": new KeywordTokenType("super", { startsExpr: startsExpr }), "class": new KeywordTokenType("class"), "extends": new KeywordTokenType("extends", { beforeExpr: beforeExpr }), "export": new KeywordTokenType("export"), "import": new KeywordTokenType("import", { startsExpr: startsExpr }), "yield": new KeywordTokenType("yield", { beforeExpr: beforeExpr, startsExpr: startsExpr }), "null": new KeywordTokenType("null", { startsExpr: startsExpr }), "true": new KeywordTokenType("true", { startsExpr: startsExpr }), "false": new KeywordTokenType("false", { startsExpr: startsExpr }), "in": new KeywordTokenType("in", { beforeExpr: beforeExpr, binop: 7 }), "instanceof": new KeywordTokenType("instanceof", { beforeExpr: beforeExpr, binop: 7 }), "typeof": new KeywordTokenType("typeof", { beforeExpr: beforeExpr, prefix: prefix, startsExpr: startsExpr }), "void": new KeywordTokenType("void", { beforeExpr: beforeExpr, prefix: prefix, startsExpr: startsExpr }), "delete": new KeywordTokenType("delete", { beforeExpr: beforeExpr, prefix: prefix, startsExpr: startsExpr }) }; // Map keyword names to token types. Object.keys(keywords).forEach(function (name) { types["_" + name] = keywords[name]; }); // Matches a whole line break (where CRLF is considered a single // line break). Used to count lines. var lineBreak = /\r\n?|\n|\u2028|\u2029/; var lineBreakG = new RegExp(lineBreak.source, "g"); function isNewLine(code) { return code === 10 || code === 13 || code === 0x2028 || code === 0x2029; } var nonASCIIwhitespace = /[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/; // The algorithm used to determine whether a regexp can appear at a // given point in the program is loosely based on sweet.js' approach. // See https://github.com/mozilla/sweet.js/wiki/design var TokContext = function TokContext(token, isExpr, preserveSpace, override) { classCallCheck(this, TokContext); this.token = token; this.isExpr = !!isExpr; this.preserveSpace = !!preserveSpace; this.override = override; }; var types$1 = { braceStatement: new TokContext("{", false), braceExpression: new TokContext("{", true), templateQuasi: new TokContext("${", true), parenStatement: new TokContext("(", false), parenExpression: new TokContext("(", true), template: new TokContext("`", true, true, function (p) { return p.readTmplToken(); }), functionExpression: new TokContext("function", true) }; // Token-specific context update code types.parenR.updateContext = types.braceR.updateContext = function () { if (this.state.context.length === 1) { this.state.exprAllowed = true; return; } var out = this.state.context.pop(); if (out === types$1.braceStatement && this.curContext() === types$1.functionExpression) { this.state.context.pop(); this.state.exprAllowed = false; } else if (out === types$1.templateQuasi) { this.state.exprAllowed = true; } else { this.state.exprAllowed = !out.isExpr; } }; types.name.updateContext = function (prevType) { this.state.exprAllowed = false; if (prevType === types._let || prevType === types._const || prevType === types._var) { if (lineBreak.test(this.input.slice(this.state.end))) { this.state.exprAllowed = true; } } }; types.braceL.updateContext = function (prevType) { this.state.context.push(this.braceIsBlock(prevType) ? types$1.braceStatement : types$1.braceExpression); this.state.exprAllowed = true; }; types.dollarBraceL.updateContext = function () { this.state.context.push(types$1.templateQuasi); this.state.exprAllowed = true; }; types.parenL.updateContext = function (prevType) { var statementParens = prevType === types._if || prevType === types._for || prevType === types._with || prevType === types._while; this.state.context.push(statementParens ? types$1.parenStatement : types$1.parenExpression); this.state.exprAllowed = true; }; types.incDec.updateContext = function () { // tokExprAllowed stays unchanged }; types._function.updateContext = function () { if (this.curContext() !== types$1.braceStatement) { this.state.context.push(types$1.functionExpression); } this.state.exprAllowed = false; }; types.backQuote.updateContext = function () { if (this.curContext() === types$1.template) { this.state.context.pop(); } else { this.state.context.push(types$1.template); } this.state.exprAllowed = false; }; // These are used when `options.locations` is on, for the // `startLoc` and `endLoc` properties. var Position = function Position(line, col) { classCallCheck(this, Position); this.line = line; this.column = col; }; var SourceLocation = function SourceLocation(start, end) { classCallCheck(this, SourceLocation); this.start = start; this.end = end; }; // The `getLineInfo` function is mostly useful when the // `locations` option is off (for performance reasons) and you // want to find the line/column position for a given character // offset. `input` should be the code string that the offset refers // into. function getLineInfo(input, offset) { for (var line = 1, cur = 0;;) { lineBreakG.lastIndex = cur; var match = lineBreakG.exec(input); if (match && match.index < offset) { ++line; cur = match.index + match[0].length; } else { return new Position(line, offset - cur); } } } var State = function () { function State() { classCallCheck(this, State); } State.prototype.init = function init(options, input) { this.strict = options.strictMode === false ? false : options.sourceType === "module"; this.input = input; this.potentialArrowAt = -1; this.inMethod = this.inFunction = this.inGenerator = this.inAsync = this.inPropertyName = this.inType = this.inClassProperty = this.noAnonFunctionType = false; this.labels = []; this.decorators = []; this.tokens = []; this.comments = []; this.trailingComments = []; this.leadingComments = []; this.commentStack = []; this.pos = this.lineStart = 0; this.curLine = options.startLine; this.type = types.eof; this.value = null; this.start = this.end = this.pos; this.startLoc = this.endLoc = this.curPosition(); this.lastTokEndLoc = this.lastTokStartLoc = null; this.lastTokStart = this.lastTokEnd = this.pos; this.context = [types$1.braceStatement]; this.exprAllowed = true; this.containsEsc = this.containsOctal = false; this.octalPosition = null; this.invalidTemplateEscapePosition = null; this.exportedIdentifiers = []; return this; }; // TODO // TODO // Used to signify the start of a potential arrow function // Flags to track whether we are in a function, a generator. // Labels in scope. // Leading decorators. // Token store. // Comment store. // Comment attachment store // The current position of the tokenizer in the input. // Properties of the current token: // Its type // For tokens that include more information than their type, the value // Its start and end offset // And, if locations are used, the {line, column} object // corresponding to those offsets // Position information for the previous token // The context stack is used to superficially track syntactic // context to predict whether a regular expression is allowed in a // given position. // Used to signal to callers of `readWord1` whether the word // contained any escape sequences. This is needed because words with // escape sequences must not be interpreted as keywords. // TODO // Names of exports store. `default` is stored as a name for both // `export default foo;` and `export { foo as default };`. State.prototype.curPosition = function curPosition() { return new Position(this.curLine, this.pos - this.lineStart); }; State.prototype.clone = function clone(skipArrays) { var state = new State(); for (var key in this) { var val = this[key]; if ((!skipArrays || key === "context") && Array.isArray(val)) { val = val.slice(); } state[key] = val; } return state; }; return State; }(); // Object type used to represent tokens. Note that normally, tokens // simply exist as properties on the parser object. This is only // used for the onToken callback and the external tokenizer. var Token = function Token(state) { classCallCheck(this, Token); this.type = state.type; this.value = state.value; this.start = state.start; this.end = state.end; this.loc = new SourceLocation(state.startLoc, state.endLoc); }; // ## Tokenizer function codePointToString(code) { // UTF-16 Decoding if (code <= 0xFFFF) { return String.fromCharCode(code); } else { return String.fromCharCode((code - 0x10000 >> 10) + 0xD800, (code - 0x10000 & 1023) + 0xDC00); } } var Tokenizer = function () { function Tokenizer(options, input) { classCallCheck(this, Tokenizer); this.state = new State(); this.state.init(options, input); } // Move to the next token Tokenizer.prototype.next = function next() { if (!this.isLookahead) { this.state.tokens.push(new Token(this.state)); } this.state.lastTokEnd = this.state.end; this.state.lastTokStart = this.state.start; this.state.lastTokEndLoc = this.state.endLoc; this.state.lastTokStartLoc = this.state.startLoc; this.nextToken(); }; // TODO Tokenizer.prototype.eat = function eat(type) { if (this.match(type)) { this.next(); return true; } else { return false; } }; // TODO Tokenizer.prototype.match = function match(type) { return this.state.type === type; }; // TODO Tokenizer.prototype.isKeyword = function isKeyword$$1(word) { return isKeyword(word); }; // TODO Tokenizer.prototype.lookahead = function lookahead() { var old = this.state; this.state = old.clone(true); this.isLookahead = true; this.next(); this.isLookahead = false; var curr = this.state.clone(true); this.state = old; return curr; }; // Toggle strict mode. Re-reads the next number or string to please // pedantic tests (`"use strict"; 010;` should fail). Tokenizer.prototype.setStrict = function setStrict(strict) { this.state.strict = strict; if (!this.match(types.num) && !this.match(types.string)) return; this.state.pos = this.state.start; while (this.state.pos < this.state.lineStart) { this.state.lineStart = this.input.lastIndexOf("\n", this.state.lineStart - 2) + 1; --this.state.curLine; } this.nextToken(); }; Tokenizer.prototype.curContext = function curContext() { return this.state.context[this.state.context.length - 1]; }; // Read a single token, updating the parser object's token-related // properties. Tokenizer.prototype.nextToken = function nextToken() { var curContext = this.curContext(); if (!curContext || !curContext.preserveSpace) this.skipSpace(); this.state.containsOctal = false; this.state.octalPosition = null; this.state.start = this.state.pos; this.state.startLoc = this.state.curPosition(); if (this.state.pos >= this.input.length) return this.finishToken(types.eof); if (curContext.override) { return curContext.override(this); } else { return this.readToken(this.fullCharCodeAtPos()); } }; Tokenizer.prototype.readToken = function readToken(code) { // Identifier or keyword. '\uXXXX' sequences are allowed in // identifiers, so '\' also dispatches to that. if (isIdentifierStart(code) || code === 92 /* '\' */) { return this.readWord(); } else { return this.getTokenFromCode(code); } }; Tokenizer.prototype.fullCharCodeAtPos = function fullCharCodeAtPos() { var code = this.input.charCodeAt(this.state.pos); if (code <= 0xd7ff || code >= 0xe000) return code; var next = this.input.charCodeAt(this.state.pos + 1); return (code << 10) + next - 0x35fdc00; }; Tokenizer.prototype.pushComment = function pushComment(block, text, start, end, startLoc, endLoc) { var comment = { type: block ? "CommentBlock" : "CommentLine", value: text, start: start, end: end, loc: new SourceLocation(startLoc, endLoc) }; if (!this.isLookahead) { this.state.tokens.push(comment); this.state.comments.push(comment); this.addComment(comment); } }; Tokenizer.prototype.skipBlockComment = function skipBlockComment() { var startLoc = this.state.curPosition(); var start = this.state.pos; var end = this.input.indexOf("*/", this.state.pos += 2); if (end === -1) this.raise(this.state.pos - 2, "Unterminated comment"); this.state.pos = end + 2; lineBreakG.lastIndex = start; var match = void 0; while ((match = lineBreakG.exec(this.input)) && match.index < this.state.pos) { ++this.state.curLine; this.state.lineStart = match.index + match[0].length; } this.pushComment(true, this.input.slice(start + 2, end), start, this.state.pos, startLoc, this.state.curPosition()); }; Tokenizer.prototype.skipLineComment = function skipLineComment(startSkip) { var start = this.state.pos; var startLoc = this.state.curPosition(); var ch = this.input.charCodeAt(this.state.pos += startSkip); while (this.state.pos < this.input.length && ch !== 10 && ch !== 13 && ch !== 8232 && ch !== 8233) { ++this.state.pos; ch = this.input.charCodeAt(this.state.pos); } this.pushComment(false, this.input.slice(start + startSkip, this.state.pos), start, this.state.pos, startLoc, this.state.curPosition()); }; // Called at the start of the parse and after every token. Skips // whitespace and comments, and. Tokenizer.prototype.skipSpace = function skipSpace() { loop: while (this.state.pos < this.input.length) { var ch = this.input.charCodeAt(this.state.pos); switch (ch) { case 32:case 160: // ' ' ++this.state.pos; break; case 13: if (this.input.charCodeAt(this.state.pos + 1) === 10) { ++this.state.pos; } case 10:case 8232:case 8233: ++this.state.pos; ++this.state.curLine; this.state.lineStart = this.state.pos; break; case 47: // '/' switch (this.input.charCodeAt(this.state.pos + 1)) { case 42: // '*' this.skipBlockComment(); break; case 47: this.skipLineComment(2); break; default: break loop; } break; default: if (ch > 8 && ch < 14 || ch >= 5760 && nonASCIIwhitespace.test(String.fromCharCode(ch))) { ++this.state.pos; } else { break loop; } } } }; // Called at the end of every token. Sets `end`, `val`, and // maintains `context` and `exprAllowed`, and skips the space after // the token, so that the next one's `start` will point at the // right position. Tokenizer.prototype.finishToken = function finishToken(type, val) { this.state.end = this.state.pos; this.state.endLoc = this.state.curPosition(); var prevType = this.state.type; this.state.type = type; this.state.value = val; this.updateContext(prevType); }; // ### Token reading // This is the function that is called to fetch the next token. It // is somewhat obscure, because it works in character codes rather // than characters, and because operator parsing has been inlined // into it. // // All in the name of speed. // Tokenizer.prototype.readToken_dot = function readToken_dot() { var next = this.input.charCodeAt(this.state.pos + 1); if (next >= 48 && next <= 57) { return this.readNumber(true); } var next2 = this.input.charCodeAt(this.state.pos + 2); if (next === 46 && next2 === 46) { // 46 = dot '.' this.state.pos += 3; return this.finishToken(types.ellipsis); } else { ++this.state.pos; return this.finishToken(types.dot); } }; Tokenizer.prototype.readToken_slash = function readToken_slash() { // '/' if (this.state.exprAllowed) { ++this.state.pos; return this.readRegexp(); } var next = this.input.charCodeAt(this.state.pos + 1); if (next === 61) { return this.finishOp(types.assign, 2); } else { return this.finishOp(types.slash, 1); } }; Tokenizer.prototype.readToken_mult_modulo = function readToken_mult_modulo(code) { // '%*' var type = code === 42 ? types.star : types.modulo; var width = 1; var next = this.input.charCodeAt(this.state.pos + 1); if (next === 42) { // '*' width++; next = this.input.charCodeAt(this.state.pos + 2); type = types.exponent; } if (next === 61) { width++; type = types.assign; } return this.finishOp(type, width); }; Tokenizer.prototype.readToken_pipe_amp = function readToken_pipe_amp(code) { // '|&' var next = this.input.charCodeAt(this.state.pos + 1); if (next === code) return this.finishOp(code === 124 ? types.logicalOR : types.logicalAND, 2); if (next === 61) return this.finishOp(types.assign, 2); if (code === 124 && next === 125 && this.hasPlugin("flow")) return this.finishOp(types.braceBarR, 2); return this.finishOp(code === 124 ? types.bitwiseOR : types.bitwiseAND, 1); }; Tokenizer.prototype.readToken_caret = function readToken_caret() { // '^' var next = this.input.charCodeAt(this.state.pos + 1); if (next === 61) { return this.finishOp(types.assign, 2); } else { return this.finishOp(types.bitwiseXOR, 1); } }; Tokenizer.prototype.readToken_plus_min = function readToken_plus_min(code) { // '+-' var next = this.input.charCodeAt(this.state.pos + 1); if (next === code) { if (next === 45 && this.input.charCodeAt(this.state.pos + 2) === 62 && lineBreak.test(this.input.slice(this.state.lastTokEnd, this.state.pos))) { // A `-->` line comment this.skipLineComment(3); this.skipSpace(); return this.nextToken(); } return this.finishOp(types.incDec, 2); } if (next === 61) { return this.finishOp(types.assign, 2); } else { return this.finishOp(types.plusMin, 1); } }; Tokenizer.prototype.readToken_lt_gt = function readToken_lt_gt(code) { // '<>' var next = this.input.charCodeAt(this.state.pos + 1); var size = 1; if (next === code) { size = code === 62 && this.input.charCodeAt(this.state.pos + 2) === 62 ? 3 : 2; if (this.input.charCodeAt(this.state.pos + size) === 61) return this.finishOp(types.assign, size + 1); return this.finishOp(types.bitShift, size); } if (next === 33 && code === 60 && this.input.charCodeAt(this.state.pos + 2) === 45 && this.input.charCodeAt(this.state.pos + 3) === 45) { if (this.inModule) this.unexpected(); // `<!--`, an XML-style comment that should be interpreted as a line comment this.skipLineComment(4); this.skipSpace(); return this.nextToken(); } if (next === 61) { // <= | >= size = 2; } return this.finishOp(types.relational, size); }; Tokenizer.prototype.readToken_eq_excl = function readToken_eq_excl(code) { // '=!' var next = this.input.charCodeAt(this.state.pos + 1); if (next === 61) return this.finishOp(types.equality, this.input.charCodeAt(this.state.pos + 2) === 61 ? 3 : 2); if (code === 61 && next === 62) { // '=>' this.state.pos += 2; return this.finishToken(types.arrow); } return this.finishOp(code === 61 ? types.eq : types.prefix, 1); }; Tokenizer.prototype.getTokenFromCode = function getTokenFromCode(code) { switch (code) { // The interpretation of a dot depends on whether it is followed // by a digit or another two dots. case 46: // '.' return this.readToken_dot(); // Punctuation tokens. case 40: ++this.state.pos;return this.finishToken(types.parenL); case 41: ++this.state.pos;return this.finishToken(types.parenR); case 59: ++this.state.pos;return this.finishToken(types.semi); case 44: ++this.state.pos;return this.finishToken(types.comma); case 91: ++this.state.pos;return this.finishToken(types.bracketL); case 93: ++this.state.pos;return this.finishToken(types.bracketR); case 123: if (this.hasPlugin("flow") && this.input.charCodeAt(this.state.pos + 1) === 124) { return this.finishOp(types.braceBarL, 2); } else { ++this.state.pos; return this.finishToken(types.braceL); } case 125: ++this.state.pos;return this.finishToken(types.braceR); case 58: if (this.hasPlugin("functionBind") && this.input.charCodeAt(this.state.pos + 1) === 58) { return this.finishOp(types.doubleColon, 2); } else { ++this.state.pos; return this.finishToken(types.colon); } case 63: ++this.state.pos;return this.finishToken(types.question); case 64: ++this.state.pos;return this.finishToken(types.at); case 96: // '`' ++this.state.pos; return this.finishToken(types.backQuote); case 48: // '0' var next = this.input.charCodeAt(this.state.pos + 1); if (next === 120 || next === 88) return this.readRadixNumber(16); // '0x', '0X' - hex number if (next === 111 || next === 79) return this.readRadixNumber(8); // '0o', '0O' - octal number if (next === 98 || next === 66) return this.readRadixNumber(2); // '0b', '0B' - binary number // Anything else beginning with a digit is an integer, octal // number, or float. case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57: // 1-9 return this.readNumber(false); // Quotes produce strings. case 34:case 39: // '"', "'" return this.readString(code); // Operators are parsed inline in tiny state machines. '=' (61) is // often referred to. `finishOp` simply skips the amount of // characters it is given as second argument, and returns a token // of the type given by its first argument. case 47: // '/' return this.readToken_slash(); case 37:case 42: // '%*' return this.readToken_mult_modulo(code); case 124:case 38: // '|&' return this.readToken_pipe_amp(code); case 94: // '^' return this.readToken_caret(); case 43:case 45: // '+-' return this.readToken_plus_min(code); case 60:case 62: // '<>' return this.readToken_lt_gt(code); case 61:case 33: // '=!' return this.readToken_eq_excl(code); case 126: // '~' return this.finishOp(types.prefix, 1); } this.raise(this.state.pos, "Unexpected character '" + codePointToString(code) + "'"); }; Tokenizer.prototype.finishOp = function finishOp(type, size) { var str = this.input.slice(this.state.pos, this.state.pos + size); this.state.pos += size; return this.finishToken(type, str); }; Tokenizer.prototype.readRegexp = function readRegexp() { var start = this.state.pos; var escaped = void 0, inClass = void 0; for (;;) { if (this.state.pos >= this.input.length) this.raise(start, "Unterminated regular expression"); var ch = this.input.charAt(this.state.pos); if (lineBreak.test(ch)) { this.raise(start, "Unterminated regular expression"); } if (escaped) { escaped = false; } else { if (ch === "[") { inClass = true; } else if (ch === "]" && inClass) { inClass = false; } else if (ch === "/" && !inClass) { break; } escaped = ch === "\\"; } ++this.state.pos; } var content = this.input.slice(start, this.state.pos); ++this.state.pos; // Need to use `readWord1` because '\uXXXX' sequences are allowed // here (don't ask). var mods = this.readWord1(); if (mods) { var validFlags = /^[gmsiyu]*$/; if (!validFlags.test(mods)) this.raise(start, "Invalid regular expression flag"); } return this.finishToken(types.regexp, { pattern: content, flags: mods }); }; // Read an integer in the given radix. Return null if zero digits // were read, the integer value otherwise. When `len` is given, this // will return `null` unless the integer has exactly `len` digits. Tokenizer.prototype.readInt = function readInt(radix, len) { var start = this.state.pos; var total = 0; for (var i = 0, e = len == null ? Infinity : len; i < e; ++i) { var code = this.input.charCodeAt(this.state.pos); var val = void 0; if (code >= 97) { val = code - 97 + 10; // a } else if (code >= 65) { val = code - 65 + 10; // A } else if (code >= 48 && code <= 57) { val = code - 48; // 0-9 } else { val = Infinity; } if (val >= radix) break; ++this.state.pos; total = total * radix + val; } if (this.state.pos === start || len != null && this.state.pos - start !== len) return null; return total; }; Tokenizer.prototype.readRadixNumber = function readRadixNumber(radix) { this.state.pos += 2; // 0x var val = this.readInt(radix); if (val == null) this.raise(this.state.start + 2, "Expected number in radix " + radix); if (isIdentifierStart(this.fullCharCodeAtPos())) this.raise(this.state.pos, "Identifier directly after number"); return this.finishToken(types.num, val); }; // Read an integer, octal integer, or floating-point number. Tokenizer.prototype.readNumber = function readNumber(startsWithDot) { var start = this.state.pos; var octal = this.input.charCodeAt(start) === 48; // '0' var isFloat = false; if (!startsWithDot && this.readInt(10) === null) this.raise(start, "Invalid number"); if (octal && this.state.pos == start + 1) octal = false; // number === 0 var next = this.input.charCodeAt(this.state.pos); if (next === 46 && !octal) { // '.' ++this.state.pos; this.readInt(10); isFloat = true; next = this.input.charCodeAt(this.state.pos); } if ((next === 69 || next === 101) && !octal) { // 'eE' next = this.input.charCodeAt(++this.state.pos); if (next === 43 || next === 45) ++this.state.pos; // '+-' if (this.readInt(10) === null) this.raise(start, "Invalid number"); isFloat = true; } if (isIdentifierStart(this.fullCharCodeAtPos())) this.raise(this.state.pos, "Identifier directly after number"); var str = this.input.slice(start, this.state.pos); var val = void 0; if (isFloat) { val = parseFloat(str); } else if (!octal || str.length === 1) { val = parseInt(str, 10); } else if (this.state.strict) { this.raise(start, "Invalid number"); } else if (/[89]/.test(str)) { val = parseInt(str, 10); } else { val = parseInt(str, 8); } return this.finishToken(types.num, val); }; // Read a string value, interpreting backslash-escapes. Tokenizer.prototype.readCodePoint = function readCodePoint(throwOnInvalid) { var ch = this.input.charCodeAt(this.state.pos); var code = void 0; if (ch === 123) { // '{' var codePos = ++this.state.pos; code = this.readHexChar(this.input.indexOf("}", this.state.pos) - this.state.pos, throwOnInvalid); ++this.state.pos; if (code === null) { --this.state.invalidTemplateEscapePosition; // to point to the '\'' instead of the 'u' } else if (code > 0x10FFFF) { if (throwOnInvalid) { this.raise(codePos, "Code point out of bounds"); } else { this.state.invalidTemplateEscapePosition = codePos - 2; return null; } } } else { code = this.readHexChar(4, throwOnInvalid); } return code; }; Tokenizer.prototype.readString = function readString(quote) { var out = "", chunkStart = ++this.state.pos; for (;;) { if (this.state.pos >= this.input.length) this.raise(this.state.start, "Unterminated string constant"); var ch = this.input.charCodeAt(this.state.pos); if (ch === quote) break; if (ch === 92) { // '\' out += this.input.slice(chunkStart, this.state.pos); out += this.readEscapedChar(false); chunkStart = this.state.pos; } else { if (isNewLine(ch)) this.raise(this.state.start, "Unterminated string constant"); ++this.state.pos; } } out += this.input.slice(chunkStart, this.state.pos++); return this.finishToken(types.string, out); }; // Reads template string tokens. Tokenizer.prototype.readTmplToken = function readTmplToken() { var out = "", chunkStart = this.state.pos, containsInvalid = false; for (;;) { if (this.state.pos >= this.input.length) this.raise(this.state.start, "Unterminated template"); var ch = this.input.charCodeAt(this.state.pos); if (ch === 96 || ch === 36 && this.input.charCodeAt(this.state.pos + 1) === 123) { // '`', '${' if (this.state.pos === this.state.start && this.match(types.template)) { if (ch === 36) { this.state.pos += 2; return this.finishToken(types.dollarBraceL); } else { ++this.state.pos; return this.finishToken(types.backQuote); } } out += this.input.slice(chunkStart, this.state.pos); return this.finishToken(types.template, containsInvalid ? null : out); } if (ch === 92) { // '\' out += this.input.slice(chunkStart, this.state.pos); var escaped = this.readEscapedChar(true); if (escaped === null) { containsInvalid = true; } else { out += escaped; } chunkStart = this.state.pos; } else if (isNewLine(ch)) { out += this.input.slice(chunkStart, this.state.pos); ++this.state.pos; switch (ch) { case 13: if (this.input.charCodeAt(this.state.pos) === 10) ++this.state.pos; case 10: out += "\n"; break; default: out += String.fromCharCode(ch); break; } ++this.state.curLine; this.state.lineStart = this.state.pos; chunkStart = this.state.pos; } else { ++this.state.pos; } } }; // Used to read escaped characters Tokenizer.prototype.readEscapedChar = function readEscapedChar(inTemplate) { var throwOnInvalid = !inTemplate; var ch = this.input.charCodeAt(++this.state.pos); ++this.state.pos; switch (ch) { case 110: return "\n"; // 'n' -> '\n' case 114: return "\r"; // 'r' -> '\r' case 120: { // 'x' var code = this.readHexChar(2, throwOnInvalid); return code === null ? null : String.fromCharCode(code); } case 117: { // 'u' var _code = this.readCodePoint(throwOnInvalid); return _code === null ? null : codePointToString(_code); } case 116: return "\t"; // 't' -> '\t' case 98: return "\b"; // 'b' -> '\b' case 118: return "\x0B"; // 'v' -> '\u000b' case 102: return "\f"; // 'f' -> '\f' case 13: if (this.input.charCodeAt(this.state.pos) === 10) ++this.state.pos; // '\r\n' case 10: // ' \n' this.state.lineStart = this.state.pos; ++this.state.curLine; return ""; default: if (ch >= 48 && ch <= 55) { var codePos = this.state.pos - 1; var octalStr = this.input.substr(this.state.pos - 1, 3).match(/^[0-7]+/)[0]; var octal = parseInt(octalStr, 8); if (octal > 255) { octalStr = octalStr.slice(0, -1); octal = parseInt(octalStr, 8); } if (octal > 0) { if (inTemplate) { this.state.invalidTemplateEscapePosition = codePos; return null; } else if (this.state.strict) { this.raise(codePos, "Octal literal in strict mode"); } else if (!this.state.containsOctal) { // These properties are only used to throw an error for an octal which occurs // in a directive which occurs prior to a "use strict" directive. this.state.containsOctal = true; this.state.octalPosition = codePos; } } this.state.pos += octalStr.length - 1; return String.fromCharCode(octal); } return String.fromCharCode(ch); } }; // Used to read character escape sequences ('\x', '\u'). Tokenizer.prototype.readHexChar = function readHexChar(len, throwOnInvalid) { var codePos = this.state.pos; var n = this.readInt(16, len); if (n === null) { if (throwOnInvalid) { this.raise(codePos, "Bad character escape sequence"); } else { this.state.pos = codePos - 1; this.state.invalidTemplateEscapePosition = codePos - 1; } } return n; }; // Read an identifier, and return it as a string. Sets `this.state.containsEsc` // to whether the word contained a '\u' escape. // // Incrementally adds only escaped chars, adding other chunks as-is // as a micro-optimization. Tokenizer.prototype.readWord1 = function readWord1() { this.state.containsEsc = false; var word = "", first = true, chunkStart = this.state.pos; while (this.state.pos < this.input.length) { var ch = this.fullCharCodeAtPos(); if (isIdentifierChar(ch)) { this.state.pos += ch <= 0xffff ? 1 : 2; } else if (ch === 92) { // "\" this.state.containsEsc = true; word += this.input.slice(chunkStart, this.state.pos); var escStart = this.state.pos; if (this.input.charCodeAt(++this.state.pos) !== 117) { // "u" this.raise(this.state.pos, "Expecting Unicode escape sequence \\uXXXX"); } ++this.state.pos; var esc = this.readCodePoint(true); if (!(first ? isIdentifierStart : isIdentifierChar)(esc, true)) { this.raise(escStart, "Invalid Unicode escape"); } word += codePointToString(esc); chunkStart = this.state.pos; } else { break; } first = false; } return word + this.input.slice(chunkStart, this.state.pos); }; // Read an identifier or keyword token. Will check for reserved // words when necessary. Tokenizer.prototype.readWord = function readWord() { var word = this.readWord1(); var type = types.name; if (!this.state.containsEsc && this.isKeyword(word)) { type = keywords[word]; } return this.finishToken(type, word); }; Tokenizer.prototype.braceIsBlock = function braceIsBlock(prevType) { if (prevType === types.colon) { var parent = this.curContext(); if (parent === types$1.braceStatement || parent === types$1.braceExpression) { return !parent.isExpr; } } if (prevType === types._return) { return lineBreak.test(this.input.slice(this.state.lastTokEnd, this.state.start)); } if (prevType === types._else || prevType === types.semi || prevType === types.eof || prevType === types.parenR) { return true; } if (prevType === types.braceL) { return this.curContext() === types$1.braceStatement; } return !this.state.exprAllowed; }; Tokenizer.prototype.updateContext = function updateContext(prevType) { var type = this.state.type; var update = void 0; if (type.keyword && prevType === types.dot) { this.state.exprAllowed = false; } else if (update = type.updateContext) { update.call(this, prevType); } else { this.state.exprAllowed = type.beforeExpr; } }; return Tokenizer; }(); var plugins = {}; var frozenDeprecatedWildcardPluginList = ["jsx", "doExpressions", "objectRestSpread", "decorators", "classProperties", "exportExtensions", "asyncGenerators", "functionBind", "functionSent", "dynamicImport", "flow"]; var Parser = function (_Tokenizer) { inherits(Parser, _Tokenizer); function Parser(options, input) { classCallCheck(this, Parser); options = getOptions(options); var _this = possibleConstructorReturn(this, _Tokenizer.call(this, options, input)); _this.options = options; _this.inModule = _this.options.sourceType === "module"; _this.input = input; _this.plugins = _this.loadPlugins(_this.options.plugins); _this.filename = options.sourceFilename; // If enabled, skip leading hashbang line. if (_this.state.pos === 0 && _this.input[0] === "#" && _this.input[1] === "!") { _this.skipLineComment(2); } return _this; } Parser.prototype.isReservedWord = function isReservedWord(word) { if (word === "await") { return this.inModule; } else { return reservedWords[6](word); } }; Parser.prototype.hasPlugin = function hasPlugin(name) { if (this.plugins["*"] && frozenDeprecatedWildcardPluginList.indexOf(name) > -1) { return true; } return !!this.plugins[name]; }; Parser.prototype.extend = function extend(name, f) { this[name] = f(this[name]); }; Parser.prototype.loadAllPlugins = function loadAllPlugins() { var _this2 = this; // ensure flow plugin loads last, also ensure estree is not loaded with * var pluginNames = Object.keys(plugins).filter(function (name) { return name !== "flow" && name !== "estree"; }); pluginNames.push("flow"); pluginNames.forEach(function (name) { var plugin = plugins[name]; if (plugin) plugin(_this2); }); }; Parser.prototype.loadPlugins = function loadPlugins(pluginList) { // TODO: Deprecate "*" option in next major version of Babylon if (pluginList.indexOf("*") >= 0) { this.loadAllPlugins(); return { "*": true }; } var pluginMap = {}; if (pluginList.indexOf("flow") >= 0) { // ensure flow plugin loads last pluginList = pluginList.filter(function (plugin) { return plugin !== "flow"; }); pluginList.push("flow"); } if (pluginList.indexOf("estree") >= 0) { // ensure estree plugin loads first pluginList = pluginList.filter(function (plugin) { return plugin !== "estree"; }); pluginList.unshift("estree"); } for (var _iterator = pluginList, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { var _ref; if (_isArray) { if (_i >= _iterator.length) break; _ref = _iterator[_i++]; } else { _i = _iterator.next(); if (_i.done) break; _ref = _i.value; } var name = _ref; if (!pluginMap[name]) { pluginMap[name] = true; var plugin = plugins[name]; if (plugin) plugin(this); } } return pluginMap; }; Parser.prototype.parse = function parse() { var file = this.startNode(); var program = this.startNode(); this.nextToken(); return this.parseTopLevel(file, program); }; return Parser; }(Tokenizer); var pp = Parser.prototype; // ## Parser utilities // TODO pp.addExtra = function (node, key, val) { if (!node) return; var extra = node.extra = node.extra || {}; extra[key] = val; }; // TODO pp.isRelational = function (op) { return this.match(types.relational) && this.state.value === op; }; // TODO pp.expectRelational = function (op) { if (this.isRelational(op)) { this.next(); } else { this.unexpected(null, types.relational); } }; // Tests whether parsed token is a contextual keyword. pp.isContextual = function (name) { return this.match(types.name) && this.state.value === name; }; // Consumes contextual keyword if possible. pp.eatContextual = function (name) { return this.state.value === name && this.eat(types.name); }; // Asserts that following token is given contextual keyword. pp.expectContextual = function (name, message) { if (!this.eatContextual(name)) this.unexpected(null, message); }; // Test whether a semicolon can be inserted at the current position. pp.canInsertSemicolon = function () { return this.match(types.eof) || this.match(types.braceR) || lineBreak.test(this.input.slice(this.state.lastTokEnd, this.state.start)); }; // TODO pp.isLineTerminator = function () { return this.eat(types.semi) || this.canInsertSemicolon(); }; // Consume a semicolon, or, failing that, see if we are allowed to // pretend that there is a semicolon at this position. pp.semicolon = function () { if (!this.isLineTerminator()) this.unexpected(null, types.semi); }; // Expect a token of a given type. If found, consume it, otherwise, // raise an unexpected token error at given pos. pp.expect = function (type, pos) { return this.eat(type) || this.unexpected(pos, type); }; // Raise an unexpected token error. Can take the expected token type // instead of a message string. pp.unexpected = function (pos) { var messageOrType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "Unexpected token"; if (messageOrType && (typeof messageOrType === "undefined" ? "undefined" : _typeof(messageOrType)) === "object" && messageOrType.label) { messageOrType = "Unexpected token, expected " + messageOrType.label; } this.raise(pos != null ? pos : this.state.start, messageOrType); }; /* eslint max-len: 0 */ var pp$1 = Parser.prototype; // ### Statement parsing // Parse a program. Initializes the parser, reads any number of // statements, and wraps them in a Program node. Optionally takes a // `program` argument. If present, the statements will be appended // to its body instead of creating a new node. pp$1.parseTopLevel = function (file, program) { program.sourceType = this.options.sourceType; this.parseBlockBody(program, true, true, types.eof); file.program = this.finishNode(program, "Program"); file.comments = this.state.comments; file.tokens = this.state.tokens; return this.finishNode(file, "File"); }; var loopLabel = { kind: "loop" }; var switchLabel = { kind: "switch" }; // TODO pp$1.stmtToDirective = function (stmt) { var expr = stmt.expression; var directiveLiteral = this.startNodeAt(expr.start, expr.loc.start); var directive = this.startNodeAt(stmt.start, stmt.loc.start); var raw = this.input.slice(expr.start, expr.end); var val = directiveLiteral.value = raw.slice(1, -1); // remove quotes this.addExtra(directiveLiteral, "raw", raw); this.addExtra(directiveLiteral, "rawValue", val); directive.value = this.finishNodeAt(directiveLiteral, "DirectiveLiteral", expr.end, expr.loc.end); return this.finishNodeAt(directive, "Directive", stmt.end, stmt.loc.end); }; // Parse a single statement. // // If expecting a statement and finding a slash operator, parse a // regular expression literal. This is to handle cases like // `if (foo) /blah/.exec(foo)`, where looking at the previous token // does not help. pp$1.parseStatement = function (declaration, topLevel) { if (this.match(types.at)) { this.parseDecorators(true); } var starttype = this.state.type; var node = this.startNode(); // Most types of statements are recognized by the keyword they // start with. Many are trivial to parse, some require a bit of // complexity. switch (starttype) { case types._break:case types._continue: return this.parseBreakContinueStatement(node, starttype.keyword); case types._debugger: return this.parseDebuggerStatement(node); case types._do: return this.parseDoStatement(node); case types._for: return this.parseForStatement(node); case types._function: if (!declaration) this.unexpected(); return this.parseFunctionStatement(node); case types._class: if (!declaration) this.unexpected(); return this.parseClass(node, true); case types._if: return this.parseIfStatement(node); case types._return: return this.parseReturnStatement(node); case types._switch: return this.parseSwitchStatement(node); case types._throw: return this.parseThrowStatement(node); case types._try: return this.parseTryStatement(node); case types._let: case types._const: if (!declaration) this.unexpected(); // NOTE: falls through to _var case types._var: return this.parseVarStatement(node, starttype); case types._while: return this.parseWhileStatement(node); case types._with: return this.parseWithStatement(node); case types.braceL: return this.parseBlock(); case types.semi: return this.parseEmptyStatement(node); case types._export: case types._import: if (this.hasPlugin("dynamicImport") && this.lookahead().type === types.parenL) break; if (!this.options.allowImportExportEverywhere) { if (!topLevel) { this.raise(this.state.start, "'import' and 'export' may only appear at the top level"); } if (!this.inModule) { this.raise(this.state.start, "'import' and 'export' may appear only with 'sourceType: \"module\"'"); } } return starttype === types._import ? this.parseImport(node) : this.parseExport(node); case types.name: if (this.state.value === "async") { // peek ahead and see if next token is a function var state = this.state.clone(); this.next(); if (this.match(types._function) && !this.canInsertSemicolon()) { this.expect(types._function); return this.parseFunction(node, true, false, true); } else { this.state = state; } } } // If the statement does not start with a statement keyword or a // brace, it's an ExpressionStatement or LabeledStatement. We // simply start parsing an expression, and afterwards, if the // next token is a colon and the expression was a simple // Identifier node, we switch to interpreting it as a label. var maybeName = this.state.value; var expr = this.parseExpression(); if (starttype === types.name && expr.type === "Identifier" && this.eat(types.colon)) { return this.parseLabeledStatement(node, maybeName, expr); } else { return this.parseExpressionStatement(node, expr); } }; pp$1.takeDecorators = function (node) { if (this.state.decorators.length) { node.decorators = this.state.decorators; this.state.decorators = []; } }; pp$1.parseDecorators = function (allowExport) { while (this.match(types.at)) { var decorator = this.parseDecorator(); this.state.decorators.push(decorator); } if (allowExport && this.match(types._export)) { return; } if (!this.match(types._class)) { this.raise(this.state.start, "Leading decorators must be attached to a class declaration"); } }; pp$1.parseDecorator = function () { if (!this.hasPlugin("decorators")) { this.unexpected(); } var node = this.startNode(); this.next(); node.expression = this.parseMaybeAssign(); return this.finishNode(node, "Decorator"); }; pp$1.parseBreakContinueStatement = function (node, keyword) { var isBreak = keyword === "break"; this.next(); if (this.isLineTerminator()) { node.label = null; } else if (!this.match(types.name)) { this.unexpected(); } else { node.label = this.parseIdentifier(); this.semicolon(); } // Verify that there is an actual destination to break or // continue to. var i = void 0; for (i = 0; i < this.state.labels.length; ++i) { var lab = this.state.labels[i]; if (node.label == null || lab.name === node.label.name) { if (lab.kind != null && (isBreak || lab.kind === "loop")) break; if (node.label && isBreak) break; } } if (i === this.state.labels.length) this.raise(node.start, "Unsyntactic " + keyword); return this.finishNode(node, isBreak ? "BreakStatement" : "ContinueStatement"); }; pp$1.parseDebuggerStatement = function (node) { this.next(); this.semicolon(); return this.finishNode(node, "DebuggerStatement"); }; pp$1.parseDoStatement = function (node) { this.next(); this.state.labels.push(loopLabel); node.body = this.parseStatement(false); this.state.labels.pop(); this.expect(types._while); node.test = this.parseParenExpression(); this.eat(types.semi); return this.finishNode(node, "DoWhileStatement"); }; // Disambiguating between a `for` and a `for`/`in` or `for`/`of` // loop is non-trivial. Basically, we have to parse the init `var` // statement or expression, disallowing the `in` operator (see // the second parameter to `parseExpression`), and then check // whether the next token is `in` or `of`. When there is no init // part (semicolon immediately after the opening parenthesis), it // is a regular `for` loop. pp$1.parseForStatement = function (node) { this.next(); this.state.labels.push(loopLabel); var forAwait = false; if (this.hasPlugin("asyncGenerators") && this.state.inAsync && this.isContextual("await")) { forAwait = true; this.next(); } this.expect(types.parenL); if (this.match(types.semi)) { if (forAwait) { this.unexpected(); } return this.parseFor(node, null); } if (this.match(types._var) || this.match(types._let) || this.match(types._const)) { var _init = this.startNode(); var varKind = this.state.type; this.next(); this.parseVar(_init, true, varKind); this.finishNode(_init, "VariableDeclaration"); if (this.match(types._in) || this.isContextual("of")) { if (_init.declarations.length === 1 && !_init.declarations[0].init) { return this.parseForIn(node, _init, forAwait); } } if (forAwait) { this.unexpected(); } return this.parseFor(node, _init); } var refShorthandDefaultPos = { start: 0 }; var init = this.parseExpression(true, refShorthandDefaultPos); if (this.match(types._in) || this.isContextual("of")) { var description = this.isContextual("of") ? "for-of statement" : "for-in statement"; this.toAssignable(init, undefined, description); this.checkLVal(init, undefined, undefined, description); return this.parseForIn(node, init, forAwait); } else if (refShorthandDefaultPos.start) { this.unexpected(refShorthandDefaultPos.start); } if (forAwait) { this.unexpected(); } return this.parseFor(node, init); }; pp$1.parseFunctionStatement = function (node) { this.next(); return this.parseFunction(node, true); }; pp$1.parseIfStatement = function (node) { this.next(); node.test = this.parseParenExpression(); node.consequent = this.parseStatement(false); node.alternate = this.eat(types._else) ? this.parseStatement(false) : null; return this.finishNode(node, "IfStatement"); }; pp$1.parseReturnStatement = function (node) { if (!this.state.inFunction && !this.options.allowReturnOutsideFunction) { this.raise(this.state.start, "'return' outside of function"); } this.next(); // In `return` (and `break`/`continue`), the keywords with // optional arguments, we eagerly look for a semicolon or the // possibility to insert one. if (this.isLineTerminator()) { node.argument = null; } else { node.argument = this.parseExpression(); this.semicolon(); } return this.finishNode(node, "ReturnStatement"); }; pp$1.parseSwitchStatement = function (node) { this.next(); node.discriminant = this.parseParenExpression(); node.cases = []; this.expect(types.braceL); this.state.labels.push(switchLabel); // Statements under must be grouped (by label) in SwitchCase // nodes. `cur` is used to keep the node that we are currently // adding statements to. var cur = void 0; for (var sawDefault; !this.match(types.braceR);) { if (this.match(types._case) || this.match(types._default)) { var isCase = this.match(types._case); if (cur) this.finishNode(cur, "SwitchCase"); node.cases.push(cur = this.startNode()); cur.consequent = []; this.next(); if (isCase) { cur.test = this.parseExpression(); } else { if (sawDefault) this.raise(this.state.lastTokStart, "Multiple default clauses"); sawDefault = true; cur.test = null; } this.expect(types.colon); } else { if (cur) { cur.consequent.push(this.parseStatement(true)); } else { this.unexpected(); } } } if (cur) this.finishNode(cur, "SwitchCase"); this.next(); // Closing brace this.state.labels.pop(); return this.finishNode(node, "SwitchStatement"); }; pp$1.parseThrowStatement = function (node) { this.next(); if (lineBreak.test(this.input.slice(this.state.lastTokEnd, this.state.start))) this.raise(this.state.lastTokEnd, "Illegal newline after throw"); node.argument = this.parseExpression(); this.semicolon(); return this.finishNode(node, "ThrowStatement"); }; // Reused empty array added for node fields that are always empty. var empty = []; pp$1.parseTryStatement = function (node) { this.next(); node.block = this.parseBlock(); node.handler = null; if (this.match(types._catch)) { var clause = this.startNode(); this.next(); this.expect(types.parenL); clause.param = this.parseBindingAtom(); this.checkLVal(clause.param, true, Object.create(null), "catch clause"); this.expect(types.parenR); clause.body = this.parseBlock(); node.handler = this.finishNode(clause, "CatchClause"); } node.guardedHandlers = empty; node.finalizer = this.eat(types._finally) ? this.parseBlock() : null; if (!node.handler && !node.finalizer) { this.raise(node.start, "Missing catch or finally clause"); } return this.finishNode(node, "TryStatement"); }; pp$1.parseVarStatement = function (node, kind) { this.next(); this.parseVar(node, false, kind); this.semicolon(); return this.finishNode(node, "VariableDeclaration"); }; pp$1.parseWhileStatement = function (node) { this.next(); node.test = this.parseParenExpression(); this.state.labels.push(loopLabel); node.body = this.parseStatement(false); this.state.labels.pop(); return this.finishNode(node, "WhileStatement"); }; pp$1.parseWithStatement = function (node) { if (this.state.strict) this.raise(this.state.start, "'with' in strict mode"); this.next(); node.object = this.parseParenExpression(); node.body = this.parseStatement(false); return this.finishNode(node, "WithStatement"); }; pp$1.parseEmptyStatement = function (node) { this.next(); return this.finishNode(node, "EmptyStatement"); }; pp$1.parseLabeledStatement = function (node, maybeName, expr) { for (var _iterator = this.state.labels, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { var _ref; if (_isArray) { if (_i >= _iterator.length) break; _ref = _iterator[_i++]; } else { _i = _iterator.next(); if (_i.done) break; _ref = _i.value; } var _label = _ref; if (_label.name === maybeName) { this.raise(expr.start, "Label '" + maybeName + "' is already declared"); } } var kind = this.state.type.isLoop ? "loop" : this.match(types._switch) ? "switch" : null; for (var i = this.state.labels.length - 1; i >= 0; i--) { var label = this.state.labels[i]; if (label.statementStart === node.start) { label.statementStart = this.state.start; label.kind = kind; } else { break; } } this.state.labels.push({ name: maybeName, kind: kind, statementStart: this.state.start }); node.body = this.parseStatement(true); this.state.labels.pop(); node.label = expr; return this.finishNode(node, "LabeledStatement"); }; pp$1.parseExpressionStatement = function (node, expr) { node.expression = expr; this.semicolon(); return this.finishNode(node, "ExpressionStatement"); }; // Parse a semicolon-enclosed block of statements, handling `"use // strict"` declarations when `allowStrict` is true (used for // function bodies). pp$1.parseBlock = function (allowDirectives) { var node = this.startNode(); this.expect(types.braceL); this.parseBlockBody(node, allowDirectives, false, types.braceR); return this.finishNode(node, "BlockStatement"); }; pp$1.isValidDirective = function (stmt) { return stmt.type === "ExpressionStatement" && stmt.expression.type === "StringLiteral" && !stmt.expression.extra.parenthesized; }; pp$1.parseBlockBody = function (node, allowDirectives, topLevel, end) { node.body = []; node.directives = []; var parsedNonDirective = false; var oldStrict = void 0; var octalPosition = void 0; while (!this.eat(end)) { if (!parsedNonDirective && this.state.containsOctal && !octalPosition) { octalPosition = this.state.octalPosition; } var stmt = this.parseStatement(true, topLevel); if (allowDirectives && !parsedNonDirective && this.isValidDirective(stmt)) { var directive = this.stmtToDirective(stmt); node.directives.push(directive); if (oldStrict === undefined && directive.value.value === "use strict") { oldStrict = this.state.strict; this.setStrict(true); if (octalPosition) { this.raise(octalPosition, "Octal literal in strict mode"); } } continue; } parsedNonDirective = true; node.body.push(stmt); } if (oldStrict === false) { this.setStrict(false); } }; // Parse a regular `for` loop. The disambiguation code in // `parseStatement` will already have parsed the init statement or // expression. pp$1.parseFor = function (node, init) { node.init = init; this.expect(types.semi); node.test = this.match(types.semi) ? null : this.parseExpression(); this.expect(types.semi); node.update = this.match(types.parenR) ? null : this.parseExpression(); this.expect(types.parenR); node.body = this.parseStatement(false); this.state.labels.pop(); return this.finishNode(node, "ForStatement"); }; // Parse a `for`/`in` and `for`/`of` loop, which are almost // same from parser's perspective. pp$1.parseForIn = function (node, init, forAwait) { var type = void 0; if (forAwait) { this.eatContextual("of"); type = "ForAwaitStatement"; } else { type = this.match(types._in) ? "ForInStatement" : "ForOfStatement"; this.next(); } node.left = init; node.right = this.parseExpression(); this.expect(types.parenR); node.body = this.parseStatement(false); this.state.labels.pop(); return this.finishNode(node, type); }; // Parse a list of variable declarations. pp$1.parseVar = function (node, isFor, kind) { node.declarations = []; node.kind = kind.keyword; for (;;) { var decl = this.startNode(); this.parseVarHead(decl); if (this.eat(types.eq)) { decl.init = this.parseMaybeAssign(isFor); } else if (kind === types._const && !(this.match(types._in) || this.isContextual("of"))) { this.unexpected(); } else if (decl.id.type !== "Identifier" && !(isFor && (this.match(types._in) || this.isContextual("of")))) { this.raise(this.state.lastTokEnd, "Complex binding patterns require an initialization value"); } else { decl.init = null; } node.declarations.push(this.finishNode(decl, "VariableDeclarator")); if (!this.eat(types.comma)) break; } return node; }; pp$1.parseVarHead = function (decl) { decl.id = this.parseBindingAtom(); this.checkLVal(decl.id, true, undefined, "variable declaration"); }; // Parse a function declaration or literal (depending on the // `isStatement` parameter). pp$1.parseFunction = function (node, isStatement, allowExpressionBody, isAsync, optionalId) { var oldInMethod = this.state.inMethod; this.state.inMethod = false; this.initFunction(node, isAsync); if (this.match(types.star)) { if (node.async && !this.hasPlugin("asyncGenerators")) { this.unexpected(); } else { node.generator = true; this.next(); } } if (isStatement && !optionalId && !this.match(types.name) && !this.match(types._yield)) { this.unexpected(); } if (this.match(types.name) || this.match(types._yield)) { node.id = this.parseBindingIdentifier(); } this.parseFunctionParams(node); this.parseFunctionBody(node, allowExpressionBody); this.state.inMethod = oldInMethod; return this.finishNode(node, isStatement ? "FunctionDeclaration" : "FunctionExpression"); }; pp$1.parseFunctionParams = function (node) { this.expect(types.parenL); node.params = this.parseBindingList(types.parenR); }; // Parse a class declaration or literal (depending on the // `isStatement` parameter). pp$1.parseClass = function (node, isStatement, optionalId) { this.next(); this.takeDecorators(node); this.parseClassId(node, isStatement, optionalId); this.parseClassSuper(node); this.parseClassBody(node); return this.finishNode(node, isStatement ? "ClassDeclaration" : "ClassExpression"); }; pp$1.isClassProperty = function () { return this.match(types.eq) || this.match(types.semi) || this.match(types.braceR); }; pp$1.isClassMethod = function () { return this.match(types.parenL); }; pp$1.isNonstaticConstructor = function (method) { return !method.computed && !method.static && (method.key.name === "constructor" || // Identifier method.key.value === "constructor" // Literal ); }; pp$1.parseClassBody = function (node) { // class bodies are implicitly strict var oldStrict = this.state.strict; this.state.strict = true; var hadConstructorCall = false; var hadConstructor = false; var decorators = []; var classBody = this.startNode(); classBody.body = []; this.expect(types.braceL); while (!this.eat(types.braceR)) { if (this.eat(types.semi)) { if (decorators.length > 0) { this.raise(this.state.lastTokEnd, "Decorators must not be followed by a semicolon"); } continue; } if (this.match(types.at)) { decorators.push(this.parseDecorator()); continue; } var method = this.startNode(); // steal the decorators if there are any if (decorators.length) { method.decorators = decorators; decorators = []; } method.static = false; if (this.match(types.name) && this.state.value === "static") { var key = this.parseIdentifier(true); // eats 'static' if (this.isClassMethod()) { // a method named 'static' method.kind = "method"; method.computed = false; method.key = key; this.parseClassMethod(classBody, method, false, false); continue; } else if (this.isClassProperty()) { // a property named 'static' method.computed = false; method.key = key; classBody.body.push(this.parseClassProperty(method)); continue; } // otherwise something static method.static = true; } if (this.eat(types.star)) { // a generator method.kind = "method"; this.parsePropertyName(method); if (this.isNonstaticConstructor(method)) { this.raise(method.key.start, "Constructor can't be a generator"); } if (!method.computed && method.static && (method.key.name === "prototype" || method.key.value === "prototype")) { this.raise(method.key.start, "Classes may not have static property named prototype"); } this.parseClassMethod(classBody, method, true, false); } else { var isSimple = this.match(types.name); var _key = this.parsePropertyName(method); if (!method.computed && method.static && (method.key.name === "prototype" || method.key.value === "prototype")) { this.raise(method.key.start, "Classes may not have static property named prototype"); } if (this.isClassMethod()) { // a normal method if (this.isNonstaticConstructor(method)) { if (hadConstructor) { this.raise(_key.start, "Duplicate constructor in the same class"); } else if (method.decorators) { this.raise(method.start, "You can't attach decorators to a class constructor"); } hadConstructor = true; method.kind = "constructor"; } else { method.kind = "method"; } this.parseClassMethod(classBody, method, false, false); } else if (this.isClassProperty()) { // a normal property if (this.isNonstaticConstructor(method)) { this.raise(method.key.start, "Classes may not have a non-static field named 'constructor'"); } classBody.body.push(this.parseClassProperty(method)); } else if (isSimple && _key.name === "async" && !this.isLineTerminator()) { // an async method var isGenerator = this.hasPlugin("asyncGenerators") && this.eat(types.star); method.kind = "method"; this.parsePropertyName(method); if (this.isNonstaticConstructor(method)) { this.raise(method.key.start, "Constructor can't be an async function"); } this.parseClassMethod(classBody, method, isGenerator, true); } else if (isSimple && (_key.name === "get" || _key.name === "set") && !(this.isLineTerminator() && this.match(types.star))) { // `get\n*` is an uninitialized property named 'get' followed by a generator. // a getter or setter method.kind = _key.name; this.parsePropertyName(method); if (this.isNonstaticConstructor(method)) { this.raise(method.key.start, "Constructor can't have get/set modifier"); } this.parseClassMethod(classBody, method, false, false); this.checkGetterSetterParamCount(method); } else if (this.hasPlugin("classConstructorCall") && isSimple && _key.name === "call" && this.match(types.name) && this.state.value === "constructor") { // a (deprecated) call constructor if (hadConstructorCall) { this.raise(method.start, "Duplicate constructor call in the same class"); } else if (method.decorators) { this.raise(method.start, "You can't attach decorators to a class constructor"); } hadConstructorCall = true; method.kind = "constructorCall"; this.parsePropertyName(method); // consume "constructor" and make it the method's name this.parseClassMethod(classBody, method, false, false); } else if (this.isLineTerminator()) { // an uninitialized class property (due to ASI, since we don't otherwise recognize the next token) if (this.isNonstaticConstructor(method)) { this.raise(method.key.start, "Classes may not have a non-static field named 'constructor'"); } classBody.body.push(this.parseClassProperty(method)); } else { this.unexpected(); } } } if (decorators.length) { this.raise(this.state.start, "You have trailing decorators with no method"); } node.body = this.finishNode(classBody, "ClassBody"); this.state.strict = oldStrict; }; pp$1.parseClassProperty = function (node) { this.state.inClassProperty = true; if (this.match(types.eq)) { if (!this.hasPlugin("classProperties")) this.unexpected(); this.next(); node.value = this.parseMaybeAssign(); } else { node.value = null; } this.semicolon(); this.state.inClassProperty = false; return this.finishNode(node, "ClassProperty"); }; pp$1.parseClassMethod = function (classBody, method, isGenerator, isAsync) { this.parseMethod(method, isGenerator, isAsync); classBody.body.push(this.finishNode(method, "ClassMethod")); }; pp$1.parseClassId = function (node, isStatement, optionalId) { if (this.match(types.name)) { node.id = this.parseIdentifier(); } else { if (optionalId || !isStatement) { node.id = null; } else { this.unexpected(); } } }; pp$1.parseClassSuper = function (node) { node.superClass = this.eat(types._extends) ? this.parseExprSubscripts() : null; }; // Parses module export declaration. pp$1.parseExport = function (node) { this.next(); // export * from '...' if (this.match(types.star)) { var specifier = this.startNode(); this.next(); if (this.hasPlugin("exportExtensions") && this.eatContextual("as")) { specifier.exported = this.parseIdentifier(); node.specifiers = [this.finishNode(specifier, "ExportNamespaceSpecifier")]; this.parseExportSpecifiersMaybe(node); this.parseExportFrom(node, true); } else { this.parseExportFrom(node, true); return this.finishNode(node, "ExportAllDeclaration"); } } else if (this.hasPlugin("exportExtensions") && this.isExportDefaultSpecifier()) { var _specifier = this.startNode(); _specifier.exported = this.parseIdentifier(true); node.specifiers = [this.finishNode(_specifier, "ExportDefaultSpecifier")]; if (this.match(types.comma) && this.lookahead().type === types.star) { this.expect(types.comma); var _specifier2 = this.startNode(); this.expect(types.star); this.expectContextual("as"); _specifier2.exported = this.parseIdentifier(); node.specifiers.push(this.finishNode(_specifier2, "ExportNamespaceSpecifier")); } else { this.parseExportSpecifiersMaybe(node); } this.parseExportFrom(node, true); } else if (this.eat(types._default)) { // export default ... var expr = this.startNode(); var needsSemi = false; if (this.eat(types._function)) { expr = this.parseFunction(expr, true, false, false, true); } else if (this.match(types._class)) { expr = this.parseClass(expr, true, true); } else { needsSemi = true; expr = this.parseMaybeAssign(); } node.declaration = expr; if (needsSemi) this.semicolon(); this.checkExport(node, true, true); return this.finishNode(node, "ExportDefaultDeclaration"); } else if (this.shouldParseExportDeclaration()) { node.specifiers = []; node.source = null; node.declaration = this.parseExportDeclaration(node); } else { // export { x, y as z } [from '...'] node.declaration = null; node.specifiers = this.parseExportSpecifiers(); this.parseExportFrom(node); } this.checkExport(node, true); return this.finishNode(node, "ExportNamedDeclaration"); }; pp$1.parseExportDeclaration = function () { return this.parseStatement(true); }; pp$1.isExportDefaultSpecifier = function () { if (this.match(types.name)) { return this.state.value !== "async"; } if (!this.match(types._default)) { return false; } var lookahead = this.lookahead(); return lookahead.type === types.comma || lookahead.type === types.name && lookahead.value === "from"; }; pp$1.parseExportSpecifiersMaybe = function (node) { if (this.eat(types.comma)) { node.specifiers = node.specifiers.concat(this.parseExportSpecifiers()); } }; pp$1.parseExportFrom = function (node, expect) { if (this.eatContextual("from")) { node.source = this.match(types.string) ? this.parseExprAtom() : this.unexpected(); this.checkExport(node); } else { if (expect) { this.unexpected(); } else { node.source = null; } } this.semicolon(); }; pp$1.shouldParseExportDeclaration = function () { return this.state.type.keyword === "var" || this.state.type.keyword === "const" || this.state.type.keyword === "let" || this.state.type.keyword === "function" || this.state.type.keyword === "class" || this.isContextual("async"); }; pp$1.checkExport = function (node, checkNames, isDefault) { if (checkNames) { // Check for duplicate exports if (isDefault) { // Default exports this.checkDuplicateExports(node, "default"); } else if (node.specifiers && node.specifiers.length) { // Named exports for (var _iterator2 = node.specifiers, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) { var _ref2; if (_isArray2) { if (_i2 >= _iterator2.length) break; _ref2 = _iterator2[_i2++]; } else { _i2 = _iterator2.next(); if (_i2.done) break; _ref2 = _i2.value; } var specifier = _ref2; this.checkDuplicateExports(specifier, specifier.exported.name); } } else if (node.declaration) { // Exported declarations if (node.declaration.type === "FunctionDeclaration" || node.declaration.type === "ClassDeclaration") { this.checkDuplicateExports(node, node.declaration.id.name); } else if (node.declaration.type === "VariableDeclaration") { for (var _iterator3 = node.declaration.declarations, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator]();;) { var _ref3; if (_isArray3) { if (_i3 >= _iterator3.length) break; _ref3 = _iterator3[_i3++]; } else { _i3 = _iterator3.next(); if (_i3.done) break; _ref3 = _i3.value; } var declaration = _ref3; this.checkDeclaration(declaration.id); } } } } if (this.state.decorators.length) { var isClass = node.declaration && (node.declaration.type === "ClassDeclaration" || node.declaration.type === "ClassExpression"); if (!node.declaration || !isClass) { this.raise(node.start, "You can only use decorators on an export when exporting a class"); } this.takeDecorators(node.declaration); } }; pp$1.checkDeclaration = function (node) { if (node.type === "ObjectPattern") { for (var _iterator4 = node.properties, _isArray4 = Array.isArray(_iterator4), _i4 = 0, _iterator4 = _isArray4 ? _iterator4 : _iterator4[Symbol.iterator]();;) { var _ref4; if (_isArray4) { if (_i4 >= _iterator4.length) break; _ref4 = _iterator4[_i4++]; } else { _i4 = _iterator4.next(); if (_i4.done) break; _ref4 = _i4.value; } var prop = _ref4; this.checkDeclaration(prop); } } else if (node.type === "ArrayPattern") { for (var _iterator5 = node.elements, _isArray5 = Array.isArray(_iterator5), _i5 = 0, _iterator5 = _isArray5 ? _iterator5 : _iterator5[Symbol.iterator]();;) { var _ref5; if (_isArray5) { if (_i5 >= _iterator5.length) break; _ref5 = _iterator5[_i5++]; } else { _i5 = _iterator5.next(); if (_i5.done) break; _ref5 = _i5.value; } var elem = _ref5; if (elem) { this.checkDeclaration(elem); } } } else if (node.type === "ObjectProperty") { this.checkDeclaration(node.value); } else if (node.type === "RestElement" || node.type === "RestProperty") { this.checkDeclaration(node.argument); } else if (node.type === "Identifier") { this.checkDuplicateExports(node, node.name); } }; pp$1.checkDuplicateExports = function (node, name) { if (this.state.exportedIdentifiers.indexOf(name) > -1) { this.raiseDuplicateExportError(node, name); } this.state.exportedIdentifiers.push(name); }; pp$1.raiseDuplicateExportError = function (node, name) { this.raise(node.start, name === "default" ? "Only one default export allowed per module." : "`" + name + "` has already been exported. Exported identifiers must be unique."); }; // Parses a comma-separated list of module exports. pp$1.parseExportSpecifiers = function () { var nodes = []; var first = true; var needsFrom = void 0; // export { x, y as z } [from '...'] this.expect(types.braceL); while (!this.eat(types.braceR)) { if (first) { first = false; } else { this.expect(types.comma); if (this.eat(types.braceR)) break; } var isDefault = this.match(types._default); if (isDefault && !needsFrom) needsFrom = true; var node = this.startNode(); node.local = this.parseIdentifier(isDefault); node.exported = this.eatContextual("as") ? this.parseIdentifier(true) : node.local.__clone(); nodes.push(this.finishNode(node, "ExportSpecifier")); } // https://github.com/ember-cli/ember-cli/pull/3739 if (needsFrom && !this.isContextual("from")) { this.unexpected(); } return nodes; }; // Parses import declaration. pp$1.parseImport = function (node) { this.eat(types._import); // import '...' if (this.match(types.string)) { node.specifiers = []; node.source = this.parseExprAtom(); } else { node.specifiers = []; this.parseImportSpecifiers(node); this.expectContextual("from"); node.source = this.match(types.string) ? this.parseExprAtom() : this.unexpected(); } this.semicolon(); return this.finishNode(node, "ImportDeclaration"); }; // Parses a comma-separated list of module imports. pp$1.parseImportSpecifiers = function (node) { var first = true; if (this.match(types.name)) { // import defaultObj, { x, y as z } from '...' var startPos = this.state.start; var startLoc = this.state.startLoc; node.specifiers.push(this.parseImportSpecifierDefault(this.parseIdentifier(), startPos, startLoc)); if (!this.eat(types.comma)) return; } if (this.match(types.star)) { var specifier = this.startNode(); this.next(); this.expectContextual("as"); specifier.local = this.parseIdentifier(); this.checkLVal(specifier.local, true, undefined, "import namespace specifier"); node.specifiers.push(this.finishNode(specifier, "ImportNamespaceSpecifier")); return; } this.expect(types.braceL); while (!this.eat(types.braceR)) { if (first) { first = false; } else { // Detect an attempt to deep destructure if (this.eat(types.colon)) { this.unexpected(null, "ES2015 named imports do not destructure. Use another statement for destructuring after the import."); } this.expect(types.comma); if (this.eat(types.braceR)) break; } this.parseImportSpecifier(node); } }; pp$1.parseImportSpecifier = function (node) { var specifier = this.startNode(); specifier.imported = this.parseIdentifier(true); if (this.eatContextual("as")) { specifier.local = this.parseIdentifier(); } else { this.checkReservedWord(specifier.imported.name, specifier.start, true, true); specifier.local = specifier.imported.__clone(); } this.checkLVal(specifier.local, true, undefined, "import specifier"); node.specifiers.push(this.finishNode(specifier, "ImportSpecifier")); }; pp$1.parseImportSpecifierDefault = function (id, startPos, startLoc) { var node = this.startNodeAt(startPos, startLoc); node.local = id; this.checkLVal(node.local, true, undefined, "default import specifier"); return this.finishNode(node, "ImportDefaultSpecifier"); }; var pp$2 = Parser.prototype; // Convert existing expression atom to assignable pattern // if possible. pp$2.toAssignable = function (node, isBinding, contextDescription) { if (node) { switch (node.type) { case "Identifier": case "ObjectPattern": case "ArrayPattern": case "AssignmentPattern": break; case "ObjectExpression": node.type = "ObjectPattern"; for (var _iterator = node.properties, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { var _ref; if (_isArray) { if (_i >= _iterator.length) break; _ref = _iterator[_i++]; } else { _i = _iterator.next(); if (_i.done) break; _ref = _i.value; } var prop = _ref; if (prop.type === "ObjectMethod") { if (prop.kind === "get" || prop.kind === "set") { this.raise(prop.key.start, "Object pattern can't contain getter or setter"); } else { this.raise(prop.key.start, "Object pattern can't contain methods"); } } else { this.toAssignable(prop, isBinding, "object destructuring pattern"); } } break; case "ObjectProperty": this.toAssignable(node.value, isBinding, contextDescription); break; case "SpreadProperty": node.type = "RestProperty"; var arg = node.argument; this.toAssignable(arg, isBinding, contextDescription); break; case "ArrayExpression": node.type = "ArrayPattern"; this.toAssignableList(node.elements, isBinding, contextDescription); break; case "AssignmentExpression": if (node.operator === "=") { node.type = "AssignmentPattern"; delete node.operator; } else { this.raise(node.left.end, "Only '=' operator can be used for specifying default value."); } break; case "MemberExpression": if (!isBinding) break; default: { var message = "Invalid left-hand side" + (contextDescription ? " in " + contextDescription : /* istanbul ignore next */"expression"); this.raise(node.start, message); } } } return node; }; // Convert list of expression atoms to binding list. pp$2.toAssignableList = function (exprList, isBinding, contextDescription) { var end = exprList.length; if (end) { var last = exprList[end - 1]; if (last && last.type === "RestElement") { --end; } else if (last && last.type === "SpreadElement") { last.type = "RestElement"; var arg = last.argument; this.toAssignable(arg, isBinding, contextDescription); if (arg.type !== "Identifier" && arg.type !== "MemberExpression" && arg.type !== "ArrayPattern") { this.unexpected(arg.start); } --end; } } for (var i = 0; i < end; i++) { var elt = exprList[i]; if (elt) this.toAssignable(elt, isBinding, contextDescription); } return exprList; }; // Convert list of expression atoms to a list of pp$2.toReferencedList = function (exprList) { return exprList; }; // Parses spread element. pp$2.parseSpread = function (refShorthandDefaultPos) { var node = this.startNode(); this.next(); node.argument = this.parseMaybeAssign(false, refShorthandDefaultPos); return this.finishNode(node, "SpreadElement"); }; pp$2.parseRest = function () { var node = this.startNode(); this.next(); node.argument = this.parseBindingIdentifier(); return this.finishNode(node, "RestElement"); }; pp$2.shouldAllowYieldIdentifier = function () { return this.match(types._yield) && !this.state.strict && !this.state.inGenerator; }; pp$2.parseBindingIdentifier = function () { return this.parseIdentifier(this.shouldAllowYieldIdentifier()); }; // Parses lvalue (assignable) atom. pp$2.parseBindingAtom = function () { switch (this.state.type) { case types._yield: if (this.state.strict || this.state.inGenerator) this.unexpected(); // fall-through case types.name: return this.parseIdentifier(true); case types.bracketL: var node = this.startNode(); this.next(); node.elements = this.parseBindingList(types.bracketR, true); return this.finishNode(node, "ArrayPattern"); case types.braceL: return this.parseObj(true); default: this.unexpected(); } }; pp$2.parseBindingList = function (close, allowEmpty) { var elts = []; var first = true; while (!this.eat(close)) { if (first) { first = false; } else { this.expect(types.comma); } if (allowEmpty && this.match(types.comma)) { elts.push(null); } else if (this.eat(close)) { break; } else if (this.match(types.ellipsis)) { elts.push(this.parseAssignableListItemTypes(this.parseRest())); this.expect(close); break; } else { var decorators = []; while (this.match(types.at)) { decorators.push(this.parseDecorator()); } var left = this.parseMaybeDefault(); if (decorators.length) { left.decorators = decorators; } this.parseAssignableListItemTypes(left); elts.push(this.parseMaybeDefault(left.start, left.loc.start, left)); } } return elts; }; pp$2.parseAssignableListItemTypes = function (param) { return param; }; // Parses assignment pattern around given atom if possible. pp$2.parseMaybeDefault = function (startPos, startLoc, left) { startLoc = startLoc || this.state.startLoc; startPos = startPos || this.state.start; left = left || this.parseBindingAtom(); if (!this.eat(types.eq)) return left; var node = this.startNodeAt(startPos, startLoc); node.left = left; node.right = this.parseMaybeAssign(); return this.finishNode(node, "AssignmentPattern"); }; // Verify that a node is an lval — something that can be assigned // to. pp$2.checkLVal = function (expr, isBinding, checkClashes, contextDescription) { switch (expr.type) { case "Identifier": this.checkReservedWord(expr.name, expr.start, false, true); if (checkClashes) { // we need to prefix this with an underscore for the cases where we have a key of // `__proto__`. there's a bug in old V8 where the following wouldn't work: // // > var obj = Object.create(null); // undefined // > obj.__proto__ // null // > obj.__proto__ = true; // true // > obj.__proto__ // null var key = "_" + expr.name; if (checkClashes[key]) { this.raise(expr.start, "Argument name clash in strict mode"); } else { checkClashes[key] = true; } } break; case "MemberExpression": if (isBinding) this.raise(expr.start, (isBinding ? "Binding" : "Assigning to") + " member expression"); break; case "ObjectPattern": for (var _iterator2 = expr.properties, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) { var _ref2; if (_isArray2) { if (_i2 >= _iterator2.length) break; _ref2 = _iterator2[_i2++]; } else { _i2 = _iterator2.next(); if (_i2.done) break; _ref2 = _i2.value; } var prop = _ref2; if (prop.type === "ObjectProperty") prop = prop.value; this.checkLVal(prop, isBinding, checkClashes, "object destructuring pattern"); } break; case "ArrayPattern": for (var _iterator3 = expr.elements, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator]();;) { var _ref3; if (_isArray3) { if (_i3 >= _iterator3.length) break; _ref3 = _iterator3[_i3++]; } else { _i3 = _iterator3.next(); if (_i3.done) break; _ref3 = _i3.value; } var elem = _ref3; if (elem) this.checkLVal(elem, isBinding, checkClashes, "array destructuring pattern"); } break; case "AssignmentPattern": this.checkLVal(expr.left, isBinding, checkClashes, "assignment pattern"); break; case "RestProperty": this.checkLVal(expr.argument, isBinding, checkClashes, "rest property"); break; case "RestElement": this.checkLVal(expr.argument, isBinding, checkClashes, "rest element"); break; default: { var message = (isBinding ? /* istanbul ignore next */"Binding invalid" : "Invalid") + " left-hand side" + (contextDescription ? " in " + contextDescription : /* istanbul ignore next */"expression"); this.raise(expr.start, message); } } }; /* eslint max-len: 0 */ // A recursive descent parser operates by defining functions for all // syntactic elements, and recursively calling those, each function // advancing the input stream and returning an AST node. Precedence // of constructs (for example, the fact that `!x[1]` means `!(x[1])` // instead of `(!x)[1]` is handled by the fact that the parser // function that parses unary prefix operators is called first, and // in turn calls the function that parses `[]` subscripts — that // way, it'll receive the node for `x[1]` already parsed, and wraps // *that* in the unary operator node. // // Acorn uses an [operator precedence parser][opp] to handle binary // operator precedence, because it is much more compact than using // the technique outlined above, which uses different, nesting // functions to specify precedence, for all of the ten binary // precedence levels that JavaScript defines. // // [opp]: http://en.wikipedia.org/wiki/Operator-precedence_parser var pp$3 = Parser.prototype; // Check if property name clashes with already added. // Object/class getters and setters are not allowed to clash — // either with each other or with an init property — and in // strict mode, init properties are also not allowed to be repeated. pp$3.checkPropClash = function (prop, propHash) { if (prop.computed || prop.kind) return; var key = prop.key; // It is either an Identifier or a String/NumericLiteral var name = key.type === "Identifier" ? key.name : String(key.value); if (name === "__proto__") { if (propHash.proto) this.raise(key.start, "Redefinition of __proto__ property"); propHash.proto = true; } }; // Convenience method to parse an Expression only pp$3.getExpression = function () { this.nextToken(); var expr = this.parseExpression(); if (!this.match(types.eof)) { this.unexpected(); } return expr; }; // ### Expression parsing // These nest, from the most general expression type at the top to // 'atomic', nondivisible expression types at the bottom. Most of // the functions will simply let the function (s) below them parse, // and, *if* the syntactic construct they handle is present, wrap // the AST node that the inner parser gave them in another node. // Parse a full expression. The optional arguments are used to // forbid the `in` operator (in for loops initialization expressions) // and provide reference for storing '=' operator inside shorthand // property assignment in contexts where both object expression // and object pattern might appear (so it's possible to raise // delayed syntax error at correct position). pp$3.parseExpression = function (noIn, refShorthandDefaultPos) { var startPos = this.state.start; var startLoc = this.state.startLoc; var expr = this.parseMaybeAssign(noIn, refShorthandDefaultPos); if (this.match(types.comma)) { var node = this.startNodeAt(startPos, startLoc); node.expressions = [expr]; while (this.eat(types.comma)) { node.expressions.push(this.parseMaybeAssign(noIn, refShorthandDefaultPos)); } this.toReferencedList(node.expressions); return this.finishNode(node, "SequenceExpression"); } return expr; }; // Parse an assignment expression. This includes applications of // operators like `+=`. pp$3.parseMaybeAssign = function (noIn, refShorthandDefaultPos, afterLeftParse, refNeedsArrowPos) { var startPos = this.state.start; var startLoc = this.state.startLoc; if (this.match(types._yield) && this.state.inGenerator) { var _left = this.parseYield(); if (afterLeftParse) _left = afterLeftParse.call(this, _left, startPos, startLoc); return _left; } var failOnShorthandAssign = void 0; if (refShorthandDefaultPos) { failOnShorthandAssign = false; } else { refShorthandDefaultPos = { start: 0 }; failOnShorthandAssign = true; } if (this.match(types.parenL) || this.match(types.name)) { this.state.potentialArrowAt = this.state.start; } var left = this.parseMaybeConditional(noIn, refShorthandDefaultPos, refNeedsArrowPos); if (afterLeftParse) left = afterLeftParse.call(this, left, startPos, startLoc); if (this.state.type.isAssign) { var node = this.startNodeAt(startPos, startLoc); node.operator = this.state.value; node.left = this.match(types.eq) ? this.toAssignable(left, undefined, "assignment expression") : left; refShorthandDefaultPos.start = 0; // reset because shorthand default was used correctly this.checkLVal(left, undefined, undefined, "assignment expression"); if (left.extra && left.extra.parenthesized) { var errorMsg = void 0; if (left.type === "ObjectPattern") { errorMsg = "`({a}) = 0` use `({a} = 0)`"; } else if (left.type === "ArrayPattern") { errorMsg = "`([a]) = 0` use `([a] = 0)`"; } if (errorMsg) { this.raise(left.start, "You're trying to assign to a parenthesized expression, eg. instead of " + errorMsg); } } this.next(); node.right = this.parseMaybeAssign(noIn); return this.finishNode(node, "AssignmentExpression"); } else if (failOnShorthandAssign && refShorthandDefaultPos.start) { this.unexpected(refShorthandDefaultPos.start); } return left; }; // Parse a ternary conditional (`?:`) operator. pp$3.parseMaybeConditional = function (noIn, refShorthandDefaultPos, refNeedsArrowPos) { var startPos = this.state.start; var startLoc = this.state.startLoc; var expr = this.parseExprOps(noIn, refShorthandDefaultPos); if (refShorthandDefaultPos && refShorthandDefaultPos.start) return expr; return this.parseConditional(expr, noIn, startPos, startLoc, refNeedsArrowPos); }; pp$3.parseConditional = function (expr, noIn, startPos, startLoc) { if (this.eat(types.question)) { var node = this.startNodeAt(startPos, startLoc); node.test = expr; node.consequent = this.parseMaybeAssign(); this.expect(types.colon); node.alternate = this.parseMaybeAssign(noIn); return this.finishNode(node, "ConditionalExpression"); } return expr; }; // Start the precedence parser. pp$3.parseExprOps = function (noIn, refShorthandDefaultPos) { var startPos = this.state.start; var startLoc = this.state.startLoc; var expr = this.parseMaybeUnary(refShorthandDefaultPos); if (refShorthandDefaultPos && refShorthandDefaultPos.start) { return expr; } else { return this.parseExprOp(expr, startPos, startLoc, -1, noIn); } }; // Parse binary operators with the operator precedence parsing // algorithm. `left` is the left-hand side of the operator. // `minPrec` provides context that allows the function to stop and // defer further parser to one of its callers when it encounters an // operator that has a lower precedence than the set it is parsing. pp$3.parseExprOp = function (left, leftStartPos, leftStartLoc, minPrec, noIn) { var prec = this.state.type.binop; if (prec != null && (!noIn || !this.match(types._in))) { if (prec > minPrec) { var node = this.startNodeAt(leftStartPos, leftStartLoc); node.left = left; node.operator = this.state.value; if (node.operator === "**" && left.type === "UnaryExpression" && left.extra && !left.extra.parenthesizedArgument && !left.extra.parenthesized) { this.raise(left.argument.start, "Illegal expression. Wrap left hand side or entire exponentiation in parentheses."); } var op = this.state.type; this.next(); var startPos = this.state.start; var startLoc = this.state.startLoc; node.right = this.parseExprOp(this.parseMaybeUnary(), startPos, startLoc, op.rightAssociative ? prec - 1 : prec, noIn); this.finishNode(node, op === types.logicalOR || op === types.logicalAND ? "LogicalExpression" : "BinaryExpression"); return this.parseExprOp(node, leftStartPos, leftStartLoc, minPrec, noIn); } } return left; }; // Parse unary operators, both prefix and postfix. pp$3.parseMaybeUnary = function (refShorthandDefaultPos) { if (this.state.type.prefix) { var node = this.startNode(); var update = this.match(types.incDec); node.operator = this.state.value; node.prefix = true; this.next(); var argType = this.state.type; node.argument = this.parseMaybeUnary(); this.addExtra(node, "parenthesizedArgument", argType === types.parenL && (!node.argument.extra || !node.argument.extra.parenthesized)); if (refShorthandDefaultPos && refShorthandDefaultPos.start) { this.unexpected(refShorthandDefaultPos.start); } if (update) { this.checkLVal(node.argument, undefined, undefined, "prefix operation"); } else if (this.state.strict && node.operator === "delete" && node.argument.type === "Identifier") { this.raise(node.start, "Deleting local variable in strict mode"); } return this.finishNode(node, update ? "UpdateExpression" : "UnaryExpression"); } var startPos = this.state.start; var startLoc = this.state.startLoc; var expr = this.parseExprSubscripts(refShorthandDefaultPos); if (refShorthandDefaultPos && refShorthandDefaultPos.start) return expr; while (this.state.type.postfix && !this.canInsertSemicolon()) { var _node = this.startNodeAt(startPos, startLoc); _node.operator = this.state.value; _node.prefix = false; _node.argument = expr; this.checkLVal(expr, undefined, undefined, "postfix operation"); this.next(); expr = this.finishNode(_node, "UpdateExpression"); } return expr; }; // Parse call, dot, and `[]`-subscript expressions. pp$3.parseExprSubscripts = function (refShorthandDefaultPos) { var startPos = this.state.start; var startLoc = this.state.startLoc; var potentialArrowAt = this.state.potentialArrowAt; var expr = this.parseExprAtom(refShorthandDefaultPos); if (expr.type === "ArrowFunctionExpression" && expr.start === potentialArrowAt) { return expr; } if (refShorthandDefaultPos && refShorthandDefaultPos.start) { return expr; } return this.parseSubscripts(expr, startPos, startLoc); }; pp$3.parseSubscripts = function (base, startPos, startLoc, noCalls) { for (;;) { if (!noCalls && this.eat(types.doubleColon)) { var node = this.startNodeAt(startPos, startLoc); node.object = base; node.callee = this.parseNoCallExpr(); return this.parseSubscripts(this.finishNode(node, "BindExpression"), startPos, startLoc, noCalls); } else if (this.eat(types.dot)) { var _node2 = this.startNodeAt(startPos, startLoc); _node2.object = base; _node2.property = this.parseIdentifier(true); _node2.computed = false; base = this.finishNode(_node2, "MemberExpression"); } else if (this.eat(types.bracketL)) { var _node3 = this.startNodeAt(startPos, startLoc); _node3.object = base; _node3.property = this.parseExpression(); _node3.computed = true; this.expect(types.bracketR); base = this.finishNode(_node3, "MemberExpression"); } else if (!noCalls && this.match(types.parenL)) { var possibleAsync = this.state.potentialArrowAt === base.start && base.type === "Identifier" && base.name === "async" && !this.canInsertSemicolon(); this.next(); var _node4 = this.startNodeAt(startPos, startLoc); _node4.callee = base; _node4.arguments = this.parseCallExpressionArguments(types.parenR, possibleAsync); if (_node4.callee.type === "Import" && _node4.arguments.length !== 1) { this.raise(_node4.start, "import() requires exactly one argument"); } base = this.finishNode(_node4, "CallExpression"); if (possibleAsync && this.shouldParseAsyncArrow()) { return this.parseAsyncArrowFromCallExpression(this.startNodeAt(startPos, startLoc), _node4); } else { this.toReferencedList(_node4.arguments); } } else if (this.match(types.backQuote)) { var _node5 = this.startNodeAt(startPos, startLoc); _node5.tag = base; _node5.quasi = this.parseTemplate(true); base = this.finishNode(_node5, "TaggedTemplateExpression"); } else { return base; } } }; pp$3.parseCallExpressionArguments = function (close, possibleAsyncArrow) { var elts = []; var innerParenStart = void 0; var first = true; while (!this.eat(close)) { if (first) { first = false; } else { this.expect(types.comma); if (this.eat(close)) break; } // we need to make sure that if this is an async arrow functions, that we don't allow inner parens inside the params if (this.match(types.parenL) && !innerParenStart) { innerParenStart = this.state.start; } elts.push(this.parseExprListItem(false, possibleAsyncArrow ? { start: 0 } : undefined, possibleAsyncArrow ? { start: 0 } : undefined)); } // we found an async arrow function so let's not allow any inner parens if (possibleAsyncArrow && innerParenStart && this.shouldParseAsyncArrow()) { this.unexpected(); } return elts; }; pp$3.shouldParseAsyncArrow = function () { return this.match(types.arrow); }; pp$3.parseAsyncArrowFromCallExpression = function (node, call) { this.expect(types.arrow); return this.parseArrowExpression(node, call.arguments, true); }; // Parse a no-call expression (like argument of `new` or `::` operators). pp$3.parseNoCallExpr = function () { var startPos = this.state.start; var startLoc = this.state.startLoc; return this.parseSubscripts(this.parseExprAtom(), startPos, startLoc, true); }; // Parse an atomic expression — either a single token that is an // expression, an expression started by a keyword like `function` or // `new`, or an expression wrapped in punctuation like `()`, `[]`, // or `{}`. pp$3.parseExprAtom = function (refShorthandDefaultPos) { var canBeArrow = this.state.potentialArrowAt === this.state.start; var node = void 0; switch (this.state.type) { case types._super: if (!this.state.inMethod && !this.state.inClassProperty && !this.options.allowSuperOutsideMethod) { this.raise(this.state.start, "'super' outside of function or class"); } node = this.startNode(); this.next(); if (!this.match(types.parenL) && !this.match(types.bracketL) && !this.match(types.dot)) { this.unexpected(); } if (this.match(types.parenL) && this.state.inMethod !== "constructor" && !this.options.allowSuperOutsideMethod) { this.raise(node.start, "super() outside of class constructor"); } return this.finishNode(node, "Super"); case types._import: if (!this.hasPlugin("dynamicImport")) this.unexpected(); node = this.startNode(); this.next(); if (!this.match(types.parenL)) { this.unexpected(null, types.parenL); } return this.finishNode(node, "Import"); case types._this: node = this.startNode(); this.next(); return this.finishNode(node, "ThisExpression"); case types._yield: if (this.state.inGenerator) this.unexpected(); case types.name: node = this.startNode(); var allowAwait = this.state.value === "await" && this.state.inAsync; var allowYield = this.shouldAllowYieldIdentifier(); var id = this.parseIdentifier(allowAwait || allowYield); if (id.name === "await") { if (this.state.inAsync || this.inModule) { return this.parseAwait(node); } } else if (id.name === "async" && this.match(types._function) && !this.canInsertSemicolon()) { this.next(); return this.parseFunction(node, false, false, true); } else if (canBeArrow && id.name === "async" && this.match(types.name)) { var params = [this.parseIdentifier()]; this.expect(types.arrow); // let foo = bar => {}; return this.parseArrowExpression(node, params, true); } if (canBeArrow && !this.canInsertSemicolon() && this.eat(types.arrow)) { return this.parseArrowExpression(node, [id]); } return id; case types._do: if (this.hasPlugin("doExpressions")) { var _node6 = this.startNode(); this.next(); var oldInFunction = this.state.inFunction; var oldLabels = this.state.labels; this.state.labels = []; this.state.inFunction = false; _node6.body = this.parseBlock(false, true); this.state.inFunction = oldInFunction; this.state.labels = oldLabels; return this.finishNode(_node6, "DoExpression"); } case types.regexp: var value = this.state.value; node = this.parseLiteral(value.value, "RegExpLiteral"); node.pattern = value.pattern; node.flags = value.flags; return node; case types.num: return this.parseLiteral(this.state.value, "NumericLiteral"); case types.string: return this.parseLiteral(this.state.value, "StringLiteral"); case types._null: node = this.startNode(); this.next(); return this.finishNode(node, "NullLiteral"); case types._true:case types._false: node = this.startNode(); node.value = this.match(types._true); this.next(); return this.finishNode(node, "BooleanLiteral"); case types.parenL: return this.parseParenAndDistinguishExpression(null, null, canBeArrow); case types.bracketL: node = this.startNode(); this.next(); node.elements = this.parseExprList(types.bracketR, true, refShorthandDefaultPos); this.toReferencedList(node.elements); return this.finishNode(node, "ArrayExpression"); case types.braceL: return this.parseObj(false, refShorthandDefaultPos); case types._function: return this.parseFunctionExpression(); case types.at: this.parseDecorators(); case types._class: node = this.startNode(); this.takeDecorators(node); return this.parseClass(node, false); case types._new: return this.parseNew(); case types.backQuote: return this.parseTemplate(false); case types.doubleColon: node = this.startNode(); this.next(); node.object = null; var callee = node.callee = this.parseNoCallExpr(); if (callee.type === "MemberExpression") { return this.finishNode(node, "BindExpression"); } else { this.raise(callee.start, "Binding should be performed on object property."); } default: this.unexpected(); } }; pp$3.parseFunctionExpression = function () { var node = this.startNode(); var meta = this.parseIdentifier(true); if (this.state.inGenerator && this.eat(types.dot) && this.hasPlugin("functionSent")) { return this.parseMetaProperty(node, meta, "sent"); } else { return this.parseFunction(node, false); } }; pp$3.parseMetaProperty = function (node, meta, propertyName) { node.meta = meta; node.property = this.parseIdentifier(true); if (node.property.name !== propertyName) { this.raise(node.property.start, "The only valid meta property for new is " + meta.name + "." + propertyName); } return this.finishNode(node, "MetaProperty"); }; pp$3.parseLiteral = function (value, type, startPos, startLoc) { startPos = startPos || this.state.start; startLoc = startLoc || this.state.startLoc; var node = this.startNodeAt(startPos, startLoc); this.addExtra(node, "rawValue", value); this.addExtra(node, "raw", this.input.slice(startPos, this.state.end)); node.value = value; this.next(); return this.finishNode(node, type); }; pp$3.parseParenExpression = function () { this.expect(types.parenL); var val = this.parseExpression(); this.expect(types.parenR); return val; }; pp$3.parseParenAndDistinguishExpression = function (startPos, startLoc, canBeArrow) { startPos = startPos || this.state.start; startLoc = startLoc || this.state.startLoc; var val = void 0; this.expect(types.parenL); var innerStartPos = this.state.start; var innerStartLoc = this.state.startLoc; var exprList = []; var refShorthandDefaultPos = { start: 0 }; var refNeedsArrowPos = { start: 0 }; var first = true; var spreadStart = void 0; var optionalCommaStart = void 0; while (!this.match(types.parenR)) { if (first) { first = false; } else { this.expect(types.comma, refNeedsArrowPos.start || null); if (this.match(types.parenR)) { optionalCommaStart = this.state.start; break; } } if (this.match(types.ellipsis)) { var spreadNodeStartPos = this.state.start; var spreadNodeStartLoc = this.state.startLoc; spreadStart = this.state.start; exprList.push(this.parseParenItem(this.parseRest(), spreadNodeStartPos, spreadNodeStartLoc)); break; } else { exprList.push(this.parseMaybeAssign(false, refShorthandDefaultPos, this.parseParenItem, refNeedsArrowPos)); } } var innerEndPos = this.state.start; var innerEndLoc = this.state.startLoc; this.expect(types.parenR); var arrowNode = this.startNodeAt(startPos, startLoc); if (canBeArrow && this.shouldParseArrow() && (arrowNode = this.parseArrow(arrowNode))) { for (var _iterator = exprList, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { var _ref; if (_isArray) { if (_i >= _iterator.length) break; _ref = _iterator[_i++]; } else { _i = _iterator.next(); if (_i.done) break; _ref = _i.value; } var param = _ref; if (param.extra && param.extra.parenthesized) this.unexpected(param.extra.parenStart); } return this.parseArrowExpression(arrowNode, exprList); } if (!exprList.length) { this.unexpected(this.state.lastTokStart); } if (optionalCommaStart) this.unexpected(optionalCommaStart); if (spreadStart) this.unexpected(spreadStart); if (refShorthandDefaultPos.start) this.unexpected(refShorthandDefaultPos.start); if (refNeedsArrowPos.start) this.unexpected(refNeedsArrowPos.start); if (exprList.length > 1) { val = this.startNodeAt(innerStartPos, innerStartLoc); val.expressions = exprList; this.toReferencedList(val.expressions); this.finishNodeAt(val, "SequenceExpression", innerEndPos, innerEndLoc); } else { val = exprList[0]; } this.addExtra(val, "parenthesized", true); this.addExtra(val, "parenStart", startPos); return val; }; pp$3.shouldParseArrow = function () { return !this.canInsertSemicolon(); }; pp$3.parseArrow = function (node) { if (this.eat(types.arrow)) { return node; } }; pp$3.parseParenItem = function (node) { return node; }; // New's precedence is slightly tricky. It must allow its argument // to be a `[]` or dot subscript expression, but not a call — at // least, not without wrapping it in parentheses. Thus, it uses the pp$3.parseNew = function () { var node = this.startNode(); var meta = this.parseIdentifier(true); if (this.eat(types.dot)) { var metaProp = this.parseMetaProperty(node, meta, "target"); if (!this.state.inFunction) { this.raise(metaProp.property.start, "new.target can only be used in functions"); } return metaProp; } node.callee = this.parseNoCallExpr(); if (this.eat(types.parenL)) { node.arguments = this.parseExprList(types.parenR); this.toReferencedList(node.arguments); } else { node.arguments = []; } return this.finishNode(node, "NewExpression"); }; // Parse template expression. pp$3.parseTemplateElement = function (isTagged) { var elem = this.startNode(); if (this.state.value === null) { if (!isTagged || !this.hasPlugin("templateInvalidEscapes")) { this.raise(this.state.invalidTemplateEscapePosition, "Invalid escape sequence in template"); } else { this.state.invalidTemplateEscapePosition = null; } } elem.value = { raw: this.input.slice(this.state.start, this.state.end).replace(/\r\n?/g, "\n"), cooked: this.state.value }; this.next(); elem.tail = this.match(types.backQuote); return this.finishNode(elem, "TemplateElement"); }; pp$3.parseTemplate = function (isTagged) { var node = this.startNode(); this.next(); node.expressions = []; var curElt = this.parseTemplateElement(isTagged); node.quasis = [curElt]; while (!curElt.tail) { this.expect(types.dollarBraceL); node.expressions.push(this.parseExpression()); this.expect(types.braceR); node.quasis.push(curElt = this.parseTemplateElement(isTagged)); } this.next(); return this.finishNode(node, "TemplateLiteral"); }; // Parse an object literal or binding pattern. pp$3.parseObj = function (isPattern, refShorthandDefaultPos) { var decorators = []; var propHash = Object.create(null); var first = true; var node = this.startNode(); node.properties = []; this.next(); var firstRestLocation = null; while (!this.eat(types.braceR)) { if (first) { first = false; } else { this.expect(types.comma); if (this.eat(types.braceR)) break; } while (this.match(types.at)) { decorators.push(this.parseDecorator()); } var prop = this.startNode(), isGenerator = false, isAsync = false, startPos = void 0, startLoc = void 0; if (decorators.length) { prop.decorators = decorators; decorators = []; } if (this.hasPlugin("objectRestSpread") && this.match(types.ellipsis)) { prop = this.parseSpread(isPattern ? { start: 0 } : undefined); prop.type = isPattern ? "RestProperty" : "SpreadProperty"; if (isPattern) this.toAssignable(prop.argument, true, "object pattern"); node.properties.push(prop); if (isPattern) { var position = this.state.start; if (firstRestLocation !== null) { this.unexpected(firstRestLocation, "Cannot have multiple rest elements when destructuring"); } else if (this.eat(types.braceR)) { break; } else if (this.match(types.comma) && this.lookahead().type === types.braceR) { // TODO: temporary rollback // this.unexpected(position, "A trailing comma is not permitted after the rest element"); continue; } else { firstRestLocation = position; continue; } } else { continue; } } prop.method = false; prop.shorthand = false; if (isPattern || refShorthandDefaultPos) { startPos = this.state.start; startLoc = this.state.startLoc; } if (!isPattern) { isGenerator = this.eat(types.star); } if (!isPattern && this.isContextual("async")) { if (isGenerator) this.unexpected(); var asyncId = this.parseIdentifier(); if (this.match(types.colon) || this.match(types.parenL) || this.match(types.braceR) || this.match(types.eq) || this.match(types.comma)) { prop.key = asyncId; prop.computed = false; } else { isAsync = true; if (this.hasPlugin("asyncGenerators")) isGenerator = this.eat(types.star); this.parsePropertyName(prop); } } else { this.parsePropertyName(prop); } this.parseObjPropValue(prop, startPos, startLoc, isGenerator, isAsync, isPattern, refShorthandDefaultPos); this.checkPropClash(prop, propHash); if (prop.shorthand) { this.addExtra(prop, "shorthand", true); } node.properties.push(prop); } if (firstRestLocation !== null) { this.unexpected(firstRestLocation, "The rest element has to be the last element when destructuring"); } if (decorators.length) { this.raise(this.state.start, "You have trailing decorators with no property"); } return this.finishNode(node, isPattern ? "ObjectPattern" : "ObjectExpression"); }; pp$3.isGetterOrSetterMethod = function (prop, isPattern) { return !isPattern && !prop.computed && prop.key.type === "Identifier" && (prop.key.name === "get" || prop.key.name === "set") && (this.match(types.string) || // get "string"() {} this.match(types.num) || // get 1() {} this.match(types.bracketL) || // get ["string"]() {} this.match(types.name) || // get foo() {} this.state.type.keyword // get debugger() {} ); }; // get methods aren't allowed to have any parameters // set methods must have exactly 1 parameter pp$3.checkGetterSetterParamCount = function (method) { var paramCount = method.kind === "get" ? 0 : 1; if (method.params.length !== paramCount) { var start = method.start; if (method.kind === "get") { this.raise(start, "getter should have no params"); } else { this.raise(start, "setter should have exactly one param"); } } }; pp$3.parseObjectMethod = function (prop, isGenerator, isAsync, isPattern) { if (isAsync || isGenerator || this.match(types.parenL)) { if (isPattern) this.unexpected(); prop.kind = "method"; prop.method = true; this.parseMethod(prop, isGenerator, isAsync); return this.finishNode(prop, "ObjectMethod"); } if (this.isGetterOrSetterMethod(prop, isPattern)) { if (isGenerator || isAsync) this.unexpected(); prop.kind = prop.key.name; this.parsePropertyName(prop); this.parseMethod(prop); this.checkGetterSetterParamCount(prop); return this.finishNode(prop, "ObjectMethod"); } }; pp$3.parseObjectProperty = function (prop, startPos, startLoc, isPattern, refShorthandDefaultPos) { if (this.eat(types.colon)) { prop.value = isPattern ? this.parseMaybeDefault(this.state.start, this.state.startLoc) : this.parseMaybeAssign(false, refShorthandDefaultPos); return this.finishNode(prop, "ObjectProperty"); } if (!prop.computed && prop.key.type === "Identifier") { this.checkReservedWord(prop.key.name, prop.key.start, true, true); if (isPattern) { prop.value = this.parseMaybeDefault(startPos, startLoc, prop.key.__clone()); } else if (this.match(types.eq) && refShorthandDefaultPos) { if (!refShorthandDefaultPos.start) { refShorthandDefaultPos.start = this.state.start; } prop.value = this.parseMaybeDefault(startPos, startLoc, prop.key.__clone()); } else { prop.value = prop.key.__clone(); } prop.shorthand = true; return this.finishNode(prop, "ObjectProperty"); } }; pp$3.parseObjPropValue = function (prop, startPos, startLoc, isGenerator, isAsync, isPattern, refShorthandDefaultPos) { var node = this.parseObjectMethod(prop, isGenerator, isAsync, isPattern) || this.parseObjectProperty(prop, startPos, startLoc, isPattern, refShorthandDefaultPos); if (!node) this.unexpected(); return node; }; pp$3.parsePropertyName = function (prop) { if (this.eat(types.bracketL)) { prop.computed = true; prop.key = this.parseMaybeAssign(); this.expect(types.bracketR); } else { prop.computed = false; var oldInPropertyName = this.state.inPropertyName; this.state.inPropertyName = true; prop.key = this.match(types.num) || this.match(types.string) ? this.parseExprAtom() : this.parseIdentifier(true); this.state.inPropertyName = oldInPropertyName; } return prop.key; }; // Initialize empty function node. pp$3.initFunction = function (node, isAsync) { node.id = null; node.generator = false; node.expression = false; node.async = !!isAsync; }; // Parse object or class method. pp$3.parseMethod = function (node, isGenerator, isAsync) { var oldInMethod = this.state.inMethod; this.state.inMethod = node.kind || true; this.initFunction(node, isAsync); this.expect(types.parenL); node.params = this.parseBindingList(types.parenR); node.generator = !!isGenerator; this.parseFunctionBody(node); this.state.inMethod = oldInMethod; return node; }; // Parse arrow function expression with given parameters. pp$3.parseArrowExpression = function (node, params, isAsync) { this.initFunction(node, isAsync); node.params = this.toAssignableList(params, true, "arrow function parameters"); this.parseFunctionBody(node, true); return this.finishNode(node, "ArrowFunctionExpression"); }; pp$3.isStrictBody = function (node, isExpression) { if (!isExpression && node.body.directives.length) { for (var _iterator2 = node.body.directives, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) { var _ref2; if (_isArray2) { if (_i2 >= _iterator2.length) break; _ref2 = _iterator2[_i2++]; } else { _i2 = _iterator2.next(); if (_i2.done) break; _ref2 = _i2.value; } var directive = _ref2; if (directive.value.value === "use strict") { return true; } } } return false; }; // Parse function body and check parameters. pp$3.parseFunctionBody = function (node, allowExpression) { var isExpression = allowExpression && !this.match(types.braceL); var oldInAsync = this.state.inAsync; this.state.inAsync = node.async; if (isExpression) { node.body = this.parseMaybeAssign(); node.expression = true; } else { // Start a new scope with regard to labels and the `inFunction` // flag (restore them to their old value afterwards). var oldInFunc = this.state.inFunction; var oldInGen = this.state.inGenerator; var oldLabels = this.state.labels; this.state.inFunction = true;this.state.inGenerator = node.generator;this.state.labels = []; node.body = this.parseBlock(true); node.expression = false; this.state.inFunction = oldInFunc;this.state.inGenerator = oldInGen;this.state.labels = oldLabels; } this.state.inAsync = oldInAsync; // If this is a strict mode function, verify that argument names // are not repeated, and it does not try to bind the words `eval` // or `arguments`. var isStrict = this.isStrictBody(node, isExpression); // Also check when allowExpression === true for arrow functions var checkLVal = this.state.strict || allowExpression || isStrict; if (isStrict && node.id && node.id.type === "Identifier" && node.id.name === "yield") { this.raise(node.id.start, "Binding yield in strict mode"); } if (checkLVal) { var nameHash = Object.create(null); var oldStrict = this.state.strict; if (isStrict) this.state.strict = true; if (node.id) { this.checkLVal(node.id, true, undefined, "function name"); } for (var _iterator3 = node.params, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator]();;) { var _ref3; if (_isArray3) { if (_i3 >= _iterator3.length) break; _ref3 = _iterator3[_i3++]; } else { _i3 = _iterator3.next(); if (_i3.done) break; _ref3 = _i3.value; } var param = _ref3; if (isStrict && param.type !== "Identifier") { this.raise(param.start, "Non-simple parameter in strict mode"); } this.checkLVal(param, true, nameHash, "function parameter list"); } this.state.strict = oldStrict; } }; // Parses a comma-separated list of expressions, and returns them as // an array. `close` is the token type that ends the list, and // `allowEmpty` can be turned on to allow subsequent commas with // nothing in between them to be parsed as `null` (which is needed // for array literals). pp$3.parseExprList = function (close, allowEmpty, refShorthandDefaultPos) { var elts = []; var first = true; while (!this.eat(close)) { if (first) { first = false; } else { this.expect(types.comma); if (this.eat(close)) break; } elts.push(this.parseExprListItem(allowEmpty, refShorthandDefaultPos)); } return elts; }; pp$3.parseExprListItem = function (allowEmpty, refShorthandDefaultPos, refNeedsArrowPos) { var elt = void 0; if (allowEmpty && this.match(types.comma)) { elt = null; } else if (this.match(types.ellipsis)) { elt = this.parseSpread(refShorthandDefaultPos); } else { elt = this.parseMaybeAssign(false, refShorthandDefaultPos, this.parseParenItem, refNeedsArrowPos); } return elt; }; // Parse the next token as an identifier. If `liberal` is true (used // when parsing properties), it will also convert keywords into // identifiers. pp$3.parseIdentifier = function (liberal) { var node = this.startNode(); if (!liberal) { this.checkReservedWord(this.state.value, this.state.start, !!this.state.type.keyword, false); } if (this.match(types.name)) { node.name = this.state.value; } else if (this.state.type.keyword) { node.name = this.state.type.keyword; } else { this.unexpected(); } if (!liberal && node.name === "await" && this.state.inAsync) { this.raise(node.start, "invalid use of await inside of an async function"); } node.loc.identifierName = node.name; this.next(); return this.finishNode(node, "Identifier"); }; pp$3.checkReservedWord = function (word, startLoc, checkKeywords, isBinding) { if (this.isReservedWord(word) || checkKeywords && this.isKeyword(word)) { this.raise(startLoc, word + " is a reserved word"); } if (this.state.strict && (reservedWords.strict(word) || isBinding && reservedWords.strictBind(word))) { this.raise(startLoc, word + " is a reserved word in strict mode"); } }; // Parses await expression inside async function. pp$3.parseAwait = function (node) { // istanbul ignore next: this condition is checked at the call site so won't be hit here if (!this.state.inAsync) { this.unexpected(); } if (this.match(types.star)) { this.raise(node.start, "await* has been removed from the async functions proposal. Use Promise.all() instead."); } node.argument = this.parseMaybeUnary(); return this.finishNode(node, "AwaitExpression"); }; // Parses yield expression inside generator. pp$3.parseYield = function () { var node = this.startNode(); this.next(); if (this.match(types.semi) || this.canInsertSemicolon() || !this.match(types.star) && !this.state.type.startsExpr) { node.delegate = false; node.argument = null; } else { node.delegate = this.eat(types.star); node.argument = this.parseMaybeAssign(); } return this.finishNode(node, "YieldExpression"); }; // Start an AST node, attaching a start offset. var pp$4 = Parser.prototype; var commentKeys = ["leadingComments", "trailingComments", "innerComments"]; var Node = function () { function Node(pos, loc, filename) { classCallCheck(this, Node); this.type = ""; this.start = pos; this.end = 0; this.loc = new SourceLocation(loc); if (filename) this.loc.filename = filename; } Node.prototype.__clone = function __clone() { var node2 = new Node(); for (var key in this) { // Do not clone comments that are already attached to the node if (commentKeys.indexOf(key) < 0) { node2[key] = this[key]; } } return node2; }; return Node; }(); pp$4.startNode = function () { return new Node(this.state.start, this.state.startLoc, this.filename); }; pp$4.startNodeAt = function (pos, loc) { return new Node(pos, loc, this.filename); }; function finishNodeAt(node, type, pos, loc) { node.type = type; node.end = pos; node.loc.end = loc; this.processComment(node); return node; } // Finish an AST node, adding `type` and `end` properties. pp$4.finishNode = function (node, type) { return finishNodeAt.call(this, node, type, this.state.lastTokEnd, this.state.lastTokEndLoc); }; // Finish node at given position pp$4.finishNodeAt = function (node, type, pos, loc) { return finishNodeAt.call(this, node, type, pos, loc); }; var pp$5 = Parser.prototype; // This function is used to raise exceptions on parse errors. It // takes an offset integer (into the current `input`) to indicate // the location of the error, attaches the position to the end // of the error message, and then raises a `SyntaxError` with that // message. pp$5.raise = function (pos, message) { var loc = getLineInfo(this.input, pos); message += " (" + loc.line + ":" + loc.column + ")"; var err = new SyntaxError(message); err.pos = pos; err.loc = loc; throw err; }; /* eslint max-len: 0 */ /** * Based on the comment attachment algorithm used in espree and estraverse. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ function last(stack) { return stack[stack.length - 1]; } var pp$6 = Parser.prototype; pp$6.addComment = function (comment) { if (this.filename) comment.loc.filename = this.filename; this.state.trailingComments.push(comment); this.state.leadingComments.push(comment); }; pp$6.processComment = function (node) { if (node.type === "Program" && node.body.length > 0) return; var stack = this.state.commentStack; var firstChild = void 0, lastChild = void 0, trailingComments = void 0, i = void 0, j = void 0; if (this.state.trailingComments.length > 0) { // If the first comment in trailingComments comes after the // current node, then we're good - all comments in the array will // come after the node and so it's safe to add them as official // trailingComments. if (this.state.trailingComments[0].start >= node.end) { trailingComments = this.state.trailingComments; this.state.trailingComments = []; } else { // Otherwise, if the first comment doesn't come after the // current node, that means we have a mix of leading and trailing // comments in the array and that leadingComments contains the // same items as trailingComments. Reset trailingComments to // zero items and we'll handle this by evaluating leadingComments // later. this.state.trailingComments.length = 0; } } else { var lastInStack = last(stack); if (stack.length > 0 && lastInStack.trailingComments && lastInStack.trailingComments[0].start >= node.end) { trailingComments = lastInStack.trailingComments; lastInStack.trailingComments = null; } } // Eating the stack. if (stack.length > 0 && last(stack).start >= node.start) { firstChild = stack.pop(); } while (stack.length > 0 && last(stack).start >= node.start) { lastChild = stack.pop(); } if (!lastChild && firstChild) lastChild = firstChild; // Attach comments that follow a trailing comma on the last // property in an object literal or a trailing comma in function arguments // as trailing comments if (firstChild && this.state.leadingComments.length > 0) { var lastComment = last(this.state.leadingComments); if (firstChild.type === "ObjectProperty") { if (lastComment.start >= node.start) { if (this.state.commentPreviousNode) { for (j = 0; j < this.state.leadingComments.length; j++) { if (this.state.leadingComments[j].end < this.state.commentPreviousNode.end) { this.state.leadingComments.splice(j, 1); j--; } } if (this.state.leadingComments.length > 0) { firstChild.trailingComments = this.state.leadingComments; this.state.leadingComments = []; } } } } else if (node.type === "CallExpression" && node.arguments && node.arguments.length) { var lastArg = last(node.arguments); if (lastArg && lastComment.start >= lastArg.start && lastComment.end <= node.end) { if (this.state.commentPreviousNode) { if (this.state.leadingComments.length > 0) { lastArg.trailingComments = this.state.leadingComments; this.state.leadingComments = []; } } } } } if (lastChild) { if (lastChild.leadingComments) { if (lastChild !== node && last(lastChild.leadingComments).end <= node.start) { node.leadingComments = lastChild.leadingComments; lastChild.leadingComments = null; } else { // A leading comment for an anonymous class had been stolen by its first ClassMethod, // so this takes back the leading comment. // See also: https://github.com/eslint/espree/issues/158 for (i = lastChild.leadingComments.length - 2; i >= 0; --i) { if (lastChild.leadingComments[i].end <= node.start) { node.leadingComments = lastChild.leadingComments.splice(0, i + 1); break; } } } } } else if (this.state.leadingComments.length > 0) { if (last(this.state.leadingComments).end <= node.start) { if (this.state.commentPreviousNode) { for (j = 0; j < this.state.leadingComments.length; j++) { if (this.state.leadingComments[j].end < this.state.commentPreviousNode.end) { this.state.leadingComments.splice(j, 1); j--; } } } if (this.state.leadingComments.length > 0) { node.leadingComments = this.state.leadingComments; this.state.leadingComments = []; } } else { // https://github.com/eslint/espree/issues/2 // // In special cases, such as return (without a value) and // debugger, all comments will end up as leadingComments and // will otherwise be eliminated. This step runs when the // commentStack is empty and there are comments left // in leadingComments. // // This loop figures out the stopping point between the actual // leading and trailing comments by finding the location of the // first comment that comes after the given node. for (i = 0; i < this.state.leadingComments.length; i++) { if (this.state.leadingComments[i].end > node.start) { break; } } // Split the array based on the location of the first comment // that comes after the node. Keep in mind that this could // result in an empty array, and if so, the array must be // deleted. node.leadingComments = this.state.leadingComments.slice(0, i); if (node.leadingComments.length === 0) { node.leadingComments = null; } // Similarly, trailing comments are attached later. The variable // must be reset to null if there are no trailing comments. trailingComments = this.state.leadingComments.slice(i); if (trailingComments.length === 0) { trailingComments = null; } } } this.state.commentPreviousNode = node; if (trailingComments) { if (trailingComments.length && trailingComments[0].start >= node.start && last(trailingComments).end <= node.end) { node.innerComments = trailingComments; } else { node.trailingComments = trailingComments; } } stack.push(node); }; var pp$7 = Parser.prototype; pp$7.estreeParseRegExpLiteral = function (_ref) { var pattern = _ref.pattern, flags = _ref.flags; var regex = null; try { regex = new RegExp(pattern, flags); } catch (e) { // In environments that don't support these flags value will // be null as the regex can't be represented natively. } var node = this.estreeParseLiteral(regex); node.regex = { pattern: pattern, flags: flags }; return node; }; pp$7.estreeParseLiteral = function (value) { return this.parseLiteral(value, "Literal"); }; pp$7.directiveToStmt = function (directive) { var directiveLiteral = directive.value; var stmt = this.startNodeAt(directive.start, directive.loc.start); var expression = this.startNodeAt(directiveLiteral.start, directiveLiteral.loc.start); expression.value = directiveLiteral.value; expression.raw = directiveLiteral.extra.raw; stmt.expression = this.finishNodeAt(expression, "Literal", directiveLiteral.end, directiveLiteral.loc.end); stmt.directive = directiveLiteral.extra.raw.slice(1, -1); return this.finishNodeAt(stmt, "ExpressionStatement", directive.end, directive.loc.end); }; function isSimpleProperty(node) { return node && node.type === "Property" && node.kind === "init" && node.method === false; } var estreePlugin = function (instance) { instance.extend("checkDeclaration", function (inner) { return function (node) { if (isSimpleProperty(node)) { this.checkDeclaration(node.value); } else { inner.call(this, node); } }; }); instance.extend("checkGetterSetterParamCount", function () { return function (prop) { var paramCount = prop.kind === "get" ? 0 : 1; if (prop.value.params.length !== paramCount) { var start = prop.start; if (prop.kind === "get") { this.raise(start, "getter should have no params"); } else { this.raise(start, "setter should have exactly one param"); } } }; }); instance.extend("checkLVal", function (inner) { return function (expr, isBinding, checkClashes) { var _this = this; switch (expr.type) { case "ObjectPattern": expr.properties.forEach(function (prop) { _this.checkLVal(prop.type === "Property" ? prop.value : prop, isBinding, checkClashes, "object destructuring pattern"); }); break; default: for (var _len = arguments.length, args = Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) { args[_key - 3] = arguments[_key]; } inner.call.apply(inner, [this, expr, isBinding, checkClashes].concat(args)); } }; }); instance.extend("checkPropClash", function () { return function (prop, propHash) { if (prop.computed || !isSimpleProperty(prop)) return; var key = prop.key; // It is either an Identifier or a String/NumericLiteral var name = key.type === "Identifier" ? key.name : String(key.value); if (name === "__proto__") { if (propHash.proto) this.raise(key.start, "Redefinition of __proto__ property"); propHash.proto = true; } }; }); instance.extend("isStrictBody", function () { return function (node, isExpression) { if (!isExpression && node.body.body.length > 0) { for (var _iterator = node.body.body, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { var _ref2; if (_isArray) { if (_i >= _iterator.length) break; _ref2 = _iterator[_i++]; } else { _i = _iterator.next(); if (_i.done) break; _ref2 = _i.value; } var directive = _ref2; if (directive.type === "ExpressionStatement" && directive.expression.type === "Literal") { if (directive.expression.value === "use strict") return true; } else { // Break for the first non literal expression break; } } } return false; }; }); instance.extend("isValidDirective", function () { return function (stmt) { return stmt.type === "ExpressionStatement" && stmt.expression.type === "Literal" && typeof stmt.expression.value === "string" && (!stmt.expression.extra || !stmt.expression.extra.parenthesized); }; }); instance.extend("stmtToDirective", function (inner) { return function (stmt) { var directive = inner.call(this, stmt); var value = stmt.expression.value; // Reset value to the actual value as in estree mode we want // the stmt to have the real value and not the raw value directive.value.value = value; return directive; }; }); instance.extend("parseBlockBody", function (inner) { return function (node) { var _this2 = this; for (var _len2 = arguments.length, args = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { args[_key2 - 1] = arguments[_key2]; } inner.call.apply(inner, [this, node].concat(args)); node.directives.reverse().forEach(function (directive) { node.body.unshift(_this2.directiveToStmt(directive)); }); delete node.directives; }; }); instance.extend("parseClassMethod", function () { return function (classBody, method, isGenerator, isAsync) { this.parseMethod(method, isGenerator, isAsync); if (method.typeParameters) { method.value.typeParameters = method.typeParameters; delete method.typeParameters; } classBody.body.push(this.finishNode(method, "MethodDefinition")); }; }); instance.extend("parseExprAtom", function (inner) { return function () { switch (this.state.type) { case types.regexp: return this.estreeParseRegExpLiteral(this.state.value); case types.num: case types.string: return this.estreeParseLiteral(this.state.value); case types._null: return this.estreeParseLiteral(null); case types._true: return this.estreeParseLiteral(true); case types._false: return this.estreeParseLiteral(false); default: for (var _len3 = arguments.length, args = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { args[_key3] = arguments[_key3]; } return inner.call.apply(inner, [this].concat(args)); } }; }); instance.extend("parseLiteral", function (inner) { return function () { for (var _len4 = arguments.length, args = Array(_len4), _key4 = 0; _key4 < _len4; _key4++) { args[_key4] = arguments[_key4]; } var node = inner.call.apply(inner, [this].concat(args)); node.raw = node.extra.raw; delete node.extra; return node; }; }); instance.extend("parseMethod", function (inner) { return function (node) { var funcNode = this.startNode(); funcNode.kind = node.kind; // provide kind, so inner method correctly sets state for (var _len5 = arguments.length, args = Array(_len5 > 1 ? _len5 - 1 : 0), _key5 = 1; _key5 < _len5; _key5++) { args[_key5 - 1] = arguments[_key5]; } funcNode = inner.call.apply(inner, [this, funcNode].concat(args)); delete funcNode.kind; node.value = this.finishNode(funcNode, "FunctionExpression"); return node; }; }); instance.extend("parseObjectMethod", function (inner) { return function () { for (var _len6 = arguments.length, args = Array(_len6), _key6 = 0; _key6 < _len6; _key6++) { args[_key6] = arguments[_key6]; } var node = inner.call.apply(inner, [this].concat(args)); if (node) { if (node.kind === "method") node.kind = "init"; node.type = "Property"; } return node; }; }); instance.extend("parseObjectProperty", function (inner) { return function () { for (var _len7 = arguments.length, args = Array(_len7), _key7 = 0; _key7 < _len7; _key7++) { args[_key7] = arguments[_key7]; } var node = inner.call.apply(inner, [this].concat(args)); if (node) { node.kind = "init"; node.type = "Property"; } return node; }; }); instance.extend("toAssignable", function (inner) { return function (node, isBinding) { for (var _len8 = arguments.length, args = Array(_len8 > 2 ? _len8 - 2 : 0), _key8 = 2; _key8 < _len8; _key8++) { args[_key8 - 2] = arguments[_key8]; } if (isSimpleProperty(node)) { this.toAssignable.apply(this, [node.value, isBinding].concat(args)); return node; } else if (node.type === "ObjectExpression") { node.type = "ObjectPattern"; for (var _iterator2 = node.properties, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) { var _ref3; if (_isArray2) { if (_i2 >= _iterator2.length) break; _ref3 = _iterator2[_i2++]; } else { _i2 = _iterator2.next(); if (_i2.done) break; _ref3 = _i2.value; } var prop = _ref3; if (prop.kind === "get" || prop.kind === "set") { this.raise(prop.key.start, "Object pattern can't contain getter or setter"); } else if (prop.method) { this.raise(prop.key.start, "Object pattern can't contain methods"); } else { this.toAssignable(prop, isBinding, "object destructuring pattern"); } } return node; } return inner.call.apply(inner, [this, node, isBinding].concat(args)); }; }); }; /* eslint max-len: 0 */ var primitiveTypes = ["any", "mixed", "empty", "bool", "boolean", "number", "string", "void", "null"]; var pp$8 = Parser.prototype; pp$8.flowParseTypeInitialiser = function (tok) { var oldInType = this.state.inType; this.state.inType = true; this.expect(tok || types.colon); var type = this.flowParseType(); this.state.inType = oldInType; return type; }; pp$8.flowParsePredicate = function () { var node = this.startNode(); var moduloLoc = this.state.startLoc; var moduloPos = this.state.start; this.expect(types.modulo); var checksLoc = this.state.startLoc; this.expectContextual("checks"); // Force '%' and 'checks' to be adjacent if (moduloLoc.line !== checksLoc.line || moduloLoc.column !== checksLoc.column - 1) { this.raise(moduloPos, "Spaces between ´%´ and ´checks´ are not allowed here."); } if (this.eat(types.parenL)) { node.expression = this.parseExpression(); this.expect(types.parenR); return this.finishNode(node, "DeclaredPredicate"); } else { return this.finishNode(node, "InferredPredicate"); } }; pp$8.flowParseTypeAndPredicateInitialiser = function () { var oldInType = this.state.inType; this.state.inType = true; this.expect(types.colon); var type = null; var predicate = null; if (this.match(types.modulo)) { this.state.inType = oldInType; predicate = this.flowParsePredicate(); } else { type = this.flowParseType(); this.state.inType = oldInType; if (this.match(types.modulo)) { predicate = this.flowParsePredicate(); } } return [type, predicate]; }; pp$8.flowParseDeclareClass = function (node) { this.next(); this.flowParseInterfaceish(node, true); return this.finishNode(node, "DeclareClass"); }; pp$8.flowParseDeclareFunction = function (node) { this.next(); var id = node.id = this.parseIdentifier(); var typeNode = this.startNode(); var typeContainer = this.startNode(); if (this.isRelational("<")) { typeNode.typeParameters = this.flowParseTypeParameterDeclaration(); } else { typeNode.typeParameters = null; } this.expect(types.parenL); var tmp = this.flowParseFunctionTypeParams(); typeNode.params = tmp.params; typeNode.rest = tmp.rest; this.expect(types.parenR); var predicate = null; var _flowParseTypeAndPred = this.flowParseTypeAndPredicateInitialiser(); typeNode.returnType = _flowParseTypeAndPred[0]; predicate = _flowParseTypeAndPred[1]; typeContainer.typeAnnotation = this.finishNode(typeNode, "FunctionTypeAnnotation"); typeContainer.predicate = predicate; id.typeAnnotation = this.finishNode(typeContainer, "TypeAnnotation"); this.finishNode(id, id.type); this.semicolon(); return this.finishNode(node, "DeclareFunction"); }; pp$8.flowParseDeclare = function (node) { if (this.match(types._class)) { return this.flowParseDeclareClass(node); } else if (this.match(types._function)) { return this.flowParseDeclareFunction(node); } else if (this.match(types._var)) { return this.flowParseDeclareVariable(node); } else if (this.isContextual("module")) { if (this.lookahead().type === types.dot) { return this.flowParseDeclareModuleExports(node); } else { return this.flowParseDeclareModule(node); } } else if (this.isContextual("type")) { return this.flowParseDeclareTypeAlias(node); } else if (this.isContextual("opaque")) { return this.flowParseDeclareOpaqueType(node); } else if (this.isContextual("interface")) { return this.flowParseDeclareInterface(node); } else if (this.match(types._export)) { return this.flowParseDeclareExportDeclaration(node); } else { this.unexpected(); } }; pp$8.flowParseDeclareExportDeclaration = function (node) { this.expect(types._export); if (this.isContextual("opaque") // declare export opaque ... ) { node.declaration = this.flowParseDeclare(this.startNode()); node.default = false; return this.finishNode(node, "DeclareExportDeclaration"); } throw this.unexpected(); }; pp$8.flowParseDeclareVariable = function (node) { this.next(); node.id = this.flowParseTypeAnnotatableIdentifier(); this.semicolon(); return this.finishNode(node, "DeclareVariable"); }; pp$8.flowParseDeclareModule = function (node) { this.next(); if (this.match(types.string)) { node.id = this.parseExprAtom(); } else { node.id = this.parseIdentifier(); } var bodyNode = node.body = this.startNode(); var body = bodyNode.body = []; this.expect(types.braceL); while (!this.match(types.braceR)) { var _bodyNode = this.startNode(); if (this.match(types._import)) { var lookahead = this.lookahead(); if (lookahead.value !== "type" && lookahead.value !== "typeof") { this.unexpected(null, "Imports within a `declare module` body must always be `import type` or `import typeof`"); } this.parseImport(_bodyNode); } else { this.expectContextual("declare", "Only declares and type imports are allowed inside declare module"); _bodyNode = this.flowParseDeclare(_bodyNode, true); } body.push(_bodyNode); } this.expect(types.braceR); this.finishNode(bodyNode, "BlockStatement"); return this.finishNode(node, "DeclareModule"); }; pp$8.flowParseDeclareModuleExports = function (node) { this.expectContextual("module"); this.expect(types.dot); this.expectContextual("exports"); node.typeAnnotation = this.flowParseTypeAnnotation(); this.semicolon(); return this.finishNode(node, "DeclareModuleExports"); }; pp$8.flowParseDeclareTypeAlias = function (node) { this.next(); this.flowParseTypeAlias(node); return this.finishNode(node, "DeclareTypeAlias"); }; pp$8.flowParseDeclareOpaqueType = function (node) { this.next(); this.flowParseOpaqueType(node, true); return this.finishNode(node, "DeclareOpaqueType"); }; pp$8.flowParseDeclareInterface = function (node) { this.next(); this.flowParseInterfaceish(node); return this.finishNode(node, "DeclareInterface"); }; // Interfaces pp$8.flowParseInterfaceish = function (node) { node.id = this.parseIdentifier(); if (this.isRelational("<")) { node.typeParameters = this.flowParseTypeParameterDeclaration(); } else { node.typeParameters = null; } node.extends = []; node.mixins = []; if (this.eat(types._extends)) { do { node.extends.push(this.flowParseInterfaceExtends()); } while (this.eat(types.comma)); } if (this.isContextual("mixins")) { this.next(); do { node.mixins.push(this.flowParseInterfaceExtends()); } while (this.eat(types.comma)); } node.body = this.flowParseObjectType(true, false, false); }; pp$8.flowParseInterfaceExtends = function () { var node = this.startNode(); node.id = this.flowParseQualifiedTypeIdentifier(); if (this.isRelational("<")) { node.typeParameters = this.flowParseTypeParameterInstantiation(); } else { node.typeParameters = null; } return this.finishNode(node, "InterfaceExtends"); }; pp$8.flowParseInterface = function (node) { this.flowParseInterfaceish(node, false); return this.finishNode(node, "InterfaceDeclaration"); }; pp$8.flowParseRestrictedIdentifier = function (liberal) { if (primitiveTypes.indexOf(this.state.value) > -1) { this.raise(this.state.start, "Cannot overwrite primitive type " + this.state.value); } return this.parseIdentifier(liberal); }; // Type aliases pp$8.flowParseTypeAlias = function (node) { node.id = this.flowParseRestrictedIdentifier(); if (this.isRelational("<")) { node.typeParameters = this.flowParseTypeParameterDeclaration(); } else { node.typeParameters = null; } node.right = this.flowParseTypeInitialiser(types.eq); this.semicolon(); return this.finishNode(node, "TypeAlias"); }; // Opaque type aliases pp$8.flowParseOpaqueType = function (node, declare) { this.expectContextual("type"); node.id = this.flowParseRestrictedIdentifier(); if (this.isRelational("<")) { node.typeParameters = this.flowParseTypeParameterDeclaration(); } else { node.typeParameters = null; } // Parse the supertype node.supertype = null; if (this.match(types.colon)) { node.supertype = this.flowParseTypeInitialiser(types.colon); } node.impltype = null; if (!declare) { node.impltype = this.flowParseTypeInitialiser(types.eq); } this.semicolon(); return this.finishNode(node, "OpaqueType"); }; // Type annotations pp$8.flowParseTypeParameter = function () { var node = this.startNode(); var variance = this.flowParseVariance(); var ident = this.flowParseTypeAnnotatableIdentifier(); node.name = ident.name; node.variance = variance; node.bound = ident.typeAnnotation; if (this.match(types.eq)) { this.eat(types.eq); node.default = this.flowParseType(); } return this.finishNode(node, "TypeParameter"); }; pp$8.flowParseTypeParameterDeclaration = function () { var oldInType = this.state.inType; var node = this.startNode(); node.params = []; this.state.inType = true; // istanbul ignore else: this condition is already checked at all call sites if (this.isRelational("<") || this.match(types.jsxTagStart)) { this.next(); } else { this.unexpected(); } do { node.params.push(this.flowParseTypeParameter()); if (!this.isRelational(">")) { this.expect(types.comma); } } while (!this.isRelational(">")); this.expectRelational(">"); this.state.inType = oldInType; return this.finishNode(node, "TypeParameterDeclaration"); }; pp$8.flowParseTypeParameterInstantiation = function () { var node = this.startNode(); var oldInType = this.state.inType; node.params = []; this.state.inType = true; this.expectRelational("<"); while (!this.isRelational(">")) { node.params.push(this.flowParseType()); if (!this.isRelational(">")) { this.expect(types.comma); } } this.expectRelational(">"); this.state.inType = oldInType; return this.finishNode(node, "TypeParameterInstantiation"); }; pp$8.flowParseObjectPropertyKey = function () { return this.match(types.num) || this.match(types.string) ? this.parseExprAtom() : this.parseIdentifier(true); }; pp$8.flowParseObjectTypeIndexer = function (node, isStatic, variance) { node.static = isStatic; this.expect(types.bracketL); if (this.lookahead().type === types.colon) { node.id = this.flowParseObjectPropertyKey(); node.key = this.flowParseTypeInitialiser(); } else { node.id = null; node.key = this.flowParseType(); } this.expect(types.bracketR); node.value = this.flowParseTypeInitialiser(); node.variance = variance; this.flowObjectTypeSemicolon(); return this.finishNode(node, "ObjectTypeIndexer"); }; pp$8.flowParseObjectTypeMethodish = function (node) { node.params = []; node.rest = null; node.typeParameters = null; if (this.isRelational("<")) { node.typeParameters = this.flowParseTypeParameterDeclaration(); } this.expect(types.parenL); while (!this.match(types.parenR) && !this.match(types.ellipsis)) { node.params.push(this.flowParseFunctionTypeParam()); if (!this.match(types.parenR)) { this.expect(types.comma); } } if (this.eat(types.ellipsis)) { node.rest = this.flowParseFunctionTypeParam(); } this.expect(types.parenR); node.returnType = this.flowParseTypeInitialiser(); return this.finishNode(node, "FunctionTypeAnnotation"); }; pp$8.flowParseObjectTypeMethod = function (startPos, startLoc, isStatic, key) { var node = this.startNodeAt(startPos, startLoc); node.value = this.flowParseObjectTypeMethodish(this.startNodeAt(startPos, startLoc)); node.static = isStatic; node.key = key; node.optional = false; this.flowObjectTypeSemicolon(); return this.finishNode(node, "ObjectTypeProperty"); }; pp$8.flowParseObjectTypeCallProperty = function (node, isStatic) { var valueNode = this.startNode(); node.static = isStatic; node.value = this.flowParseObjectTypeMethodish(valueNode); this.flowObjectTypeSemicolon(); return this.finishNode(node, "ObjectTypeCallProperty"); }; pp$8.flowParseObjectType = function (allowStatic, allowExact, allowSpread) { var oldInType = this.state.inType; this.state.inType = true; var nodeStart = this.startNode(); var node = void 0; var propertyKey = void 0; var isStatic = false; nodeStart.callProperties = []; nodeStart.properties = []; nodeStart.indexers = []; var endDelim = void 0; var exact = void 0; if (allowExact && this.match(types.braceBarL)) { this.expect(types.braceBarL); endDelim = types.braceBarR; exact = true; } else { this.expect(types.braceL); endDelim = types.braceR; exact = false; } nodeStart.exact = exact; while (!this.match(endDelim)) { var optional = false; var startPos = this.state.start; var startLoc = this.state.startLoc; node = this.startNode(); if (allowStatic && this.isContextual("static") && this.lookahead().type !== types.colon) { this.next(); isStatic = true; } var variancePos = this.state.start; var variance = this.flowParseVariance(); if (this.match(types.bracketL)) { nodeStart.indexers.push(this.flowParseObjectTypeIndexer(node, isStatic, variance)); } else if (this.match(types.parenL) || this.isRelational("<")) { if (variance) { this.unexpected(variancePos); } nodeStart.callProperties.push(this.flowParseObjectTypeCallProperty(node, isStatic)); } else { if (this.match(types.ellipsis)) { if (!allowSpread) { this.unexpected(null, "Spread operator cannot appear in class or interface definitions"); } if (variance) { this.unexpected(variance.start, "Spread properties cannot have variance"); } this.expect(types.ellipsis); node.argument = this.flowParseType(); this.flowObjectTypeSemicolon(); nodeStart.properties.push(this.finishNode(node, "ObjectTypeSpreadProperty")); } else { propertyKey = this.flowParseObjectPropertyKey(); if (this.isRelational("<") || this.match(types.parenL)) { // This is a method property if (variance) { this.unexpected(variance.start); } nodeStart.properties.push(this.flowParseObjectTypeMethod(startPos, startLoc, isStatic, propertyKey)); } else { if (this.eat(types.question)) { optional = true; } node.key = propertyKey; node.value = this.flowParseTypeInitialiser(); node.optional = optional; node.static = isStatic; node.variance = variance; this.flowObjectTypeSemicolon(); nodeStart.properties.push(this.finishNode(node, "ObjectTypeProperty")); } } } isStatic = false; } this.expect(endDelim); var out = this.finishNode(nodeStart, "ObjectTypeAnnotation"); this.state.inType = oldInType; return out; }; pp$8.flowObjectTypeSemicolon = function () { if (!this.eat(types.semi) && !this.eat(types.comma) && !this.match(types.braceR) && !this.match(types.braceBarR)) { this.unexpected(); } }; pp$8.flowParseQualifiedTypeIdentifier = function (startPos, startLoc, id) { startPos = startPos || this.state.start; startLoc = startLoc || this.state.startLoc; var node = id || this.parseIdentifier(); while (this.eat(types.dot)) { var node2 = this.startNodeAt(startPos, startLoc); node2.qualification = node; node2.id = this.parseIdentifier(); node = this.finishNode(node2, "QualifiedTypeIdentifier"); } return node; }; pp$8.flowParseGenericType = function (startPos, startLoc, id) { var node = this.startNodeAt(startPos, startLoc); node.typeParameters = null; node.id = this.flowParseQualifiedTypeIdentifier(startPos, startLoc, id); if (this.isRelational("<")) { node.typeParameters = this.flowParseTypeParameterInstantiation(); } return this.finishNode(node, "GenericTypeAnnotation"); }; pp$8.flowParseTypeofType = function () { var node = this.startNode(); this.expect(types._typeof); node.argument = this.flowParsePrimaryType(); return this.finishNode(node, "TypeofTypeAnnotation"); }; pp$8.flowParseTupleType = function () { var node = this.startNode(); node.types = []; this.expect(types.bracketL); // We allow trailing commas while (this.state.pos < this.input.length && !this.match(types.bracketR)) { node.types.push(this.flowParseType()); if (this.match(types.bracketR)) break; this.expect(types.comma); } this.expect(types.bracketR); return this.finishNode(node, "TupleTypeAnnotation"); }; pp$8.flowParseFunctionTypeParam = function () { var name = null; var optional = false; var typeAnnotation = null; var node = this.startNode(); var lh = this.lookahead(); if (lh.type === types.colon || lh.type === types.question) { name = this.parseIdentifier(); if (this.eat(types.question)) { optional = true; } typeAnnotation = this.flowParseTypeInitialiser(); } else { typeAnnotation = this.flowParseType(); } node.name = name; node.optional = optional; node.typeAnnotation = typeAnnotation; return this.finishNode(node, "FunctionTypeParam"); }; pp$8.reinterpretTypeAsFunctionTypeParam = function (type) { var node = this.startNodeAt(type.start, type.loc.start); node.name = null; node.optional = false; node.typeAnnotation = type; return this.finishNode(node, "FunctionTypeParam"); }; pp$8.flowParseFunctionTypeParams = function () { var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; var ret = { params: params, rest: null }; while (!this.match(types.parenR) && !this.match(types.ellipsis)) { ret.params.push(this.flowParseFunctionTypeParam()); if (!this.match(types.parenR)) { this.expect(types.comma); } } if (this.eat(types.ellipsis)) { ret.rest = this.flowParseFunctionTypeParam(); } return ret; }; pp$8.flowIdentToTypeAnnotation = function (startPos, startLoc, node, id) { switch (id.name) { case "any": return this.finishNode(node, "AnyTypeAnnotation"); case "void": return this.finishNode(node, "VoidTypeAnnotation"); case "bool": case "boolean": return this.finishNode(node, "BooleanTypeAnnotation"); case "mixed": return this.finishNode(node, "MixedTypeAnnotation"); case "empty": return this.finishNode(node, "EmptyTypeAnnotation"); case "number": return this.finishNode(node, "NumberTypeAnnotation"); case "string": return this.finishNode(node, "StringTypeAnnotation"); default: return this.flowParseGenericType(startPos, startLoc, id); } }; // The parsing of types roughly parallels the parsing of expressions, and // primary types are kind of like primary expressions...they're the // primitives with which other types are constructed. pp$8.flowParsePrimaryType = function () { var startPos = this.state.start; var startLoc = this.state.startLoc; var node = this.startNode(); var tmp = void 0; var type = void 0; var isGroupedType = false; var oldNoAnonFunctionType = this.state.noAnonFunctionType; switch (this.state.type) { case types.name: return this.flowIdentToTypeAnnotation(startPos, startLoc, node, this.parseIdentifier()); case types.braceL: return this.flowParseObjectType(false, false, true); case types.braceBarL: return this.flowParseObjectType(false, true, true); case types.bracketL: return this.flowParseTupleType(); case types.relational: if (this.state.value === "<") { node.typeParameters = this.flowParseTypeParameterDeclaration(); this.expect(types.parenL); tmp = this.flowParseFunctionTypeParams(); node.params = tmp.params; node.rest = tmp.rest; this.expect(types.parenR); this.expect(types.arrow); node.returnType = this.flowParseType(); return this.finishNode(node, "FunctionTypeAnnotation"); } break; case types.parenL: this.next(); // Check to see if this is actually a grouped type if (!this.match(types.parenR) && !this.match(types.ellipsis)) { if (this.match(types.name)) { var token = this.lookahead().type; isGroupedType = token !== types.question && token !== types.colon; } else { isGroupedType = true; } } if (isGroupedType) { this.state.noAnonFunctionType = false; type = this.flowParseType(); this.state.noAnonFunctionType = oldNoAnonFunctionType; // A `,` or a `) =>` means this is an anonymous function type if (this.state.noAnonFunctionType || !(this.match(types.comma) || this.match(types.parenR) && this.lookahead().type === types.arrow)) { this.expect(types.parenR); return type; } else { // Eat a comma if there is one this.eat(types.comma); } } if (type) { tmp = this.flowParseFunctionTypeParams([this.reinterpretTypeAsFunctionTypeParam(type)]); } else { tmp = this.flowParseFunctionTypeParams(); } node.params = tmp.params; node.rest = tmp.rest; this.expect(types.parenR); this.expect(types.arrow); node.returnType = this.flowParseType(); node.typeParameters = null; return this.finishNode(node, "FunctionTypeAnnotation"); case types.string: return this.parseLiteral(this.state.value, "StringLiteralTypeAnnotation"); case types._true:case types._false: node.value = this.match(types._true); this.next(); return this.finishNode(node, "BooleanLiteralTypeAnnotation"); case types.plusMin: if (this.state.value === "-") { this.next(); if (!this.match(types.num)) this.unexpected(null, "Unexpected token, expected number"); return this.parseLiteral(-this.state.value, "NumericLiteralTypeAnnotation", node.start, node.loc.start); } this.unexpected(); case types.num: return this.parseLiteral(this.state.value, "NumericLiteralTypeAnnotation"); case types._null: node.value = this.match(types._null); this.next(); return this.finishNode(node, "NullLiteralTypeAnnotation"); case types._this: node.value = this.match(types._this); this.next(); return this.finishNode(node, "ThisTypeAnnotation"); case types.star: this.next(); return this.finishNode(node, "ExistentialTypeParam"); default: if (this.state.type.keyword === "typeof") { return this.flowParseTypeofType(); } } this.unexpected(); }; pp$8.flowParsePostfixType = function () { var startPos = this.state.start, startLoc = this.state.startLoc; var type = this.flowParsePrimaryType(); while (!this.canInsertSemicolon() && this.match(types.bracketL)) { var node = this.startNodeAt(startPos, startLoc); node.elementType = type; this.expect(types.bracketL); this.expect(types.bracketR); type = this.finishNode(node, "ArrayTypeAnnotation"); } return type; }; pp$8.flowParsePrefixType = function () { var node = this.startNode(); if (this.eat(types.question)) { node.typeAnnotation = this.flowParsePrefixType(); return this.finishNode(node, "NullableTypeAnnotation"); } else { return this.flowParsePostfixType(); } }; pp$8.flowParseAnonFunctionWithoutParens = function () { var param = this.flowParsePrefixType(); if (!this.state.noAnonFunctionType && this.eat(types.arrow)) { var node = this.startNodeAt(param.start, param.loc.start); node.params = [this.reinterpretTypeAsFunctionTypeParam(param)]; node.rest = null; node.returnType = this.flowParseType(); node.typeParameters = null; return this.finishNode(node, "FunctionTypeAnnotation"); } return param; }; pp$8.flowParseIntersectionType = function () { var node = this.startNode(); this.eat(types.bitwiseAND); var type = this.flowParseAnonFunctionWithoutParens(); node.types = [type]; while (this.eat(types.bitwiseAND)) { node.types.push(this.flowParseAnonFunctionWithoutParens()); } return node.types.length === 1 ? type : this.finishNode(node, "IntersectionTypeAnnotation"); }; pp$8.flowParseUnionType = function () { var node = this.startNode(); this.eat(types.bitwiseOR); var type = this.flowParseIntersectionType(); node.types = [type]; while (this.eat(types.bitwiseOR)) { node.types.push(this.flowParseIntersectionType()); } return node.types.length === 1 ? type : this.finishNode(node, "UnionTypeAnnotation"); }; pp$8.flowParseType = function () { var oldInType = this.state.inType; this.state.inType = true; var type = this.flowParseUnionType(); this.state.inType = oldInType; return type; }; pp$8.flowParseTypeAnnotation = function () { var node = this.startNode(); node.typeAnnotation = this.flowParseTypeInitialiser(); return this.finishNode(node, "TypeAnnotation"); }; pp$8.flowParseTypeAndPredicateAnnotation = function () { var node = this.startNode(); var _flowParseTypeAndPred2 = this.flowParseTypeAndPredicateInitialiser(); node.typeAnnotation = _flowParseTypeAndPred2[0]; node.predicate = _flowParseTypeAndPred2[1]; return this.finishNode(node, "TypeAnnotation"); }; pp$8.flowParseTypeAnnotatableIdentifier = function () { var ident = this.flowParseRestrictedIdentifier(); if (this.match(types.colon)) { ident.typeAnnotation = this.flowParseTypeAnnotation(); this.finishNode(ident, ident.type); } return ident; }; pp$8.typeCastToParameter = function (node) { node.expression.typeAnnotation = node.typeAnnotation; return this.finishNodeAt(node.expression, node.expression.type, node.typeAnnotation.end, node.typeAnnotation.loc.end); }; pp$8.flowParseVariance = function () { var variance = null; if (this.match(types.plusMin)) { if (this.state.value === "+") { variance = "plus"; } else if (this.state.value === "-") { variance = "minus"; } this.next(); } return variance; }; var flowPlugin = function (instance) { // plain function return types: function name(): string {} instance.extend("parseFunctionBody", function (inner) { return function (node, allowExpression) { if (this.match(types.colon) && !allowExpression) { // if allowExpression is true then we're parsing an arrow function and if // there's a return type then it's been handled elsewhere node.returnType = this.flowParseTypeAndPredicateAnnotation(); } return inner.call(this, node, allowExpression); }; }); // interfaces instance.extend("parseStatement", function (inner) { return function (declaration, topLevel) { // strict mode handling of `interface` since it's a reserved word if (this.state.strict && this.match(types.name) && this.state.value === "interface") { var node = this.startNode(); this.next(); return this.flowParseInterface(node); } else { return inner.call(this, declaration, topLevel); } }; }); // declares, interfaces and type aliases instance.extend("parseExpressionStatement", function (inner) { return function (node, expr) { if (expr.type === "Identifier") { if (expr.name === "declare") { if (this.match(types._class) || this.match(types.name) || this.match(types._function) || this.match(types._var) || this.match(types._export)) { return this.flowParseDeclare(node); } } else if (this.match(types.name)) { if (expr.name === "interface") { return this.flowParseInterface(node); } else if (expr.name === "type") { return this.flowParseTypeAlias(node); } else if (expr.name === "opaque") { return this.flowParseOpaqueType(node, false); } } } return inner.call(this, node, expr); }; }); // export type instance.extend("shouldParseExportDeclaration", function (inner) { return function () { return this.isContextual("type") || this.isContextual("interface") || this.isContextual("opaque") || inner.call(this); }; }); instance.extend("isExportDefaultSpecifier", function (inner) { return function () { if (this.match(types.name) && (this.state.value === "type" || this.state.value === "interface" || this.state.value === "opaque")) { return false; } return inner.call(this); }; }); instance.extend("parseConditional", function (inner) { return function (expr, noIn, startPos, startLoc, refNeedsArrowPos) { // only do the expensive clone if there is a question mark // and if we come from inside parens if (refNeedsArrowPos && this.match(types.question)) { var state = this.state.clone(); try { return inner.call(this, expr, noIn, startPos, startLoc); } catch (err) { if (err instanceof SyntaxError) { this.state = state; refNeedsArrowPos.start = err.pos || this.state.start; return expr; } else { // istanbul ignore next: no such error is expected throw err; } } } return inner.call(this, expr, noIn, startPos, startLoc); }; }); instance.extend("parseParenItem", function (inner) { return function (node, startPos, startLoc) { node = inner.call(this, node, startPos, startLoc); if (this.eat(types.question)) { node.optional = true; } if (this.match(types.colon)) { var typeCastNode = this.startNodeAt(startPos, startLoc); typeCastNode.expression = node; typeCastNode.typeAnnotation = this.flowParseTypeAnnotation(); return this.finishNode(typeCastNode, "TypeCastExpression"); } return node; }; }); instance.extend("parseExport", function (inner) { return function (node) { node = inner.call(this, node); if (node.type === "ExportNamedDeclaration") { node.exportKind = node.exportKind || "value"; } return node; }; }); instance.extend("parseExportDeclaration", function (inner) { return function (node) { if (this.isContextual("type")) { node.exportKind = "type"; var declarationNode = this.startNode(); this.next(); if (this.match(types.braceL)) { // export type { foo, bar }; node.specifiers = this.parseExportSpecifiers(); this.parseExportFrom(node); return null; } else { // export type Foo = Bar; return this.flowParseTypeAlias(declarationNode); } } else if (this.isContextual("opaque")) { node.exportKind = "type"; var _declarationNode = this.startNode(); this.next(); // export opaque type Foo = Bar; return this.flowParseOpaqueType(_declarationNode, false); } else if (this.isContextual("interface")) { node.exportKind = "type"; var _declarationNode2 = this.startNode(); this.next(); return this.flowParseInterface(_declarationNode2); } else { return inner.call(this, node); } }; }); instance.extend("parseClassId", function (inner) { return function (node) { inner.apply(this, arguments); if (this.isRelational("<")) { node.typeParameters = this.flowParseTypeParameterDeclaration(); } }; }); // don't consider `void` to be a keyword as then it'll use the void token type // and set startExpr instance.extend("isKeyword", function (inner) { return function (name) { if (this.state.inType && name === "void") { return false; } else { return inner.call(this, name); } }; }); // ensure that inside flow types, we bypass the jsx parser plugin instance.extend("readToken", function (inner) { return function (code) { if (this.state.inType && (code === 62 || code === 60)) { return this.finishOp(types.relational, 1); } else { return inner.call(this, code); } }; }); // don't lex any token as a jsx one inside a flow type instance.extend("jsx_readToken", function (inner) { return function () { if (!this.state.inType) return inner.call(this); }; }); instance.extend("toAssignable", function (inner) { return function (node, isBinding, contextDescription) { if (node.type === "TypeCastExpression") { return inner.call(this, this.typeCastToParameter(node), isBinding, contextDescription); } else { return inner.call(this, node, isBinding, contextDescription); } }; }); // turn type casts that we found in function parameter head into type annotated params instance.extend("toAssignableList", function (inner) { return function (exprList, isBinding, contextDescription) { for (var i = 0; i < exprList.length; i++) { var expr = exprList[i]; if (expr && expr.type === "TypeCastExpression") { exprList[i] = this.typeCastToParameter(expr); } } return inner.call(this, exprList, isBinding, contextDescription); }; }); // this is a list of nodes, from something like a call expression, we need to filter the // type casts that we've found that are illegal in this context instance.extend("toReferencedList", function () { return function (exprList) { for (var i = 0; i < exprList.length; i++) { var expr = exprList[i]; if (expr && expr._exprListItem && expr.type === "TypeCastExpression") { this.raise(expr.start, "Unexpected type cast"); } } return exprList; }; }); // parse an item inside a expression list eg. `(NODE, NODE)` where NODE represents // the position where this function is called instance.extend("parseExprListItem", function (inner) { return function () { var container = this.startNode(); for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } var node = inner.call.apply(inner, [this].concat(args)); if (this.match(types.colon)) { container._exprListItem = true; container.expression = node; container.typeAnnotation = this.flowParseTypeAnnotation(); return this.finishNode(container, "TypeCastExpression"); } else { return node; } }; }); instance.extend("checkLVal", function (inner) { return function (node) { if (node.type !== "TypeCastExpression") { return inner.apply(this, arguments); } }; }); // parse class property type annotations instance.extend("parseClassProperty", function (inner) { return function (node) { delete node.variancePos; if (this.match(types.colon)) { node.typeAnnotation = this.flowParseTypeAnnotation(); } return inner.call(this, node); }; }); // determine whether or not we're currently in the position where a class method would appear instance.extend("isClassMethod", function (inner) { return function () { return this.isRelational("<") || inner.call(this); }; }); // determine whether or not we're currently in the position where a class property would appear instance.extend("isClassProperty", function (inner) { return function () { return this.match(types.colon) || inner.call(this); }; }); instance.extend("isNonstaticConstructor", function (inner) { return function (method) { return !this.match(types.colon) && inner.call(this, method); }; }); // parse type parameters for class methods instance.extend("parseClassMethod", function (inner) { return function (classBody, method) { if (method.variance) { this.unexpected(method.variancePos); } delete method.variance; delete method.variancePos; if (this.isRelational("<")) { method.typeParameters = this.flowParseTypeParameterDeclaration(); } for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) { args[_key2 - 2] = arguments[_key2]; } inner.call.apply(inner, [this, classBody, method].concat(args)); }; }); // parse a the super class type parameters and implements instance.extend("parseClassSuper", function (inner) { return function (node, isStatement) { inner.call(this, node, isStatement); if (node.superClass && this.isRelational("<")) { node.superTypeParameters = this.flowParseTypeParameterInstantiation(); } if (this.isContextual("implements")) { this.next(); var implemented = node.implements = []; do { var _node = this.startNode(); _node.id = this.parseIdentifier(); if (this.isRelational("<")) { _node.typeParameters = this.flowParseTypeParameterInstantiation(); } else { _node.typeParameters = null; } implemented.push(this.finishNode(_node, "ClassImplements")); } while (this.eat(types.comma)); } }; }); instance.extend("parsePropertyName", function (inner) { return function (node) { var variancePos = this.state.start; var variance = this.flowParseVariance(); var key = inner.call(this, node); node.variance = variance; node.variancePos = variancePos; return key; }; }); // parse type parameters for object method shorthand instance.extend("parseObjPropValue", function (inner) { return function (prop) { if (prop.variance) { this.unexpected(prop.variancePos); } delete prop.variance; delete prop.variancePos; var typeParameters = void 0; // method shorthand if (this.isRelational("<")) { typeParameters = this.flowParseTypeParameterDeclaration(); if (!this.match(types.parenL)) this.unexpected(); } inner.apply(this, arguments); // add typeParameters if we found them if (typeParameters) { (prop.value || prop).typeParameters = typeParameters; } }; }); instance.extend("parseAssignableListItemTypes", function () { return function (param) { if (this.eat(types.question)) { param.optional = true; } if (this.match(types.colon)) { param.typeAnnotation = this.flowParseTypeAnnotation(); } this.finishNode(param, param.type); return param; }; }); instance.extend("parseMaybeDefault", function (inner) { return function () { for (var _len3 = arguments.length, args = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { args[_key3] = arguments[_key3]; } var node = inner.apply(this, args); if (node.type === "AssignmentPattern" && node.typeAnnotation && node.right.start < node.typeAnnotation.start) { this.raise(node.typeAnnotation.start, "Type annotations must come before default assignments, e.g. instead of `age = 25: number` use `age: number = 25`"); } return node; }; }); // parse typeof and type imports instance.extend("parseImportSpecifiers", function (inner) { return function (node) { node.importKind = "value"; var kind = null; if (this.match(types._typeof)) { kind = "typeof"; } else if (this.isContextual("type")) { kind = "type"; } if (kind) { var lh = this.lookahead(); if (lh.type === types.name && lh.value !== "from" || lh.type === types.braceL || lh.type === types.star) { this.next(); node.importKind = kind; } } inner.call(this, node); }; }); // parse import-type/typeof shorthand instance.extend("parseImportSpecifier", function () { return function (node) { var specifier = this.startNode(); var firstIdentLoc = this.state.start; var firstIdent = this.parseIdentifier(true); var specifierTypeKind = null; if (firstIdent.name === "type") { specifierTypeKind = "type"; } else if (firstIdent.name === "typeof") { specifierTypeKind = "typeof"; } var isBinding = false; if (this.isContextual("as")) { var as_ident = this.parseIdentifier(true); if (specifierTypeKind !== null && !this.match(types.name) && !this.state.type.keyword) { // `import {type as ,` or `import {type as }` specifier.imported = as_ident; specifier.importKind = specifierTypeKind; specifier.local = as_ident.__clone(); } else { // `import {type as foo` specifier.imported = firstIdent; specifier.importKind = null; specifier.local = this.parseIdentifier(); } } else if (specifierTypeKind !== null && (this.match(types.name) || this.state.type.keyword)) { // `import {type foo` specifier.imported = this.parseIdentifier(true); specifier.importKind = specifierTypeKind; if (this.eatContextual("as")) { specifier.local = this.parseIdentifier(); } else { isBinding = true; specifier.local = specifier.imported.__clone(); } } else { isBinding = true; specifier.imported = firstIdent; specifier.importKind = null; specifier.local = specifier.imported.__clone(); } if ((node.importKind === "type" || node.importKind === "typeof") && (specifier.importKind === "type" || specifier.importKind === "typeof")) { this.raise(firstIdentLoc, "`The `type` and `typeof` keywords on named imports can only be used on regular `import` statements. It cannot be used with `import type` or `import typeof` statements`"); } if (isBinding) this.checkReservedWord(specifier.local.name, specifier.start, true, true); this.checkLVal(specifier.local, true, undefined, "import specifier"); node.specifiers.push(this.finishNode(specifier, "ImportSpecifier")); }; }); // parse function type parameters - function foo<T>() {} instance.extend("parseFunctionParams", function (inner) { return function (node) { if (this.isRelational("<")) { node.typeParameters = this.flowParseTypeParameterDeclaration(); } inner.call(this, node); }; }); // parse flow type annotations on variable declarator heads - let foo: string = bar instance.extend("parseVarHead", function (inner) { return function (decl) { inner.call(this, decl); if (this.match(types.colon)) { decl.id.typeAnnotation = this.flowParseTypeAnnotation(); this.finishNode(decl.id, decl.id.type); } }; }); // parse the return type of an async arrow function - let foo = (async (): number => {}); instance.extend("parseAsyncArrowFromCallExpression", function (inner) { return function (node, call) { if (this.match(types.colon)) { var oldNoAnonFunctionType = this.state.noAnonFunctionType; this.state.noAnonFunctionType = true; node.returnType = this.flowParseTypeAnnotation(); this.state.noAnonFunctionType = oldNoAnonFunctionType; } return inner.call(this, node, call); }; }); // todo description instance.extend("shouldParseAsyncArrow", function (inner) { return function () { return this.match(types.colon) || inner.call(this); }; }); // We need to support type parameter declarations for arrow functions. This // is tricky. There are three situations we need to handle // // 1. This is either JSX or an arrow function. We'll try JSX first. If that // fails, we'll try an arrow function. If that fails, we'll throw the JSX // error. // 2. This is an arrow function. We'll parse the type parameter declaration, // parse the rest, make sure the rest is an arrow function, and go from // there // 3. This is neither. Just call the inner function instance.extend("parseMaybeAssign", function (inner) { return function () { var jsxError = null; for (var _len4 = arguments.length, args = Array(_len4), _key4 = 0; _key4 < _len4; _key4++) { args[_key4] = arguments[_key4]; } if (types.jsxTagStart && this.match(types.jsxTagStart)) { var state = this.state.clone(); try { return inner.apply(this, args); } catch (err) { if (err instanceof SyntaxError) { this.state = state; // Remove `tc.j_expr` and `tc.j_oTag` from context added // by parsing `jsxTagStart` to stop the JSX plugin from // messing with the tokens this.state.context.length -= 2; jsxError = err; } else { // istanbul ignore next: no such error is expected throw err; } } } if (jsxError != null || this.isRelational("<")) { var arrowExpression = void 0; var typeParameters = void 0; try { typeParameters = this.flowParseTypeParameterDeclaration(); arrowExpression = inner.apply(this, args); arrowExpression.typeParameters = typeParameters; arrowExpression.start = typeParameters.start; arrowExpression.loc.start = typeParameters.loc.start; } catch (err) { throw jsxError || err; } if (arrowExpression.type === "ArrowFunctionExpression") { return arrowExpression; } else if (jsxError != null) { throw jsxError; } else { this.raise(typeParameters.start, "Expected an arrow function after this type parameter declaration"); } } return inner.apply(this, args); }; }); // handle return types for arrow functions instance.extend("parseArrow", function (inner) { return function (node) { if (this.match(types.colon)) { var state = this.state.clone(); try { var oldNoAnonFunctionType = this.state.noAnonFunctionType; this.state.noAnonFunctionType = true; var returnType = this.flowParseTypeAndPredicateAnnotation(); this.state.noAnonFunctionType = oldNoAnonFunctionType; if (this.canInsertSemicolon()) this.unexpected(); if (!this.match(types.arrow)) this.unexpected(); // assign after it is clear it is an arrow node.returnType = returnType; } catch (err) { if (err instanceof SyntaxError) { this.state = state; } else { // istanbul ignore next: no such error is expected throw err; } } } return inner.call(this, node); }; }); instance.extend("shouldParseArrow", function (inner) { return function () { return this.match(types.colon) || inner.call(this); }; }); }; // Adapted from String.fromcodepoint to export the function without modifying String /*! https://mths.be/fromcodepoint v0.2.1 by @mathias */ // The MIT License (MIT) // Copyright (c) Mathias Bynens // // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and // associated documentation files (the "Software"), to deal in the Software without restriction, // including without limitation the rights to use, copy, modify, merge, publish, distribute, // sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in all copies or // substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT // NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. var fromCodePoint = String.fromCodePoint; if (!fromCodePoint) { var stringFromCharCode = String.fromCharCode; var floor = Math.floor; fromCodePoint = function fromCodePoint() { var MAX_SIZE = 0x4000; var codeUnits = []; var highSurrogate = void 0; var lowSurrogate = void 0; var index = -1; var length = arguments.length; if (!length) { return ""; } var result = ""; while (++index < length) { var codePoint = Number(arguments[index]); if (!isFinite(codePoint) || // `NaN`, `+Infinity`, or `-Infinity` codePoint < 0 || // not a valid Unicode code point codePoint > 0x10FFFF || // not a valid Unicode code point floor(codePoint) != codePoint // not an integer ) { throw RangeError("Invalid code point: " + codePoint); } if (codePoint <= 0xFFFF) { // BMP code point codeUnits.push(codePoint); } else { // Astral code point; split in surrogate halves // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae codePoint -= 0x10000; highSurrogate = (codePoint >> 10) + 0xD800; lowSurrogate = codePoint % 0x400 + 0xDC00; codeUnits.push(highSurrogate, lowSurrogate); } if (index + 1 == length || codeUnits.length > MAX_SIZE) { result += stringFromCharCode.apply(null, codeUnits); codeUnits.length = 0; } } return result; }; } var fromCodePoint$1 = fromCodePoint; var XHTMLEntities = { quot: "\"", amp: "&", apos: "'", lt: "<", gt: ">", nbsp: "\xA0", iexcl: "\xA1", cent: "\xA2", pound: "\xA3", curren: "\xA4", yen: "\xA5", brvbar: "\xA6", sect: "\xA7", uml: "\xA8", copy: "\xA9", ordf: "\xAA", laquo: "\xAB", not: "\xAC", shy: "\xAD", reg: "\xAE", macr: "\xAF", deg: "\xB0", plusmn: "\xB1", sup2: "\xB2", sup3: "\xB3", acute: "\xB4", micro: "\xB5", para: "\xB6", middot: "\xB7", cedil: "\xB8", sup1: "\xB9", ordm: "\xBA", raquo: "\xBB", frac14: "\xBC", frac12: "\xBD", frac34: "\xBE", iquest: "\xBF", Agrave: "\xC0", Aacute: "\xC1", Acirc: "\xC2", Atilde: "\xC3", Auml: "\xC4", Aring: "\xC5", AElig: "\xC6", Ccedil: "\xC7", Egrave: "\xC8", Eacute: "\xC9", Ecirc: "\xCA", Euml: "\xCB", Igrave: "\xCC", Iacute: "\xCD", Icirc: "\xCE", Iuml: "\xCF", ETH: "\xD0", Ntilde: "\xD1", Ograve: "\xD2", Oacute: "\xD3", Ocirc: "\xD4", Otilde: "\xD5", Ouml: "\xD6", times: "\xD7", Oslash: "\xD8", Ugrave: "\xD9", Uacute: "\xDA", Ucirc: "\xDB", Uuml: "\xDC", Yacute: "\xDD", THORN: "\xDE", szlig: "\xDF", agrave: "\xE0", aacute: "\xE1", acirc: "\xE2", atilde: "\xE3", auml: "\xE4", aring: "\xE5", aelig: "\xE6", ccedil: "\xE7", egrave: "\xE8", eacute: "\xE9", ecirc: "\xEA", euml: "\xEB", igrave: "\xEC", iacute: "\xED", icirc: "\xEE", iuml: "\xEF", eth: "\xF0", ntilde: "\xF1", ograve: "\xF2", oacute: "\xF3", ocirc: "\xF4", otilde: "\xF5", ouml: "\xF6", divide: "\xF7", oslash: "\xF8", ugrave: "\xF9", uacute: "\xFA", ucirc: "\xFB", uuml: "\xFC", yacute: "\xFD", thorn: "\xFE", yuml: "\xFF", OElig: "\u0152", oelig: "\u0153", Scaron: "\u0160", scaron: "\u0161", Yuml: "\u0178", fnof: "\u0192", circ: "\u02C6", tilde: "\u02DC", Alpha: "\u0391", Beta: "\u0392", Gamma: "\u0393", Delta: "\u0394", Epsilon: "\u0395", Zeta: "\u0396", Eta: "\u0397", Theta: "\u0398", Iota: "\u0399", Kappa: "\u039A", Lambda: "\u039B", Mu: "\u039C", Nu: "\u039D", Xi: "\u039E", Omicron: "\u039F", Pi: "\u03A0", Rho: "\u03A1", Sigma: "\u03A3", Tau: "\u03A4", Upsilon: "\u03A5", Phi: "\u03A6", Chi: "\u03A7", Psi: "\u03A8", Omega: "\u03A9", alpha: "\u03B1", beta: "\u03B2", gamma: "\u03B3", delta: "\u03B4", epsilon: "\u03B5", zeta: "\u03B6", eta: "\u03B7", theta: "\u03B8", iota: "\u03B9", kappa: "\u03BA", lambda: "\u03BB", mu: "\u03BC", nu: "\u03BD", xi: "\u03BE", omicron: "\u03BF", pi: "\u03C0", rho: "\u03C1", sigmaf: "\u03C2", sigma: "\u03C3", tau: "\u03C4", upsilon: "\u03C5", phi: "\u03C6", chi: "\u03C7", psi: "\u03C8", omega: "\u03C9", thetasym: "\u03D1", upsih: "\u03D2", piv: "\u03D6", ensp: "\u2002", emsp: "\u2003", thinsp: "\u2009", zwnj: "\u200C", zwj: "\u200D", lrm: "\u200E", rlm: "\u200F", ndash: "\u2013", mdash: "\u2014", lsquo: "\u2018", rsquo: "\u2019", sbquo: "\u201A", ldquo: "\u201C", rdquo: "\u201D", bdquo: "\u201E", dagger: "\u2020", Dagger: "\u2021", bull: "\u2022", hellip: "\u2026", permil: "\u2030", prime: "\u2032", Prime: "\u2033", lsaquo: "\u2039", rsaquo: "\u203A", oline: "\u203E", frasl: "\u2044", euro: "\u20AC", image: "\u2111", weierp: "\u2118", real: "\u211C", trade: "\u2122", alefsym: "\u2135", larr: "\u2190", uarr: "\u2191", rarr: "\u2192", darr: "\u2193", harr: "\u2194", crarr: "\u21B5", lArr: "\u21D0", uArr: "\u21D1", rArr: "\u21D2", dArr: "\u21D3", hArr: "\u21D4", forall: "\u2200", part: "\u2202", exist: "\u2203", empty: "\u2205", nabla: "\u2207", isin: "\u2208", notin: "\u2209", ni: "\u220B", prod: "\u220F", sum: "\u2211", minus: "\u2212", lowast: "\u2217", radic: "\u221A", prop: "\u221D", infin: "\u221E", ang: "\u2220", and: "\u2227", or: "\u2228", cap: "\u2229", cup: "\u222A", "int": "\u222B", there4: "\u2234", sim: "\u223C", cong: "\u2245", asymp: "\u2248", ne: "\u2260", equiv: "\u2261", le: "\u2264", ge: "\u2265", sub: "\u2282", sup: "\u2283", nsub: "\u2284", sube: "\u2286", supe: "\u2287", oplus: "\u2295", otimes: "\u2297", perp: "\u22A5", sdot: "\u22C5", lceil: "\u2308", rceil: "\u2309", lfloor: "\u230A", rfloor: "\u230B", lang: "\u2329", rang: "\u232A", loz: "\u25CA", spades: "\u2660", clubs: "\u2663", hearts: "\u2665", diams: "\u2666" }; var HEX_NUMBER = /^[\da-fA-F]+$/; var DECIMAL_NUMBER = /^\d+$/; types$1.j_oTag = new TokContext("<tag", false); types$1.j_cTag = new TokContext("</tag", false); types$1.j_expr = new TokContext("<tag>...</tag>", true, true); types.jsxName = new TokenType("jsxName"); types.jsxText = new TokenType("jsxText", { beforeExpr: true }); types.jsxTagStart = new TokenType("jsxTagStart", { startsExpr: true }); types.jsxTagEnd = new TokenType("jsxTagEnd"); types.jsxTagStart.updateContext = function () { this.state.context.push(types$1.j_expr); // treat as beginning of JSX expression this.state.context.push(types$1.j_oTag); // start opening tag context this.state.exprAllowed = false; }; types.jsxTagEnd.updateContext = function (prevType) { var out = this.state.context.pop(); if (out === types$1.j_oTag && prevType === types.slash || out === types$1.j_cTag) { this.state.context.pop(); this.state.exprAllowed = this.curContext() === types$1.j_expr; } else { this.state.exprAllowed = true; } }; var pp$9 = Parser.prototype; // Reads inline JSX contents token. pp$9.jsxReadToken = function () { var out = ""; var chunkStart = this.state.pos; for (;;) { if (this.state.pos >= this.input.length) { this.raise(this.state.start, "Unterminated JSX contents"); } var ch = this.input.charCodeAt(this.state.pos); switch (ch) { case 60: // "<" case 123: // "{" if (this.state.pos === this.state.start) { if (ch === 60 && this.state.exprAllowed) { ++this.state.pos; return this.finishToken(types.jsxTagStart); } return this.getTokenFromCode(ch); } out += this.input.slice(chunkStart, this.state.pos); return this.finishToken(types.jsxText, out); case 38: // "&" out += this.input.slice(chunkStart, this.state.pos); out += this.jsxReadEntity(); chunkStart = this.state.pos; break; default: if (isNewLine(ch)) { out += this.input.slice(chunkStart, this.state.pos); out += this.jsxReadNewLine(true); chunkStart = this.state.pos; } else { ++this.state.pos; } } } }; pp$9.jsxReadNewLine = function (normalizeCRLF) { var ch = this.input.charCodeAt(this.state.pos); var out = void 0; ++this.state.pos; if (ch === 13 && this.input.charCodeAt(this.state.pos) === 10) { ++this.state.pos; out = normalizeCRLF ? "\n" : "\r\n"; } else { out = String.fromCharCode(ch); } ++this.state.curLine; this.state.lineStart = this.state.pos; return out; }; pp$9.jsxReadString = function (quote) { var out = ""; var chunkStart = ++this.state.pos; for (;;) { if (this.state.pos >= this.input.length) { this.raise(this.state.start, "Unterminated string constant"); } var ch = this.input.charCodeAt(this.state.pos); if (ch === quote) break; if (ch === 38) { // "&" out += this.input.slice(chunkStart, this.state.pos); out += this.jsxReadEntity(); chunkStart = this.state.pos; } else if (isNewLine(ch)) { out += this.input.slice(chunkStart, this.state.pos); out += this.jsxReadNewLine(false); chunkStart = this.state.pos; } else { ++this.state.pos; } } out += this.input.slice(chunkStart, this.state.pos++); return this.finishToken(types.string, out); }; pp$9.jsxReadEntity = function () { var str = ""; var count = 0; var entity = void 0; var ch = this.input[this.state.pos]; var startPos = ++this.state.pos; while (this.state.pos < this.input.length && count++ < 10) { ch = this.input[this.state.pos++]; if (ch === ";") { if (str[0] === "#") { if (str[1] === "x") { str = str.substr(2); if (HEX_NUMBER.test(str)) entity = fromCodePoint$1(parseInt(str, 16)); } else { str = str.substr(1); if (DECIMAL_NUMBER.test(str)) entity = fromCodePoint$1(parseInt(str, 10)); } } else { entity = XHTMLEntities[str]; } break; } str += ch; } if (!entity) { this.state.pos = startPos; return "&"; } return entity; }; // Read a JSX identifier (valid tag or attribute name). // // Optimized version since JSX identifiers can"t contain // escape characters and so can be read as single slice. // Also assumes that first character was already checked // by isIdentifierStart in readToken. pp$9.jsxReadWord = function () { var ch = void 0; var start = this.state.pos; do { ch = this.input.charCodeAt(++this.state.pos); } while (isIdentifierChar(ch) || ch === 45); // "-" return this.finishToken(types.jsxName, this.input.slice(start, this.state.pos)); }; // Transforms JSX element name to string. function getQualifiedJSXName(object) { if (object.type === "JSXIdentifier") { return object.name; } if (object.type === "JSXNamespacedName") { return object.namespace.name + ":" + object.name.name; } if (object.type === "JSXMemberExpression") { return getQualifiedJSXName(object.object) + "." + getQualifiedJSXName(object.property); } } // Parse next token as JSX identifier pp$9.jsxParseIdentifier = function () { var node = this.startNode(); if (this.match(types.jsxName)) { node.name = this.state.value; } else if (this.state.type.keyword) { node.name = this.state.type.keyword; } else { this.unexpected(); } this.next(); return this.finishNode(node, "JSXIdentifier"); }; // Parse namespaced identifier. pp$9.jsxParseNamespacedName = function () { var startPos = this.state.start; var startLoc = this.state.startLoc; var name = this.jsxParseIdentifier(); if (!this.eat(types.colon)) return name; var node = this.startNodeAt(startPos, startLoc); node.namespace = name; node.name = this.jsxParseIdentifier(); return this.finishNode(node, "JSXNamespacedName"); }; // Parses element name in any form - namespaced, member // or single identifier. pp$9.jsxParseElementName = function () { var startPos = this.state.start; var startLoc = this.state.startLoc; var node = this.jsxParseNamespacedName(); while (this.eat(types.dot)) { var newNode = this.startNodeAt(startPos, startLoc); newNode.object = node; newNode.property = this.jsxParseIdentifier(); node = this.finishNode(newNode, "JSXMemberExpression"); } return node; }; // Parses any type of JSX attribute value. pp$9.jsxParseAttributeValue = function () { var node = void 0; switch (this.state.type) { case types.braceL: node = this.jsxParseExpressionContainer(); if (node.expression.type === "JSXEmptyExpression") { this.raise(node.start, "JSX attributes must only be assigned a non-empty expression"); } else { return node; } case types.jsxTagStart: case types.string: node = this.parseExprAtom(); node.extra = null; return node; default: this.raise(this.state.start, "JSX value should be either an expression or a quoted JSX text"); } }; // JSXEmptyExpression is unique type since it doesn't actually parse anything, // and so it should start at the end of last read token (left brace) and finish // at the beginning of the next one (right brace). pp$9.jsxParseEmptyExpression = function () { var node = this.startNodeAt(this.state.lastTokEnd, this.state.lastTokEndLoc); return this.finishNodeAt(node, "JSXEmptyExpression", this.state.start, this.state.startLoc); }; // Parse JSX spread child pp$9.jsxParseSpreadChild = function () { var node = this.startNode(); this.expect(types.braceL); this.expect(types.ellipsis); node.expression = this.parseExpression(); this.expect(types.braceR); return this.finishNode(node, "JSXSpreadChild"); }; // Parses JSX expression enclosed into curly brackets. pp$9.jsxParseExpressionContainer = function () { var node = this.startNode(); this.next(); if (this.match(types.braceR)) { node.expression = this.jsxParseEmptyExpression(); } else { node.expression = this.parseExpression(); } this.expect(types.braceR); return this.finishNode(node, "JSXExpressionContainer"); }; // Parses following JSX attribute name-value pair. pp$9.jsxParseAttribute = function () { var node = this.startNode(); if (this.eat(types.braceL)) { this.expect(types.ellipsis); node.argument = this.parseMaybeAssign(); this.expect(types.braceR); return this.finishNode(node, "JSXSpreadAttribute"); } node.name = this.jsxParseNamespacedName(); node.value = this.eat(types.eq) ? this.jsxParseAttributeValue() : null; return this.finishNode(node, "JSXAttribute"); }; // Parses JSX opening tag starting after "<". pp$9.jsxParseOpeningElementAt = function (startPos, startLoc) { var node = this.startNodeAt(startPos, startLoc); node.attributes = []; node.name = this.jsxParseElementName(); while (!this.match(types.slash) && !this.match(types.jsxTagEnd)) { node.attributes.push(this.jsxParseAttribute()); } node.selfClosing = this.eat(types.slash); this.expect(types.jsxTagEnd); return this.finishNode(node, "JSXOpeningElement"); }; // Parses JSX closing tag starting after "</". pp$9.jsxParseClosingElementAt = function (startPos, startLoc) { var node = this.startNodeAt(startPos, startLoc); node.name = this.jsxParseElementName(); this.expect(types.jsxTagEnd); return this.finishNode(node, "JSXClosingElement"); }; // Parses entire JSX element, including it"s opening tag // (starting after "<"), attributes, contents and closing tag. pp$9.jsxParseElementAt = function (startPos, startLoc) { var node = this.startNodeAt(startPos, startLoc); var children = []; var openingElement = this.jsxParseOpeningElementAt(startPos, startLoc); var closingElement = null; if (!openingElement.selfClosing) { contents: for (;;) { switch (this.state.type) { case types.jsxTagStart: startPos = this.state.start;startLoc = this.state.startLoc; this.next(); if (this.eat(types.slash)) { closingElement = this.jsxParseClosingElementAt(startPos, startLoc); break contents; } children.push(this.jsxParseElementAt(startPos, startLoc)); break; case types.jsxText: children.push(this.parseExprAtom()); break; case types.braceL: if (this.lookahead().type === types.ellipsis) { children.push(this.jsxParseSpreadChild()); } else { children.push(this.jsxParseExpressionContainer()); } break; // istanbul ignore next - should never happen default: this.unexpected(); } } if (getQualifiedJSXName(closingElement.name) !== getQualifiedJSXName(openingElement.name)) { this.raise(closingElement.start, "Expected corresponding JSX closing tag for <" + getQualifiedJSXName(openingElement.name) + ">"); } } node.openingElement = openingElement; node.closingElement = closingElement; node.children = children; if (this.match(types.relational) && this.state.value === "<") { this.raise(this.state.start, "Adjacent JSX elements must be wrapped in an enclosing tag"); } return this.finishNode(node, "JSXElement"); }; // Parses entire JSX element from current position. pp$9.jsxParseElement = function () { var startPos = this.state.start; var startLoc = this.state.startLoc; this.next(); return this.jsxParseElementAt(startPos, startLoc); }; var jsxPlugin = function (instance) { instance.extend("parseExprAtom", function (inner) { return function (refShortHandDefaultPos) { if (this.match(types.jsxText)) { var node = this.parseLiteral(this.state.value, "JSXText"); // https://github.com/babel/babel/issues/2078 node.extra = null; return node; } else if (this.match(types.jsxTagStart)) { return this.jsxParseElement(); } else { return inner.call(this, refShortHandDefaultPos); } }; }); instance.extend("readToken", function (inner) { return function (code) { if (this.state.inPropertyName) return inner.call(this, code); var context = this.curContext(); if (context === types$1.j_expr) { return this.jsxReadToken(); } if (context === types$1.j_oTag || context === types$1.j_cTag) { if (isIdentifierStart(code)) { return this.jsxReadWord(); } if (code === 62) { ++this.state.pos; return this.finishToken(types.jsxTagEnd); } if ((code === 34 || code === 39) && context === types$1.j_oTag) { return this.jsxReadString(code); } } if (code === 60 && this.state.exprAllowed) { ++this.state.pos; return this.finishToken(types.jsxTagStart); } return inner.call(this, code); }; }); instance.extend("updateContext", function (inner) { return function (prevType) { if (this.match(types.braceL)) { var curContext = this.curContext(); if (curContext === types$1.j_oTag) { this.state.context.push(types$1.braceExpression); } else if (curContext === types$1.j_expr) { this.state.context.push(types$1.templateQuasi); } else { inner.call(this, prevType); } this.state.exprAllowed = true; } else if (this.match(types.slash) && prevType === types.jsxTagStart) { this.state.context.length -= 2; // do not consider JSX expr -> JSX open tag -> ... anymore this.state.context.push(types$1.j_cTag); // reconsider as closing tag context this.state.exprAllowed = false; } else { return inner.call(this, prevType); } }; }); }; plugins.estree = estreePlugin; plugins.flow = flowPlugin; plugins.jsx = jsxPlugin; function parse(input, options) { return new Parser(options, input).parse(); } function parseExpression(input, options) { var parser = new Parser(options, input); if (parser.options.strictMode) { parser.state.strict = true; } return parser.getExpression(); } exports.parse = parse; exports.parseExpression = parseExpression; exports.tokTypes = types; /***/ }), /* 71 */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(235); /***/ }), /* 72 */ /***/ (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('') } /***/ }), /* 73 */ /***/ (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 } /***/ }), /* 74 */ /***/ (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; }; /***/ }), /* 75 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var utf8 = __webpack_require__(17); var utils = __webpack_require__(8); var GenericWorker = __webpack_require__(12); var StreamHelper = __webpack_require__(46); var defaults = __webpack_require__(47); var CompressedObject = __webpack_require__(35); var ZipObject = __webpack_require__(92); var generate = __webpack_require__(93); var nodejsUtils = __webpack_require__(29); var NodejsStreamInputAdapter = __webpack_require__(105); /** * Add a file in the current folder. * @private * @param {string} name the name of the file * @param {String|ArrayBuffer|Uint8Array|Buffer} data the data of the file * @param {Object} originalOptions the options of the file * @return {Object} the new file. */ var fileAdd = function(name, data, originalOptions) { // be sure sub folders exist var dataType = utils.getTypeOf(data), parent; /* * Correct options. */ var o = utils.extend(originalOptions || {}, defaults); o.date = o.date || new Date(); if (o.compression !== null) { o.compression = o.compression.toUpperCase(); } if (typeof o.unixPermissions === "string") { o.unixPermissions = parseInt(o.unixPermissions, 8); } // UNX_IFDIR 0040000 see zipinfo.c if (o.unixPermissions && (o.unixPermissions & 0x4000)) { o.dir = true; } // Bit 4 Directory if (o.dosPermissions && (o.dosPermissions & 0x0010)) { o.dir = true; } if (o.dir) { name = forceTrailingSlash(name); } if (o.createFolders && (parent = parentFolder(name))) { folderAdd.call(this, parent, true); } var isUnicodeString = dataType === "string" && o.binary === false && o.base64 === false; if (!originalOptions || typeof originalOptions.binary === "undefined") { o.binary = !isUnicodeString; } var isCompressedEmpty = (data instanceof CompressedObject) && data.uncompressedSize === 0; if (isCompressedEmpty || o.dir || !data || data.length === 0) { o.base64 = false; o.binary = true; data = ""; o.compression = "STORE"; dataType = "string"; } /* * Convert content to fit. */ var zipObjectContent = null; if (data instanceof CompressedObject || data instanceof GenericWorker) { zipObjectContent = data; } else if (nodejsUtils.isNode && nodejsUtils.isStream(data)) { zipObjectContent = new NodejsStreamInputAdapter(name, data); } else { zipObjectContent = utils.prepareContent(name, data, o.binary, o.optimizedBinaryString, o.base64); } var object = new ZipObject(name, zipObjectContent, o); this.files[name] = object; /* TODO: we can't throw an exception because we have async promises (we can have a promise of a Date() for example) but returning a promise is useless because file(name, data) returns the JSZip object for chaining. Should we break that to allow the user to catch the error ? return external.Promise.resolve(zipObjectContent) .then(function () { return object; }); */ }; /** * Find the parent folder of the path. * @private * @param {string} path the path to use * @return {string} the parent folder, or "" */ var parentFolder = function (path) { if (path.slice(-1) === '/') { path = path.substring(0, path.length - 1); } var lastSlash = path.lastIndexOf('/'); return (lastSlash > 0) ? path.substring(0, lastSlash) : ""; }; /** * Returns the path with a slash at the end. * @private * @param {String} path the path to check. * @return {String} the path with a trailing slash. */ var forceTrailingSlash = function(path) { // Check the name ends with a / if (path.slice(-1) !== "/") { path += "/"; // IE doesn't like substr(-1) } return path; }; /** * Add a (sub) folder in the current folder. * @private * @param {string} name the folder's name * @param {boolean=} [createFolders] If true, automatically create sub * folders. Defaults to false. * @return {Object} the new folder. */ var folderAdd = function(name, createFolders) { createFolders = (typeof createFolders !== 'undefined') ? createFolders : defaults.createFolders; name = forceTrailingSlash(name); // Does this folder already exist? if (!this.files[name]) { fileAdd.call(this, name, null, { dir: true, createFolders: createFolders }); } return this.files[name]; }; /** * Cross-window, cross-Node-context regular expression detection * @param {Object} object Anything * @return {Boolean} true if the object is a regular expression, * false otherwise */ function isRegExp(object) { return Object.prototype.toString.call(object) === "[object RegExp]"; } // return the actual prototype of JSZip var out = { /** * @see loadAsync */ load: function() { throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide."); }, /** * Call a callback function for each entry at this folder level. * @param {Function} cb the callback function: * function (relativePath, file) {...} * It takes 2 arguments : the relative path and the file. */ forEach: function(cb) { var filename, relativePath, file; for (filename in this.files) { if (!this.files.hasOwnProperty(filename)) { continue; } file = this.files[filename]; relativePath = filename.slice(this.root.length, filename.length); if (relativePath && filename.slice(0, this.root.length) === this.root) { // the file is in the current root cb(relativePath, file); // TODO reverse the parameters ? need to be clean AND consistent with the filter search fn... } } }, /** * Filter nested files/folders with the specified function. * @param {Function} search the predicate to use : * function (relativePath, file) {...} * It takes 2 arguments : the relative path and the file. * @return {Array} An array of matching elements. */ filter: function(search) { var result = []; this.forEach(function (relativePath, entry) { if (search(relativePath, entry)) { // the file matches the function result.push(entry); } }); return result; }, /** * Add a file to the zip file, or search a file. * @param {string|RegExp} name The name of the file to add (if data is defined), * the name of the file to find (if no data) or a regex to match files. * @param {String|ArrayBuffer|Uint8Array|Buffer} data The file data, either raw or base64 encoded * @param {Object} o File options * @return {JSZip|Object|Array} this JSZip object (when adding a file), * a file (when searching by string) or an array of files (when searching by regex). */ file: function(name, data, o) { if (arguments.length === 1) { if (isRegExp(name)) { var regexp = name; return this.filter(function(relativePath, file) { return !file.dir && regexp.test(relativePath); }); } else { // text var obj = this.files[this.root + name]; if (obj && !obj.dir) { return obj; } else { return null; } } } else { // more than one argument : we have data ! name = this.root + name; fileAdd.call(this, name, data, o); } return this; }, /** * Add a directory to the zip file, or search. * @param {String|RegExp} arg The name of the directory to add, or a regex to search folders. * @return {JSZip} an object with the new directory as the root, or an array containing matching folders. */ folder: function(arg) { if (!arg) { return this; } if (isRegExp(arg)) { return this.filter(function(relativePath, file) { return file.dir && arg.test(relativePath); }); } // else, name is a new folder var name = this.root + arg; var newFolder = folderAdd.call(this, name); // Allow chaining by returning a new object with this folder as the root var ret = this.clone(); ret.root = newFolder.name; return ret; }, /** * Delete a file, or a directory and all sub-files, from the zip * @param {string} name the name of the file to delete * @return {JSZip} this JSZip object */ remove: function(name) { name = this.root + name; var file = this.files[name]; if (!file) { // Look for any folders if (name.slice(-1) !== "/") { name += "/"; } file = this.files[name]; } if (file && !file.dir) { // file delete this.files[name]; } else { // maybe a folder, delete recursively var kids = this.filter(function(relativePath, file) { return file.name.slice(0, name.length) === name; }); for (var i = 0; i < kids.length; i++) { delete this.files[kids[i].name]; } } return this; }, /** * Generate the complete zip file * @param {Object} options the options to generate the zip file : * - compression, "STORE" by default. * - type, "base64" by default. Values are : string, base64, uint8array, arraybuffer, blob. * @return {String|Uint8Array|ArrayBuffer|Buffer|Blob} the zip file */ generate: function(options) { throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide."); }, /** * Generate the complete zip file as an internal stream. * @param {Object} options the options to generate the zip file : * - compression, "STORE" by default. * - type, "base64" by default. Values are : string, base64, uint8array, arraybuffer, blob. * @return {StreamHelper} the streamed zip file. */ generateInternalStream: function(options) { var worker, opts = {}; try { opts = utils.extend(options || {}, { streamFiles: false, compression: "STORE", compressionOptions : null, type: "", platform: "DOS", comment: null, mimeType: 'application/zip', encodeFileName: utf8.utf8encode }); opts.type = opts.type.toLowerCase(); opts.compression = opts.compression.toUpperCase(); // "binarystring" is prefered but the internals use "string". if(opts.type === "binarystring") { opts.type = "string"; } if (!opts.type) { throw new Error("No output type specified."); } utils.checkSupport(opts.type); // accept nodejs `process.platform` if( opts.platform === 'darwin' || opts.platform === 'freebsd' || opts.platform === 'linux' || opts.platform === 'sunos' ) { opts.platform = "UNIX"; } if (opts.platform === 'win32') { opts.platform = "DOS"; } var comment = opts.comment || this.comment || ""; worker = generate.generateWorker(this, opts, comment); } catch (e) { worker = new GenericWorker("error"); worker.error(e); } return new StreamHelper(worker, opts.type || "string", opts.mimeType); }, /** * Generate the complete zip file asynchronously. * @see generateInternalStream */ generateAsync: function(options, onUpdate) { return this.generateInternalStream(options).accumulate(onUpdate); }, /** * Generate the complete zip file asynchronously. * @see generateInternalStream */ generateNodeStream: function(options, onUpdate) { options = options || {}; if (!options.type) { options.type = "nodebuffer"; } return this.generateInternalStream(options).toNodejsStream(onUpdate); } }; module.exports = out; /***/ }), /* 76 */ /***/ (function(module, exports, __webpack_require__) { // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to permit // persons to whom the Software is furnished to do so, subject to the // following conditions: // // The above copyright notice and this permission notice shall be included // in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. module.exports = Stream; var EE = __webpack_require__(31).EventEmitter; var inherits = __webpack_require__(18); inherits(Stream, EE); Stream.Readable = __webpack_require__(32); Stream.Writable = __webpack_require__(83); Stream.Duplex = __webpack_require__(84); Stream.Transform = __webpack_require__(85); Stream.PassThrough = __webpack_require__(86); // Backwards-compat with node 0.4.x Stream.Stream = Stream; // old-style streams. Note that the pipe method (the only relevant // part of this class) is overridden in the Readable class. function Stream() { EE.call(this); } Stream.prototype.pipe = function(dest, options) { var source = this; function ondata(chunk) { if (dest.writable) { if (false === dest.write(chunk) && source.pause) { source.pause(); } } } source.on('data', ondata); function ondrain() { if (source.readable && source.resume) { source.resume(); } } dest.on('drain', ondrain); // If the 'end' option is not supplied, dest.end() will be called when // source gets the 'end' or 'close' events. Only dest.end() once. if (!dest._isStdio && (!options || options.end !== false)) { source.on('end', onend); source.on('close', onclose); } var didOnEnd = false; function onend() { if (didOnEnd) return; didOnEnd = true; dest.end(); } function onclose() { if (didOnEnd) return; didOnEnd = true; if (typeof dest.destroy === 'function') dest.destroy(); } // don't leave dangling pipes when there are errors. function onerror(er) { cleanup(); if (EE.listenerCount(this, 'error') === 0) { throw er; // Unhandled stream error in pipe. } } source.on('error', onerror); dest.on('error', onerror); // remove all the event listeners that were added. function cleanup() { source.removeListener('data', ondata); dest.removeListener('drain', ondrain); source.removeListener('end', onend); source.removeListener('close', onclose); source.removeListener('error', onerror); dest.removeListener('error', onerror); source.removeListener('end', cleanup); source.removeListener('close', cleanup); dest.removeListener('close', cleanup); } source.on('end', cleanup); source.on('close', cleanup); dest.on('close', cleanup); dest.emit('pipe', source); // Allow for unix-like usage: A.pipe(B).pipe(C) return dest; }; /***/ }), /* 77 */ /***/ (function(module, exports) { /* (ignored) */ /***/ }), /* 78 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var Buffer = __webpack_require__(28).Buffer; var util = __webpack_require__(79); function copyBuffer(src, target, offset) { src.copy(target, offset); } module.exports = function () { function BufferList() { _classCallCheck(this, BufferList); this.head = null; this.tail = null; this.length = 0; } BufferList.prototype.push = function push(v) { var entry = { data: v, next: null }; if (this.length > 0) this.tail.next = entry;else this.head = entry; this.tail = entry; ++this.length; }; BufferList.prototype.unshift = function unshift(v) { var entry = { data: v, next: this.head }; if (this.length === 0) this.tail = entry; this.head = entry; ++this.length; }; BufferList.prototype.shift = function shift() { if (this.length === 0) return; var ret = this.head.data; if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next; --this.length; return ret; }; BufferList.prototype.clear = function clear() { this.head = this.tail = null; this.length = 0; }; BufferList.prototype.join = function join(s) { if (this.length === 0) return ''; var p = this.head; var ret = '' + p.data; while (p = p.next) { ret += s + p.data; }return ret; }; BufferList.prototype.concat = function concat(n) { if (this.length === 0) return Buffer.alloc(0); if (this.length === 1) return this.head.data; var ret = Buffer.allocUnsafe(n >>> 0); var p = this.head; var i = 0; while (p) { copyBuffer(p.data, ret, i); i += p.data.length; p = p.next; } return ret; }; return BufferList; }(); if (util && util.inspect && util.inspect.custom) { module.exports.prototype[util.inspect.custom] = function () { var obj = util.inspect({ length: this.length }); return this.constructor.name + ' ' + obj; }; } /***/ }), /* 79 */ /***/ (function(module, exports) { /* (ignored) */ /***/ }), /* 80 */ /***/ (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__(11), __webpack_require__(26))) /***/ }), /* 81 */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(global) { /** * Module exports. */ module.exports = deprecate; /** * Mark that a method should not be used. * Returns a modified function which warns once by default. * * If `localStorage.noDeprecation = true` is set, then it is a no-op. * * If `localStorage.throwDeprecation = true` is set, then deprecated functions * will throw an Error when invoked. * * If `localStorage.traceDeprecation = true` is set, then deprecated functions * will invoke `console.trace()` instead of `console.error()`. * * @param {Function} fn - the function to deprecate * @param {String} msg - the string to print to the console when `fn` is invoked * @returns {Function} a new "deprecated" version of `fn` * @api public */ function deprecate (fn, msg) { if (config('noDeprecation')) { return fn; } var warned = false; function deprecated() { if (!warned) { if (config('throwDeprecation')) { throw new Error(msg); } else if (config('traceDeprecation')) { console.trace(msg); } else { console.warn(msg); } warned = true; } return fn.apply(this, arguments); } return deprecated; } /** * Checks `localStorage` for boolean values for the given `name`. * * @param {String} name * @returns {Boolean} * @api private */ function config (name) { // accessing global.localStorage can trigger a DOMException in sandboxed iframes try { if (!global.localStorage) return false; } catch (_) { return false; } var val = global.localStorage[name]; if (null == val) return false; return String(val).toLowerCase() === 'true'; } /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(11))) /***/ }), /* 82 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to permit // persons to whom the Software is furnished to do so, subject to the // following conditions: // // The above copyright notice and this permission notice shall be included // in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. // a passthrough stream. // basically just the most minimal sort of Transform stream. // Every written chunk gets output as-is. module.exports = PassThrough; var Transform = __webpack_require__(44); /*<replacement>*/ var util = __webpack_require__(20); util.inherits = __webpack_require__(18); /*</replacement>*/ util.inherits(PassThrough, Transform); function PassThrough(options) { if (!(this instanceof PassThrough)) return new PassThrough(options); Transform.call(this, options); } PassThrough.prototype._transform = function (chunk, encoding, cb) { cb(null, chunk); }; /***/ }), /* 83 */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(33); /***/ }), /* 84 */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(16); /***/ }), /* 85 */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(32).Transform /***/ }), /* 86 */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(32).PassThrough /***/ }), /* 87 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(setImmediate) { module.exports = typeof setImmediate === 'function' ? setImmediate : function setImmediate() { var args = [].slice.apply(arguments); args.splice(1, 0, 0); setTimeout.apply(null, args); }; /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(34).setImmediate)) /***/ }), /* 88 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var immediate = __webpack_require__(89); /* istanbul ignore next */ function INTERNAL() {} var handlers = {}; var REJECTED = ['REJECTED']; var FULFILLED = ['FULFILLED']; var PENDING = ['PENDING']; module.exports = Promise; function Promise(resolver) { if (typeof resolver !== 'function') { throw new TypeError('resolver must be a function'); } this.state = PENDING; this.queue = []; this.outcome = void 0; if (resolver !== INTERNAL) { safelyResolveThenable(this, resolver); } } Promise.prototype["finally"] = function (callback) { if (typeof callback !== 'function') { return this; } var p = this.constructor; return this.then(resolve, reject); function resolve(value) { function yes () { return value; } return p.resolve(callback()).then(yes); } function reject(reason) { function no () { throw reason; } return p.resolve(callback()).then(no); } }; Promise.prototype["catch"] = function (onRejected) { return this.then(null, onRejected); }; Promise.prototype.then = function (onFulfilled, onRejected) { if (typeof onFulfilled !== 'function' && this.state === FULFILLED || typeof onRejected !== 'function' && this.state === REJECTED) { return this; } var promise = new this.constructor(INTERNAL); if (this.state !== PENDING) { var resolver = this.state === FULFILLED ? onFulfilled : onRejected; unwrap(promise, resolver, this.outcome); } else { this.queue.push(new QueueItem(promise, onFulfilled, onRejected)); } return promise; }; function QueueItem(promise, onFulfilled, onRejected) { this.promise = promise; if (typeof onFulfilled === 'function') { this.onFulfilled = onFulfilled; this.callFulfilled = this.otherCallFulfilled; } if (typeof onRejected === 'function') { this.onRejected = onRejected; this.callRejected = this.otherCallRejected; } } QueueItem.prototype.callFulfilled = function (value) { handlers.resolve(this.promise, value); }; QueueItem.prototype.otherCallFulfilled = function (value) { unwrap(this.promise, this.onFulfilled, value); }; QueueItem.prototype.callRejected = function (value) { handlers.reject(this.promise, value); }; QueueItem.prototype.otherCallRejected = function (value) { unwrap(this.promise, this.onRejected, value); }; function unwrap(promise, func, value) { immediate(function () { var returnValue; try { returnValue = func(value); } catch (e) { return handlers.reject(promise, e); } if (returnValue === promise) { handlers.reject(promise, new TypeError('Cannot resolve promise with itself')); } else { handlers.resolve(promise, returnValue); } }); } handlers.resolve = function (self, value) { var result = tryCatch(getThen, value); if (result.status === 'error') { return handlers.reject(self, result.value); } var thenable = result.value; if (thenable) { safelyResolveThenable(self, thenable); } else { self.state = FULFILLED; self.outcome = value; var i = -1; var len = self.queue.length; while (++i < len) { self.queue[i].callFulfilled(value); } } return self; }; handlers.reject = function (self, error) { self.state = REJECTED; self.outcome = error; var i = -1; var len = self.queue.length; while (++i < len) { self.queue[i].callRejected(error); } return self; }; function getThen(obj) { // Make sure we only access the accessor once as required by the spec var then = obj && obj.then; if (obj && (typeof obj === 'object' || typeof obj === 'function') && typeof then === 'function') { return function appyThen() { then.apply(obj, arguments); }; } } function safelyResolveThenable(self, thenable) { // Either fulfill, reject or reject with error var called = false; function onError(value) { if (called) { return; } called = true; handlers.reject(self, value); } function onSuccess(value) { if (called) { return; } called = true; handlers.resolve(self, value); } function tryToUnwrap() { thenable(onSuccess, onError); } var result = tryCatch(tryToUnwrap); if (result.status === 'error') { onError(result.value); } } function tryCatch(func, value) { var out = {}; try { out.value = func(value); out.status = 'success'; } catch (e) { out.status = 'error'; out.value = e; } return out; } Promise.resolve = resolve; function resolve(value) { if (value instanceof this) { return value; } return handlers.resolve(new this(INTERNAL), value); } Promise.reject = reject; function reject(reason) { var promise = new this(INTERNAL); return handlers.reject(promise, reason); } Promise.all = all; function all(iterable) { var self = this; if (Object.prototype.toString.call(iterable) !== '[object Array]') { return this.reject(new TypeError('must be an array')); } var len = iterable.length; var called = false; if (!len) { return this.resolve([]); } var values = new Array(len); var resolved = 0; var i = -1; var promise = new this(INTERNAL); while (++i < len) { allResolver(iterable[i], i); } return promise; function allResolver(value, i) { self.resolve(value).then(resolveFromAll, function (error) { if (!called) { called = true; handlers.reject(promise, error); } }); function resolveFromAll(outValue) { values[i] = outValue; if (++resolved === len && !called) { called = true; handlers.resolve(promise, values); } } } } Promise.race = race; function race(iterable) { var self = this; if (Object.prototype.toString.call(iterable) !== '[object Array]') { return this.reject(new TypeError('must be an array')); } var len = iterable.length; var called = false; if (!len) { return this.resolve([]); } var i = -1; var promise = new this(INTERNAL); while (++i < len) { resolver(iterable[i]); } return promise; function resolver(value) { self.resolve(value).then(function (response) { if (!called) { called = true; handlers.resolve(promise, response); } }, function (error) { if (!called) { called = true; handlers.reject(promise, error); } }); } } /***/ }), /* 89 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(global) { var Mutation = global.MutationObserver || global.WebKitMutationObserver; var scheduleDrain; { if (Mutation) { var called = 0; var observer = new Mutation(nextTick); var element = global.document.createTextNode(''); observer.observe(element, { characterData: true }); scheduleDrain = function () { element.data = (called = ++called % 2); }; } else if (!global.setImmediate && typeof global.MessageChannel !== 'undefined') { var channel = new global.MessageChannel(); channel.port1.onmessage = nextTick; scheduleDrain = function () { channel.port2.postMessage(0); }; } else if ('document' in global && 'onreadystatechange' in global.document.createElement('script')) { scheduleDrain = function () { // 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 scriptEl = global.document.createElement('script'); scriptEl.onreadystatechange = function () { nextTick(); scriptEl.onreadystatechange = null; scriptEl.parentNode.removeChild(scriptEl); scriptEl = null; }; global.document.documentElement.appendChild(scriptEl); }; } else { scheduleDrain = function () { setTimeout(nextTick, 0); }; } } var draining; var queue = []; //named nextTick for less confusing stack traces function nextTick() { draining = true; var i, oldQueue; var len = queue.length; while (len) { oldQueue = queue; queue = []; i = -1; while (++i < len) { oldQueue[i](); } len = queue.length; } draining = false; } module.exports = immediate; function immediate(task) { if (queue.push(task) === 1 && !draining) { scheduleDrain(); } } /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(11))) /***/ }), /* 90 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var GenericWorker = __webpack_require__(12); var utils = __webpack_require__(8); /** * A worker which convert chunks to a specified type. * @constructor * @param {String} destType the destination type. */ function ConvertWorker(destType) { GenericWorker.call(this, "ConvertWorker to " + destType); this.destType = destType; } utils.inherits(ConvertWorker, GenericWorker); /** * @see GenericWorker.processChunk */ ConvertWorker.prototype.processChunk = function (chunk) { this.push({ data : utils.transformTo(this.destType, chunk.data), meta : chunk.meta }); }; module.exports = ConvertWorker; /***/ }), /* 91 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var Readable = __webpack_require__(39).Readable; var utils = __webpack_require__(8); utils.inherits(NodejsStreamOutputAdapter, Readable); /** * A nodejs stream using a worker as source. * @see the SourceWrapper in http://nodejs.org/api/stream.html * @constructor * @param {StreamHelper} helper the helper wrapping the worker * @param {Object} options the nodejs stream options * @param {Function} updateCb the update callback. */ function NodejsStreamOutputAdapter(helper, options, updateCb) { Readable.call(this, options); this._helper = helper; var self = this; helper.on("data", function (data, meta) { if (!self.push(data)) { self._helper.pause(); } if(updateCb) { updateCb(meta); } }) .on("error", function(e) { self.emit('error', e); }) .on("end", function () { self.push(null); }); } NodejsStreamOutputAdapter.prototype._read = function() { this._helper.resume(); }; module.exports = NodejsStreamOutputAdapter; /***/ }), /* 92 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var StreamHelper = __webpack_require__(46); var DataWorker = __webpack_require__(48); var utf8 = __webpack_require__(17); var CompressedObject = __webpack_require__(35); var GenericWorker = __webpack_require__(12); /** * A simple object representing a file in the zip file. * @constructor * @param {string} name the name of the file * @param {String|ArrayBuffer|Uint8Array|Buffer} data the data * @param {Object} options the options of the file */ var ZipObject = function(name, data, options) { this.name = name; this.dir = options.dir; this.date = options.date; this.comment = options.comment; this.unixPermissions = options.unixPermissions; this.dosPermissions = options.dosPermissions; this._data = data; this._dataBinary = options.binary; // keep only the compression this.options = { compression : options.compression, compressionOptions : options.compressionOptions }; }; ZipObject.prototype = { /** * Create an internal stream for the content of this object. * @param {String} type the type of each chunk. * @return StreamHelper the stream. */ internalStream: function (type) { var result = null, outputType = "string"; try { if (!type) { throw new Error("No output type specified."); } outputType = type.toLowerCase(); var askUnicodeString = outputType === "string" || outputType === "text"; if (outputType === "binarystring" || outputType === "text") { outputType = "string"; } result = this._decompressWorker(); var isUnicodeString = !this._dataBinary; if (isUnicodeString && !askUnicodeString) { result = result.pipe(new utf8.Utf8EncodeWorker()); } if (!isUnicodeString && askUnicodeString) { result = result.pipe(new utf8.Utf8DecodeWorker()); } } catch (e) { result = new GenericWorker("error"); result.error(e); } return new StreamHelper(result, outputType, ""); }, /** * Prepare the content in the asked type. * @param {String} type the type of the result. * @param {Function} onUpdate a function to call on each internal update. * @return Promise the promise of the result. */ async: function (type, onUpdate) { return this.internalStream(type).accumulate(onUpdate); }, /** * Prepare the content as a nodejs stream. * @param {String} type the type of each chunk. * @param {Function} onUpdate a function to call on each internal update. * @return Stream the stream. */ nodeStream: function (type, onUpdate) { return this.internalStream(type || "nodebuffer").toNodejsStream(onUpdate); }, /** * Return a worker for the compressed content. * @private * @param {Object} compression the compression object to use. * @param {Object} compressionOptions the options to use when compressing. * @return Worker the worker. */ _compressWorker: function (compression, compressionOptions) { if ( this._data instanceof CompressedObject && this._data.compression.magic === compression.magic ) { return this._data.getCompressedWorker(); } else { var result = this._decompressWorker(); if(!this._dataBinary) { result = result.pipe(new utf8.Utf8EncodeWorker()); } return CompressedObject.createWorkerFrom(result, compression, compressionOptions); } }, /** * Return a worker for the decompressed content. * @private * @return Worker the worker. */ _decompressWorker : function () { if (this._data instanceof CompressedObject) { return this._data.getContentWorker(); } else if (this._data instanceof GenericWorker) { return this._data; } else { return new DataWorker(this._data); } } }; var removedMethods = ["asText", "asBinary", "asNodeBuffer", "asUint8Array", "asArrayBuffer"]; var removedFn = function () { throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide."); }; for(var i = 0; i < removedMethods.length; i++) { ZipObject.prototype[removedMethods[i]] = removedFn; } module.exports = ZipObject; /***/ }), /* 93 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var compressions = __webpack_require__(51); var ZipFileWorker = __webpack_require__(104); /** * Find the compression to use. * @param {String} fileCompression the compression defined at the file level, if any. * @param {String} zipCompression the compression defined at the load() level. * @return {Object} the compression object to use. */ var getCompression = function (fileCompression, zipCompression) { var compressionName = fileCompression || zipCompression; var compression = compressions[compressionName]; if (!compression) { throw new Error(compressionName + " is not a valid compression method !"); } return compression; }; /** * Create a worker to generate a zip file. * @param {JSZip} zip the JSZip instance at the right root level. * @param {Object} options to generate the zip file. * @param {String} comment the comment to use. */ exports.generateWorker = function (zip, options, comment) { var zipFileWorker = new ZipFileWorker(options.streamFiles, comment, options.platform, options.encodeFileName); var entriesCount = 0; try { zip.forEach(function (relativePath, file) { entriesCount++; var compression = getCompression(file.options.compression, options.compression); var compressionOptions = file.options.compressionOptions || options.compressionOptions || {}; var dir = file.dir, date = file.date; file._compressWorker(compression, compressionOptions) .withStreamInfo("file", { name : relativePath, dir : dir, date : date, comment : file.comment || "", unixPermissions : file.unixPermissions, dosPermissions : file.dosPermissions }) .pipe(zipFileWorker); }); zipFileWorker.entriesCount = entriesCount; } catch (e) { zipFileWorker.error(e); } return zipFileWorker; }; /***/ }), /* 94 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var USE_TYPEDARRAY = (typeof Uint8Array !== 'undefined') && (typeof Uint16Array !== 'undefined') && (typeof Uint32Array !== 'undefined'); var pako = __webpack_require__(95); var utils = __webpack_require__(8); var GenericWorker = __webpack_require__(12); var ARRAY_TYPE = USE_TYPEDARRAY ? "uint8array" : "array"; exports.magic = "\x08\x00"; /** * Create a worker that uses pako to inflate/deflate. * @constructor * @param {String} action the name of the pako function to call : either "Deflate" or "Inflate". * @param {Object} options the options to use when (de)compressing. */ function FlateWorker(action, options) { GenericWorker.call(this, "FlateWorker/" + action); this._pako = null; this._pakoAction = action; this._pakoOptions = options; // the `meta` object from the last chunk received // this allow this worker to pass around metadata this.meta = {}; } utils.inherits(FlateWorker, GenericWorker); /** * @see GenericWorker.processChunk */ FlateWorker.prototype.processChunk = function (chunk) { this.meta = chunk.meta; if (this._pako === null) { this._createPako(); } this._pako.push(utils.transformTo(ARRAY_TYPE, chunk.data), false); }; /** * @see GenericWorker.flush */ FlateWorker.prototype.flush = function () { GenericWorker.prototype.flush.call(this); if (this._pako === null) { this._createPako(); } this._pako.push([], true); }; /** * @see GenericWorker.cleanUp */ FlateWorker.prototype.cleanUp = function () { GenericWorker.prototype.cleanUp.call(this); this._pako = null; }; /** * Create the _pako object. * TODO: lazy-loading this object isn't the best solution but it's the * quickest. The best solution is to lazy-load the worker list. See also the * issue #446. */ FlateWorker.prototype._createPako = function () { this._pako = new pako[this._pakoAction]({ raw: true, level: this._pakoOptions.level || -1 // default compression }); var self = this; this._pako.onData = function(data) { self.push({ data : data, meta : self.meta }); }; }; exports.compressWorker = function (compressionOptions) { return new FlateWorker("Deflate", compressionOptions); }; exports.uncompressWorker = function () { return new FlateWorker("Inflate", {}); }; /***/ }), /* 95 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // Top level file is just a mixin of submodules & constants var assign = __webpack_require__(15).assign; var deflate = __webpack_require__(96); var inflate = __webpack_require__(99); var constants = __webpack_require__(56); var pako = {}; assign(pako, deflate, inflate, constants); module.exports = pako; /***/ }), /* 96 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var zlib_deflate = __webpack_require__(97); var utils = __webpack_require__(15); var strings = __webpack_require__(54); var msg = __webpack_require__(37); var ZStream = __webpack_require__(55); var toString = Object.prototype.toString; /* Public constants ==========================================================*/ /* ===========================================================================*/ var Z_NO_FLUSH = 0; var Z_FINISH = 4; var Z_OK = 0; var Z_STREAM_END = 1; var Z_SYNC_FLUSH = 2; var Z_DEFAULT_COMPRESSION = -1; var Z_DEFAULT_STRATEGY = 0; var Z_DEFLATED = 8; /* ===========================================================================*/ /** * class Deflate * * Generic JS-style wrapper for zlib calls. If you don't need * streaming behaviour - use more simple functions: [[deflate]], * [[deflateRaw]] and [[gzip]]. **/ /* internal * Deflate.chunks -> Array * * Chunks of output data, if [[Deflate#onData]] not overridden. **/ /** * Deflate.result -> Uint8Array|Array * * Compressed result, generated by default [[Deflate#onData]] * and [[Deflate#onEnd]] handlers. Filled after you push last chunk * (call [[Deflate#push]] with `Z_FINISH` / `true` param) or if you * push a chunk with explicit flush (call [[Deflate#push]] with * `Z_SYNC_FLUSH` param). **/ /** * Deflate.err -> Number * * Error code after deflate finished. 0 (Z_OK) on success. * You will not need it in real life, because deflate errors * are possible only on wrong options or bad `onData` / `onEnd` * custom handlers. **/ /** * Deflate.msg -> String * * Error message, if [[Deflate.err]] != 0 **/ /** * new Deflate(options) * - options (Object): zlib deflate options. * * Creates new deflator instance with specified params. Throws exception * on bad params. Supported options: * * - `level` * - `windowBits` * - `memLevel` * - `strategy` * - `dictionary` * * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced) * for more information on these. * * Additional options, for internal needs: * * - `chunkSize` - size of generated data chunks (16K by default) * - `raw` (Boolean) - do raw deflate * - `gzip` (Boolean) - create gzip wrapper * - `to` (String) - if equal to 'string', then result will be "binary string" * (each char code [0..255]) * - `header` (Object) - custom header for gzip * - `text` (Boolean) - true if compressed data believed to be text * - `time` (Number) - modification time, unix timestamp * - `os` (Number) - operation system code * - `extra` (Array) - array of bytes with extra data (max 65536) * - `name` (String) - file name (binary string) * - `comment` (String) - comment (binary string) * - `hcrc` (Boolean) - true if header crc should be added * * ##### Example: * * ```javascript * var pako = require('pako') * , chunk1 = Uint8Array([1,2,3,4,5,6,7,8,9]) * , chunk2 = Uint8Array([10,11,12,13,14,15,16,17,18,19]); * * var deflate = new pako.Deflate({ level: 3}); * * deflate.push(chunk1, false); * deflate.push(chunk2, true); // true -> last chunk * * if (deflate.err) { throw new Error(deflate.err); } * * console.log(deflate.result); * ``` **/ function Deflate(options) { if (!(this instanceof Deflate)) return new Deflate(options); this.options = utils.assign({ level: Z_DEFAULT_COMPRESSION, method: Z_DEFLATED, chunkSize: 16384, windowBits: 15, memLevel: 8, strategy: Z_DEFAULT_STRATEGY, to: '' }, options || {}); var opt = this.options; if (opt.raw && (opt.windowBits > 0)) { opt.windowBits = -opt.windowBits; } else if (opt.gzip && (opt.windowBits > 0) && (opt.windowBits < 16)) { opt.windowBits += 16; } this.err = 0; // error code, if happens (0 = Z_OK) this.msg = ''; // error message this.ended = false; // used to avoid multiple onEnd() calls this.chunks = []; // chunks of compressed data this.strm = new ZStream(); this.strm.avail_out = 0; var status = zlib_deflate.deflateInit2( this.strm, opt.level, opt.method, opt.windowBits, opt.memLevel, opt.strategy ); if (status !== Z_OK) { throw new Error(msg[status]); } if (opt.header) { zlib_deflate.deflateSetHeader(this.strm, opt.header); } if (opt.dictionary) { var dict; // Convert data if needed if (typeof opt.dictionary === 'string') { // If we need to compress text, change encoding to utf8. dict = strings.string2buf(opt.dictionary); } else if (toString.call(opt.dictionary) === '[object ArrayBuffer]') { dict = new Uint8Array(opt.dictionary); } else { dict = opt.dictionary; } status = zlib_deflate.deflateSetDictionary(this.strm, dict); if (status !== Z_OK) { throw new Error(msg[status]); } this._dict_set = true; } } /** * Deflate#push(data[, mode]) -> Boolean * - data (Uint8Array|Array|ArrayBuffer|String): input data. Strings will be * converted to utf8 byte sequence. * - mode (Number|Boolean): 0..6 for corresponding Z_NO_FLUSH..Z_TREE modes. * See constants. Skipped or `false` means Z_NO_FLUSH, `true` means Z_FINISH. * * Sends input data to deflate pipe, generating [[Deflate#onData]] calls with * new compressed chunks. Returns `true` on success. The last data block must have * mode Z_FINISH (or `true`). That will flush internal pending buffers and call * [[Deflate#onEnd]]. For interim explicit flushes (without ending the stream) you * can use mode Z_SYNC_FLUSH, keeping the compression context. * * On fail call [[Deflate#onEnd]] with error code and return false. * * We strongly recommend to use `Uint8Array` on input for best speed (output * array format is detected automatically). Also, don't skip last param and always * use the same type in your code (boolean or number). That will improve JS speed. * * For regular `Array`-s make sure all elements are [0..255]. * * ##### Example * * ```javascript * push(chunk, false); // push one of data chunks * ... * push(chunk, true); // push last chunk * ``` **/ Deflate.prototype.push = function (data, mode) { var strm = this.strm; var chunkSize = this.options.chunkSize; var status, _mode; if (this.ended) { return false; } _mode = (mode === ~~mode) ? mode : ((mode === true) ? Z_FINISH : Z_NO_FLUSH); // Convert data if needed if (typeof data === 'string') { // If we need to compress text, change encoding to utf8. strm.input = strings.string2buf(data); } else if (toString.call(data) === '[object ArrayBuffer]') { strm.input = new Uint8Array(data); } else { strm.input = data; } strm.next_in = 0; strm.avail_in = strm.input.length; do { if (strm.avail_out === 0) { strm.output = new utils.Buf8(chunkSize); strm.next_out = 0; strm.avail_out = chunkSize; } status = zlib_deflate.deflate(strm, _mode); /* no bad return value */ if (status !== Z_STREAM_END && status !== Z_OK) { this.onEnd(status); this.ended = true; return false; } if (strm.avail_out === 0 || (strm.avail_in === 0 && (_mode === Z_FINISH || _mode === Z_SYNC_FLUSH))) { if (this.options.to === 'string') { this.onData(strings.buf2binstring(utils.shrinkBuf(strm.output, strm.next_out))); } else { this.onData(utils.shrinkBuf(strm.output, strm.next_out)); } } } while ((strm.avail_in > 0 || strm.avail_out === 0) && status !== Z_STREAM_END); // Finalize on the last chunk. if (_mode === Z_FINISH) { status = zlib_deflate.deflateEnd(this.strm); this.onEnd(status); this.ended = true; return status === Z_OK; } // callback interim results if Z_SYNC_FLUSH. if (_mode === Z_SYNC_FLUSH) { this.onEnd(Z_OK); strm.avail_out = 0; return true; } return true; }; /** * Deflate#onData(chunk) -> Void * - chunk (Uint8Array|Array|String): output data. Type of array depends * on js engine support. When string output requested, each chunk * will be string. * * By default, stores data blocks in `chunks[]` property and glue * those in `onEnd`. Override this handler, if you need another behaviour. **/ Deflate.prototype.onData = function (chunk) { this.chunks.push(chunk); }; /** * Deflate#onEnd(status) -> Void * - status (Number): deflate status. 0 (Z_OK) on success, * other if not. * * Called once after you tell deflate that the input stream is * complete (Z_FINISH) or should be flushed (Z_SYNC_FLUSH) * or if an error happened. By default - join collected chunks, * free memory and fill `results` / `err` properties. **/ Deflate.prototype.onEnd = function (status) { // On success - join if (status === Z_OK) { if (this.options.to === 'string') { this.result = this.chunks.join(''); } else { this.result = utils.flattenChunks(this.chunks); } } this.chunks = []; this.err = status; this.msg = this.strm.msg; }; /** * deflate(data[, options]) -> Uint8Array|Array|String * - data (Uint8Array|Array|String): input data to compress. * - options (Object): zlib deflate options. * * Compress `data` with deflate algorithm and `options`. * * Supported options are: * * - level * - windowBits * - memLevel * - strategy * - dictionary * * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced) * for more information on these. * * Sugar (options): * * - `raw` (Boolean) - say that we work with raw stream, if you don't wish to specify * negative windowBits implicitly. * - `to` (String) - if equal to 'string', then result will be "binary string" * (each char code [0..255]) * * ##### Example: * * ```javascript * var pako = require('pako') * , data = Uint8Array([1,2,3,4,5,6,7,8,9]); * * console.log(pako.deflate(data)); * ``` **/ function deflate(input, options) { var deflator = new Deflate(options); deflator.push(input, true); // That will never happens, if you don't cheat with options :) if (deflator.err) { throw deflator.msg || msg[deflator.err]; } return deflator.result; } /** * deflateRaw(data[, options]) -> Uint8Array|Array|String * - data (Uint8Array|Array|String): input data to compress. * - options (Object): zlib deflate options. * * The same as [[deflate]], but creates raw data, without wrapper * (header and adler32 crc). **/ function deflateRaw(input, options) { options = options || {}; options.raw = true; return deflate(input, options); } /** * gzip(data[, options]) -> Uint8Array|Array|String * - data (Uint8Array|Array|String): input data to compress. * - options (Object): zlib deflate options. * * The same as [[deflate]], but create gzip wrapper instead of * deflate one. **/ function gzip(input, options) { options = options || {}; options.gzip = true; return deflate(input, options); } exports.Deflate = Deflate; exports.deflate = deflate; exports.deflateRaw = deflateRaw; exports.gzip = gzip; /***/ }), /* 97 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // (C) 1995-2013 Jean-loup Gailly and Mark Adler // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would be // appreciated but is not required. // 2. Altered source versions must be plainly marked as such, and must not be // misrepresented as being the original software. // 3. This notice may not be removed or altered from any source distribution. var utils = __webpack_require__(15); var trees = __webpack_require__(98); var adler32 = __webpack_require__(52); var crc32 = __webpack_require__(53); var msg = __webpack_require__(37); /* Public constants ==========================================================*/ /* ===========================================================================*/ /* Allowed flush values; see deflate() and inflate() below for details */ var Z_NO_FLUSH = 0; var Z_PARTIAL_FLUSH = 1; //var Z_SYNC_FLUSH = 2; var Z_FULL_FLUSH = 3; var Z_FINISH = 4; var Z_BLOCK = 5; //var Z_TREES = 6; /* Return codes for the compression/decompression functions. Negative values * are errors, positive values are used for special but normal events. */ var Z_OK = 0; var Z_STREAM_END = 1; //var Z_NEED_DICT = 2; //var Z_ERRNO = -1; var Z_STREAM_ERROR = -2; var Z_DATA_ERROR = -3; //var Z_MEM_ERROR = -4; var Z_BUF_ERROR = -5; //var Z_VERSION_ERROR = -6; /* compression levels */ //var Z_NO_COMPRESSION = 0; //var Z_BEST_SPEED = 1; //var Z_BEST_COMPRESSION = 9; var Z_DEFAULT_COMPRESSION = -1; var Z_FILTERED = 1; var Z_HUFFMAN_ONLY = 2; var Z_RLE = 3; var Z_FIXED = 4; var Z_DEFAULT_STRATEGY = 0; /* Possible values of the data_type field (though see inflate()) */ //var Z_BINARY = 0; //var Z_TEXT = 1; //var Z_ASCII = 1; // = Z_TEXT var Z_UNKNOWN = 2; /* The deflate compression method */ var Z_DEFLATED = 8; /*============================================================================*/ var MAX_MEM_LEVEL = 9; /* Maximum value for memLevel in deflateInit2 */ var MAX_WBITS = 15; /* 32K LZ77 window */ var DEF_MEM_LEVEL = 8; var LENGTH_CODES = 29; /* number of length codes, not counting the special END_BLOCK code */ var LITERALS = 256; /* number of literal bytes 0..255 */ var L_CODES = LITERALS + 1 + LENGTH_CODES; /* number of Literal or Length codes, including the END_BLOCK code */ var D_CODES = 30; /* number of distance codes */ var BL_CODES = 19; /* number of codes used to transfer the bit lengths */ var HEAP_SIZE = 2 * L_CODES + 1; /* maximum heap size */ var MAX_BITS = 15; /* All codes must not exceed MAX_BITS bits */ var MIN_MATCH = 3; var MAX_MATCH = 258; var MIN_LOOKAHEAD = (MAX_MATCH + MIN_MATCH + 1); var PRESET_DICT = 0x20; var INIT_STATE = 42; var EXTRA_STATE = 69; var NAME_STATE = 73; var COMMENT_STATE = 91; var HCRC_STATE = 103; var BUSY_STATE = 113; var FINISH_STATE = 666; var BS_NEED_MORE = 1; /* block not completed, need more input or more output */ var BS_BLOCK_DONE = 2; /* block flush performed */ var BS_FINISH_STARTED = 3; /* finish started, need only more output at next deflate */ var BS_FINISH_DONE = 4; /* finish done, accept no more input or output */ var OS_CODE = 0x03; // Unix :) . Don't detect, use this default. function err(strm, errorCode) { strm.msg = msg[errorCode]; return errorCode; } function rank(f) { return ((f) << 1) - ((f) > 4 ? 9 : 0); } function zero(buf) { var len = buf.length; while (--len >= 0) { buf[len] = 0; } } /* ========================================================================= * Flush as much pending output as possible. All deflate() output goes * through this function so some applications may wish to modify it * to avoid allocating a large strm->output buffer and copying into it. * (See also read_buf()). */ function flush_pending(strm) { var s = strm.state; //_tr_flush_bits(s); var len = s.pending; if (len > strm.avail_out) { len = strm.avail_out; } if (len === 0) { return; } utils.arraySet(strm.output, s.pending_buf, s.pending_out, len, strm.next_out); strm.next_out += len; s.pending_out += len; strm.total_out += len; strm.avail_out -= len; s.pending -= len; if (s.pending === 0) { s.pending_out = 0; } } function flush_block_only(s, last) { trees._tr_flush_block(s, (s.block_start >= 0 ? s.block_start : -1), s.strstart - s.block_start, last); s.block_start = s.strstart; flush_pending(s.strm); } function put_byte(s, b) { s.pending_buf[s.pending++] = b; } /* ========================================================================= * Put a short in the pending buffer. The 16-bit value is put in MSB order. * IN assertion: the stream state is correct and there is enough room in * pending_buf. */ function putShortMSB(s, b) { // put_byte(s, (Byte)(b >> 8)); // put_byte(s, (Byte)(b & 0xff)); s.pending_buf[s.pending++] = (b >>> 8) & 0xff; s.pending_buf[s.pending++] = b & 0xff; } /* =========================================================================== * Read a new buffer from the current input stream, update the adler32 * and total number of bytes read. All deflate() input goes through * this function so some applications may wish to modify it to avoid * allocating a large strm->input buffer and copying from it. * (See also flush_pending()). */ function read_buf(strm, buf, start, size) { var len = strm.avail_in; if (len > size) { len = size; } if (len === 0) { return 0; } strm.avail_in -= len; // zmemcpy(buf, strm->next_in, len); utils.arraySet(buf, strm.input, strm.next_in, len, start); if (strm.state.wrap === 1) { strm.adler = adler32(strm.adler, buf, len, start); } else if (strm.state.wrap === 2) { strm.adler = crc32(strm.adler, buf, len, start); } strm.next_in += len; strm.total_in += len; return len; } /* =========================================================================== * Set match_start to the longest match starting at the given string and * return its length. Matches shorter or equal to prev_length are discarded, * in which case the result is equal to prev_length and match_start is * garbage. * IN assertions: cur_match is the head of the hash chain for the current * string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1 * OUT assertion: the match length is not greater than s->lookahead. */ function longest_match(s, cur_match) { var chain_length = s.max_chain_length; /* max hash chain length */ var scan = s.strstart; /* current string */ var match; /* matched string */ var len; /* length of current match */ var best_len = s.prev_length; /* best match length so far */ var nice_match = s.nice_match; /* stop if match long enough */ var limit = (s.strstart > (s.w_size - MIN_LOOKAHEAD)) ? s.strstart - (s.w_size - MIN_LOOKAHEAD) : 0/*NIL*/; var _win = s.window; // shortcut var wmask = s.w_mask; var prev = s.prev; /* Stop when cur_match becomes <= limit. To simplify the code, * we prevent matches with the string of window index 0. */ var strend = s.strstart + MAX_MATCH; var scan_end1 = _win[scan + best_len - 1]; var scan_end = _win[scan + best_len]; /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16. * It is easy to get rid of this optimization if necessary. */ // Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever"); /* Do not waste too much time if we already have a good match: */ if (s.prev_length >= s.good_match) { chain_length >>= 2; } /* Do not look for matches beyond the end of the input. This is necessary * to make deflate deterministic. */ if (nice_match > s.lookahead) { nice_match = s.lookahead; } // Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead"); do { // Assert(cur_match < s->strstart, "no future"); match = cur_match; /* Skip to next match if the match length cannot increase * or if the match length is less than 2. Note that the checks below * for insufficient lookahead only occur occasionally for performance * reasons. Therefore uninitialized memory will be accessed, and * conditional jumps will be made that depend on those values. * However the length of the match is limited to the lookahead, so * the output of deflate is not affected by the uninitialized values. */ if (_win[match + best_len] !== scan_end || _win[match + best_len - 1] !== scan_end1 || _win[match] !== _win[scan] || _win[++match] !== _win[scan + 1]) { continue; } /* The check at best_len-1 can be removed because it will be made * again later. (This heuristic is not always a win.) * It is not necessary to compare scan[2] and match[2] since they * are always equal when the other bytes match, given that * the hash keys are equal and that HASH_BITS >= 8. */ scan += 2; match++; // Assert(*scan == *match, "match[2]?"); /* We check for insufficient lookahead only every 8th comparison; * the 256th check will be made at strstart+258. */ do { /*jshint noempty:false*/ } while (_win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && scan < strend); // Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); len = MAX_MATCH - (strend - scan); scan = strend - MAX_MATCH; if (len > best_len) { s.match_start = cur_match; best_len = len; if (len >= nice_match) { break; } scan_end1 = _win[scan + best_len - 1]; scan_end = _win[scan + best_len]; } } while ((cur_match = prev[cur_match & wmask]) > limit && --chain_length !== 0); if (best_len <= s.lookahead) { return best_len; } return s.lookahead; } /* =========================================================================== * Fill the window when the lookahead becomes insufficient. * Updates strstart and lookahead. * * IN assertion: lookahead < MIN_LOOKAHEAD * OUT assertions: strstart <= window_size-MIN_LOOKAHEAD * At least one byte has been read, or avail_in == 0; reads are * performed for at least two bytes (required for the zip translate_eol * option -- not supported here). */ function fill_window(s) { var _w_size = s.w_size; var p, n, m, more, str; //Assert(s->lookahead < MIN_LOOKAHEAD, "already enough lookahead"); do { more = s.window_size - s.lookahead - s.strstart; // JS ints have 32 bit, block below not needed /* Deal with !@#$% 64K limit: */ //if (sizeof(int) <= 2) { // if (more == 0 && s->strstart == 0 && s->lookahead == 0) { // more = wsize; // // } else if (more == (unsigned)(-1)) { // /* Very unlikely, but possible on 16 bit machine if // * strstart == 0 && lookahead == 1 (input done a byte at time) // */ // more--; // } //} /* If the window is almost full and there is insufficient lookahead, * move the upper half to the lower one to make room in the upper half. */ if (s.strstart >= _w_size + (_w_size - MIN_LOOKAHEAD)) { utils.arraySet(s.window, s.window, _w_size, _w_size, 0); s.match_start -= _w_size; s.strstart -= _w_size; /* we now have strstart >= MAX_DIST */ s.block_start -= _w_size; /* Slide the hash table (could be avoided with 32 bit values at the expense of memory usage). We slide even when level == 0 to keep the hash table consistent if we switch back to level > 0 later. (Using level 0 permanently is not an optimal usage of zlib, so we don't care about this pathological case.) */ n = s.hash_size; p = n; do { m = s.head[--p]; s.head[p] = (m >= _w_size ? m - _w_size : 0); } while (--n); n = _w_size; p = n; do { m = s.prev[--p]; s.prev[p] = (m >= _w_size ? m - _w_size : 0); /* If n is not on any hash chain, prev[n] is garbage but * its value will never be used. */ } while (--n); more += _w_size; } if (s.strm.avail_in === 0) { break; } /* If there was no sliding: * strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 && * more == window_size - lookahead - strstart * => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1) * => more >= window_size - 2*WSIZE + 2 * In the BIG_MEM or MMAP case (not yet supported), * window_size == input_size + MIN_LOOKAHEAD && * strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD. * Otherwise, window_size == 2*WSIZE so more >= 2. * If there was sliding, more >= WSIZE. So in all cases, more >= 2. */ //Assert(more >= 2, "more < 2"); n = read_buf(s.strm, s.window, s.strstart + s.lookahead, more); s.lookahead += n; /* Initialize the hash value now that we have some input: */ if (s.lookahead + s.insert >= MIN_MATCH) { str = s.strstart - s.insert; s.ins_h = s.window[str]; /* UPDATE_HASH(s, s->ins_h, s->window[str + 1]); */ s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + 1]) & s.hash_mask; //#if MIN_MATCH != 3 // Call update_hash() MIN_MATCH-3 more times //#endif while (s.insert) { /* UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); */ s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + MIN_MATCH - 1]) & s.hash_mask; s.prev[str & s.w_mask] = s.head[s.ins_h]; s.head[s.ins_h] = str; str++; s.insert--; if (s.lookahead + s.insert < MIN_MATCH) { break; } } } /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage, * but this is not important since only literal bytes will be emitted. */ } while (s.lookahead < MIN_LOOKAHEAD && s.strm.avail_in !== 0); /* If the WIN_INIT bytes after the end of the current data have never been * written, then zero those bytes in order to avoid memory check reports of * the use of uninitialized (or uninitialised as Julian writes) bytes by * the longest match routines. Update the high water mark for the next * time through here. WIN_INIT is set to MAX_MATCH since the longest match * routines allow scanning to strstart + MAX_MATCH, ignoring lookahead. */ // if (s.high_water < s.window_size) { // var curr = s.strstart + s.lookahead; // var init = 0; // // if (s.high_water < curr) { // /* Previous high water mark below current data -- zero WIN_INIT // * bytes or up to end of window, whichever is less. // */ // init = s.window_size - curr; // if (init > WIN_INIT) // init = WIN_INIT; // zmemzero(s->window + curr, (unsigned)init); // s->high_water = curr + init; // } // else if (s->high_water < (ulg)curr + WIN_INIT) { // /* High water mark at or above current data, but below current data // * plus WIN_INIT -- zero out to current data plus WIN_INIT, or up // * to end of window, whichever is less. // */ // init = (ulg)curr + WIN_INIT - s->high_water; // if (init > s->window_size - s->high_water) // init = s->window_size - s->high_water; // zmemzero(s->window + s->high_water, (unsigned)init); // s->high_water += init; // } // } // // Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD, // "not enough room for search"); } /* =========================================================================== * Copy without compression as much as possible from the input stream, return * the current block state. * This function does not insert new strings in the dictionary since * uncompressible data is probably not useful. This function is used * only for the level=0 compression option. * NOTE: this function should be optimized to avoid extra copying from * window to pending_buf. */ function deflate_stored(s, flush) { /* Stored blocks are limited to 0xffff bytes, pending_buf is limited * to pending_buf_size, and each stored block has a 5 byte header: */ var max_block_size = 0xffff; if (max_block_size > s.pending_buf_size - 5) { max_block_size = s.pending_buf_size - 5; } /* Copy as much as possible from input to output: */ for (;;) { /* Fill the window as much as possible: */ if (s.lookahead <= 1) { //Assert(s->strstart < s->w_size+MAX_DIST(s) || // s->block_start >= (long)s->w_size, "slide too late"); // if (!(s.strstart < s.w_size + (s.w_size - MIN_LOOKAHEAD) || // s.block_start >= s.w_size)) { // throw new Error("slide too late"); // } fill_window(s); if (s.lookahead === 0 && flush === Z_NO_FLUSH) { return BS_NEED_MORE; } if (s.lookahead === 0) { break; } /* flush the current block */ } //Assert(s->block_start >= 0L, "block gone"); // if (s.block_start < 0) throw new Error("block gone"); s.strstart += s.lookahead; s.lookahead = 0; /* Emit a stored block if pending_buf will be full: */ var max_start = s.block_start + max_block_size; if (s.strstart === 0 || s.strstart >= max_start) { /* strstart == 0 is possible when wraparound on 16-bit machine */ s.lookahead = s.strstart - max_start; s.strstart = max_start; /*** FLUSH_BLOCK(s, 0); ***/ flush_block_only(s, false); if (s.strm.avail_out === 0) { return BS_NEED_MORE; } /***/ } /* Flush if we may have to slide, otherwise block_start may become * negative and the data will be gone: */ if (s.strstart - s.block_start >= (s.w_size - MIN_LOOKAHEAD)) { /*** FLUSH_BLOCK(s, 0); ***/ flush_block_only(s, false); if (s.strm.avail_out === 0) { return BS_NEED_MORE; } /***/ } } s.insert = 0; if (flush === Z_FINISH) { /*** FLUSH_BLOCK(s, 1); ***/ flush_block_only(s, true); if (s.strm.avail_out === 0) { return BS_FINISH_STARTED; } /***/ return BS_FINISH_DONE; } if (s.strstart > s.block_start) { /*** FLUSH_BLOCK(s, 0); ***/ flush_block_only(s, false); if (s.strm.avail_out === 0) { return BS_NEED_MORE; } /***/ } return BS_NEED_MORE; } /* =========================================================================== * Compress as much as possible from the input stream, return the current * block state. * This function does not perform lazy evaluation of matches and inserts * new strings in the dictionary only for unmatched strings or for short * matches. It is used only for the fast compression options. */ function deflate_fast(s, flush) { var hash_head; /* head of the hash chain */ var bflush; /* set if current block must be flushed */ for (;;) { /* Make sure that we always have enough lookahead, except * at the end of the input file. We need MAX_MATCH bytes * for the next match, plus MIN_MATCH bytes to insert the * string following the next match. */ if (s.lookahead < MIN_LOOKAHEAD) { fill_window(s); if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) { return BS_NEED_MORE; } if (s.lookahead === 0) { break; /* flush the current block */ } } /* Insert the string window[strstart .. strstart+2] in the * dictionary, and set hash_head to the head of the hash chain: */ hash_head = 0/*NIL*/; if (s.lookahead >= MIN_MATCH) { /*** INSERT_STRING(s, s.strstart, hash_head); ***/ s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask; hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h]; s.head[s.ins_h] = s.strstart; /***/ } /* Find the longest match, discarding those <= prev_length. * At this point we have always match_length < MIN_MATCH */ if (hash_head !== 0/*NIL*/ && ((s.strstart - hash_head) <= (s.w_size - MIN_LOOKAHEAD))) { /* To simplify the code, we prevent matches with the string * of window index 0 (in particular we have to avoid a match * of the string with itself at the start of the input file). */ s.match_length = longest_match(s, hash_head); /* longest_match() sets match_start */ } if (s.match_length >= MIN_MATCH) { // check_match(s, s.strstart, s.match_start, s.match_length); // for debug only /*** _tr_tally_dist(s, s.strstart - s.match_start, s.match_length - MIN_MATCH, bflush); ***/ bflush = trees._tr_tally(s, s.strstart - s.match_start, s.match_length - MIN_MATCH); s.lookahead -= s.match_length; /* Insert new strings in the hash table only if the match length * is not too large. This saves time but degrades compression. */ if (s.match_length <= s.max_lazy_match/*max_insert_length*/ && s.lookahead >= MIN_MATCH) { s.match_length--; /* string at strstart already in table */ do { s.strstart++; /*** INSERT_STRING(s, s.strstart, hash_head); ***/ s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask; hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h]; s.head[s.ins_h] = s.strstart; /***/ /* strstart never exceeds WSIZE-MAX_MATCH, so there are * always MIN_MATCH bytes ahead. */ } while (--s.match_length !== 0); s.strstart++; } else { s.strstart += s.match_length; s.match_length = 0; s.ins_h = s.window[s.strstart]; /* UPDATE_HASH(s, s.ins_h, s.window[s.strstart+1]); */ s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + 1]) & s.hash_mask; //#if MIN_MATCH != 3 // Call UPDATE_HASH() MIN_MATCH-3 more times //#endif /* If lookahead < MIN_MATCH, ins_h is garbage, but it does not * matter since it will be recomputed at next deflate call. */ } } else { /* No match, output a literal byte */ //Tracevv((stderr,"%c", s.window[s.strstart])); /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/ bflush = trees._tr_tally(s, 0, s.window[s.strstart]); s.lookahead--; s.strstart++; } if (bflush) { /*** FLUSH_BLOCK(s, 0); ***/ flush_block_only(s, false); if (s.strm.avail_out === 0) { return BS_NEED_MORE; } /***/ } } s.insert = ((s.strstart < (MIN_MATCH - 1)) ? s.strstart : MIN_MATCH - 1); if (flush === Z_FINISH) { /*** FLUSH_BLOCK(s, 1); ***/ flush_block_only(s, true); if (s.strm.avail_out === 0) { return BS_FINISH_STARTED; } /***/ return BS_FINISH_DONE; } if (s.last_lit) { /*** FLUSH_BLOCK(s, 0); ***/ flush_block_only(s, false); if (s.strm.avail_out === 0) { return BS_NEED_MORE; } /***/ } return BS_BLOCK_DONE; } /* =========================================================================== * Same as above, but achieves better compression. We use a lazy * evaluation for matches: a match is finally adopted only if there is * no better match at the next window position. */ function deflate_slow(s, flush) { var hash_head; /* head of hash chain */ var bflush; /* set if current block must be flushed */ var max_insert; /* Process the input block. */ for (;;) { /* Make sure that we always have enough lookahead, except * at the end of the input file. We need MAX_MATCH bytes * for the next match, plus MIN_MATCH bytes to insert the * string following the next match. */ if (s.lookahead < MIN_LOOKAHEAD) { fill_window(s); if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) { return BS_NEED_MORE; } if (s.lookahead === 0) { break; } /* flush the current block */ } /* Insert the string window[strstart .. strstart+2] in the * dictionary, and set hash_head to the head of the hash chain: */ hash_head = 0/*NIL*/; if (s.lookahead >= MIN_MATCH) { /*** INSERT_STRING(s, s.strstart, hash_head); ***/ s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask; hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h]; s.head[s.ins_h] = s.strstart; /***/ } /* Find the longest match, discarding those <= prev_length. */ s.prev_length = s.match_length; s.prev_match = s.match_start; s.match_length = MIN_MATCH - 1; if (hash_head !== 0/*NIL*/ && s.prev_length < s.max_lazy_match && s.strstart - hash_head <= (s.w_size - MIN_LOOKAHEAD)/*MAX_DIST(s)*/) { /* To simplify the code, we prevent matches with the string * of window index 0 (in particular we have to avoid a match * of the string with itself at the start of the input file). */ s.match_length = longest_match(s, hash_head); /* longest_match() sets match_start */ if (s.match_length <= 5 && (s.strategy === Z_FILTERED || (s.match_length === MIN_MATCH && s.strstart - s.match_start > 4096/*TOO_FAR*/))) { /* If prev_match is also MIN_MATCH, match_start is garbage * but we will ignore the current match anyway. */ s.match_length = MIN_MATCH - 1; } } /* If there was a match at the previous step and the current * match is not better, output the previous match: */ if (s.prev_length >= MIN_MATCH && s.match_length <= s.prev_length) { max_insert = s.strstart + s.lookahead - MIN_MATCH; /* Do not insert strings in hash table beyond this. */ //check_match(s, s.strstart-1, s.prev_match, s.prev_length); /***_tr_tally_dist(s, s.strstart - 1 - s.prev_match, s.prev_length - MIN_MATCH, bflush);***/ bflush = trees._tr_tally(s, s.strstart - 1 - s.prev_match, s.prev_length - MIN_MATCH); /* Insert in hash table all strings up to the end of the match. * strstart-1 and strstart are already inserted. If there is not * enough lookahead, the last two strings are not inserted in * the hash table. */ s.lookahead -= s.prev_length - 1; s.prev_length -= 2; do { if (++s.strstart <= max_insert) { /*** INSERT_STRING(s, s.strstart, hash_head); ***/ s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask; hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h]; s.head[s.ins_h] = s.strstart; /***/ } } while (--s.prev_length !== 0); s.match_available = 0; s.match_length = MIN_MATCH - 1; s.strstart++; if (bflush) { /*** FLUSH_BLOCK(s, 0); ***/ flush_block_only(s, false); if (s.strm.avail_out === 0) { return BS_NEED_MORE; } /***/ } } else if (s.match_available) { /* If there was no match at the previous position, output a * single literal. If there was a match but the current match * is longer, truncate the previous match to a single literal. */ //Tracevv((stderr,"%c", s->window[s->strstart-1])); /*** _tr_tally_lit(s, s.window[s.strstart-1], bflush); ***/ bflush = trees._tr_tally(s, 0, s.window[s.strstart - 1]); if (bflush) { /*** FLUSH_BLOCK_ONLY(s, 0) ***/ flush_block_only(s, false); /***/ } s.strstart++; s.lookahead--; if (s.strm.avail_out === 0) { return BS_NEED_MORE; } } else { /* There is no previous match to compare with, wait for * the next step to decide. */ s.match_available = 1; s.strstart++; s.lookahead--; } } //Assert (flush != Z_NO_FLUSH, "no flush?"); if (s.match_available) { //Tracevv((stderr,"%c", s->window[s->strstart-1])); /*** _tr_tally_lit(s, s.window[s.strstart-1], bflush); ***/ bflush = trees._tr_tally(s, 0, s.window[s.strstart - 1]); s.match_available = 0; } s.insert = s.strstart < MIN_MATCH - 1 ? s.strstart : MIN_MATCH - 1; if (flush === Z_FINISH) { /*** FLUSH_BLOCK(s, 1); ***/ flush_block_only(s, true); if (s.strm.avail_out === 0) { return BS_FINISH_STARTED; } /***/ return BS_FINISH_DONE; } if (s.last_lit) { /*** FLUSH_BLOCK(s, 0); ***/ flush_block_only(s, false); if (s.strm.avail_out === 0) { return BS_NEED_MORE; } /***/ } return BS_BLOCK_DONE; } /* =========================================================================== * For Z_RLE, simply look for runs of bytes, generate matches only of distance * one. Do not maintain a hash table. (It will be regenerated if this run of * deflate switches away from Z_RLE.) */ function deflate_rle(s, flush) { var bflush; /* set if current block must be flushed */ var prev; /* byte at distance one to match */ var scan, strend; /* scan goes up to strend for length of run */ var _win = s.window; for (;;) { /* Make sure that we always have enough lookahead, except * at the end of the input file. We need MAX_MATCH bytes * for the longest run, plus one for the unrolled loop. */ if (s.lookahead <= MAX_MATCH) { fill_window(s); if (s.lookahead <= MAX_MATCH && flush === Z_NO_FLUSH) { return BS_NEED_MORE; } if (s.lookahead === 0) { break; } /* flush the current block */ } /* See how many times the previous byte repeats */ s.match_length = 0; if (s.lookahead >= MIN_MATCH && s.strstart > 0) { scan = s.strstart - 1; prev = _win[scan]; if (prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan]) { strend = s.strstart + MAX_MATCH; do { /*jshint noempty:false*/ } while (prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && scan < strend); s.match_length = MAX_MATCH - (strend - scan); if (s.match_length > s.lookahead) { s.match_length = s.lookahead; } } //Assert(scan <= s->window+(uInt)(s->window_size-1), "wild scan"); } /* Emit match if have run of MIN_MATCH or longer, else emit literal */ if (s.match_length >= MIN_MATCH) { //check_match(s, s.strstart, s.strstart - 1, s.match_length); /*** _tr_tally_dist(s, 1, s.match_length - MIN_MATCH, bflush); ***/ bflush = trees._tr_tally(s, 1, s.match_length - MIN_MATCH); s.lookahead -= s.match_length; s.strstart += s.match_length; s.match_length = 0; } else { /* No match, output a literal byte */ //Tracevv((stderr,"%c", s->window[s->strstart])); /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/ bflush = trees._tr_tally(s, 0, s.window[s.strstart]); s.lookahead--; s.strstart++; } if (bflush) { /*** FLUSH_BLOCK(s, 0); ***/ flush_block_only(s, false); if (s.strm.avail_out === 0) { return BS_NEED_MORE; } /***/ } } s.insert = 0; if (flush === Z_FINISH) { /*** FLUSH_BLOCK(s, 1); ***/ flush_block_only(s, true); if (s.strm.avail_out === 0) { return BS_FINISH_STARTED; } /***/ return BS_FINISH_DONE; } if (s.last_lit) { /*** FLUSH_BLOCK(s, 0); ***/ flush_block_only(s, false); if (s.strm.avail_out === 0) { return BS_NEED_MORE; } /***/ } return BS_BLOCK_DONE; } /* =========================================================================== * For Z_HUFFMAN_ONLY, do not look for matches. Do not maintain a hash table. * (It will be regenerated if this run of deflate switches away from Huffman.) */ function deflate_huff(s, flush) { var bflush; /* set if current block must be flushed */ for (;;) { /* Make sure that we have a literal to write. */ if (s.lookahead === 0) { fill_window(s); if (s.lookahead === 0) { if (flush === Z_NO_FLUSH) { return BS_NEED_MORE; } break; /* flush the current block */ } } /* Output a literal byte */ s.match_length = 0; //Tracevv((stderr,"%c", s->window[s->strstart])); /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/ bflush = trees._tr_tally(s, 0, s.window[s.strstart]); s.lookahead--; s.strstart++; if (bflush) { /*** FLUSH_BLOCK(s, 0); ***/ flush_block_only(s, false); if (s.strm.avail_out === 0) { return BS_NEED_MORE; } /***/ } } s.insert = 0; if (flush === Z_FINISH) { /*** FLUSH_BLOCK(s, 1); ***/ flush_block_only(s, true); if (s.strm.avail_out === 0) { return BS_FINISH_STARTED; } /***/ return BS_FINISH_DONE; } if (s.last_lit) { /*** FLUSH_BLOCK(s, 0); ***/ flush_block_only(s, false); if (s.strm.avail_out === 0) { return BS_NEED_MORE; } /***/ } return BS_BLOCK_DONE; } /* Values for max_lazy_match, good_match and max_chain_length, depending on * the desired pack level (0..9). The values given below have been tuned to * exclude worst case performance for pathological files. Better values may be * found for specific files. */ function Config(good_length, max_lazy, nice_length, max_chain, func) { this.good_length = good_length; this.max_lazy = max_lazy; this.nice_length = nice_length; this.max_chain = max_chain; this.func = func; } var configuration_table; configuration_table = [ /* good lazy nice chain */ new Config(0, 0, 0, 0, deflate_stored), /* 0 store only */ new Config(4, 4, 8, 4, deflate_fast), /* 1 max speed, no lazy matches */ new Config(4, 5, 16, 8, deflate_fast), /* 2 */ new Config(4, 6, 32, 32, deflate_fast), /* 3 */ new Config(4, 4, 16, 16, deflate_slow), /* 4 lazy matches */ new Config(8, 16, 32, 32, deflate_slow), /* 5 */ new Config(8, 16, 128, 128, deflate_slow), /* 6 */ new Config(8, 32, 128, 256, deflate_slow), /* 7 */ new Config(32, 128, 258, 1024, deflate_slow), /* 8 */ new Config(32, 258, 258, 4096, deflate_slow) /* 9 max compression */ ]; /* =========================================================================== * Initialize the "longest match" routines for a new zlib stream */ function lm_init(s) { s.window_size = 2 * s.w_size; /*** CLEAR_HASH(s); ***/ zero(s.head); // Fill with NIL (= 0); /* Set the default configuration parameters: */ s.max_lazy_match = configuration_table[s.level].max_lazy; s.good_match = configuration_table[s.level].good_length; s.nice_match = configuration_table[s.level].nice_length; s.max_chain_length = configuration_table[s.level].max_chain; s.strstart = 0; s.block_start = 0; s.lookahead = 0; s.insert = 0; s.match_length = s.prev_length = MIN_MATCH - 1; s.match_available = 0; s.ins_h = 0; } function DeflateState() { this.strm = null; /* pointer back to this zlib stream */ this.status = 0; /* as the name implies */ this.pending_buf = null; /* output still pending */ this.pending_buf_size = 0; /* size of pending_buf */ this.pending_out = 0; /* next pending byte to output to the stream */ this.pending = 0; /* nb of bytes in the pending buffer */ this.wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip */ this.gzhead = null; /* gzip header information to write */ this.gzindex = 0; /* where in extra, name, or comment */ this.method = Z_DEFLATED; /* can only be DEFLATED */ this.last_flush = -1; /* value of flush param for previous deflate call */ this.w_size = 0; /* LZ77 window size (32K by default) */ this.w_bits = 0; /* log2(w_size) (8..16) */ this.w_mask = 0; /* w_size - 1 */ this.window = null; /* Sliding window. Input bytes are read into the second half of the window, * and move to the first half later to keep a dictionary of at least wSize * bytes. With this organization, matches are limited to a distance of * wSize-MAX_MATCH bytes, but this ensures that IO is always * performed with a length multiple of the block size. */ this.window_size = 0; /* Actual size of window: 2*wSize, except when the user input buffer * is directly used as sliding window. */ this.prev = null; /* Link to older string with same hash index. To limit the size of this * array to 64K, this link is maintained only for the last 32K strings. * An index in this array is thus a window index modulo 32K. */ this.head = null; /* Heads of the hash chains or NIL. */ this.ins_h = 0; /* hash index of string to be inserted */ this.hash_size = 0; /* number of elements in hash table */ this.hash_bits = 0; /* log2(hash_size) */ this.hash_mask = 0; /* hash_size-1 */ this.hash_shift = 0; /* Number of bits by which ins_h must be shifted at each input * step. It must be such that after MIN_MATCH steps, the oldest * byte no longer takes part in the hash key, that is: * hash_shift * MIN_MATCH >= hash_bits */ this.block_start = 0; /* Window position at the beginning of the current output block. Gets * negative when the window is moved backwards. */ this.match_length = 0; /* length of best match */ this.prev_match = 0; /* previous match */ this.match_available = 0; /* set if previous match exists */ this.strstart = 0; /* start of string to insert */ this.match_start = 0; /* start of matching string */ this.lookahead = 0; /* number of valid bytes ahead in window */ this.prev_length = 0; /* Length of the best match at previous step. Matches not greater than this * are discarded. This is used in the lazy match evaluation. */ this.max_chain_length = 0; /* To speed up deflation, hash chains are never searched beyond this * length. A higher limit improves compression ratio but degrades the * speed. */ this.max_lazy_match = 0; /* Attempt to find a better match only when the current match is strictly * smaller than this value. This mechanism is used only for compression * levels >= 4. */ // That's alias to max_lazy_match, don't use directly //this.max_insert_length = 0; /* Insert new strings in the hash table only if the match length is not * greater than this length. This saves time but degrades compression. * max_insert_length is used only for compression levels <= 3. */ this.level = 0; /* compression level (1..9) */ this.strategy = 0; /* favor or force Huffman coding*/ this.good_match = 0; /* Use a faster search when the previous match is longer than this */ this.nice_match = 0; /* Stop searching when current match exceeds this */ /* used by trees.c: */ /* Didn't use ct_data typedef below to suppress compiler warning */ // struct ct_data_s dyn_ltree[HEAP_SIZE]; /* literal and length tree */ // struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */ // struct ct_data_s bl_tree[2*BL_CODES+1]; /* Huffman tree for bit lengths */ // Use flat array of DOUBLE size, with interleaved fata, // because JS does not support effective this.dyn_ltree = new utils.Buf16(HEAP_SIZE * 2); this.dyn_dtree = new utils.Buf16((2 * D_CODES + 1) * 2); this.bl_tree = new utils.Buf16((2 * BL_CODES + 1) * 2); zero(this.dyn_ltree); zero(this.dyn_dtree); zero(this.bl_tree); this.l_desc = null; /* desc. for literal tree */ this.d_desc = null; /* desc. for distance tree */ this.bl_desc = null; /* desc. for bit length tree */ //ush bl_count[MAX_BITS+1]; this.bl_count = new utils.Buf16(MAX_BITS + 1); /* number of codes at each bit length for an optimal tree */ //int heap[2*L_CODES+1]; /* heap used to build the Huffman trees */ this.heap = new utils.Buf16(2 * L_CODES + 1); /* heap used to build the Huffman trees */ zero(this.heap); this.heap_len = 0; /* number of elements in the heap */ this.heap_max = 0; /* element of largest frequency */ /* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used. * The same heap array is used to build all trees. */ this.depth = new utils.Buf16(2 * L_CODES + 1); //uch depth[2*L_CODES+1]; zero(this.depth); /* Depth of each subtree used as tie breaker for trees of equal frequency */ this.l_buf = 0; /* buffer index for literals or lengths */ this.lit_bufsize = 0; /* Size of match buffer for literals/lengths. There are 4 reasons for * limiting lit_bufsize to 64K: * - frequencies can be kept in 16 bit counters * - if compression is not successful for the first block, all input * data is still in the window so we can still emit a stored block even * when input comes from standard input. (This can also be done for * all blocks if lit_bufsize is not greater than 32K.) * - if compression is not successful for a file smaller than 64K, we can * even emit a stored file instead of a stored block (saving 5 bytes). * This is applicable only for zip (not gzip or zlib). * - creating new Huffman trees less frequently may not provide fast * adaptation to changes in the input data statistics. (Take for * example a binary file with poorly compressible code followed by * a highly compressible string table.) Smaller buffer sizes give * fast adaptation but have of course the overhead of transmitting * trees more frequently. * - I can't count above 4 */ this.last_lit = 0; /* running index in l_buf */ this.d_buf = 0; /* Buffer index for distances. To simplify the code, d_buf and l_buf have * the same number of elements. To use different lengths, an extra flag * array would be necessary. */ this.opt_len = 0; /* bit length of current block with optimal trees */ this.static_len = 0; /* bit length of current block with static trees */ this.matches = 0; /* number of string matches in current block */ this.insert = 0; /* bytes at end of window left to insert */ this.bi_buf = 0; /* Output buffer. bits are inserted starting at the bottom (least * significant bits). */ this.bi_valid = 0; /* Number of valid bits in bi_buf. All bits above the last valid bit * are always zero. */ // Used for window memory init. We safely ignore it for JS. That makes // sense only for pointers and memory check tools. //this.high_water = 0; /* High water mark offset in window for initialized bytes -- bytes above * this are set to zero in order to avoid memory check warnings when * longest match routines access bytes past the input. This is then * updated to the new high water mark. */ } function deflateResetKeep(strm) { var s; if (!strm || !strm.state) { return err(strm, Z_STREAM_ERROR); } strm.total_in = strm.total_out = 0; strm.data_type = Z_UNKNOWN; s = strm.state; s.pending = 0; s.pending_out = 0; if (s.wrap < 0) { s.wrap = -s.wrap; /* was made negative by deflate(..., Z_FINISH); */ } s.status = (s.wrap ? INIT_STATE : BUSY_STATE); strm.adler = (s.wrap === 2) ? 0 // crc32(0, Z_NULL, 0) : 1; // adler32(0, Z_NULL, 0) s.last_flush = Z_NO_FLUSH; trees._tr_init(s); return Z_OK; } function deflateReset(strm) { var ret = deflateResetKeep(strm); if (ret === Z_OK) { lm_init(strm.state); } return ret; } function deflateSetHeader(strm, head) { if (!strm || !strm.state) { return Z_STREAM_ERROR; } if (strm.state.wrap !== 2) { return Z_STREAM_ERROR; } strm.state.gzhead = head; return Z_OK; } function deflateInit2(strm, level, method, windowBits, memLevel, strategy) { if (!strm) { // === Z_NULL return Z_STREAM_ERROR; } var wrap = 1; if (level === Z_DEFAULT_COMPRESSION) { level = 6; } if (windowBits < 0) { /* suppress zlib wrapper */ wrap = 0; windowBits = -windowBits; } else if (windowBits > 15) { wrap = 2; /* write gzip wrapper instead */ windowBits -= 16; } if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method !== Z_DEFLATED || windowBits < 8 || windowBits > 15 || level < 0 || level > 9 || strategy < 0 || strategy > Z_FIXED) { return err(strm, Z_STREAM_ERROR); } if (windowBits === 8) { windowBits = 9; } /* until 256-byte window bug fixed */ var s = new DeflateState(); strm.state = s; s.strm = strm; s.wrap = wrap; s.gzhead = null; s.w_bits = windowBits; s.w_size = 1 << s.w_bits; s.w_mask = s.w_size - 1; s.hash_bits = memLevel + 7; s.hash_size = 1 << s.hash_bits; s.hash_mask = s.hash_size - 1; s.hash_shift = ~~((s.hash_bits + MIN_MATCH - 1) / MIN_MATCH); s.window = new utils.Buf8(s.w_size * 2); s.head = new utils.Buf16(s.hash_size); s.prev = new utils.Buf16(s.w_size); // Don't need mem init magic for JS. //s.high_water = 0; /* nothing written to s->window yet */ s.lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */ s.pending_buf_size = s.lit_bufsize * 4; //overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2); //s->pending_buf = (uchf *) overlay; s.pending_buf = new utils.Buf8(s.pending_buf_size); // It is offset from `s.pending_buf` (size is `s.lit_bufsize * 2`) //s->d_buf = overlay + s->lit_bufsize/sizeof(ush); s.d_buf = 1 * s.lit_bufsize; //s->l_buf = s->pending_buf + (1+sizeof(ush))*s->lit_bufsize; s.l_buf = (1 + 2) * s.lit_bufsize; s.level = level; s.strategy = strategy; s.method = method; return deflateReset(strm); } function deflateInit(strm, level) { return deflateInit2(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY); } function deflate(strm, flush) { var old_flush, s; var beg, val; // for gzip header write only if (!strm || !strm.state || flush > Z_BLOCK || flush < 0) { return strm ? err(strm, Z_STREAM_ERROR) : Z_STREAM_ERROR; } s = strm.state; if (!strm.output || (!strm.input && strm.avail_in !== 0) || (s.status === FINISH_STATE && flush !== Z_FINISH)) { return err(strm, (strm.avail_out === 0) ? Z_BUF_ERROR : Z_STREAM_ERROR); } s.strm = strm; /* just in case */ old_flush = s.last_flush; s.last_flush = flush; /* Write the header */ if (s.status === INIT_STATE) { if (s.wrap === 2) { // GZIP header strm.adler = 0; //crc32(0L, Z_NULL, 0); put_byte(s, 31); put_byte(s, 139); put_byte(s, 8); if (!s.gzhead) { // s->gzhead == Z_NULL put_byte(s, 0); put_byte(s, 0); put_byte(s, 0); put_byte(s, 0); put_byte(s, 0); put_byte(s, s.level === 9 ? 2 : (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ? 4 : 0)); put_byte(s, OS_CODE); s.status = BUSY_STATE; } else { put_byte(s, (s.gzhead.text ? 1 : 0) + (s.gzhead.hcrc ? 2 : 0) + (!s.gzhead.extra ? 0 : 4) + (!s.gzhead.name ? 0 : 8) + (!s.gzhead.comment ? 0 : 16) ); put_byte(s, s.gzhead.time & 0xff); put_byte(s, (s.gzhead.time >> 8) & 0xff); put_byte(s, (s.gzhead.time >> 16) & 0xff); put_byte(s, (s.gzhead.time >> 24) & 0xff); put_byte(s, s.level === 9 ? 2 : (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ? 4 : 0)); put_byte(s, s.gzhead.os & 0xff); if (s.gzhead.extra && s.gzhead.extra.length) { put_byte(s, s.gzhead.extra.length & 0xff); put_byte(s, (s.gzhead.extra.length >> 8) & 0xff); } if (s.gzhead.hcrc) { strm.adler = crc32(strm.adler, s.pending_buf, s.pending, 0); } s.gzindex = 0; s.status = EXTRA_STATE; } } else // DEFLATE header { var header = (Z_DEFLATED + ((s.w_bits - 8) << 4)) << 8; var level_flags = -1; if (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2) { level_flags = 0; } else if (s.level < 6) { level_flags = 1; } else if (s.level === 6) { level_flags = 2; } else { level_flags = 3; } header |= (level_flags << 6); if (s.strstart !== 0) { header |= PRESET_DICT; } header += 31 - (header % 31); s.status = BUSY_STATE; putShortMSB(s, header); /* Save the adler32 of the preset dictionary: */ if (s.strstart !== 0) { putShortMSB(s, strm.adler >>> 16); putShortMSB(s, strm.adler & 0xffff); } strm.adler = 1; // adler32(0L, Z_NULL, 0); } } //#ifdef GZIP if (s.status === EXTRA_STATE) { if (s.gzhead.extra/* != Z_NULL*/) { beg = s.pending; /* start of bytes to update crc */ while (s.gzindex < (s.gzhead.extra.length & 0xffff)) { if (s.pending === s.pending_buf_size) { if (s.gzhead.hcrc && s.pending > beg) { strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); } flush_pending(strm); beg = s.pending; if (s.pending === s.pending_buf_size) { break; } } put_byte(s, s.gzhead.extra[s.gzindex] & 0xff); s.gzindex++; } if (s.gzhead.hcrc && s.pending > beg) { strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); } if (s.gzindex === s.gzhead.extra.length) { s.gzindex = 0; s.status = NAME_STATE; } } else { s.status = NAME_STATE; } } if (s.status === NAME_STATE) { if (s.gzhead.name/* != Z_NULL*/) { beg = s.pending; /* start of bytes to update crc */ //int val; do { if (s.pending === s.pending_buf_size) { if (s.gzhead.hcrc && s.pending > beg) { strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); } flush_pending(strm); beg = s.pending; if (s.pending === s.pending_buf_size) { val = 1; break; } } // JS specific: little magic to add zero terminator to end of string if (s.gzindex < s.gzhead.name.length) { val = s.gzhead.name.charCodeAt(s.gzindex++) & 0xff; } else { val = 0; } put_byte(s, val); } while (val !== 0); if (s.gzhead.hcrc && s.pending > beg) { strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); } if (val === 0) { s.gzindex = 0; s.status = COMMENT_STATE; } } else { s.status = COMMENT_STATE; } } if (s.status === COMMENT_STATE) { if (s.gzhead.comment/* != Z_NULL*/) { beg = s.pending; /* start of bytes to update crc */ //int val; do { if (s.pending === s.pending_buf_size) { if (s.gzhead.hcrc && s.pending > beg) { strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); } flush_pending(strm); beg = s.pending; if (s.pending === s.pending_buf_size) { val = 1; break; } } // JS specific: little magic to add zero terminator to end of string if (s.gzindex < s.gzhead.comment.length) { val = s.gzhead.comment.charCodeAt(s.gzindex++) & 0xff; } else { val = 0; } put_byte(s, val); } while (val !== 0); if (s.gzhead.hcrc && s.pending > beg) { strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); } if (val === 0) { s.status = HCRC_STATE; } } else { s.status = HCRC_STATE; } } if (s.status === HCRC_STATE) { if (s.gzhead.hcrc) { if (s.pending + 2 > s.pending_buf_size) { flush_pending(strm); } if (s.pending + 2 <= s.pending_buf_size) { put_byte(s, strm.adler & 0xff); put_byte(s, (strm.adler >> 8) & 0xff); strm.adler = 0; //crc32(0L, Z_NULL, 0); s.status = BUSY_STATE; } } else { s.status = BUSY_STATE; } } //#endif /* Flush as much pending output as possible */ if (s.pending !== 0) { flush_pending(strm); if (strm.avail_out === 0) { /* Since avail_out is 0, deflate will be called again with * more output space, but possibly with both pending and * avail_in equal to zero. There won't be anything to do, * but this is not an error situation so make sure we * return OK instead of BUF_ERROR at next call of deflate: */ s.last_flush = -1; return Z_OK; } /* Make sure there is something to do and avoid duplicate consecutive * flushes. For repeated and useless calls with Z_FINISH, we keep * returning Z_STREAM_END instead of Z_BUF_ERROR. */ } else if (strm.avail_in === 0 && rank(flush) <= rank(old_flush) && flush !== Z_FINISH) { return err(strm, Z_BUF_ERROR); } /* User must not provide more input after the first FINISH: */ if (s.status === FINISH_STATE && strm.avail_in !== 0) { return err(strm, Z_BUF_ERROR); } /* Start a new block or continue the current one. */ if (strm.avail_in !== 0 || s.lookahead !== 0 || (flush !== Z_NO_FLUSH && s.status !== FINISH_STATE)) { var bstate = (s.strategy === Z_HUFFMAN_ONLY) ? deflate_huff(s, flush) : (s.strategy === Z_RLE ? deflate_rle(s, flush) : configuration_table[s.level].func(s, flush)); if (bstate === BS_FINISH_STARTED || bstate === BS_FINISH_DONE) { s.status = FINISH_STATE; } if (bstate === BS_NEED_MORE || bstate === BS_FINISH_STARTED) { if (strm.avail_out === 0) { s.last_flush = -1; /* avoid BUF_ERROR next call, see above */ } return Z_OK; /* If flush != Z_NO_FLUSH && avail_out == 0, the next call * of deflate should use the same flush parameter to make sure * that the flush is complete. So we don't have to output an * empty block here, this will be done at next call. This also * ensures that for a very small output buffer, we emit at most * one empty block. */ } if (bstate === BS_BLOCK_DONE) { if (flush === Z_PARTIAL_FLUSH) { trees._tr_align(s); } else if (flush !== Z_BLOCK) { /* FULL_FLUSH or SYNC_FLUSH */ trees._tr_stored_block(s, 0, 0, false); /* For a full flush, this empty block will be recognized * as a special marker by inflate_sync(). */ if (flush === Z_FULL_FLUSH) { /*** CLEAR_HASH(s); ***/ /* forget history */ zero(s.head); // Fill with NIL (= 0); if (s.lookahead === 0) { s.strstart = 0; s.block_start = 0; s.insert = 0; } } } flush_pending(strm); if (strm.avail_out === 0) { s.last_flush = -1; /* avoid BUF_ERROR at next call, see above */ return Z_OK; } } } //Assert(strm->avail_out > 0, "bug2"); //if (strm.avail_out <= 0) { throw new Error("bug2");} if (flush !== Z_FINISH) { return Z_OK; } if (s.wrap <= 0) { return Z_STREAM_END; } /* Write the trailer */ if (s.wrap === 2) { put_byte(s, strm.adler & 0xff); put_byte(s, (strm.adler >> 8) & 0xff); put_byte(s, (strm.adler >> 16) & 0xff); put_byte(s, (strm.adler >> 24) & 0xff); put_byte(s, strm.total_in & 0xff); put_byte(s, (strm.total_in >> 8) & 0xff); put_byte(s, (strm.total_in >> 16) & 0xff); put_byte(s, (strm.total_in >> 24) & 0xff); } else { putShortMSB(s, strm.adler >>> 16); putShortMSB(s, strm.adler & 0xffff); } flush_pending(strm); /* If avail_out is zero, the application will call deflate again * to flush the rest. */ if (s.wrap > 0) { s.wrap = -s.wrap; } /* write the trailer only once! */ return s.pending !== 0 ? Z_OK : Z_STREAM_END; } function deflateEnd(strm) { var status; if (!strm/*== Z_NULL*/ || !strm.state/*== Z_NULL*/) { return Z_STREAM_ERROR; } status = strm.state.status; if (status !== INIT_STATE && status !== EXTRA_STATE && status !== NAME_STATE && status !== COMMENT_STATE && status !== HCRC_STATE && status !== BUSY_STATE && status !== FINISH_STATE ) { return err(strm, Z_STREAM_ERROR); } strm.state = null; return status === BUSY_STATE ? err(strm, Z_DATA_ERROR) : Z_OK; } /* ========================================================================= * Initializes the compression dictionary from the given byte * sequence without producing any compressed output. */ function deflateSetDictionary(strm, dictionary) { var dictLength = dictionary.length; var s; var str, n; var wrap; var avail; var next; var input; var tmpDict; if (!strm/*== Z_NULL*/ || !strm.state/*== Z_NULL*/) { return Z_STREAM_ERROR; } s = strm.state; wrap = s.wrap; if (wrap === 2 || (wrap === 1 && s.status !== INIT_STATE) || s.lookahead) { return Z_STREAM_ERROR; } /* when using zlib wrappers, compute Adler-32 for provided dictionary */ if (wrap === 1) { /* adler32(strm->adler, dictionary, dictLength); */ strm.adler = adler32(strm.adler, dictionary, dictLength, 0); } s.wrap = 0; /* avoid computing Adler-32 in read_buf */ /* if dictionary would fill window, just replace the history */ if (dictLength >= s.w_size) { if (wrap === 0) { /* already empty otherwise */ /*** CLEAR_HASH(s); ***/ zero(s.head); // Fill with NIL (= 0); s.strstart = 0; s.block_start = 0; s.insert = 0; } /* use the tail */ // dictionary = dictionary.slice(dictLength - s.w_size); tmpDict = new utils.Buf8(s.w_size); utils.arraySet(tmpDict, dictionary, dictLength - s.w_size, s.w_size, 0); dictionary = tmpDict; dictLength = s.w_size; } /* insert dictionary into window and hash */ avail = strm.avail_in; next = strm.next_in; input = strm.input; strm.avail_in = dictLength; strm.next_in = 0; strm.input = dictionary; fill_window(s); while (s.lookahead >= MIN_MATCH) { str = s.strstart; n = s.lookahead - (MIN_MATCH - 1); do { /* UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); */ s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + MIN_MATCH - 1]) & s.hash_mask; s.prev[str & s.w_mask] = s.head[s.ins_h]; s.head[s.ins_h] = str; str++; } while (--n); s.strstart = str; s.lookahead = MIN_MATCH - 1; fill_window(s); } s.strstart += s.lookahead; s.block_start = s.strstart; s.insert = s.lookahead; s.lookahead = 0; s.match_length = s.prev_length = MIN_MATCH - 1; s.match_available = 0; strm.next_in = next; strm.input = input; strm.avail_in = avail; s.wrap = wrap; return Z_OK; } exports.deflateInit = deflateInit; exports.deflateInit2 = deflateInit2; exports.deflateReset = deflateReset; exports.deflateResetKeep = deflateResetKeep; exports.deflateSetHeader = deflateSetHeader; exports.deflate = deflate; exports.deflateEnd = deflateEnd; exports.deflateSetDictionary = deflateSetDictionary; exports.deflateInfo = 'pako deflate (from Nodeca project)'; /* Not implemented exports.deflateBound = deflateBound; exports.deflateCopy = deflateCopy; exports.deflateParams = deflateParams; exports.deflatePending = deflatePending; exports.deflatePrime = deflatePrime; exports.deflateTune = deflateTune; */ /***/ }), /* 98 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // (C) 1995-2013 Jean-loup Gailly and Mark Adler // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would be // appreciated but is not required. // 2. Altered source versions must be plainly marked as such, and must not be // misrepresented as being the original software. // 3. This notice may not be removed or altered from any source distribution. /* eslint-disable space-unary-ops */ var utils = __webpack_require__(15); /* Public constants ==========================================================*/ /* ===========================================================================*/ //var Z_FILTERED = 1; //var Z_HUFFMAN_ONLY = 2; //var Z_RLE = 3; var Z_FIXED = 4; //var Z_DEFAULT_STRATEGY = 0; /* Possible values of the data_type field (though see inflate()) */ var Z_BINARY = 0; var Z_TEXT = 1; //var Z_ASCII = 1; // = Z_TEXT var Z_UNKNOWN = 2; /*============================================================================*/ function zero(buf) { var len = buf.length; while (--len >= 0) { buf[len] = 0; } } // From zutil.h var STORED_BLOCK = 0; var STATIC_TREES = 1; var DYN_TREES = 2; /* The three kinds of block type */ var MIN_MATCH = 3; var MAX_MATCH = 258; /* The minimum and maximum match lengths */ // From deflate.h /* =========================================================================== * Internal compression state. */ var LENGTH_CODES = 29; /* number of length codes, not counting the special END_BLOCK code */ var LITERALS = 256; /* number of literal bytes 0..255 */ var L_CODES = LITERALS + 1 + LENGTH_CODES; /* number of Literal or Length codes, including the END_BLOCK code */ var D_CODES = 30; /* number of distance codes */ var BL_CODES = 19; /* number of codes used to transfer the bit lengths */ var HEAP_SIZE = 2 * L_CODES + 1; /* maximum heap size */ var MAX_BITS = 15; /* All codes must not exceed MAX_BITS bits */ var Buf_size = 16; /* size of bit buffer in bi_buf */ /* =========================================================================== * Constants */ var MAX_BL_BITS = 7; /* Bit length codes must not exceed MAX_BL_BITS bits */ var END_BLOCK = 256; /* end of block literal code */ var REP_3_6 = 16; /* repeat previous bit length 3-6 times (2 bits of repeat count) */ var REPZ_3_10 = 17; /* repeat a zero length 3-10 times (3 bits of repeat count) */ var REPZ_11_138 = 18; /* repeat a zero length 11-138 times (7 bits of repeat count) */ /* eslint-disable comma-spacing,array-bracket-spacing */ var extra_lbits = /* extra bits for each length code */ [0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]; var extra_dbits = /* extra bits for each distance code */ [0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]; var extra_blbits = /* extra bits for each bit length code */ [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]; var bl_order = [16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]; /* eslint-enable comma-spacing,array-bracket-spacing */ /* The lengths of the bit length codes are sent in order of decreasing * probability, to avoid transmitting the lengths for unused bit length codes. */ /* =========================================================================== * Local data. These are initialized only once. */ // We pre-fill arrays with 0 to avoid uninitialized gaps var DIST_CODE_LEN = 512; /* see definition of array dist_code below */ // !!!! Use flat array instead of structure, Freq = i*2, Len = i*2+1 var static_ltree = new Array((L_CODES + 2) * 2); zero(static_ltree); /* The static literal tree. Since the bit lengths are imposed, there is no * need for the L_CODES extra codes used during heap construction. However * The codes 286 and 287 are needed to build a canonical tree (see _tr_init * below). */ var static_dtree = new Array(D_CODES * 2); zero(static_dtree); /* The static distance tree. (Actually a trivial tree since all codes use * 5 bits.) */ var _dist_code = new Array(DIST_CODE_LEN); zero(_dist_code); /* Distance codes. The first 256 values correspond to the distances * 3 .. 258, the last 256 values correspond to the top 8 bits of * the 15 bit distances. */ var _length_code = new Array(MAX_MATCH - MIN_MATCH + 1); zero(_length_code); /* length code for each normalized match length (0 == MIN_MATCH) */ var base_length = new Array(LENGTH_CODES); zero(base_length); /* First normalized length for each code (0 = MIN_MATCH) */ var base_dist = new Array(D_CODES); zero(base_dist); /* First normalized distance for each code (0 = distance of 1) */ function StaticTreeDesc(static_tree, extra_bits, extra_base, elems, max_length) { this.static_tree = static_tree; /* static tree or NULL */ this.extra_bits = extra_bits; /* extra bits for each code or NULL */ this.extra_base = extra_base; /* base index for extra_bits */ this.elems = elems; /* max number of elements in the tree */ this.max_length = max_length; /* max bit length for the codes */ // show if `static_tree` has data or dummy - needed for monomorphic objects this.has_stree = static_tree && static_tree.length; } var static_l_desc; var static_d_desc; var static_bl_desc; function TreeDesc(dyn_tree, stat_desc) { this.dyn_tree = dyn_tree; /* the dynamic tree */ this.max_code = 0; /* largest code with non zero frequency */ this.stat_desc = stat_desc; /* the corresponding static tree */ } function d_code(dist) { return dist < 256 ? _dist_code[dist] : _dist_code[256 + (dist >>> 7)]; } /* =========================================================================== * Output a short LSB first on the stream. * IN assertion: there is enough room in pendingBuf. */ function put_short(s, w) { // put_byte(s, (uch)((w) & 0xff)); // put_byte(s, (uch)((ush)(w) >> 8)); s.pending_buf[s.pending++] = (w) & 0xff; s.pending_buf[s.pending++] = (w >>> 8) & 0xff; } /* =========================================================================== * Send a value on a given number of bits. * IN assertion: length <= 16 and value fits in length bits. */ function send_bits(s, value, length) { if (s.bi_valid > (Buf_size - length)) { s.bi_buf |= (value << s.bi_valid) & 0xffff; put_short(s, s.bi_buf); s.bi_buf = value >> (Buf_size - s.bi_valid); s.bi_valid += length - Buf_size; } else { s.bi_buf |= (value << s.bi_valid) & 0xffff; s.bi_valid += length; } } function send_code(s, c, tree) { send_bits(s, tree[c * 2]/*.Code*/, tree[c * 2 + 1]/*.Len*/); } /* =========================================================================== * Reverse the first len bits of a code, using straightforward code (a faster * method would use a table) * IN assertion: 1 <= len <= 15 */ function bi_reverse(code, len) { var res = 0; do { res |= code & 1; code >>>= 1; res <<= 1; } while (--len > 0); return res >>> 1; } /* =========================================================================== * Flush the bit buffer, keeping at most 7 bits in it. */ function bi_flush(s) { if (s.bi_valid === 16) { put_short(s, s.bi_buf); s.bi_buf = 0; s.bi_valid = 0; } else if (s.bi_valid >= 8) { s.pending_buf[s.pending++] = s.bi_buf & 0xff; s.bi_buf >>= 8; s.bi_valid -= 8; } } /* =========================================================================== * Compute the optimal bit lengths for a tree and update the total bit length * for the current block. * IN assertion: the fields freq and dad are set, heap[heap_max] and * above are the tree nodes sorted by increasing frequency. * OUT assertions: the field len is set to the optimal bit length, the * array bl_count contains the frequencies for each bit length. * The length opt_len is updated; static_len is also updated if stree is * not null. */ function gen_bitlen(s, desc) // deflate_state *s; // tree_desc *desc; /* the tree descriptor */ { var tree = desc.dyn_tree; var max_code = desc.max_code; var stree = desc.stat_desc.static_tree; var has_stree = desc.stat_desc.has_stree; var extra = desc.stat_desc.extra_bits; var base = desc.stat_desc.extra_base; var max_length = desc.stat_desc.max_length; var h; /* heap index */ var n, m; /* iterate over the tree elements */ var bits; /* bit length */ var xbits; /* extra bits */ var f; /* frequency */ var overflow = 0; /* number of elements with bit length too large */ for (bits = 0; bits <= MAX_BITS; bits++) { s.bl_count[bits] = 0; } /* In a first pass, compute the optimal bit lengths (which may * overflow in the case of the bit length tree). */ tree[s.heap[s.heap_max] * 2 + 1]/*.Len*/ = 0; /* root of the heap */ for (h = s.heap_max + 1; h < HEAP_SIZE; h++) { n = s.heap[h]; bits = tree[tree[n * 2 + 1]/*.Dad*/ * 2 + 1]/*.Len*/ + 1; if (bits > max_length) { bits = max_length; overflow++; } tree[n * 2 + 1]/*.Len*/ = bits; /* We overwrite tree[n].Dad which is no longer needed */ if (n > max_code) { continue; } /* not a leaf node */ s.bl_count[bits]++; xbits = 0; if (n >= base) { xbits = extra[n - base]; } f = tree[n * 2]/*.Freq*/; s.opt_len += f * (bits + xbits); if (has_stree) { s.static_len += f * (stree[n * 2 + 1]/*.Len*/ + xbits); } } if (overflow === 0) { return; } // Trace((stderr,"\nbit length overflow\n")); /* This happens for example on obj2 and pic of the Calgary corpus */ /* Find the first bit length which could increase: */ do { bits = max_length - 1; while (s.bl_count[bits] === 0) { bits--; } s.bl_count[bits]--; /* move one leaf down the tree */ s.bl_count[bits + 1] += 2; /* move one overflow item as its brother */ s.bl_count[max_length]--; /* The brother of the overflow item also moves one step up, * but this does not affect bl_count[max_length] */ overflow -= 2; } while (overflow > 0); /* Now recompute all bit lengths, scanning in increasing frequency. * h is still equal to HEAP_SIZE. (It is simpler to reconstruct all * lengths instead of fixing only the wrong ones. This idea is taken * from 'ar' written by Haruhiko Okumura.) */ for (bits = max_length; bits !== 0; bits--) { n = s.bl_count[bits]; while (n !== 0) { m = s.heap[--h]; if (m > max_code) { continue; } if (tree[m * 2 + 1]/*.Len*/ !== bits) { // Trace((stderr,"code %d bits %d->%d\n", m, tree[m].Len, bits)); s.opt_len += (bits - tree[m * 2 + 1]/*.Len*/) * tree[m * 2]/*.Freq*/; tree[m * 2 + 1]/*.Len*/ = bits; } n--; } } } /* =========================================================================== * Generate the codes for a given tree and bit counts (which need not be * optimal). * IN assertion: the array bl_count contains the bit length statistics for * the given tree and the field len is set for all tree elements. * OUT assertion: the field code is set for all tree elements of non * zero code length. */ function gen_codes(tree, max_code, bl_count) // ct_data *tree; /* the tree to decorate */ // int max_code; /* largest code with non zero frequency */ // ushf *bl_count; /* number of codes at each bit length */ { var next_code = new Array(MAX_BITS + 1); /* next code value for each bit length */ var code = 0; /* running code value */ var bits; /* bit index */ var n; /* code index */ /* The distribution counts are first used to generate the code values * without bit reversal. */ for (bits = 1; bits <= MAX_BITS; bits++) { next_code[bits] = code = (code + bl_count[bits - 1]) << 1; } /* Check that the bit counts in bl_count are consistent. The last code * must be all ones. */ //Assert (code + bl_count[MAX_BITS]-1 == (1<<MAX_BITS)-1, // "inconsistent bit counts"); //Tracev((stderr,"\ngen_codes: max_code %d ", max_code)); for (n = 0; n <= max_code; n++) { var len = tree[n * 2 + 1]/*.Len*/; if (len === 0) { continue; } /* Now reverse the bits */ tree[n * 2]/*.Code*/ = bi_reverse(next_code[len]++, len); //Tracecv(tree != static_ltree, (stderr,"\nn %3d %c l %2d c %4x (%x) ", // n, (isgraph(n) ? n : ' '), len, tree[n].Code, next_code[len]-1)); } } /* =========================================================================== * Initialize the various 'constant' tables. */ function tr_static_init() { var n; /* iterates over tree elements */ var bits; /* bit counter */ var length; /* length value */ var code; /* code value */ var dist; /* distance index */ var bl_count = new Array(MAX_BITS + 1); /* number of codes at each bit length for an optimal tree */ // do check in _tr_init() //if (static_init_done) return; /* For some embedded targets, global variables are not initialized: */ /*#ifdef NO_INIT_GLOBAL_POINTERS static_l_desc.static_tree = static_ltree; static_l_desc.extra_bits = extra_lbits; static_d_desc.static_tree = static_dtree; static_d_desc.extra_bits = extra_dbits; static_bl_desc.extra_bits = extra_blbits; #endif*/ /* Initialize the mapping length (0..255) -> length code (0..28) */ length = 0; for (code = 0; code < LENGTH_CODES - 1; code++) { base_length[code] = length; for (n = 0; n < (1 << extra_lbits[code]); n++) { _length_code[length++] = code; } } //Assert (length == 256, "tr_static_init: length != 256"); /* Note that the length 255 (match length 258) can be represented * in two different ways: code 284 + 5 bits or code 285, so we * overwrite length_code[255] to use the best encoding: */ _length_code[length - 1] = code; /* Initialize the mapping dist (0..32K) -> dist code (0..29) */ dist = 0; for (code = 0; code < 16; code++) { base_dist[code] = dist; for (n = 0; n < (1 << extra_dbits[code]); n++) { _dist_code[dist++] = code; } } //Assert (dist == 256, "tr_static_init: dist != 256"); dist >>= 7; /* from now on, all distances are divided by 128 */ for (; code < D_CODES; code++) { base_dist[code] = dist << 7; for (n = 0; n < (1 << (extra_dbits[code] - 7)); n++) { _dist_code[256 + dist++] = code; } } //Assert (dist == 256, "tr_static_init: 256+dist != 512"); /* Construct the codes of the static literal tree */ for (bits = 0; bits <= MAX_BITS; bits++) { bl_count[bits] = 0; } n = 0; while (n <= 143) { static_ltree[n * 2 + 1]/*.Len*/ = 8; n++; bl_count[8]++; } while (n <= 255) { static_ltree[n * 2 + 1]/*.Len*/ = 9; n++; bl_count[9]++; } while (n <= 279) { static_ltree[n * 2 + 1]/*.Len*/ = 7; n++; bl_count[7]++; } while (n <= 287) { static_ltree[n * 2 + 1]/*.Len*/ = 8; n++; bl_count[8]++; } /* Codes 286 and 287 do not exist, but we must include them in the * tree construction to get a canonical Huffman tree (longest code * all ones) */ gen_codes(static_ltree, L_CODES + 1, bl_count); /* The static distance tree is trivial: */ for (n = 0; n < D_CODES; n++) { static_dtree[n * 2 + 1]/*.Len*/ = 5; static_dtree[n * 2]/*.Code*/ = bi_reverse(n, 5); } // Now data ready and we can init static trees static_l_desc = new StaticTreeDesc(static_ltree, extra_lbits, LITERALS + 1, L_CODES, MAX_BITS); static_d_desc = new StaticTreeDesc(static_dtree, extra_dbits, 0, D_CODES, MAX_BITS); static_bl_desc = new StaticTreeDesc(new Array(0), extra_blbits, 0, BL_CODES, MAX_BL_BITS); //static_init_done = true; } /* =========================================================================== * Initialize a new block. */ function init_block(s) { var n; /* iterates over tree elements */ /* Initialize the trees. */ for (n = 0; n < L_CODES; n++) { s.dyn_ltree[n * 2]/*.Freq*/ = 0; } for (n = 0; n < D_CODES; n++) { s.dyn_dtree[n * 2]/*.Freq*/ = 0; } for (n = 0; n < BL_CODES; n++) { s.bl_tree[n * 2]/*.Freq*/ = 0; } s.dyn_ltree[END_BLOCK * 2]/*.Freq*/ = 1; s.opt_len = s.static_len = 0; s.last_lit = s.matches = 0; } /* =========================================================================== * Flush the bit buffer and align the output on a byte boundary */ function bi_windup(s) { if (s.bi_valid > 8) { put_short(s, s.bi_buf); } else if (s.bi_valid > 0) { //put_byte(s, (Byte)s->bi_buf); s.pending_buf[s.pending++] = s.bi_buf; } s.bi_buf = 0; s.bi_valid = 0; } /* =========================================================================== * Copy a stored block, storing first the length and its * one's complement if requested. */ function copy_block(s, buf, len, header) //DeflateState *s; //charf *buf; /* the input data */ //unsigned len; /* its length */ //int header; /* true if block header must be written */ { bi_windup(s); /* align on byte boundary */ if (header) { put_short(s, len); put_short(s, ~len); } // while (len--) { // put_byte(s, *buf++); // } utils.arraySet(s.pending_buf, s.window, buf, len, s.pending); s.pending += len; } /* =========================================================================== * Compares to subtrees, using the tree depth as tie breaker when * the subtrees have equal frequency. This minimizes the worst case length. */ function smaller(tree, n, m, depth) { var _n2 = n * 2; var _m2 = m * 2; return (tree[_n2]/*.Freq*/ < tree[_m2]/*.Freq*/ || (tree[_n2]/*.Freq*/ === tree[_m2]/*.Freq*/ && depth[n] <= depth[m])); } /* =========================================================================== * Restore the heap property by moving down the tree starting at node k, * exchanging a node with the smallest of its two sons if necessary, stopping * when the heap property is re-established (each father smaller than its * two sons). */ function pqdownheap(s, tree, k) // deflate_state *s; // ct_data *tree; /* the tree to restore */ // int k; /* node to move down */ { var v = s.heap[k]; var j = k << 1; /* left son of k */ while (j <= s.heap_len) { /* Set j to the smallest of the two sons: */ if (j < s.heap_len && smaller(tree, s.heap[j + 1], s.heap[j], s.depth)) { j++; } /* Exit if v is smaller than both sons */ if (smaller(tree, v, s.heap[j], s.depth)) { break; } /* Exchange v with the smallest son */ s.heap[k] = s.heap[j]; k = j; /* And continue down the tree, setting j to the left son of k */ j <<= 1; } s.heap[k] = v; } // inlined manually // var SMALLEST = 1; /* =========================================================================== * Send the block data compressed using the given Huffman trees */ function compress_block(s, ltree, dtree) // deflate_state *s; // const ct_data *ltree; /* literal tree */ // const ct_data *dtree; /* distance tree */ { var dist; /* distance of matched string */ var lc; /* match length or unmatched char (if dist == 0) */ var lx = 0; /* running index in l_buf */ var code; /* the code to send */ var extra; /* number of extra bits to send */ if (s.last_lit !== 0) { do { dist = (s.pending_buf[s.d_buf + lx * 2] << 8) | (s.pending_buf[s.d_buf + lx * 2 + 1]); lc = s.pending_buf[s.l_buf + lx]; lx++; if (dist === 0) { send_code(s, lc, ltree); /* send a literal byte */ //Tracecv(isgraph(lc), (stderr," '%c' ", lc)); } else { /* Here, lc is the match length - MIN_MATCH */ code = _length_code[lc]; send_code(s, code + LITERALS + 1, ltree); /* send the length code */ extra = extra_lbits[code]; if (extra !== 0) { lc -= base_length[code]; send_bits(s, lc, extra); /* send the extra length bits */ } dist--; /* dist is now the match distance - 1 */ code = d_code(dist); //Assert (code < D_CODES, "bad d_code"); send_code(s, code, dtree); /* send the distance code */ extra = extra_dbits[code]; if (extra !== 0) { dist -= base_dist[code]; send_bits(s, dist, extra); /* send the extra distance bits */ } } /* literal or match pair ? */ /* Check that the overlay between pending_buf and d_buf+l_buf is ok: */ //Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx, // "pendingBuf overflow"); } while (lx < s.last_lit); } send_code(s, END_BLOCK, ltree); } /* =========================================================================== * Construct one Huffman tree and assigns the code bit strings and lengths. * Update the total bit length for the current block. * IN assertion: the field freq is set for all tree elements. * OUT assertions: the fields len and code are set to the optimal bit length * and corresponding code. The length opt_len is updated; static_len is * also updated if stree is not null. The field max_code is set. */ function build_tree(s, desc) // deflate_state *s; // tree_desc *desc; /* the tree descriptor */ { var tree = desc.dyn_tree; var stree = desc.stat_desc.static_tree; var has_stree = desc.stat_desc.has_stree; var elems = desc.stat_desc.elems; var n, m; /* iterate over heap elements */ var max_code = -1; /* largest code with non zero frequency */ var node; /* new node being created */ /* Construct the initial heap, with least frequent element in * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1]. * heap[0] is not used. */ s.heap_len = 0; s.heap_max = HEAP_SIZE; for (n = 0; n < elems; n++) { if (tree[n * 2]/*.Freq*/ !== 0) { s.heap[++s.heap_len] = max_code = n; s.depth[n] = 0; } else { tree[n * 2 + 1]/*.Len*/ = 0; } } /* The pkzip format requires that at least one distance code exists, * and that at least one bit should be sent even if there is only one * possible code. So to avoid special checks later on we force at least * two codes of non zero frequency. */ while (s.heap_len < 2) { node = s.heap[++s.heap_len] = (max_code < 2 ? ++max_code : 0); tree[node * 2]/*.Freq*/ = 1; s.depth[node] = 0; s.opt_len--; if (has_stree) { s.static_len -= stree[node * 2 + 1]/*.Len*/; } /* node is 0 or 1 so it does not have extra bits */ } desc.max_code = max_code; /* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree, * establish sub-heaps of increasing lengths: */ for (n = (s.heap_len >> 1/*int /2*/); n >= 1; n--) { pqdownheap(s, tree, n); } /* Construct the Huffman tree by repeatedly combining the least two * frequent nodes. */ node = elems; /* next internal node of the tree */ do { //pqremove(s, tree, n); /* n = node of least frequency */ /*** pqremove ***/ n = s.heap[1/*SMALLEST*/]; s.heap[1/*SMALLEST*/] = s.heap[s.heap_len--]; pqdownheap(s, tree, 1/*SMALLEST*/); /***/ m = s.heap[1/*SMALLEST*/]; /* m = node of next least frequency */ s.heap[--s.heap_max] = n; /* keep the nodes sorted by frequency */ s.heap[--s.heap_max] = m; /* Create a new node father of n and m */ tree[node * 2]/*.Freq*/ = tree[n * 2]/*.Freq*/ + tree[m * 2]/*.Freq*/; s.depth[node] = (s.depth[n] >= s.depth[m] ? s.depth[n] : s.depth[m]) + 1; tree[n * 2 + 1]/*.Dad*/ = tree[m * 2 + 1]/*.Dad*/ = node; /* and insert the new node in the heap */ s.heap[1/*SMALLEST*/] = node++; pqdownheap(s, tree, 1/*SMALLEST*/); } while (s.heap_len >= 2); s.heap[--s.heap_max] = s.heap[1/*SMALLEST*/]; /* At this point, the fields freq and dad are set. We can now * generate the bit lengths. */ gen_bitlen(s, desc); /* The field len is now set, we can generate the bit codes */ gen_codes(tree, max_code, s.bl_count); } /* =========================================================================== * Scan a literal or distance tree to determine the frequencies of the codes * in the bit length tree. */ function scan_tree(s, tree, max_code) // deflate_state *s; // ct_data *tree; /* the tree to be scanned */ // int max_code; /* and its largest code of non zero frequency */ { var n; /* iterates over all tree elements */ var prevlen = -1; /* last emitted length */ var curlen; /* length of current code */ var nextlen = tree[0 * 2 + 1]/*.Len*/; /* length of next code */ var count = 0; /* repeat count of the current code */ var max_count = 7; /* max repeat count */ var min_count = 4; /* min repeat count */ if (nextlen === 0) { max_count = 138; min_count = 3; } tree[(max_code + 1) * 2 + 1]/*.Len*/ = 0xffff; /* guard */ for (n = 0; n <= max_code; n++) { curlen = nextlen; nextlen = tree[(n + 1) * 2 + 1]/*.Len*/; if (++count < max_count && curlen === nextlen) { continue; } else if (count < min_count) { s.bl_tree[curlen * 2]/*.Freq*/ += count; } else if (curlen !== 0) { if (curlen !== prevlen) { s.bl_tree[curlen * 2]/*.Freq*/++; } s.bl_tree[REP_3_6 * 2]/*.Freq*/++; } else if (count <= 10) { s.bl_tree[REPZ_3_10 * 2]/*.Freq*/++; } else { s.bl_tree[REPZ_11_138 * 2]/*.Freq*/++; } count = 0; prevlen = curlen; if (nextlen === 0) { max_count = 138; min_count = 3; } else if (curlen === nextlen) { max_count = 6; min_count = 3; } else { max_count = 7; min_count = 4; } } } /* =========================================================================== * Send a literal or distance tree in compressed form, using the codes in * bl_tree. */ function send_tree(s, tree, max_code) // deflate_state *s; // ct_data *tree; /* the tree to be scanned */ // int max_code; /* and its largest code of non zero frequency */ { var n; /* iterates over all tree elements */ var prevlen = -1; /* last emitted length */ var curlen; /* length of current code */ var nextlen = tree[0 * 2 + 1]/*.Len*/; /* length of next code */ var count = 0; /* repeat count of the current code */ var max_count = 7; /* max repeat count */ var min_count = 4; /* min repeat count */ /* tree[max_code+1].Len = -1; */ /* guard already set */ if (nextlen === 0) { max_count = 138; min_count = 3; } for (n = 0; n <= max_code; n++) { curlen = nextlen; nextlen = tree[(n + 1) * 2 + 1]/*.Len*/; if (++count < max_count && curlen === nextlen) { continue; } else if (count < min_count) { do { send_code(s, curlen, s.bl_tree); } while (--count !== 0); } else if (curlen !== 0) { if (curlen !== prevlen) { send_code(s, curlen, s.bl_tree); count--; } //Assert(count >= 3 && count <= 6, " 3_6?"); send_code(s, REP_3_6, s.bl_tree); send_bits(s, count - 3, 2); } else if (count <= 10) { send_code(s, REPZ_3_10, s.bl_tree); send_bits(s, count - 3, 3); } else { send_code(s, REPZ_11_138, s.bl_tree); send_bits(s, count - 11, 7); } count = 0; prevlen = curlen; if (nextlen === 0) { max_count = 138; min_count = 3; } else if (curlen === nextlen) { max_count = 6; min_count = 3; } else { max_count = 7; min_count = 4; } } } /* =========================================================================== * Construct the Huffman tree for the bit lengths and return the index in * bl_order of the last bit length code to send. */ function build_bl_tree(s) { var max_blindex; /* index of last bit length code of non zero freq */ /* Determine the bit length frequencies for literal and distance trees */ scan_tree(s, s.dyn_ltree, s.l_desc.max_code); scan_tree(s, s.dyn_dtree, s.d_desc.max_code); /* Build the bit length tree: */ build_tree(s, s.bl_desc); /* opt_len now includes the length of the tree representations, except * the lengths of the bit lengths codes and the 5+5+4 bits for the counts. */ /* Determine the number of bit length codes to send. The pkzip format * requires that at least 4 bit length codes be sent. (appnote.txt says * 3 but the actual value used is 4.) */ for (max_blindex = BL_CODES - 1; max_blindex >= 3; max_blindex--) { if (s.bl_tree[bl_order[max_blindex] * 2 + 1]/*.Len*/ !== 0) { break; } } /* Update opt_len to include the bit length tree and counts */ s.opt_len += 3 * (max_blindex + 1) + 5 + 5 + 4; //Tracev((stderr, "\ndyn trees: dyn %ld, stat %ld", // s->opt_len, s->static_len)); return max_blindex; } /* =========================================================================== * Send the header for a block using dynamic Huffman trees: the counts, the * lengths of the bit length codes, the literal tree and the distance tree. * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4. */ function send_all_trees(s, lcodes, dcodes, blcodes) // deflate_state *s; // int lcodes, dcodes, blcodes; /* number of codes for each tree */ { var rank; /* index in bl_order */ //Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, "not enough codes"); //Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES, // "too many codes"); //Tracev((stderr, "\nbl counts: ")); send_bits(s, lcodes - 257, 5); /* not +255 as stated in appnote.txt */ send_bits(s, dcodes - 1, 5); send_bits(s, blcodes - 4, 4); /* not -3 as stated in appnote.txt */ for (rank = 0; rank < blcodes; rank++) { //Tracev((stderr, "\nbl code %2d ", bl_order[rank])); send_bits(s, s.bl_tree[bl_order[rank] * 2 + 1]/*.Len*/, 3); } //Tracev((stderr, "\nbl tree: sent %ld", s->bits_sent)); send_tree(s, s.dyn_ltree, lcodes - 1); /* literal tree */ //Tracev((stderr, "\nlit tree: sent %ld", s->bits_sent)); send_tree(s, s.dyn_dtree, dcodes - 1); /* distance tree */ //Tracev((stderr, "\ndist tree: sent %ld", s->bits_sent)); } /* =========================================================================== * Check if the data type is TEXT or BINARY, using the following algorithm: * - TEXT if the two conditions below are satisfied: * a) There are no non-portable control characters belonging to the * "black list" (0..6, 14..25, 28..31). * b) There is at least one printable character belonging to the * "white list" (9 {TAB}, 10 {LF}, 13 {CR}, 32..255). * - BINARY otherwise. * - The following partially-portable control characters form a * "gray list" that is ignored in this detection algorithm: * (7 {BEL}, 8 {BS}, 11 {VT}, 12 {FF}, 26 {SUB}, 27 {ESC}). * IN assertion: the fields Freq of dyn_ltree are set. */ function detect_data_type(s) { /* black_mask is the bit mask of black-listed bytes * set bits 0..6, 14..25, and 28..31 * 0xf3ffc07f = binary 11110011111111111100000001111111 */ var black_mask = 0xf3ffc07f; var n; /* Check for non-textual ("black-listed") bytes. */ for (n = 0; n <= 31; n++, black_mask >>>= 1) { if ((black_mask & 1) && (s.dyn_ltree[n * 2]/*.Freq*/ !== 0)) { return Z_BINARY; } } /* Check for textual ("white-listed") bytes. */ if (s.dyn_ltree[9 * 2]/*.Freq*/ !== 0 || s.dyn_ltree[10 * 2]/*.Freq*/ !== 0 || s.dyn_ltree[13 * 2]/*.Freq*/ !== 0) { return Z_TEXT; } for (n = 32; n < LITERALS; n++) { if (s.dyn_ltree[n * 2]/*.Freq*/ !== 0) { return Z_TEXT; } } /* There are no "black-listed" or "white-listed" bytes: * this stream either is empty or has tolerated ("gray-listed") bytes only. */ return Z_BINARY; } var static_init_done = false; /* =========================================================================== * Initialize the tree data structures for a new zlib stream. */ function _tr_init(s) { if (!static_init_done) { tr_static_init(); static_init_done = true; } s.l_desc = new TreeDesc(s.dyn_ltree, static_l_desc); s.d_desc = new TreeDesc(s.dyn_dtree, static_d_desc); s.bl_desc = new TreeDesc(s.bl_tree, static_bl_desc); s.bi_buf = 0; s.bi_valid = 0; /* Initialize the first block of the first file: */ init_block(s); } /* =========================================================================== * Send a stored block */ function _tr_stored_block(s, buf, stored_len, last) //DeflateState *s; //charf *buf; /* input block */ //ulg stored_len; /* length of input block */ //int last; /* one if this is the last block for a file */ { send_bits(s, (STORED_BLOCK << 1) + (last ? 1 : 0), 3); /* send block type */ copy_block(s, buf, stored_len, true); /* with header */ } /* =========================================================================== * Send one empty static block to give enough lookahead for inflate. * This takes 10 bits, of which 7 may remain in the bit buffer. */ function _tr_align(s) { send_bits(s, STATIC_TREES << 1, 3); send_code(s, END_BLOCK, static_ltree); bi_flush(s); } /* =========================================================================== * Determine the best encoding for the current block: dynamic trees, static * trees or store, and output the encoded block to the zip file. */ function _tr_flush_block(s, buf, stored_len, last) //DeflateState *s; //charf *buf; /* input block, or NULL if too old */ //ulg stored_len; /* length of input block */ //int last; /* one if this is the last block for a file */ { var opt_lenb, static_lenb; /* opt_len and static_len in bytes */ var max_blindex = 0; /* index of last bit length code of non zero freq */ /* Build the Huffman trees unless a stored block is forced */ if (s.level > 0) { /* Check if the file is binary or text */ if (s.strm.data_type === Z_UNKNOWN) { s.strm.data_type = detect_data_type(s); } /* Construct the literal and distance trees */ build_tree(s, s.l_desc); // Tracev((stderr, "\nlit data: dyn %ld, stat %ld", s->opt_len, // s->static_len)); build_tree(s, s.d_desc); // Tracev((stderr, "\ndist data: dyn %ld, stat %ld", s->opt_len, // s->static_len)); /* At this point, opt_len and static_len are the total bit lengths of * the compressed block data, excluding the tree representations. */ /* Build the bit length tree for the above two trees, and get the index * in bl_order of the last bit length code to send. */ max_blindex = build_bl_tree(s); /* Determine the best encoding. Compute the block lengths in bytes. */ opt_lenb = (s.opt_len + 3 + 7) >>> 3; static_lenb = (s.static_len + 3 + 7) >>> 3; // Tracev((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u ", // opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len, // s->last_lit)); if (static_lenb <= opt_lenb) { opt_lenb = static_lenb; } } else { // Assert(buf != (char*)0, "lost buf"); opt_lenb = static_lenb = stored_len + 5; /* force a stored block */ } if ((stored_len + 4 <= opt_lenb) && (buf !== -1)) { /* 4: two words for the lengths */ /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE. * Otherwise we can't have processed more than WSIZE input bytes since * the last block flush, because compression would have been * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to * transform a block into a stored block. */ _tr_stored_block(s, buf, stored_len, last); } else if (s.strategy === Z_FIXED || static_lenb === opt_lenb) { send_bits(s, (STATIC_TREES << 1) + (last ? 1 : 0), 3); compress_block(s, static_ltree, static_dtree); } else { send_bits(s, (DYN_TREES << 1) + (last ? 1 : 0), 3); send_all_trees(s, s.l_desc.max_code + 1, s.d_desc.max_code + 1, max_blindex + 1); compress_block(s, s.dyn_ltree, s.dyn_dtree); } // Assert (s->compressed_len == s->bits_sent, "bad compressed size"); /* The above check is made mod 2^32, for files larger than 512 MB * and uLong implemented on 32 bits. */ init_block(s); if (last) { bi_windup(s); } // Tracev((stderr,"\ncomprlen %lu(%lu) ", s->compressed_len>>3, // s->compressed_len-7*last)); } /* =========================================================================== * Save the match info and tally the frequency counts. Return true if * the current block must be flushed. */ function _tr_tally(s, dist, lc) // deflate_state *s; // unsigned dist; /* distance of matched string */ // unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */ { //var out_length, in_length, dcode; s.pending_buf[s.d_buf + s.last_lit * 2] = (dist >>> 8) & 0xff; s.pending_buf[s.d_buf + s.last_lit * 2 + 1] = dist & 0xff; s.pending_buf[s.l_buf + s.last_lit] = lc & 0xff; s.last_lit++; if (dist === 0) { /* lc is the unmatched char */ s.dyn_ltree[lc * 2]/*.Freq*/++; } else { s.matches++; /* Here, lc is the match length - MIN_MATCH */ dist--; /* dist = match distance - 1 */ //Assert((ush)dist < (ush)MAX_DIST(s) && // (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) && // (ush)d_code(dist) < (ush)D_CODES, "_tr_tally: bad match"); s.dyn_ltree[(_length_code[lc] + LITERALS + 1) * 2]/*.Freq*/++; s.dyn_dtree[d_code(dist) * 2]/*.Freq*/++; } // (!) This block is disabled in zlib defaults, // don't enable it for binary compatibility //#ifdef TRUNCATE_BLOCK // /* Try to guess if it is profitable to stop the current block here */ // if ((s.last_lit & 0x1fff) === 0 && s.level > 2) { // /* Compute an upper bound for the compressed length */ // out_length = s.last_lit*8; // in_length = s.strstart - s.block_start; // // for (dcode = 0; dcode < D_CODES; dcode++) { // out_length += s.dyn_dtree[dcode*2]/*.Freq*/ * (5 + extra_dbits[dcode]); // } // out_length >>>= 3; // //Tracev((stderr,"\nlast_lit %u, in %ld, out ~%ld(%ld%%) ", // // s->last_lit, in_length, out_length, // // 100L - out_length*100L/in_length)); // if (s.matches < (s.last_lit>>1)/*int /2*/ && out_length < (in_length>>1)/*int /2*/) { // return true; // } // } //#endif return (s.last_lit === s.lit_bufsize - 1); /* We avoid equality with lit_bufsize because of wraparound at 64K * on 16 bit machines and because stored blocks are restricted to * 64K-1 bytes. */ } exports._tr_init = _tr_init; exports._tr_stored_block = _tr_stored_block; exports._tr_flush_block = _tr_flush_block; exports._tr_tally = _tr_tally; exports._tr_align = _tr_align; /***/ }), /* 99 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var zlib_inflate = __webpack_require__(100); var utils = __webpack_require__(15); var strings = __webpack_require__(54); var c = __webpack_require__(56); var msg = __webpack_require__(37); var ZStream = __webpack_require__(55); var GZheader = __webpack_require__(103); var toString = Object.prototype.toString; /** * class Inflate * * Generic JS-style wrapper for zlib calls. If you don't need * streaming behaviour - use more simple functions: [[inflate]] * and [[inflateRaw]]. **/ /* internal * inflate.chunks -> Array * * Chunks of output data, if [[Inflate#onData]] not overridden. **/ /** * Inflate.result -> Uint8Array|Array|String * * Uncompressed result, generated by default [[Inflate#onData]] * and [[Inflate#onEnd]] handlers. Filled after you push last chunk * (call [[Inflate#push]] with `Z_FINISH` / `true` param) or if you * push a chunk with explicit flush (call [[Inflate#push]] with * `Z_SYNC_FLUSH` param). **/ /** * Inflate.err -> Number * * Error code after inflate finished. 0 (Z_OK) on success. * Should be checked if broken data possible. **/ /** * Inflate.msg -> String * * Error message, if [[Inflate.err]] != 0 **/ /** * new Inflate(options) * - options (Object): zlib inflate options. * * Creates new inflator instance with specified params. Throws exception * on bad params. Supported options: * * - `windowBits` * - `dictionary` * * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced) * for more information on these. * * Additional options, for internal needs: * * - `chunkSize` - size of generated data chunks (16K by default) * - `raw` (Boolean) - do raw inflate * - `to` (String) - if equal to 'string', then result will be converted * from utf8 to utf16 (javascript) string. When string output requested, * chunk length can differ from `chunkSize`, depending on content. * * By default, when no options set, autodetect deflate/gzip data format via * wrapper header. * * ##### Example: * * ```javascript * var pako = require('pako') * , chunk1 = Uint8Array([1,2,3,4,5,6,7,8,9]) * , chunk2 = Uint8Array([10,11,12,13,14,15,16,17,18,19]); * * var inflate = new pako.Inflate({ level: 3}); * * inflate.push(chunk1, false); * inflate.push(chunk2, true); // true -> last chunk * * if (inflate.err) { throw new Error(inflate.err); } * * console.log(inflate.result); * ``` **/ function Inflate(options) { if (!(this instanceof Inflate)) return new Inflate(options); this.options = utils.assign({ chunkSize: 16384, windowBits: 0, to: '' }, options || {}); var opt = this.options; // Force window size for `raw` data, if not set directly, // because we have no header for autodetect. if (opt.raw && (opt.windowBits >= 0) && (opt.windowBits < 16)) { opt.windowBits = -opt.windowBits; if (opt.windowBits === 0) { opt.windowBits = -15; } } // If `windowBits` not defined (and mode not raw) - set autodetect flag for gzip/deflate if ((opt.windowBits >= 0) && (opt.windowBits < 16) && !(options && options.windowBits)) { opt.windowBits += 32; } // Gzip header has no info about windows size, we can do autodetect only // for deflate. So, if window size not set, force it to max when gzip possible if ((opt.windowBits > 15) && (opt.windowBits < 48)) { // bit 3 (16) -> gzipped data // bit 4 (32) -> autodetect gzip/deflate if ((opt.windowBits & 15) === 0) { opt.windowBits |= 15; } } this.err = 0; // error code, if happens (0 = Z_OK) this.msg = ''; // error message this.ended = false; // used to avoid multiple onEnd() calls this.chunks = []; // chunks of compressed data this.strm = new ZStream(); this.strm.avail_out = 0; var status = zlib_inflate.inflateInit2( this.strm, opt.windowBits ); if (status !== c.Z_OK) { throw new Error(msg[status]); } this.header = new GZheader(); zlib_inflate.inflateGetHeader(this.strm, this.header); // Setup dictionary if (opt.dictionary) { // Convert data if needed if (typeof opt.dictionary === 'string') { opt.dictionary = strings.string2buf(opt.dictionary); } else if (toString.call(opt.dictionary) === '[object ArrayBuffer]') { opt.dictionary = new Uint8Array(opt.dictionary); } if (opt.raw) { //In raw mode we need to set the dictionary early status = zlib_inflate.inflateSetDictionary(this.strm, opt.dictionary); if (status !== c.Z_OK) { throw new Error(msg[status]); } } } } /** * Inflate#push(data[, mode]) -> Boolean * - data (Uint8Array|Array|ArrayBuffer|String): input data * - mode (Number|Boolean): 0..6 for corresponding Z_NO_FLUSH..Z_TREE modes. * See constants. Skipped or `false` means Z_NO_FLUSH, `true` means Z_FINISH. * * Sends input data to inflate pipe, generating [[Inflate#onData]] calls with * new output chunks. Returns `true` on success. The last data block must have * mode Z_FINISH (or `true`). That will flush internal pending buffers and call * [[Inflate#onEnd]]. For interim explicit flushes (without ending the stream) you * can use mode Z_SYNC_FLUSH, keeping the decompression context. * * On fail call [[Inflate#onEnd]] with error code and return false. * * We strongly recommend to use `Uint8Array` on input for best speed (output * format is detected automatically). Also, don't skip last param and always * use the same type in your code (boolean or number). That will improve JS speed. * * For regular `Array`-s make sure all elements are [0..255]. * * ##### Example * * ```javascript * push(chunk, false); // push one of data chunks * ... * push(chunk, true); // push last chunk * ``` **/ Inflate.prototype.push = function (data, mode) { var strm = this.strm; var chunkSize = this.options.chunkSize; var dictionary = this.options.dictionary; var status, _mode; var next_out_utf8, tail, utf8str; // Flag to properly process Z_BUF_ERROR on testing inflate call // when we check that all output data was flushed. var allowBufError = false; if (this.ended) { return false; } _mode = (mode === ~~mode) ? mode : ((mode === true) ? c.Z_FINISH : c.Z_NO_FLUSH); // Convert data if needed if (typeof data === 'string') { // Only binary strings can be decompressed on practice strm.input = strings.binstring2buf(data); } else if (toString.call(data) === '[object ArrayBuffer]') { strm.input = new Uint8Array(data); } else { strm.input = data; } strm.next_in = 0; strm.avail_in = strm.input.length; do { if (strm.avail_out === 0) { strm.output = new utils.Buf8(chunkSize); strm.next_out = 0; strm.avail_out = chunkSize; } status = zlib_inflate.inflate(strm, c.Z_NO_FLUSH); /* no bad return value */ if (status === c.Z_NEED_DICT && dictionary) { status = zlib_inflate.inflateSetDictionary(this.strm, dictionary); } if (status === c.Z_BUF_ERROR && allowBufError === true) { status = c.Z_OK; allowBufError = false; } if (status !== c.Z_STREAM_END && status !== c.Z_OK) { this.onEnd(status); this.ended = true; return false; } if (strm.next_out) { if (strm.avail_out === 0 || status === c.Z_STREAM_END || (strm.avail_in === 0 && (_mode === c.Z_FINISH || _mode === c.Z_SYNC_FLUSH))) { if (this.options.to === 'string') { next_out_utf8 = strings.utf8border(strm.output, strm.next_out); tail = strm.next_out - next_out_utf8; utf8str = strings.buf2string(strm.output, next_out_utf8); // move tail strm.next_out = tail; strm.avail_out = chunkSize - tail; if (tail) { utils.arraySet(strm.output, strm.output, next_out_utf8, tail, 0); } this.onData(utf8str); } else { this.onData(utils.shrinkBuf(strm.output, strm.next_out)); } } } // When no more input data, we should check that internal inflate buffers // are flushed. The only way to do it when avail_out = 0 - run one more // inflate pass. But if output data not exists, inflate return Z_BUF_ERROR. // Here we set flag to process this error properly. // // NOTE. Deflate does not return error in this case and does not needs such // logic. if (strm.avail_in === 0 && strm.avail_out === 0) { allowBufError = true; } } while ((strm.avail_in > 0 || strm.avail_out === 0) && status !== c.Z_STREAM_END); if (status === c.Z_STREAM_END) { _mode = c.Z_FINISH; } // Finalize on the last chunk. if (_mode === c.Z_FINISH) { status = zlib_inflate.inflateEnd(this.strm); this.onEnd(status); this.ended = true; return status === c.Z_OK; } // callback interim results if Z_SYNC_FLUSH. if (_mode === c.Z_SYNC_FLUSH) { this.onEnd(c.Z_OK); strm.avail_out = 0; return true; } return true; }; /** * Inflate#onData(chunk) -> Void * - chunk (Uint8Array|Array|String): output data. Type of array depends * on js engine support. When string output requested, each chunk * will be string. * * By default, stores data blocks in `chunks[]` property and glue * those in `onEnd`. Override this handler, if you need another behaviour. **/ Inflate.prototype.onData = function (chunk) { this.chunks.push(chunk); }; /** * Inflate#onEnd(status) -> Void * - status (Number): inflate status. 0 (Z_OK) on success, * other if not. * * Called either after you tell inflate that the input stream is * complete (Z_FINISH) or should be flushed (Z_SYNC_FLUSH) * or if an error happened. By default - join collected chunks, * free memory and fill `results` / `err` properties. **/ Inflate.prototype.onEnd = function (status) { // On success - join if (status === c.Z_OK) { if (this.options.to === 'string') { // Glue & convert here, until we teach pako to send // utf8 aligned strings to onData this.result = this.chunks.join(''); } else { this.result = utils.flattenChunks(this.chunks); } } this.chunks = []; this.err = status; this.msg = this.strm.msg; }; /** * inflate(data[, options]) -> Uint8Array|Array|String * - data (Uint8Array|Array|String): input data to decompress. * - options (Object): zlib inflate options. * * Decompress `data` with inflate/ungzip and `options`. Autodetect * format via wrapper header by default. That's why we don't provide * separate `ungzip` method. * * Supported options are: * * - windowBits * * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced) * for more information. * * Sugar (options): * * - `raw` (Boolean) - say that we work with raw stream, if you don't wish to specify * negative windowBits implicitly. * - `to` (String) - if equal to 'string', then result will be converted * from utf8 to utf16 (javascript) string. When string output requested, * chunk length can differ from `chunkSize`, depending on content. * * * ##### Example: * * ```javascript * var pako = require('pako') * , input = pako.deflate([1,2,3,4,5,6,7,8,9]) * , output; * * try { * output = pako.inflate(input); * } catch (err) * console.log(err); * } * ``` **/ function inflate(input, options) { var inflator = new Inflate(options); inflator.push(input, true); // That will never happens, if you don't cheat with options :) if (inflator.err) { throw inflator.msg || msg[inflator.err]; } return inflator.result; } /** * inflateRaw(data[, options]) -> Uint8Array|Array|String * - data (Uint8Array|Array|String): input data to decompress. * - options (Object): zlib inflate options. * * The same as [[inflate]], but creates raw data, without wrapper * (header and adler32 crc). **/ function inflateRaw(input, options) { options = options || {}; options.raw = true; return inflate(input, options); } /** * ungzip(data[, options]) -> Uint8Array|Array|String * - data (Uint8Array|Array|String): input data to decompress. * - options (Object): zlib inflate options. * * Just shortcut to [[inflate]], because it autodetects format * by header.content. Done for convenience. **/ exports.Inflate = Inflate; exports.inflate = inflate; exports.inflateRaw = inflateRaw; exports.ungzip = inflate; /***/ }), /* 100 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // (C) 1995-2013 Jean-loup Gailly and Mark Adler // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would be // appreciated but is not required. // 2. Altered source versions must be plainly marked as such, and must not be // misrepresented as being the original software. // 3. This notice may not be removed or altered from any source distribution. var utils = __webpack_require__(15); var adler32 = __webpack_require__(52); var crc32 = __webpack_require__(53); var inflate_fast = __webpack_require__(101); var inflate_table = __webpack_require__(102); var CODES = 0; var LENS = 1; var DISTS = 2; /* Public constants ==========================================================*/ /* ===========================================================================*/ /* Allowed flush values; see deflate() and inflate() below for details */ //var Z_NO_FLUSH = 0; //var Z_PARTIAL_FLUSH = 1; //var Z_SYNC_FLUSH = 2; //var Z_FULL_FLUSH = 3; var Z_FINISH = 4; var Z_BLOCK = 5; var Z_TREES = 6; /* Return codes for the compression/decompression functions. Negative values * are errors, positive values are used for special but normal events. */ var Z_OK = 0; var Z_STREAM_END = 1; var Z_NEED_DICT = 2; //var Z_ERRNO = -1; var Z_STREAM_ERROR = -2; var Z_DATA_ERROR = -3; var Z_MEM_ERROR = -4; var Z_BUF_ERROR = -5; //var Z_VERSION_ERROR = -6; /* The deflate compression method */ var Z_DEFLATED = 8; /* STATES ====================================================================*/ /* ===========================================================================*/ var HEAD = 1; /* i: waiting for magic header */ var FLAGS = 2; /* i: waiting for method and flags (gzip) */ var TIME = 3; /* i: waiting for modification time (gzip) */ var OS = 4; /* i: waiting for extra flags and operating system (gzip) */ var EXLEN = 5; /* i: waiting for extra length (gzip) */ var EXTRA = 6; /* i: waiting for extra bytes (gzip) */ var NAME = 7; /* i: waiting for end of file name (gzip) */ var COMMENT = 8; /* i: waiting for end of comment (gzip) */ var HCRC = 9; /* i: waiting for header crc (gzip) */ var DICTID = 10; /* i: waiting for dictionary check value */ var DICT = 11; /* waiting for inflateSetDictionary() call */ var TYPE = 12; /* i: waiting for type bits, including last-flag bit */ var TYPEDO = 13; /* i: same, but skip check to exit inflate on new block */ var STORED = 14; /* i: waiting for stored size (length and complement) */ var COPY_ = 15; /* i/o: same as COPY below, but only first time in */ var COPY = 16; /* i/o: waiting for input or output to copy stored block */ var TABLE = 17; /* i: waiting for dynamic block table lengths */ var LENLENS = 18; /* i: waiting for code length code lengths */ var CODELENS = 19; /* i: waiting for length/lit and distance code lengths */ var LEN_ = 20; /* i: same as LEN below, but only first time in */ var LEN = 21; /* i: waiting for length/lit/eob code */ var LENEXT = 22; /* i: waiting for length extra bits */ var DIST = 23; /* i: waiting for distance code */ var DISTEXT = 24; /* i: waiting for distance extra bits */ var MATCH = 25; /* o: waiting for output space to copy string */ var LIT = 26; /* o: waiting for output space to write literal */ var CHECK = 27; /* i: waiting for 32-bit check value */ var LENGTH = 28; /* i: waiting for 32-bit length (gzip) */ var DONE = 29; /* finished check, done -- remain here until reset */ var BAD = 30; /* got a data error -- remain here until reset */ var MEM = 31; /* got an inflate() memory error -- remain here until reset */ var SYNC = 32; /* looking for synchronization bytes to restart inflate() */ /* ===========================================================================*/ var ENOUGH_LENS = 852; var ENOUGH_DISTS = 592; //var ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS); var MAX_WBITS = 15; /* 32K LZ77 window */ var DEF_WBITS = MAX_WBITS; function zswap32(q) { return (((q >>> 24) & 0xff) + ((q >>> 8) & 0xff00) + ((q & 0xff00) << 8) + ((q & 0xff) << 24)); } function InflateState() { this.mode = 0; /* current inflate mode */ this.last = false; /* true if processing last block */ this.wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip */ this.havedict = false; /* true if dictionary provided */ this.flags = 0; /* gzip header method and flags (0 if zlib) */ this.dmax = 0; /* zlib header max distance (INFLATE_STRICT) */ this.check = 0; /* protected copy of check value */ this.total = 0; /* protected copy of output count */ // TODO: may be {} this.head = null; /* where to save gzip header information */ /* sliding window */ this.wbits = 0; /* log base 2 of requested window size */ this.wsize = 0; /* window size or zero if not using window */ this.whave = 0; /* valid bytes in the window */ this.wnext = 0; /* window write index */ this.window = null; /* allocated sliding window, if needed */ /* bit accumulator */ this.hold = 0; /* input bit accumulator */ this.bits = 0; /* number of bits in "in" */ /* for string and stored block copying */ this.length = 0; /* literal or length of data to copy */ this.offset = 0; /* distance back to copy string from */ /* for table and code decoding */ this.extra = 0; /* extra bits needed */ /* fixed and dynamic code tables */ this.lencode = null; /* starting table for length/literal codes */ this.distcode = null; /* starting table for distance codes */ this.lenbits = 0; /* index bits for lencode */ this.distbits = 0; /* index bits for distcode */ /* dynamic table building */ this.ncode = 0; /* number of code length code lengths */ this.nlen = 0; /* number of length code lengths */ this.ndist = 0; /* number of distance code lengths */ this.have = 0; /* number of code lengths in lens[] */ this.next = null; /* next available space in codes[] */ this.lens = new utils.Buf16(320); /* temporary storage for code lengths */ this.work = new utils.Buf16(288); /* work area for code table building */ /* because we don't have pointers in js, we use lencode and distcode directly as buffers so we don't need codes */ //this.codes = new utils.Buf32(ENOUGH); /* space for code tables */ this.lendyn = null; /* dynamic table for length/literal codes (JS specific) */ this.distdyn = null; /* dynamic table for distance codes (JS specific) */ this.sane = 0; /* if false, allow invalid distance too far */ this.back = 0; /* bits back of last unprocessed length/lit */ this.was = 0; /* initial length of match */ } function inflateResetKeep(strm) { var state; if (!strm || !strm.state) { return Z_STREAM_ERROR; } state = strm.state; strm.total_in = strm.total_out = state.total = 0; strm.msg = ''; /*Z_NULL*/ if (state.wrap) { /* to support ill-conceived Java test suite */ strm.adler = state.wrap & 1; } state.mode = HEAD; state.last = 0; state.havedict = 0; state.dmax = 32768; state.head = null/*Z_NULL*/; state.hold = 0; state.bits = 0; //state.lencode = state.distcode = state.next = state.codes; state.lencode = state.lendyn = new utils.Buf32(ENOUGH_LENS); state.distcode = state.distdyn = new utils.Buf32(ENOUGH_DISTS); state.sane = 1; state.back = -1; //Tracev((stderr, "inflate: reset\n")); return Z_OK; } function inflateReset(strm) { var state; if (!strm || !strm.state) { return Z_STREAM_ERROR; } state = strm.state; state.wsize = 0; state.whave = 0; state.wnext = 0; return inflateResetKeep(strm); } function inflateReset2(strm, windowBits) { var wrap; var state; /* get the state */ if (!strm || !strm.state) { return Z_STREAM_ERROR; } state = strm.state; /* extract wrap request from windowBits parameter */ if (windowBits < 0) { wrap = 0; windowBits = -windowBits; } else { wrap = (windowBits >> 4) + 1; if (windowBits < 48) { windowBits &= 15; } } /* set number of window bits, free window if different */ if (windowBits && (windowBits < 8 || windowBits > 15)) { return Z_STREAM_ERROR; } if (state.window !== null && state.wbits !== windowBits) { state.window = null; } /* update state and reset the rest of it */ state.wrap = wrap; state.wbits = windowBits; return inflateReset(strm); } function inflateInit2(strm, windowBits) { var ret; var state; if (!strm) { return Z_STREAM_ERROR; } //strm.msg = Z_NULL; /* in case we return an error */ state = new InflateState(); //if (state === Z_NULL) return Z_MEM_ERROR; //Tracev((stderr, "inflate: allocated\n")); strm.state = state; state.window = null/*Z_NULL*/; ret = inflateReset2(strm, windowBits); if (ret !== Z_OK) { strm.state = null/*Z_NULL*/; } return ret; } function inflateInit(strm) { return inflateInit2(strm, DEF_WBITS); } /* Return state with length and distance decoding tables and index sizes set to fixed code decoding. Normally this returns fixed tables from inffixed.h. If BUILDFIXED is defined, then instead this routine builds the tables the first time it's called, and returns those tables the first time and thereafter. This reduces the size of the code by about 2K bytes, in exchange for a little execution time. However, BUILDFIXED should not be used for threaded applications, since the rewriting of the tables and virgin may not be thread-safe. */ var virgin = true; var lenfix, distfix; // We have no pointers in JS, so keep tables separate function fixedtables(state) { /* build fixed huffman tables if first call (may not be thread safe) */ if (virgin) { var sym; lenfix = new utils.Buf32(512); distfix = new utils.Buf32(32); /* literal/length table */ sym = 0; while (sym < 144) { state.lens[sym++] = 8; } while (sym < 256) { state.lens[sym++] = 9; } while (sym < 280) { state.lens[sym++] = 7; } while (sym < 288) { state.lens[sym++] = 8; } inflate_table(LENS, state.lens, 0, 288, lenfix, 0, state.work, { bits: 9 }); /* distance table */ sym = 0; while (sym < 32) { state.lens[sym++] = 5; } inflate_table(DISTS, state.lens, 0, 32, distfix, 0, state.work, { bits: 5 }); /* do this just once */ virgin = false; } state.lencode = lenfix; state.lenbits = 9; state.distcode = distfix; state.distbits = 5; } /* Update the window with the last wsize (normally 32K) bytes written before returning. If window does not exist yet, create it. This is only called when a window is already in use, or when output has been written during this inflate call, but the end of the deflate stream has not been reached yet. It is also called to create a window for dictionary data when a dictionary is loaded. Providing output buffers larger than 32K to inflate() should provide a speed advantage, since only the last 32K of output is copied to the sliding window upon return from inflate(), and since all distances after the first 32K of output will fall in the output data, making match copies simpler and faster. The advantage may be dependent on the size of the processor's data caches. */ function updatewindow(strm, src, end, copy) { var dist; var state = strm.state; /* if it hasn't been done already, allocate space for the window */ if (state.window === null) { state.wsize = 1 << state.wbits; state.wnext = 0; state.whave = 0; state.window = new utils.Buf8(state.wsize); } /* copy state->wsize or less output bytes into the circular window */ if (copy >= state.wsize) { utils.arraySet(state.window, src, end - state.wsize, state.wsize, 0); state.wnext = 0; state.whave = state.wsize; } else { dist = state.wsize - state.wnext; if (dist > copy) { dist = copy; } //zmemcpy(state->window + state->wnext, end - copy, dist); utils.arraySet(state.window, src, end - copy, dist, state.wnext); copy -= dist; if (copy) { //zmemcpy(state->window, end - copy, copy); utils.arraySet(state.window, src, end - copy, copy, 0); state.wnext = copy; state.whave = state.wsize; } else { state.wnext += dist; if (state.wnext === state.wsize) { state.wnext = 0; } if (state.whave < state.wsize) { state.whave += dist; } } } return 0; } function inflate(strm, flush) { var state; var input, output; // input/output buffers var next; /* next input INDEX */ var put; /* next output INDEX */ var have, left; /* available input and output */ var hold; /* bit buffer */ var bits; /* bits in bit buffer */ var _in, _out; /* save starting available input and output */ var copy; /* number of stored or match bytes to copy */ var from; /* where to copy match bytes from */ var from_source; var here = 0; /* current decoding table entry */ var here_bits, here_op, here_val; // paked "here" denormalized (JS specific) //var last; /* parent table entry */ var last_bits, last_op, last_val; // paked "last" denormalized (JS specific) var len; /* length to copy for repeats, bits to drop */ var ret; /* return code */ var hbuf = new utils.Buf8(4); /* buffer for gzip header crc calculation */ var opts; var n; // temporary var for NEED_BITS var order = /* permutation of code lengths */ [ 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 ]; if (!strm || !strm.state || !strm.output || (!strm.input && strm.avail_in !== 0)) { return Z_STREAM_ERROR; } state = strm.state; if (state.mode === TYPE) { state.mode = TYPEDO; } /* skip check */ //--- LOAD() --- put = strm.next_out; output = strm.output; left = strm.avail_out; next = strm.next_in; input = strm.input; have = strm.avail_in; hold = state.hold; bits = state.bits; //--- _in = have; _out = left; ret = Z_OK; inf_leave: // goto emulation for (;;) { switch (state.mode) { case HEAD: if (state.wrap === 0) { state.mode = TYPEDO; break; } //=== NEEDBITS(16); while (bits < 16) { if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; } //===// if ((state.wrap & 2) && hold === 0x8b1f) { /* gzip header */ state.check = 0/*crc32(0L, Z_NULL, 0)*/; //=== CRC2(state.check, hold); hbuf[0] = hold & 0xff; hbuf[1] = (hold >>> 8) & 0xff; state.check = crc32(state.check, hbuf, 2, 0); //===// //=== INITBITS(); hold = 0; bits = 0; //===// state.mode = FLAGS; break; } state.flags = 0; /* expect zlib header */ if (state.head) { state.head.done = false; } if (!(state.wrap & 1) || /* check if zlib header allowed */ (((hold & 0xff)/*BITS(8)*/ << 8) + (hold >> 8)) % 31) { strm.msg = 'incorrect header check'; state.mode = BAD; break; } if ((hold & 0x0f)/*BITS(4)*/ !== Z_DEFLATED) { strm.msg = 'unknown compression method'; state.mode = BAD; break; } //--- DROPBITS(4) ---// hold >>>= 4; bits -= 4; //---// len = (hold & 0x0f)/*BITS(4)*/ + 8; if (state.wbits === 0) { state.wbits = len; } else if (len > state.wbits) { strm.msg = 'invalid window size'; state.mode = BAD; break; } state.dmax = 1 << len; //Tracev((stderr, "inflate: zlib header ok\n")); strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/; state.mode = hold & 0x200 ? DICTID : TYPE; //=== INITBITS(); hold = 0; bits = 0; //===// break; case FLAGS: //=== NEEDBITS(16); */ while (bits < 16) { if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; } //===// state.flags = hold; if ((state.flags & 0xff) !== Z_DEFLATED) { strm.msg = 'unknown compression method'; state.mode = BAD; break; } if (state.flags & 0xe000) { strm.msg = 'unknown header flags set'; state.mode = BAD; break; } if (state.head) { state.head.text = ((hold >> 8) & 1); } if (state.flags & 0x0200) { //=== CRC2(state.check, hold); hbuf[0] = hold & 0xff; hbuf[1] = (hold >>> 8) & 0xff; state.check = crc32(state.check, hbuf, 2, 0); //===// } //=== INITBITS(); hold = 0; bits = 0; //===// state.mode = TIME; /* falls through */ case TIME: //=== NEEDBITS(32); */ while (bits < 32) { if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; } //===// if (state.head) { state.head.time = hold; } if (state.flags & 0x0200) { //=== CRC4(state.check, hold) hbuf[0] = hold & 0xff; hbuf[1] = (hold >>> 8) & 0xff; hbuf[2] = (hold >>> 16) & 0xff; hbuf[3] = (hold >>> 24) & 0xff; state.check = crc32(state.check, hbuf, 4, 0); //=== } //=== INITBITS(); hold = 0; bits = 0; //===// state.mode = OS; /* falls through */ case OS: //=== NEEDBITS(16); */ while (bits < 16) { if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; } //===// if (state.head) { state.head.xflags = (hold & 0xff); state.head.os = (hold >> 8); } if (state.flags & 0x0200) { //=== CRC2(state.check, hold); hbuf[0] = hold & 0xff; hbuf[1] = (hold >>> 8) & 0xff; state.check = crc32(state.check, hbuf, 2, 0); //===// } //=== INITBITS(); hold = 0; bits = 0; //===// state.mode = EXLEN; /* falls through */ case EXLEN: if (state.flags & 0x0400) { //=== NEEDBITS(16); */ while (bits < 16) { if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; } //===// state.length = hold; if (state.head) { state.head.extra_len = hold; } if (state.flags & 0x0200) { //=== CRC2(state.check, hold); hbuf[0] = hold & 0xff; hbuf[1] = (hold >>> 8) & 0xff; state.check = crc32(state.check, hbuf, 2, 0); //===// } //=== INITBITS(); hold = 0; bits = 0; //===// } else if (state.head) { state.head.extra = null/*Z_NULL*/; } state.mode = EXTRA; /* falls through */ case EXTRA: if (state.flags & 0x0400) { copy = state.length; if (copy > have) { copy = have; } if (copy) { if (state.head) { len = state.head.extra_len - state.length; if (!state.head.extra) { // Use untyped array for more convenient processing later state.head.extra = new Array(state.head.extra_len); } utils.arraySet( state.head.extra, input, next, // extra field is limited to 65536 bytes // - no need for additional size check copy, /*len + copy > state.head.extra_max - len ? state.head.extra_max : copy,*/ len ); //zmemcpy(state.head.extra + len, next, // len + copy > state.head.extra_max ? // state.head.extra_max - len : copy); } if (state.flags & 0x0200) { state.check = crc32(state.check, input, copy, next); } have -= copy; next += copy; state.length -= copy; } if (state.length) { break inf_leave; } } state.length = 0; state.mode = NAME; /* falls through */ case NAME: if (state.flags & 0x0800) { if (have === 0) { break inf_leave; } copy = 0; do { // TODO: 2 or 1 bytes? len = input[next + copy++]; /* use constant limit because in js we should not preallocate memory */ if (state.head && len && (state.length < 65536 /*state.head.name_max*/)) { state.head.name += String.fromCharCode(len); } } while (len && copy < have); if (state.flags & 0x0200) { state.check = crc32(state.check, input, copy, next); } have -= copy; next += copy; if (len) { break inf_leave; } } else if (state.head) { state.head.name = null; } state.length = 0; state.mode = COMMENT; /* falls through */ case COMMENT: if (state.flags & 0x1000) { if (have === 0) { break inf_leave; } copy = 0; do { len = input[next + copy++]; /* use constant limit because in js we should not preallocate memory */ if (state.head && len && (state.length < 65536 /*state.head.comm_max*/)) { state.head.comment += String.fromCharCode(len); } } while (len && copy < have); if (state.flags & 0x0200) { state.check = crc32(state.check, input, copy, next); } have -= copy; next += copy; if (len) { break inf_leave; } } else if (state.head) { state.head.comment = null; } state.mode = HCRC; /* falls through */ case HCRC: if (state.flags & 0x0200) { //=== NEEDBITS(16); */ while (bits < 16) { if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; } //===// if (hold !== (state.check & 0xffff)) { strm.msg = 'header crc mismatch'; state.mode = BAD; break; } //=== INITBITS(); hold = 0; bits = 0; //===// } if (state.head) { state.head.hcrc = ((state.flags >> 9) & 1); state.head.done = true; } strm.adler = state.check = 0; state.mode = TYPE; break; case DICTID: //=== NEEDBITS(32); */ while (bits < 32) { if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; } //===// strm.adler = state.check = zswap32(hold); //=== INITBITS(); hold = 0; bits = 0; //===// state.mode = DICT; /* falls through */ case DICT: if (state.havedict === 0) { //--- RESTORE() --- strm.next_out = put; strm.avail_out = left; strm.next_in = next; strm.avail_in = have; state.hold = hold; state.bits = bits; //--- return Z_NEED_DICT; } strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/; state.mode = TYPE; /* falls through */ case TYPE: if (flush === Z_BLOCK || flush === Z_TREES) { break inf_leave; } /* falls through */ case TYPEDO: if (state.last) { //--- BYTEBITS() ---// hold >>>= bits & 7; bits -= bits & 7; //---// state.mode = CHECK; break; } //=== NEEDBITS(3); */ while (bits < 3) { if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; } //===// state.last = (hold & 0x01)/*BITS(1)*/; //--- DROPBITS(1) ---// hold >>>= 1; bits -= 1; //---// switch ((hold & 0x03)/*BITS(2)*/) { case 0: /* stored block */ //Tracev((stderr, "inflate: stored block%s\n", // state.last ? " (last)" : "")); state.mode = STORED; break; case 1: /* fixed block */ fixedtables(state); //Tracev((stderr, "inflate: fixed codes block%s\n", // state.last ? " (last)" : "")); state.mode = LEN_; /* decode codes */ if (flush === Z_TREES) { //--- DROPBITS(2) ---// hold >>>= 2; bits -= 2; //---// break inf_leave; } break; case 2: /* dynamic block */ //Tracev((stderr, "inflate: dynamic codes block%s\n", // state.last ? " (last)" : "")); state.mode = TABLE; break; case 3: strm.msg = 'invalid block type'; state.mode = BAD; } //--- DROPBITS(2) ---// hold >>>= 2; bits -= 2; //---// break; case STORED: //--- BYTEBITS() ---// /* go to byte boundary */ hold >>>= bits & 7; bits -= bits & 7; //---// //=== NEEDBITS(32); */ while (bits < 32) { if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; } //===// if ((hold & 0xffff) !== ((hold >>> 16) ^ 0xffff)) { strm.msg = 'invalid stored block lengths'; state.mode = BAD; break; } state.length = hold & 0xffff; //Tracev((stderr, "inflate: stored length %u\n", // state.length)); //=== INITBITS(); hold = 0; bits = 0; //===// state.mode = COPY_; if (flush === Z_TREES) { break inf_leave; } /* falls through */ case COPY_: state.mode = COPY; /* falls through */ case COPY: copy = state.length; if (copy) { if (copy > have) { copy = have; } if (copy > left) { copy = left; } if (copy === 0) { break inf_leave; } //--- zmemcpy(put, next, copy); --- utils.arraySet(output, input, next, copy, put); //---// have -= copy; next += copy; left -= copy; put += copy; state.length -= copy; break; } //Tracev((stderr, "inflate: stored end\n")); state.mode = TYPE; break; case TABLE: //=== NEEDBITS(14); */ while (bits < 14) { if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; } //===// state.nlen = (hold & 0x1f)/*BITS(5)*/ + 257; //--- DROPBITS(5) ---// hold >>>= 5; bits -= 5; //---// state.ndist = (hold & 0x1f)/*BITS(5)*/ + 1; //--- DROPBITS(5) ---// hold >>>= 5; bits -= 5; //---// state.ncode = (hold & 0x0f)/*BITS(4)*/ + 4; //--- DROPBITS(4) ---// hold >>>= 4; bits -= 4; //---// //#ifndef PKZIP_BUG_WORKAROUND if (state.nlen > 286 || state.ndist > 30) { strm.msg = 'too many length or distance symbols'; state.mode = BAD; break; } //#endif //Tracev((stderr, "inflate: table sizes ok\n")); state.have = 0; state.mode = LENLENS; /* falls through */ case LENLENS: while (state.have < state.ncode) { //=== NEEDBITS(3); while (bits < 3) { if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; } //===// state.lens[order[state.have++]] = (hold & 0x07);//BITS(3); //--- DROPBITS(3) ---// hold >>>= 3; bits -= 3; //---// } while (state.have < 19) { state.lens[order[state.have++]] = 0; } // We have separate tables & no pointers. 2 commented lines below not needed. //state.next = state.codes; //state.lencode = state.next; // Switch to use dynamic table state.lencode = state.lendyn; state.lenbits = 7; opts = { bits: state.lenbits }; ret = inflate_table(CODES, state.lens, 0, 19, state.lencode, 0, state.work, opts); state.lenbits = opts.bits; if (ret) { strm.msg = 'invalid code lengths set'; state.mode = BAD; break; } //Tracev((stderr, "inflate: code lengths ok\n")); state.have = 0; state.mode = CODELENS; /* falls through */ case CODELENS: while (state.have < state.nlen + state.ndist) { for (;;) { here = state.lencode[hold & ((1 << state.lenbits) - 1)];/*BITS(state.lenbits)*/ here_bits = here >>> 24; here_op = (here >>> 16) & 0xff; here_val = here & 0xffff; if ((here_bits) <= bits) { break; } //--- PULLBYTE() ---// if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; //---// } if (here_val < 16) { //--- DROPBITS(here.bits) ---// hold >>>= here_bits; bits -= here_bits; //---// state.lens[state.have++] = here_val; } else { if (here_val === 16) { //=== NEEDBITS(here.bits + 2); n = here_bits + 2; while (bits < n) { if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; } //===// //--- DROPBITS(here.bits) ---// hold >>>= here_bits; bits -= here_bits; //---// if (state.have === 0) { strm.msg = 'invalid bit length repeat'; state.mode = BAD; break; } len = state.lens[state.have - 1]; copy = 3 + (hold & 0x03);//BITS(2); //--- DROPBITS(2) ---// hold >>>= 2; bits -= 2; //---// } else if (here_val === 17) { //=== NEEDBITS(here.bits + 3); n = here_bits + 3; while (bits < n) { if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; } //===// //--- DROPBITS(here.bits) ---// hold >>>= here_bits; bits -= here_bits; //---// len = 0; copy = 3 + (hold & 0x07);//BITS(3); //--- DROPBITS(3) ---// hold >>>= 3; bits -= 3; //---// } else { //=== NEEDBITS(here.bits + 7); n = here_bits + 7; while (bits < n) { if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; } //===// //--- DROPBITS(here.bits) ---// hold >>>= here_bits; bits -= here_bits; //---// len = 0; copy = 11 + (hold & 0x7f);//BITS(7); //--- DROPBITS(7) ---// hold >>>= 7; bits -= 7; //---// } if (state.have + copy > state.nlen + state.ndist) { strm.msg = 'invalid bit length repeat'; state.mode = BAD; break; } while (copy--) { state.lens[state.have++] = len; } } } /* handle error breaks in while */ if (state.mode === BAD) { break; } /* check for end-of-block code (better have one) */ if (state.lens[256] === 0) { strm.msg = 'invalid code -- missing end-of-block'; state.mode = BAD; break; } /* build code tables -- note: do not change the lenbits or distbits values here (9 and 6) without reading the comments in inftrees.h concerning the ENOUGH constants, which depend on those values */ state.lenbits = 9; opts = { bits: state.lenbits }; ret = inflate_table(LENS, state.lens, 0, state.nlen, state.lencode, 0, state.work, opts); // We have separate tables & no pointers. 2 commented lines below not needed. // state.next_index = opts.table_index; state.lenbits = opts.bits; // state.lencode = state.next; if (ret) { strm.msg = 'invalid literal/lengths set'; state.mode = BAD; break; } state.distbits = 6; //state.distcode.copy(state.codes); // Switch to use dynamic table state.distcode = state.distdyn; opts = { bits: state.distbits }; ret = inflate_table(DISTS, state.lens, state.nlen, state.ndist, state.distcode, 0, state.work, opts); // We have separate tables & no pointers. 2 commented lines below not needed. // state.next_index = opts.table_index; state.distbits = opts.bits; // state.distcode = state.next; if (ret) { strm.msg = 'invalid distances set'; state.mode = BAD; break; } //Tracev((stderr, 'inflate: codes ok\n')); state.mode = LEN_; if (flush === Z_TREES) { break inf_leave; } /* falls through */ case LEN_: state.mode = LEN; /* falls through */ case LEN: if (have >= 6 && left >= 258) { //--- RESTORE() --- strm.next_out = put; strm.avail_out = left; strm.next_in = next; strm.avail_in = have; state.hold = hold; state.bits = bits; //--- inflate_fast(strm, _out); //--- LOAD() --- put = strm.next_out; output = strm.output; left = strm.avail_out; next = strm.next_in; input = strm.input; have = strm.avail_in; hold = state.hold; bits = state.bits; //--- if (state.mode === TYPE) { state.back = -1; } break; } state.back = 0; for (;;) { here = state.lencode[hold & ((1 << state.lenbits) - 1)]; /*BITS(state.lenbits)*/ here_bits = here >>> 24; here_op = (here >>> 16) & 0xff; here_val = here & 0xffff; if (here_bits <= bits) { break; } //--- PULLBYTE() ---// if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; //---// } if (here_op && (here_op & 0xf0) === 0) { last_bits = here_bits; last_op = here_op; last_val = here_val; for (;;) { here = state.lencode[last_val + ((hold & ((1 << (last_bits + last_op)) - 1))/*BITS(last.bits + last.op)*/ >> last_bits)]; here_bits = here >>> 24; here_op = (here >>> 16) & 0xff; here_val = here & 0xffff; if ((last_bits + here_bits) <= bits) { break; } //--- PULLBYTE() ---// if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; //---// } //--- DROPBITS(last.bits) ---// hold >>>= last_bits; bits -= last_bits; //---// state.back += last_bits; } //--- DROPBITS(here.bits) ---// hold >>>= here_bits; bits -= here_bits; //---// state.back += here_bits; state.length = here_val; if (here_op === 0) { //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? // "inflate: literal '%c'\n" : // "inflate: literal 0x%02x\n", here.val)); state.mode = LIT; break; } if (here_op & 32) { //Tracevv((stderr, "inflate: end of block\n")); state.back = -1; state.mode = TYPE; break; } if (here_op & 64) { strm.msg = 'invalid literal/length code'; state.mode = BAD; break; } state.extra = here_op & 15; state.mode = LENEXT; /* falls through */ case LENEXT: if (state.extra) { //=== NEEDBITS(state.extra); n = state.extra; while (bits < n) { if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; } //===// state.length += hold & ((1 << state.extra) - 1)/*BITS(state.extra)*/; //--- DROPBITS(state.extra) ---// hold >>>= state.extra; bits -= state.extra; //---// state.back += state.extra; } //Tracevv((stderr, "inflate: length %u\n", state.length)); state.was = state.length; state.mode = DIST; /* falls through */ case DIST: for (;;) { here = state.distcode[hold & ((1 << state.distbits) - 1)];/*BITS(state.distbits)*/ here_bits = here >>> 24; here_op = (here >>> 16) & 0xff; here_val = here & 0xffff; if ((here_bits) <= bits) { break; } //--- PULLBYTE() ---// if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; //---// } if ((here_op & 0xf0) === 0) { last_bits = here_bits; last_op = here_op; last_val = here_val; for (;;) { here = state.distcode[last_val + ((hold & ((1 << (last_bits + last_op)) - 1))/*BITS(last.bits + last.op)*/ >> last_bits)]; here_bits = here >>> 24; here_op = (here >>> 16) & 0xff; here_val = here & 0xffff; if ((last_bits + here_bits) <= bits) { break; } //--- PULLBYTE() ---// if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; //---// } //--- DROPBITS(last.bits) ---// hold >>>= last_bits; bits -= last_bits; //---// state.back += last_bits; } //--- DROPBITS(here.bits) ---// hold >>>= here_bits; bits -= here_bits; //---// state.back += here_bits; if (here_op & 64) { strm.msg = 'invalid distance code'; state.mode = BAD; break; } state.offset = here_val; state.extra = (here_op) & 15; state.mode = DISTEXT; /* falls through */ case DISTEXT: if (state.extra) { //=== NEEDBITS(state.extra); n = state.extra; while (bits < n) { if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; } //===// state.offset += hold & ((1 << state.extra) - 1)/*BITS(state.extra)*/; //--- DROPBITS(state.extra) ---// hold >>>= state.extra; bits -= state.extra; //---// state.back += state.extra; } //#ifdef INFLATE_STRICT if (state.offset > state.dmax) { strm.msg = 'invalid distance too far back'; state.mode = BAD; break; } //#endif //Tracevv((stderr, "inflate: distance %u\n", state.offset)); state.mode = MATCH; /* falls through */ case MATCH: if (left === 0) { break inf_leave; } copy = _out - left; if (state.offset > copy) { /* copy from window */ copy = state.offset - copy; if (copy > state.whave) { if (state.sane) { strm.msg = 'invalid distance too far back'; state.mode = BAD; break; } // (!) This block is disabled in zlib defaults, // don't enable it for binary compatibility //#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR // Trace((stderr, "inflate.c too far\n")); // copy -= state.whave; // if (copy > state.length) { copy = state.length; } // if (copy > left) { copy = left; } // left -= copy; // state.length -= copy; // do { // output[put++] = 0; // } while (--copy); // if (state.length === 0) { state.mode = LEN; } // break; //#endif } if (copy > state.wnext) { copy -= state.wnext; from = state.wsize - copy; } else { from = state.wnext - copy; } if (copy > state.length) { copy = state.length; } from_source = state.window; } else { /* copy from output */ from_source = output; from = put - state.offset; copy = state.length; } if (copy > left) { copy = left; } left -= copy; state.length -= copy; do { output[put++] = from_source[from++]; } while (--copy); if (state.length === 0) { state.mode = LEN; } break; case LIT: if (left === 0) { break inf_leave; } output[put++] = state.length; left--; state.mode = LEN; break; case CHECK: if (state.wrap) { //=== NEEDBITS(32); while (bits < 32) { if (have === 0) { break inf_leave; } have--; // Use '|' instead of '+' to make sure that result is signed hold |= input[next++] << bits; bits += 8; } //===// _out -= left; strm.total_out += _out; state.total += _out; if (_out) { strm.adler = state.check = /*UPDATE(state.check, put - _out, _out);*/ (state.flags ? crc32(state.check, output, _out, put - _out) : adler32(state.check, output, _out, put - _out)); } _out = left; // NB: crc32 stored as signed 32-bit int, zswap32 returns signed too if ((state.flags ? hold : zswap32(hold)) !== state.check) { strm.msg = 'incorrect data check'; state.mode = BAD; break; } //=== INITBITS(); hold = 0; bits = 0; //===// //Tracev((stderr, "inflate: check matches trailer\n")); } state.mode = LENGTH; /* falls through */ case LENGTH: if (state.wrap && state.flags) { //=== NEEDBITS(32); while (bits < 32) { if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; } //===// if (hold !== (state.total & 0xffffffff)) { strm.msg = 'incorrect length check'; state.mode = BAD; break; } //=== INITBITS(); hold = 0; bits = 0; //===// //Tracev((stderr, "inflate: length matches trailer\n")); } state.mode = DONE; /* falls through */ case DONE: ret = Z_STREAM_END; break inf_leave; case BAD: ret = Z_DATA_ERROR; break inf_leave; case MEM: return Z_MEM_ERROR; case SYNC: /* falls through */ default: return Z_STREAM_ERROR; } } // inf_leave <- here is real place for "goto inf_leave", emulated via "break inf_leave" /* Return from inflate(), updating the total counts and the check value. If there was no progress during the inflate() call, return a buffer error. Call updatewindow() to create and/or update the window state. Note: a memory error from inflate() is non-recoverable. */ //--- RESTORE() --- strm.next_out = put; strm.avail_out = left; strm.next_in = next; strm.avail_in = have; state.hold = hold; state.bits = bits; //--- if (state.wsize || (_out !== strm.avail_out && state.mode < BAD && (state.mode < CHECK || flush !== Z_FINISH))) { if (updatewindow(strm, strm.output, strm.next_out, _out - strm.avail_out)) { state.mode = MEM; return Z_MEM_ERROR; } } _in -= strm.avail_in; _out -= strm.avail_out; strm.total_in += _in; strm.total_out += _out; state.total += _out; if (state.wrap && _out) { strm.adler = state.check = /*UPDATE(state.check, strm.next_out - _out, _out);*/ (state.flags ? crc32(state.check, output, _out, strm.next_out - _out) : adler32(state.check, output, _out, strm.next_out - _out)); } strm.data_type = state.bits + (state.last ? 64 : 0) + (state.mode === TYPE ? 128 : 0) + (state.mode === LEN_ || state.mode === COPY_ ? 256 : 0); if (((_in === 0 && _out === 0) || flush === Z_FINISH) && ret === Z_OK) { ret = Z_BUF_ERROR; } return ret; } function inflateEnd(strm) { if (!strm || !strm.state /*|| strm->zfree == (free_func)0*/) { return Z_STREAM_ERROR; } var state = strm.state; if (state.window) { state.window = null; } strm.state = null; return Z_OK; } function inflateGetHeader(strm, head) { var state; /* check state */ if (!strm || !strm.state) { return Z_STREAM_ERROR; } state = strm.state; if ((state.wrap & 2) === 0) { return Z_STREAM_ERROR; } /* save header structure */ state.head = head; head.done = false; return Z_OK; } function inflateSetDictionary(strm, dictionary) { var dictLength = dictionary.length; var state; var dictid; var ret; /* check state */ if (!strm /* == Z_NULL */ || !strm.state /* == Z_NULL */) { return Z_STREAM_ERROR; } state = strm.state; if (state.wrap !== 0 && state.mode !== DICT) { return Z_STREAM_ERROR; } /* check for correct dictionary identifier */ if (state.mode === DICT) { dictid = 1; /* adler32(0, null, 0)*/ /* dictid = adler32(dictid, dictionary, dictLength); */ dictid = adler32(dictid, dictionary, dictLength, 0); if (dictid !== state.check) { return Z_DATA_ERROR; } } /* copy dictionary to window using updatewindow(), which will amend the existing dictionary if appropriate */ ret = updatewindow(strm, dictionary, dictLength, dictLength); if (ret) { state.mode = MEM; return Z_MEM_ERROR; } state.havedict = 1; // Tracev((stderr, "inflate: dictionary set\n")); return Z_OK; } exports.inflateReset = inflateReset; exports.inflateReset2 = inflateReset2; exports.inflateResetKeep = inflateResetKeep; exports.inflateInit = inflateInit; exports.inflateInit2 = inflateInit2; exports.inflate = inflate; exports.inflateEnd = inflateEnd; exports.inflateGetHeader = inflateGetHeader; exports.inflateSetDictionary = inflateSetDictionary; exports.inflateInfo = 'pako inflate (from Nodeca project)'; /* Not implemented exports.inflateCopy = inflateCopy; exports.inflateGetDictionary = inflateGetDictionary; exports.inflateMark = inflateMark; exports.inflatePrime = inflatePrime; exports.inflateSync = inflateSync; exports.inflateSyncPoint = inflateSyncPoint; exports.inflateUndermine = inflateUndermine; */ /***/ }), /* 101 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // (C) 1995-2013 Jean-loup Gailly and Mark Adler // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would be // appreciated but is not required. // 2. Altered source versions must be plainly marked as such, and must not be // misrepresented as being the original software. // 3. This notice may not be removed or altered from any source distribution. // See state defs from inflate.js var BAD = 30; /* got a data error -- remain here until reset */ var TYPE = 12; /* i: waiting for type bits, including last-flag bit */ /* Decode literal, length, and distance codes and write out the resulting literal and match bytes until either not enough input or output is available, an end-of-block is encountered, or a data error is encountered. When large enough input and output buffers are supplied to inflate(), for example, a 16K input buffer and a 64K output buffer, more than 95% of the inflate execution time is spent in this routine. Entry assumptions: state.mode === LEN strm.avail_in >= 6 strm.avail_out >= 258 start >= strm.avail_out state.bits < 8 On return, state.mode is one of: LEN -- ran out of enough output space or enough available input TYPE -- reached end of block code, inflate() to interpret next block BAD -- error in block data Notes: - The maximum input bits used by a length/distance pair is 15 bits for the length code, 5 bits for the length extra, 15 bits for the distance code, and 13 bits for the distance extra. This totals 48 bits, or six bytes. Therefore if strm.avail_in >= 6, then there is enough input to avoid checking for available input while decoding. - The maximum bytes that a single length/distance pair can output is 258 bytes, which is the maximum length that can be coded. inflate_fast() requires strm.avail_out >= 258 for each loop to avoid checking for output space. */ module.exports = function inflate_fast(strm, start) { var state; var _in; /* local strm.input */ var last; /* have enough input while in < last */ var _out; /* local strm.output */ var beg; /* inflate()'s initial strm.output */ var end; /* while out < end, enough space available */ //#ifdef INFLATE_STRICT var dmax; /* maximum distance from zlib header */ //#endif var wsize; /* window size or zero if not using window */ var whave; /* valid bytes in the window */ var wnext; /* window write index */ // Use `s_window` instead `window`, avoid conflict with instrumentation tools var s_window; /* allocated sliding window, if wsize != 0 */ var hold; /* local strm.hold */ var bits; /* local strm.bits */ var lcode; /* local strm.lencode */ var dcode; /* local strm.distcode */ var lmask; /* mask for first level of length codes */ var dmask; /* mask for first level of distance codes */ var here; /* retrieved table entry */ var op; /* code bits, operation, extra bits, or */ /* window position, window bytes to copy */ var len; /* match length, unused bytes */ var dist; /* match distance */ var from; /* where to copy match from */ var from_source; var input, output; // JS specific, because we have no pointers /* copy state to local variables */ state = strm.state; //here = state.here; _in = strm.next_in; input = strm.input; last = _in + (strm.avail_in - 5); _out = strm.next_out; output = strm.output; beg = _out - (start - strm.avail_out); end = _out + (strm.avail_out - 257); //#ifdef INFLATE_STRICT dmax = state.dmax; //#endif wsize = state.wsize; whave = state.whave; wnext = state.wnext; s_window = state.window; hold = state.hold; bits = state.bits; lcode = state.lencode; dcode = state.distcode; lmask = (1 << state.lenbits) - 1; dmask = (1 << state.distbits) - 1; /* decode literals and length/distances until end-of-block or not enough input data or output space */ top: do { if (bits < 15) { hold += input[_in++] << bits; bits += 8; hold += input[_in++] << bits; bits += 8; } here = lcode[hold & lmask]; dolen: for (;;) { // Goto emulation op = here >>> 24/*here.bits*/; hold >>>= op; bits -= op; op = (here >>> 16) & 0xff/*here.op*/; if (op === 0) { /* literal */ //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? // "inflate: literal '%c'\n" : // "inflate: literal 0x%02x\n", here.val)); output[_out++] = here & 0xffff/*here.val*/; } else if (op & 16) { /* length base */ len = here & 0xffff/*here.val*/; op &= 15; /* number of extra bits */ if (op) { if (bits < op) { hold += input[_in++] << bits; bits += 8; } len += hold & ((1 << op) - 1); hold >>>= op; bits -= op; } //Tracevv((stderr, "inflate: length %u\n", len)); if (bits < 15) { hold += input[_in++] << bits; bits += 8; hold += input[_in++] << bits; bits += 8; } here = dcode[hold & dmask]; dodist: for (;;) { // goto emulation op = here >>> 24/*here.bits*/; hold >>>= op; bits -= op; op = (here >>> 16) & 0xff/*here.op*/; if (op & 16) { /* distance base */ dist = here & 0xffff/*here.val*/; op &= 15; /* number of extra bits */ if (bits < op) { hold += input[_in++] << bits; bits += 8; if (bits < op) { hold += input[_in++] << bits; bits += 8; } } dist += hold & ((1 << op) - 1); //#ifdef INFLATE_STRICT if (dist > dmax) { strm.msg = 'invalid distance too far back'; state.mode = BAD; break top; } //#endif hold >>>= op; bits -= op; //Tracevv((stderr, "inflate: distance %u\n", dist)); op = _out - beg; /* max distance in output */ if (dist > op) { /* see if copy from window */ op = dist - op; /* distance back in window */ if (op > whave) { if (state.sane) { strm.msg = 'invalid distance too far back'; state.mode = BAD; break top; } // (!) This block is disabled in zlib defaults, // don't enable it for binary compatibility //#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR // if (len <= op - whave) { // do { // output[_out++] = 0; // } while (--len); // continue top; // } // len -= op - whave; // do { // output[_out++] = 0; // } while (--op > whave); // if (op === 0) { // from = _out - dist; // do { // output[_out++] = output[from++]; // } while (--len); // continue top; // } //#endif } from = 0; // window index from_source = s_window; if (wnext === 0) { /* very common case */ from += wsize - op; if (op < len) { /* some from window */ len -= op; do { output[_out++] = s_window[from++]; } while (--op); from = _out - dist; /* rest from output */ from_source = output; } } else if (wnext < op) { /* wrap around window */ from += wsize + wnext - op; op -= wnext; if (op < len) { /* some from end of window */ len -= op; do { output[_out++] = s_window[from++]; } while (--op); from = 0; if (wnext < len) { /* some from start of window */ op = wnext; len -= op; do { output[_out++] = s_window[from++]; } while (--op); from = _out - dist; /* rest from output */ from_source = output; } } } else { /* contiguous in window */ from += wnext - op; if (op < len) { /* some from window */ len -= op; do { output[_out++] = s_window[from++]; } while (--op); from = _out - dist; /* rest from output */ from_source = output; } } while (len > 2) { output[_out++] = from_source[from++]; output[_out++] = from_source[from++]; output[_out++] = from_source[from++]; len -= 3; } if (len) { output[_out++] = from_source[from++]; if (len > 1) { output[_out++] = from_source[from++]; } } } else { from = _out - dist; /* copy direct from output */ do { /* minimum length is three */ output[_out++] = output[from++]; output[_out++] = output[from++]; output[_out++] = output[from++]; len -= 3; } while (len > 2); if (len) { output[_out++] = output[from++]; if (len > 1) { output[_out++] = output[from++]; } } } } else if ((op & 64) === 0) { /* 2nd level distance code */ here = dcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))]; continue dodist; } else { strm.msg = 'invalid distance code'; state.mode = BAD; break top; } break; // need to emulate goto via "continue" } } else if ((op & 64) === 0) { /* 2nd level length code */ here = lcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))]; continue dolen; } else if (op & 32) { /* end-of-block */ //Tracevv((stderr, "inflate: end of block\n")); state.mode = TYPE; break top; } else { strm.msg = 'invalid literal/length code'; state.mode = BAD; break top; } break; // need to emulate goto via "continue" } } while (_in < last && _out < end); /* return unused bytes (on entry, bits < 8, so in won't go too far back) */ len = bits >> 3; _in -= len; bits -= len << 3; hold &= (1 << bits) - 1; /* update state and return */ strm.next_in = _in; strm.next_out = _out; strm.avail_in = (_in < last ? 5 + (last - _in) : 5 - (_in - last)); strm.avail_out = (_out < end ? 257 + (end - _out) : 257 - (_out - end)); state.hold = hold; state.bits = bits; return; }; /***/ }), /* 102 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // (C) 1995-2013 Jean-loup Gailly and Mark Adler // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would be // appreciated but is not required. // 2. Altered source versions must be plainly marked as such, and must not be // misrepresented as being the original software. // 3. This notice may not be removed or altered from any source distribution. var utils = __webpack_require__(15); var MAXBITS = 15; var ENOUGH_LENS = 852; var ENOUGH_DISTS = 592; //var ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS); var CODES = 0; var LENS = 1; var DISTS = 2; var lbase = [ /* Length codes 257..285 base */ 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0 ]; var lext = [ /* Length codes 257..285 extra */ 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78 ]; var dbase = [ /* Distance codes 0..29 base */ 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577, 0, 0 ]; var dext = [ /* Distance codes 0..29 extra */ 16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 64, 64 ]; module.exports = function inflate_table(type, lens, lens_index, codes, table, table_index, work, opts) { var bits = opts.bits; //here = opts.here; /* table entry for duplication */ var len = 0; /* a code's length in bits */ var sym = 0; /* index of code symbols */ var min = 0, max = 0; /* minimum and maximum code lengths */ var root = 0; /* number of index bits for root table */ var curr = 0; /* number of index bits for current table */ var drop = 0; /* code bits to drop for sub-table */ var left = 0; /* number of prefix codes available */ var used = 0; /* code entries in table used */ var huff = 0; /* Huffman code */ var incr; /* for incrementing code, index */ var fill; /* index for replicating entries */ var low; /* low bits for current root entry */ var mask; /* mask for low root bits */ var next; /* next available space in table */ var base = null; /* base value table to use */ var base_index = 0; // var shoextra; /* extra bits table to use */ var end; /* use base and extra for symbol > end */ var count = new utils.Buf16(MAXBITS + 1); //[MAXBITS+1]; /* number of codes of each length */ var offs = new utils.Buf16(MAXBITS + 1); //[MAXBITS+1]; /* offsets in table for each length */ var extra = null; var extra_index = 0; var here_bits, here_op, here_val; /* Process a set of code lengths to create a canonical Huffman code. The code lengths are lens[0..codes-1]. Each length corresponds to the symbols 0..codes-1. The Huffman code is generated by first sorting the symbols by length from short to long, and retaining the symbol order for codes with equal lengths. Then the code starts with all zero bits for the first code of the shortest length, and the codes are integer increments for the same length, and zeros are appended as the length increases. For the deflate format, these bits are stored backwards from their more natural integer increment ordering, and so when the decoding tables are built in the large loop below, the integer codes are incremented backwards. This routine assumes, but does not check, that all of the entries in lens[] are in the range 0..MAXBITS. The caller must assure this. 1..MAXBITS is interpreted as that code length. zero means that that symbol does not occur in this code. The codes are sorted by computing a count of codes for each length, creating from that a table of starting indices for each length in the sorted table, and then entering the symbols in order in the sorted table. The sorted table is work[], with that space being provided by the caller. The length counts are used for other purposes as well, i.e. finding the minimum and maximum length codes, determining if there are any codes at all, checking for a valid set of lengths, and looking ahead at length counts to determine sub-table sizes when building the decoding tables. */ /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */ for (len = 0; len <= MAXBITS; len++) { count[len] = 0; } for (sym = 0; sym < codes; sym++) { count[lens[lens_index + sym]]++; } /* bound code lengths, force root to be within code lengths */ root = bits; for (max = MAXBITS; max >= 1; max--) { if (count[max] !== 0) { break; } } if (root > max) { root = max; } if (max === 0) { /* no symbols to code at all */ //table.op[opts.table_index] = 64; //here.op = (var char)64; /* invalid code marker */ //table.bits[opts.table_index] = 1; //here.bits = (var char)1; //table.val[opts.table_index++] = 0; //here.val = (var short)0; table[table_index++] = (1 << 24) | (64 << 16) | 0; //table.op[opts.table_index] = 64; //table.bits[opts.table_index] = 1; //table.val[opts.table_index++] = 0; table[table_index++] = (1 << 24) | (64 << 16) | 0; opts.bits = 1; return 0; /* no symbols, but wait for decoding to report error */ } for (min = 1; min < max; min++) { if (count[min] !== 0) { break; } } if (root < min) { root = min; } /* check for an over-subscribed or incomplete set of lengths */ left = 1; for (len = 1; len <= MAXBITS; len++) { left <<= 1; left -= count[len]; if (left < 0) { return -1; } /* over-subscribed */ } if (left > 0 && (type === CODES || max !== 1)) { return -1; /* incomplete set */ } /* generate offsets into symbol table for each length for sorting */ offs[1] = 0; for (len = 1; len < MAXBITS; len++) { offs[len + 1] = offs[len] + count[len]; } /* sort symbols by length, by symbol order within each length */ for (sym = 0; sym < codes; sym++) { if (lens[lens_index + sym] !== 0) { work[offs[lens[lens_index + sym]]++] = sym; } } /* Create and fill in decoding tables. In this loop, the table being filled is at next and has curr index bits. The code being used is huff with length len. That code is converted to an index by dropping drop bits off of the bottom. For codes where len is less than drop + curr, those top drop + curr - len bits are incremented through all values to fill the table with replicated entries. root is the number of index bits for the root table. When len exceeds root, sub-tables are created pointed to by the root entry with an index of the low root bits of huff. This is saved in low to check for when a new sub-table should be started. drop is zero when the root table is being filled, and drop is root when sub-tables are being filled. When a new sub-table is needed, it is necessary to look ahead in the code lengths to determine what size sub-table is needed. The length counts are used for this, and so count[] is decremented as codes are entered in the tables. used keeps track of how many table entries have been allocated from the provided *table space. It is checked for LENS and DIST tables against the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in the initial root table size constants. See the comments in inftrees.h for more information. sym increments through all symbols, and the loop terminates when all codes of length max, i.e. all codes, have been processed. This routine permits incomplete codes, so another loop after this one fills in the rest of the decoding tables with invalid code markers. */ /* set up for code type */ // poor man optimization - use if-else instead of switch, // to avoid deopts in old v8 if (type === CODES) { base = extra = work; /* dummy value--not used */ end = 19; } else if (type === LENS) { base = lbase; base_index -= 257; extra = lext; extra_index -= 257; end = 256; } else { /* DISTS */ base = dbase; extra = dext; end = -1; } /* initialize opts for loop */ huff = 0; /* starting code */ sym = 0; /* starting code symbol */ len = min; /* starting code length */ next = table_index; /* current table to fill in */ curr = root; /* current table index bits */ drop = 0; /* current bits to drop from code for index */ low = -1; /* trigger new sub-table when len > root */ used = 1 << root; /* use root table entries */ mask = used - 1; /* mask for comparing low */ /* check available table space */ if ((type === LENS && used > ENOUGH_LENS) || (type === DISTS && used > ENOUGH_DISTS)) { return 1; } /* process all codes and make table entries */ for (;;) { /* create table entry */ here_bits = len - drop; if (work[sym] < end) { here_op = 0; here_val = work[sym]; } else if (work[sym] > end) { here_op = extra[extra_index + work[sym]]; here_val = base[base_index + work[sym]]; } else { here_op = 32 + 64; /* end of block */ here_val = 0; } /* replicate for those indices with low len bits equal to huff */ incr = 1 << (len - drop); fill = 1 << curr; min = fill; /* save offset to next table */ do { fill -= incr; table[next + (huff >> drop) + fill] = (here_bits << 24) | (here_op << 16) | here_val |0; } while (fill !== 0); /* backwards increment the len-bit code huff */ incr = 1 << (len - 1); while (huff & incr) { incr >>= 1; } if (incr !== 0) { huff &= incr - 1; huff += incr; } else { huff = 0; } /* go to next symbol, update count, len */ sym++; if (--count[len] === 0) { if (len === max) { break; } len = lens[lens_index + work[sym]]; } /* create new sub-table if needed */ if (len > root && (huff & mask) !== low) { /* if first time, transition to sub-tables */ if (drop === 0) { drop = root; } /* increment past last table */ next += min; /* here min is 1 << curr */ /* determine length of next table */ curr = len - drop; left = 1 << curr; while (curr + drop < max) { left -= count[curr + drop]; if (left <= 0) { break; } curr++; left <<= 1; } /* check for enough space */ used += 1 << curr; if ((type === LENS && used > ENOUGH_LENS) || (type === DISTS && used > ENOUGH_DISTS)) { return 1; } /* point entry in root table to sub-table */ low = huff & mask; /*table.op[low] = curr; table.bits[low] = root; table.val[low] = next - opts.table_index;*/ table[low] = (root << 24) | (curr << 16) | (next - table_index) |0; } } /* fill in remaining table entry if code is incomplete (guaranteed to have at most one remaining entry, since if the code is incomplete, the maximum code length that was allowed to get this far is one bit) */ if (huff !== 0) { //table.op[next + huff] = 64; /* invalid code marker */ //table.bits[next + huff] = len - drop; //table.val[next + huff] = 0; table[next + huff] = ((len - drop) << 24) | (64 << 16) |0; } /* set return parameters */ //opts.table_index += used; opts.bits = root; return 0; }; /***/ }), /* 103 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // (C) 1995-2013 Jean-loup Gailly and Mark Adler // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would be // appreciated but is not required. // 2. Altered source versions must be plainly marked as such, and must not be // misrepresented as being the original software. // 3. This notice may not be removed or altered from any source distribution. function GZheader() { /* true if compressed data believed to be text */ this.text = 0; /* modification time */ this.time = 0; /* extra flags (not used when writing a gzip file) */ this.xflags = 0; /* operating system */ this.os = 0; /* pointer to extra field or Z_NULL if none */ this.extra = null; /* extra field length (valid if extra != Z_NULL) */ this.extra_len = 0; // Actually, we don't need it in JS, // but leave for few code modifications // // Setup limits is not necessary because in js we should not preallocate memory // for inflate use constant limit in 65536 bytes // /* space at extra (only when reading header) */ // this.extra_max = 0; /* pointer to zero-terminated file name or Z_NULL */ this.name = ''; /* space at name (only when reading header) */ // this.name_max = 0; /* pointer to zero-terminated comment or Z_NULL */ this.comment = ''; /* space at comment (only when reading header) */ // this.comm_max = 0; /* true if there was or will be a header crc */ this.hcrc = 0; /* true when done reading gzip header (not used when writing a gzip file) */ this.done = false; } module.exports = GZheader; /***/ }), /* 104 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var utils = __webpack_require__(8); var GenericWorker = __webpack_require__(12); var utf8 = __webpack_require__(17); var crc32 = __webpack_require__(36); var signature = __webpack_require__(57); /** * Transform an integer into a string in hexadecimal. * @private * @param {number} dec the number to convert. * @param {number} bytes the number of bytes to generate. * @returns {string} the result. */ var decToHex = function(dec, bytes) { var hex = "", i; for (i = 0; i < bytes; i++) { hex += String.fromCharCode(dec & 0xff); dec = dec >>> 8; } return hex; }; /** * Generate the UNIX part of the external file attributes. * @param {Object} unixPermissions the unix permissions or null. * @param {Boolean} isDir true if the entry is a directory, false otherwise. * @return {Number} a 32 bit integer. * * adapted from http://unix.stackexchange.com/questions/14705/the-zip-formats-external-file-attribute : * * TTTTsstrwxrwxrwx0000000000ADVSHR * ^^^^____________________________ file type, see zipinfo.c (UNX_*) * ^^^_________________________ setuid, setgid, sticky * ^^^^^^^^^________________ permissions * ^^^^^^^^^^______ not used ? * ^^^^^^ DOS attribute bits : Archive, Directory, Volume label, System file, Hidden, Read only */ var generateUnixExternalFileAttr = function (unixPermissions, isDir) { var result = unixPermissions; if (!unixPermissions) { // I can't use octal values in strict mode, hence the hexa. // 040775 => 0x41fd // 0100664 => 0x81b4 result = isDir ? 0x41fd : 0x81b4; } return (result & 0xFFFF) << 16; }; /** * Generate the DOS part of the external file attributes. * @param {Object} dosPermissions the dos permissions or null. * @param {Boolean} isDir true if the entry is a directory, false otherwise. * @return {Number} a 32 bit integer. * * Bit 0 Read-Only * Bit 1 Hidden * Bit 2 System * Bit 3 Volume Label * Bit 4 Directory * Bit 5 Archive */ var generateDosExternalFileAttr = function (dosPermissions, isDir) { // the dir flag is already set for compatibility return (dosPermissions || 0) & 0x3F; }; /** * Generate the various parts used in the construction of the final zip file. * @param {Object} streamInfo the hash with informations about the compressed file. * @param {Boolean} streamedContent is the content streamed ? * @param {Boolean} streamingEnded is the stream finished ? * @param {number} offset the current offset from the start of the zip file. * @param {String} platform let's pretend we are this platform (change platform dependents fields) * @param {Function} encodeFileName the function to encode the file name / comment. * @return {Object} the zip parts. */ var generateZipParts = function(streamInfo, streamedContent, streamingEnded, offset, platform, encodeFileName) { var file = streamInfo['file'], compression = streamInfo['compression'], useCustomEncoding = encodeFileName !== utf8.utf8encode, encodedFileName = utils.transformTo("string", encodeFileName(file.name)), utfEncodedFileName = utils.transformTo("string", utf8.utf8encode(file.name)), comment = file.comment, encodedComment = utils.transformTo("string", encodeFileName(comment)), utfEncodedComment = utils.transformTo("string", utf8.utf8encode(comment)), useUTF8ForFileName = utfEncodedFileName.length !== file.name.length, useUTF8ForComment = utfEncodedComment.length !== comment.length, dosTime, dosDate, extraFields = "", unicodePathExtraField = "", unicodeCommentExtraField = "", dir = file.dir, date = file.date; var dataInfo = { crc32 : 0, compressedSize : 0, uncompressedSize : 0 }; // if the content is streamed, the sizes/crc32 are only available AFTER // the end of the stream. if (!streamedContent || streamingEnded) { dataInfo.crc32 = streamInfo['crc32']; dataInfo.compressedSize = streamInfo['compressedSize']; dataInfo.uncompressedSize = streamInfo['uncompressedSize']; } var bitflag = 0; if (streamedContent) { // Bit 3: the sizes/crc32 are set to zero in the local header. // The correct values are put in the data descriptor immediately // following the compressed data. bitflag |= 0x0008; } if (!useCustomEncoding && (useUTF8ForFileName || useUTF8ForComment)) { // Bit 11: Language encoding flag (EFS). bitflag |= 0x0800; } var extFileAttr = 0; var versionMadeBy = 0; if (dir) { // dos or unix, we set the dos dir flag extFileAttr |= 0x00010; } if(platform === "UNIX") { versionMadeBy = 0x031E; // UNIX, version 3.0 extFileAttr |= generateUnixExternalFileAttr(file.unixPermissions, dir); } else { // DOS or other, fallback to DOS versionMadeBy = 0x0014; // DOS, version 2.0 extFileAttr |= generateDosExternalFileAttr(file.dosPermissions, dir); } // date // @see http://www.delorie.com/djgpp/doc/rbinter/it/52/13.html // @see http://www.delorie.com/djgpp/doc/rbinter/it/65/16.html // @see http://www.delorie.com/djgpp/doc/rbinter/it/66/16.html dosTime = date.getUTCHours(); dosTime = dosTime << 6; dosTime = dosTime | date.getUTCMinutes(); dosTime = dosTime << 5; dosTime = dosTime | date.getUTCSeconds() / 2; dosDate = date.getUTCFullYear() - 1980; dosDate = dosDate << 4; dosDate = dosDate | (date.getUTCMonth() + 1); dosDate = dosDate << 5; dosDate = dosDate | date.getUTCDate(); if (useUTF8ForFileName) { // set the unicode path extra field. unzip needs at least one extra // field to correctly handle unicode path, so using the path is as good // as any other information. This could improve the situation with // other archive managers too. // This field is usually used without the utf8 flag, with a non // unicode path in the header (winrar, winzip). This helps (a bit) // with the messy Windows' default compressed folders feature but // breaks on p7zip which doesn't seek the unicode path extra field. // So for now, UTF-8 everywhere ! unicodePathExtraField = // Version decToHex(1, 1) + // NameCRC32 decToHex(crc32(encodedFileName), 4) + // UnicodeName utfEncodedFileName; extraFields += // Info-ZIP Unicode Path Extra Field "\x75\x70" + // size decToHex(unicodePathExtraField.length, 2) + // content unicodePathExtraField; } if(useUTF8ForComment) { unicodeCommentExtraField = // Version decToHex(1, 1) + // CommentCRC32 decToHex(crc32(encodedComment), 4) + // UnicodeName utfEncodedComment; extraFields += // Info-ZIP Unicode Path Extra Field "\x75\x63" + // size decToHex(unicodeCommentExtraField.length, 2) + // content unicodeCommentExtraField; } var header = ""; // version needed to extract header += "\x0A\x00"; // general purpose bit flag header += decToHex(bitflag, 2); // compression method header += compression.magic; // last mod file time header += decToHex(dosTime, 2); // last mod file date header += decToHex(dosDate, 2); // crc-32 header += decToHex(dataInfo.crc32, 4); // compressed size header += decToHex(dataInfo.compressedSize, 4); // uncompressed size header += decToHex(dataInfo.uncompressedSize, 4); // file name length header += decToHex(encodedFileName.length, 2); // extra field length header += decToHex(extraFields.length, 2); var fileRecord = signature.LOCAL_FILE_HEADER + header + encodedFileName + extraFields; var dirRecord = signature.CENTRAL_FILE_HEADER + // version made by (00: DOS) decToHex(versionMadeBy, 2) + // file header (common to file and central directory) header + // file comment length decToHex(encodedComment.length, 2) + // disk number start "\x00\x00" + // internal file attributes TODO "\x00\x00" + // external file attributes decToHex(extFileAttr, 4) + // relative offset of local header decToHex(offset, 4) + // file name encodedFileName + // extra field extraFields + // file comment encodedComment; return { fileRecord: fileRecord, dirRecord: dirRecord }; }; /** * Generate the EOCD record. * @param {Number} entriesCount the number of entries in the zip file. * @param {Number} centralDirLength the length (in bytes) of the central dir. * @param {Number} localDirLength the length (in bytes) of the local dir. * @param {String} comment the zip file comment as a binary string. * @param {Function} encodeFileName the function to encode the comment. * @return {String} the EOCD record. */ var generateCentralDirectoryEnd = function (entriesCount, centralDirLength, localDirLength, comment, encodeFileName) { var dirEnd = ""; var encodedComment = utils.transformTo("string", encodeFileName(comment)); // end of central dir signature dirEnd = signature.CENTRAL_DIRECTORY_END + // number of this disk "\x00\x00" + // number of the disk with the start of the central directory "\x00\x00" + // total number of entries in the central directory on this disk decToHex(entriesCount, 2) + // total number of entries in the central directory decToHex(entriesCount, 2) + // size of the central directory 4 bytes decToHex(centralDirLength, 4) + // offset of start of central directory with respect to the starting disk number decToHex(localDirLength, 4) + // .ZIP file comment length decToHex(encodedComment.length, 2) + // .ZIP file comment encodedComment; return dirEnd; }; /** * Generate data descriptors for a file entry. * @param {Object} streamInfo the hash generated by a worker, containing informations * on the file entry. * @return {String} the data descriptors. */ var generateDataDescriptors = function (streamInfo) { var descriptor = ""; descriptor = signature.DATA_DESCRIPTOR + // crc-32 4 bytes decToHex(streamInfo['crc32'], 4) + // compressed size 4 bytes decToHex(streamInfo['compressedSize'], 4) + // uncompressed size 4 bytes decToHex(streamInfo['uncompressedSize'], 4); return descriptor; }; /** * A worker to concatenate other workers to create a zip file. * @param {Boolean} streamFiles `true` to stream the content of the files, * `false` to accumulate it. * @param {String} comment the comment to use. * @param {String} platform the platform to use, "UNIX" or "DOS". * @param {Function} encodeFileName the function to encode file names and comments. */ function ZipFileWorker(streamFiles, comment, platform, encodeFileName) { GenericWorker.call(this, "ZipFileWorker"); // The number of bytes written so far. This doesn't count accumulated chunks. this.bytesWritten = 0; // The comment of the zip file this.zipComment = comment; // The platform "generating" the zip file. this.zipPlatform = platform; // the function to encode file names and comments. this.encodeFileName = encodeFileName; // Should we stream the content of the files ? this.streamFiles = streamFiles; // If `streamFiles` is false, we will need to accumulate the content of the // files to calculate sizes / crc32 (and write them *before* the content). // This boolean indicates if we are accumulating chunks (it will change a lot // during the lifetime of this worker). this.accumulate = false; // The buffer receiving chunks when accumulating content. this.contentBuffer = []; // The list of generated directory records. this.dirRecords = []; // The offset (in bytes) from the beginning of the zip file for the current source. this.currentSourceOffset = 0; // The total number of entries in this zip file. this.entriesCount = 0; // the name of the file currently being added, null when handling the end of the zip file. // Used for the emited metadata. this.currentFile = null; this._sources = []; } utils.inherits(ZipFileWorker, GenericWorker); /** * @see GenericWorker.push */ ZipFileWorker.prototype.push = function (chunk) { var currentFilePercent = chunk.meta.percent || 0; var entriesCount = this.entriesCount; var remainingFiles = this._sources.length; if(this.accumulate) { this.contentBuffer.push(chunk); } else { this.bytesWritten += chunk.data.length; GenericWorker.prototype.push.call(this, { data : chunk.data, meta : { currentFile : this.currentFile, percent : entriesCount ? (currentFilePercent + 100 * (entriesCount - remainingFiles - 1)) / entriesCount : 100 } }); } }; /** * The worker started a new source (an other worker). * @param {Object} streamInfo the streamInfo object from the new source. */ ZipFileWorker.prototype.openedSource = function (streamInfo) { this.currentSourceOffset = this.bytesWritten; this.currentFile = streamInfo['file'].name; var streamedContent = this.streamFiles && !streamInfo['file'].dir; // don't stream folders (because they don't have any content) if(streamedContent) { var record = generateZipParts(streamInfo, streamedContent, false, this.currentSourceOffset, this.zipPlatform, this.encodeFileName); this.push({ data : record.fileRecord, meta : {percent:0} }); } else { // we need to wait for the whole file before pushing anything this.accumulate = true; } }; /** * The worker finished a source (an other worker). * @param {Object} streamInfo the streamInfo object from the finished source. */ ZipFileWorker.prototype.closedSource = function (streamInfo) { this.accumulate = false; var streamedContent = this.streamFiles && !streamInfo['file'].dir; var record = generateZipParts(streamInfo, streamedContent, true, this.currentSourceOffset, this.zipPlatform, this.encodeFileName); this.dirRecords.push(record.dirRecord); if(streamedContent) { // after the streamed file, we put data descriptors this.push({ data : generateDataDescriptors(streamInfo), meta : {percent:100} }); } else { // the content wasn't streamed, we need to push everything now // first the file record, then the content this.push({ data : record.fileRecord, meta : {percent:0} }); while(this.contentBuffer.length) { this.push(this.contentBuffer.shift()); } } this.currentFile = null; }; /** * @see GenericWorker.flush */ ZipFileWorker.prototype.flush = function () { var localDirLength = this.bytesWritten; for(var i = 0; i < this.dirRecords.length; i++) { this.push({ data : this.dirRecords[i], meta : {percent:100} }); } var centralDirLength = this.bytesWritten - localDirLength; var dirEnd = generateCentralDirectoryEnd(this.dirRecords.length, centralDirLength, localDirLength, this.zipComment, this.encodeFileName); this.push({ data : dirEnd, meta : {percent:100} }); }; /** * Prepare the next source to be read. */ ZipFileWorker.prototype.prepareNextSource = function () { this.previous = this._sources.shift(); this.openedSource(this.previous.streamInfo); if (this.isPaused) { this.previous.pause(); } else { this.previous.resume(); } }; /** * @see GenericWorker.registerPrevious */ ZipFileWorker.prototype.registerPrevious = function (previous) { this._sources.push(previous); var self = this; previous.on('data', function (chunk) { self.processChunk(chunk); }); previous.on('end', function () { self.closedSource(self.previous.streamInfo); if(self._sources.length) { self.prepareNextSource(); } else { self.end(); } }); previous.on('error', function (e) { self.error(e); }); return this; }; /** * @see GenericWorker.resume */ ZipFileWorker.prototype.resume = function () { if(!GenericWorker.prototype.resume.call(this)) { return false; } if (!this.previous && this._sources.length) { this.prepareNextSource(); return true; } if (!this.previous && !this._sources.length && !this.generatedError) { this.end(); return true; } }; /** * @see GenericWorker.error */ ZipFileWorker.prototype.error = function (e) { var sources = this._sources; if(!GenericWorker.prototype.error.call(this, e)) { return false; } for(var i = 0; i < sources.length; i++) { try { sources[i].error(e); } catch(e) { // the `error` exploded, nothing to do } } return true; }; /** * @see GenericWorker.lock */ ZipFileWorker.prototype.lock = function () { GenericWorker.prototype.lock.call(this); var sources = this._sources; for(var i = 0; i < sources.length; i++) { sources[i].lock(); } }; module.exports = ZipFileWorker; /***/ }), /* 105 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var utils = __webpack_require__(8); var GenericWorker = __webpack_require__(12); /** * A worker that use a nodejs stream as source. * @constructor * @param {String} filename the name of the file entry for this stream. * @param {Readable} stream the nodejs stream. */ function NodejsStreamInputAdapter(filename, stream) { GenericWorker.call(this, "Nodejs stream input adapter for " + filename); this._upstreamEnded = false; this._bindStream(stream); } utils.inherits(NodejsStreamInputAdapter, GenericWorker); /** * Prepare the stream and bind the callbacks on it. * Do this ASAP on node 0.10 ! A lazy binding doesn't always work. * @param {Stream} stream the nodejs stream to use. */ NodejsStreamInputAdapter.prototype._bindStream = function (stream) { var self = this; this._stream = stream; stream.pause(); stream .on("data", function (chunk) { self.push({ data: chunk, meta : { percent : 0 } }); }) .on("error", function (e) { if(self.isPaused) { this.generatedError = e; } else { self.error(e); } }) .on("end", function () { if(self.isPaused) { self._upstreamEnded = true; } else { self.end(); } }); }; NodejsStreamInputAdapter.prototype.pause = function () { if(!GenericWorker.prototype.pause.call(this)) { return false; } this._stream.pause(); return true; }; NodejsStreamInputAdapter.prototype.resume = function () { if(!GenericWorker.prototype.resume.call(this)) { return false; } if(this._upstreamEnded) { this.end(); } else { this._stream.resume(); } return true; }; module.exports = NodejsStreamInputAdapter; /***/ }), /* 106 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var utils = __webpack_require__(8); var external = __webpack_require__(21); var utf8 = __webpack_require__(17); var utils = __webpack_require__(8); var ZipEntries = __webpack_require__(107); var Crc32Probe = __webpack_require__(50); var nodejsUtils = __webpack_require__(29); /** * Check the CRC32 of an entry. * @param {ZipEntry} zipEntry the zip entry to check. * @return {Promise} the result. */ function checkEntryCRC32(zipEntry) { return new external.Promise(function (resolve, reject) { var worker = zipEntry.decompressed.getContentWorker().pipe(new Crc32Probe()); worker.on("error", function (e) { reject(e); }) .on("end", function () { if (worker.streamInfo.crc32 !== zipEntry.decompressed.crc32) { reject(new Error("Corrupted zip : CRC32 mismatch")); } else { resolve(); } }) .resume(); }); } module.exports = function(data, options) { var zip = this; options = utils.extend(options || {}, { base64: false, checkCRC32: false, optimizedBinaryString: false, createFolders: false, decodeFileName: utf8.utf8decode }); if (nodejsUtils.isNode && nodejsUtils.isStream(data)) { return external.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")); } return utils.prepareContent("the loaded zip file", data, true, options.optimizedBinaryString, options.base64) .then(function(data) { var zipEntries = new ZipEntries(options); zipEntries.load(data); return zipEntries; }).then(function checkCRC32(zipEntries) { var promises = [external.Promise.resolve(zipEntries)]; var files = zipEntries.files; if (options.checkCRC32) { for (var i = 0; i < files.length; i++) { promises.push(checkEntryCRC32(files[i])); } } return external.Promise.all(promises); }).then(function addFiles(results) { var zipEntries = results.shift(); var files = zipEntries.files; for (var i = 0; i < files.length; i++) { var input = files[i]; zip.file(input.fileNameStr, input.decompressed, { binary: true, optimizedBinaryString: true, date: input.date, dir: input.dir, comment : input.fileCommentStr.length ? input.fileCommentStr : null, unixPermissions : input.unixPermissions, dosPermissions : input.dosPermissions, createFolders: options.createFolders }); } if (zipEntries.zipComment.length) { zip.comment = zipEntries.zipComment; } return zip; }); }; /***/ }), /* 107 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var readerFor = __webpack_require__(58); var utils = __webpack_require__(8); var sig = __webpack_require__(57); var ZipEntry = __webpack_require__(110); var utf8 = __webpack_require__(17); var support = __webpack_require__(14); // class ZipEntries {{{ /** * All the entries in the zip file. * @constructor * @param {Object} loadOptions Options for loading the stream. */ function ZipEntries(loadOptions) { this.files = []; this.loadOptions = loadOptions; } ZipEntries.prototype = { /** * Check that the reader is on the specified signature. * @param {string} expectedSignature the expected signature. * @throws {Error} if it is an other signature. */ checkSignature: function(expectedSignature) { if (!this.reader.readAndCheckSignature(expectedSignature)) { this.reader.index -= 4; var signature = this.reader.readString(4); throw new Error("Corrupted zip or bug: unexpected signature " + "(" + utils.pretty(signature) + ", expected " + utils.pretty(expectedSignature) + ")"); } }, /** * Check if the given signature is at the given index. * @param {number} askedIndex the index to check. * @param {string} expectedSignature the signature to expect. * @return {boolean} true if the signature is here, false otherwise. */ isSignature: function(askedIndex, expectedSignature) { var currentIndex = this.reader.index; this.reader.setIndex(askedIndex); var signature = this.reader.readString(4); var result = signature === expectedSignature; this.reader.setIndex(currentIndex); return result; }, /** * Read the end of the central directory. */ readBlockEndOfCentral: function() { this.diskNumber = this.reader.readInt(2); this.diskWithCentralDirStart = this.reader.readInt(2); this.centralDirRecordsOnThisDisk = this.reader.readInt(2); this.centralDirRecords = this.reader.readInt(2); this.centralDirSize = this.reader.readInt(4); this.centralDirOffset = this.reader.readInt(4); this.zipCommentLength = this.reader.readInt(2); // warning : the encoding depends of the system locale // On a linux machine with LANG=en_US.utf8, this field is utf8 encoded. // On a windows machine, this field is encoded with the localized windows code page. var zipComment = this.reader.readData(this.zipCommentLength); var decodeParamType = support.uint8array ? "uint8array" : "array"; // To get consistent behavior with the generation part, we will assume that // this is utf8 encoded unless specified otherwise. var decodeContent = utils.transformTo(decodeParamType, zipComment); this.zipComment = this.loadOptions.decodeFileName(decodeContent); }, /** * Read the end of the Zip 64 central directory. * Not merged with the method readEndOfCentral : * The end of central can coexist with its Zip64 brother, * I don't want to read the wrong number of bytes ! */ readBlockZip64EndOfCentral: function() { this.zip64EndOfCentralSize = this.reader.readInt(8); this.reader.skip(4); // this.versionMadeBy = this.reader.readString(2); // this.versionNeeded = this.reader.readInt(2); this.diskNumber = this.reader.readInt(4); this.diskWithCentralDirStart = this.reader.readInt(4); this.centralDirRecordsOnThisDisk = this.reader.readInt(8); this.centralDirRecords = this.reader.readInt(8); this.centralDirSize = this.reader.readInt(8); this.centralDirOffset = this.reader.readInt(8); this.zip64ExtensibleData = {}; var extraDataSize = this.zip64EndOfCentralSize - 44, index = 0, extraFieldId, extraFieldLength, extraFieldValue; while (index < extraDataSize) { extraFieldId = this.reader.readInt(2); extraFieldLength = this.reader.readInt(4); extraFieldValue = this.reader.readData(extraFieldLength); this.zip64ExtensibleData[extraFieldId] = { id: extraFieldId, length: extraFieldLength, value: extraFieldValue }; } }, /** * Read the end of the Zip 64 central directory locator. */ readBlockZip64EndOfCentralLocator: function() { this.diskWithZip64CentralDirStart = this.reader.readInt(4); this.relativeOffsetEndOfZip64CentralDir = this.reader.readInt(8); this.disksCount = this.reader.readInt(4); if (this.disksCount > 1) { throw new Error("Multi-volumes zip are not supported"); } }, /** * Read the local files, based on the offset read in the central part. */ readLocalFiles: function() { var i, file; for (i = 0; i < this.files.length; i++) { file = this.files[i]; this.reader.setIndex(file.localHeaderOffset); this.checkSignature(sig.LOCAL_FILE_HEADER); file.readLocalPart(this.reader); file.handleUTF8(); file.processAttributes(); } }, /** * Read the central directory. */ readCentralDir: function() { var file; this.reader.setIndex(this.centralDirOffset); while (this.reader.readAndCheckSignature(sig.CENTRAL_FILE_HEADER)) { file = new ZipEntry({ zip64: this.zip64 }, this.loadOptions); file.readCentralPart(this.reader); this.files.push(file); } if (this.centralDirRecords !== this.files.length) { if (this.centralDirRecords !== 0 && this.files.length === 0) { // We expected some records but couldn't find ANY. // This is really suspicious, as if something went wrong. throw new Error("Corrupted zip or bug: expected " + this.centralDirRecords + " records in central dir, got " + this.files.length); } else { // We found some records but not all. // Something is wrong but we got something for the user: no error here. // console.warn("expected", this.centralDirRecords, "records in central dir, got", this.files.length); } } }, /** * Read the end of central directory. */ readEndOfCentral: function() { var offset = this.reader.lastIndexOfSignature(sig.CENTRAL_DIRECTORY_END); if (offset < 0) { // Check if the content is a truncated zip or complete garbage. // A "LOCAL_FILE_HEADER" is not required at the beginning (auto // extractible zip for example) but it can give a good hint. // If an ajax request was used without responseType, we will also // get unreadable data. var isGarbage = !this.isSignature(0, sig.LOCAL_FILE_HEADER); if (isGarbage) { throw new Error("Can't find end of central directory : is this a zip file ? " + "If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html"); } else { throw new Error("Corrupted zip: can't find end of central directory"); } } this.reader.setIndex(offset); var endOfCentralDirOffset = offset; this.checkSignature(sig.CENTRAL_DIRECTORY_END); this.readBlockEndOfCentral(); /* extract from the zip spec : 4) If one of the fields in the end of central directory record is too small to hold required data, the field should be set to -1 (0xFFFF or 0xFFFFFFFF) and the ZIP64 format record should be created. 5) The end of central directory record and the Zip64 end of central directory locator record must reside on the same disk when splitting or spanning an archive. */ if (this.diskNumber === utils.MAX_VALUE_16BITS || this.diskWithCentralDirStart === utils.MAX_VALUE_16BITS || this.centralDirRecordsOnThisDisk === utils.MAX_VALUE_16BITS || this.centralDirRecords === utils.MAX_VALUE_16BITS || this.centralDirSize === utils.MAX_VALUE_32BITS || this.centralDirOffset === utils.MAX_VALUE_32BITS) { this.zip64 = true; /* Warning : the zip64 extension is supported, but ONLY if the 64bits integer read from the zip file can fit into a 32bits integer. This cannot be solved : JavaScript represents all numbers as 64-bit double precision IEEE 754 floating point numbers. So, we have 53bits for integers and bitwise operations treat everything as 32bits. see https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Bitwise_Operators and http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-262.pdf section 8.5 */ // should look for a zip64 EOCD locator offset = this.reader.lastIndexOfSignature(sig.ZIP64_CENTRAL_DIRECTORY_LOCATOR); if (offset < 0) { throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator"); } this.reader.setIndex(offset); this.checkSignature(sig.ZIP64_CENTRAL_DIRECTORY_LOCATOR); this.readBlockZip64EndOfCentralLocator(); // now the zip64 EOCD record if (!this.isSignature(this.relativeOffsetEndOfZip64CentralDir, sig.ZIP64_CENTRAL_DIRECTORY_END)) { // console.warn("ZIP64 end of central directory not where expected."); this.relativeOffsetEndOfZip64CentralDir = this.reader.lastIndexOfSignature(sig.ZIP64_CENTRAL_DIRECTORY_END); if (this.relativeOffsetEndOfZip64CentralDir < 0) { throw new Error("Corrupted zip: can't find the ZIP64 end of central directory"); } } this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir); this.checkSignature(sig.ZIP64_CENTRAL_DIRECTORY_END); this.readBlockZip64EndOfCentral(); } var expectedEndOfCentralDirOffset = this.centralDirOffset + this.centralDirSize; if (this.zip64) { expectedEndOfCentralDirOffset += 20; // end of central dir 64 locator expectedEndOfCentralDirOffset += 12 /* should not include the leading 12 bytes */ + this.zip64EndOfCentralSize; } var extraBytes = endOfCentralDirOffset - expectedEndOfCentralDirOffset; if (extraBytes > 0) { // console.warn(extraBytes, "extra bytes at beginning or within zipfile"); if (this.isSignature(endOfCentralDirOffset, sig.CENTRAL_FILE_HEADER)) { // The offsets seem wrong, but we have something at the specified offset. // So… we keep it. } else { // the offset is wrong, update the "zero" of the reader // this happens if data has been prepended (crx files for example) this.reader.zero = extraBytes; } } else if (extraBytes < 0) { throw new Error("Corrupted zip: missing " + Math.abs(extraBytes) + " bytes."); } }, prepareReader: function(data) { this.reader = readerFor(data); }, /** * Read a zip file and create ZipEntries. * @param {String|ArrayBuffer|Uint8Array|Buffer} data the binary string representing a zip file. */ load: function(data) { this.prepareReader(data); this.readEndOfCentral(); this.readCentralDir(); this.readLocalFiles(); } }; // }}} end of ZipEntries module.exports = ZipEntries; /***/ }), /* 108 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var DataReader = __webpack_require__(60); var utils = __webpack_require__(8); function StringReader(data) { DataReader.call(this, data); } utils.inherits(StringReader, DataReader); /** * @see DataReader.byteAt */ StringReader.prototype.byteAt = function(i) { return this.data.charCodeAt(this.zero + i); }; /** * @see DataReader.lastIndexOfSignature */ StringReader.prototype.lastIndexOfSignature = function(sig) { return this.data.lastIndexOf(sig) - this.zero; }; /** * @see DataReader.readAndCheckSignature */ StringReader.prototype.readAndCheckSignature = function (sig) { var data = this.readData(4); return sig === data; }; /** * @see DataReader.readData */ StringReader.prototype.readData = function(size) { this.checkOffset(size); // this will work because the constructor applied the "& 0xff" mask. var result = this.data.slice(this.zero + this.index, this.zero + this.index + size); this.index += size; return result; }; module.exports = StringReader; /***/ }), /* 109 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var Uint8ArrayReader = __webpack_require__(61); var utils = __webpack_require__(8); function NodeBufferReader(data) { Uint8ArrayReader.call(this, data); } utils.inherits(NodeBufferReader, Uint8ArrayReader); /** * @see DataReader.readData */ NodeBufferReader.prototype.readData = function(size) { this.checkOffset(size); var result = this.data.slice(this.zero + this.index, this.zero + this.index + size); this.index += size; return result; }; module.exports = NodeBufferReader; /***/ }), /* 110 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var readerFor = __webpack_require__(58); var utils = __webpack_require__(8); var CompressedObject = __webpack_require__(35); var crc32fn = __webpack_require__(36); var utf8 = __webpack_require__(17); var compressions = __webpack_require__(51); var support = __webpack_require__(14); var MADE_BY_DOS = 0x00; var MADE_BY_UNIX = 0x03; /** * Find a compression registered in JSZip. * @param {string} compressionMethod the method magic to find. * @return {Object|null} the JSZip compression object, null if none found. */ var findCompression = function(compressionMethod) { for (var method in compressions) { if (!compressions.hasOwnProperty(method)) { continue; } if (compressions[method].magic === compressionMethod) { return compressions[method]; } } return null; }; // class ZipEntry {{{ /** * An entry in the zip file. * @constructor * @param {Object} options Options of the current file. * @param {Object} loadOptions Options for loading the stream. */ function ZipEntry(options, loadOptions) { this.options = options; this.loadOptions = loadOptions; } ZipEntry.prototype = { /** * say if the file is encrypted. * @return {boolean} true if the file is encrypted, false otherwise. */ isEncrypted: function() { // bit 1 is set return (this.bitFlag & 0x0001) === 0x0001; }, /** * say if the file has utf-8 filename/comment. * @return {boolean} true if the filename/comment is in utf-8, false otherwise. */ useUTF8: function() { // bit 11 is set return (this.bitFlag & 0x0800) === 0x0800; }, /** * Read the local part of a zip file and add the info in this object. * @param {DataReader} reader the reader to use. */ readLocalPart: function(reader) { var compression, localExtraFieldsLength; // we already know everything from the central dir ! // If the central dir data are false, we are doomed. // On the bright side, the local part is scary : zip64, data descriptors, both, etc. // The less data we get here, the more reliable this should be. // Let's skip the whole header and dash to the data ! reader.skip(22); // in some zip created on windows, the filename stored in the central dir contains \ instead of /. // Strangely, the filename here is OK. // I would love to treat these zip files as corrupted (see http://www.info-zip.org/FAQ.html#backslashes // or APPNOTE#4.4.17.1, "All slashes MUST be forward slashes '/'") but there are a lot of bad zip generators... // Search "unzip mismatching "local" filename continuing with "central" filename version" on // the internet. // // I think I see the logic here : the central directory is used to display // content and the local directory is used to extract the files. Mixing / and \ // may be used to display \ to windows users and use / when extracting the files. // Unfortunately, this lead also to some issues : http://seclists.org/fulldisclosure/2009/Sep/394 this.fileNameLength = reader.readInt(2); localExtraFieldsLength = reader.readInt(2); // can't be sure this will be the same as the central dir // the fileName is stored as binary data, the handleUTF8 method will take care of the encoding. this.fileName = reader.readData(this.fileNameLength); reader.skip(localExtraFieldsLength); if (this.compressedSize === -1 || this.uncompressedSize === -1) { throw new Error("Bug or corrupted zip : didn't get enough informations from the central directory " + "(compressedSize === -1 || uncompressedSize === -1)"); } compression = findCompression(this.compressionMethod); if (compression === null) { // no compression found throw new Error("Corrupted zip : compression " + utils.pretty(this.compressionMethod) + " unknown (inner file : " + utils.transformTo("string", this.fileName) + ")"); } this.decompressed = new CompressedObject(this.compressedSize, this.uncompressedSize, this.crc32, compression, reader.readData(this.compressedSize)); }, /** * Read the central part of a zip file and add the info in this object. * @param {DataReader} reader the reader to use. */ readCentralPart: function(reader) { this.versionMadeBy = reader.readInt(2); reader.skip(2); // this.versionNeeded = reader.readInt(2); this.bitFlag = reader.readInt(2); this.compressionMethod = reader.readString(2); this.date = reader.readDate(); this.crc32 = reader.readInt(4); this.compressedSize = reader.readInt(4); this.uncompressedSize = reader.readInt(4); var fileNameLength = reader.readInt(2); this.extraFieldsLength = reader.readInt(2); this.fileCommentLength = reader.readInt(2); this.diskNumberStart = reader.readInt(2); this.internalFileAttributes = reader.readInt(2); this.externalFileAttributes = reader.readInt(4); this.localHeaderOffset = reader.readInt(4); if (this.isEncrypted()) { throw new Error("Encrypted zip are not supported"); } // will be read in the local part, see the comments there reader.skip(fileNameLength); this.readExtraFields(reader); this.parseZIP64ExtraField(reader); this.fileComment = reader.readData(this.fileCommentLength); }, /** * Parse the external file attributes and get the unix/dos permissions. */ processAttributes: function () { this.unixPermissions = null; this.dosPermissions = null; var madeBy = this.versionMadeBy >> 8; // Check if we have the DOS directory flag set. // We look for it in the DOS and UNIX permissions // but some unknown platform could set it as a compatibility flag. this.dir = this.externalFileAttributes & 0x0010 ? true : false; if(madeBy === MADE_BY_DOS) { // first 6 bits (0 to 5) this.dosPermissions = this.externalFileAttributes & 0x3F; } if(madeBy === MADE_BY_UNIX) { this.unixPermissions = (this.externalFileAttributes >> 16) & 0xFFFF; // the octal permissions are in (this.unixPermissions & 0x01FF).toString(8); } // fail safe : if the name ends with a / it probably means a folder if (!this.dir && this.fileNameStr.slice(-1) === '/') { this.dir = true; } }, /** * Parse the ZIP64 extra field and merge the info in the current ZipEntry. * @param {DataReader} reader the reader to use. */ parseZIP64ExtraField: function(reader) { if (!this.extraFields[0x0001]) { return; } // should be something, preparing the extra reader var extraReader = readerFor(this.extraFields[0x0001].value); // I really hope that these 64bits integer can fit in 32 bits integer, because js // won't let us have more. if (this.uncompressedSize === utils.MAX_VALUE_32BITS) { this.uncompressedSize = extraReader.readInt(8); } if (this.compressedSize === utils.MAX_VALUE_32BITS) { this.compressedSize = extraReader.readInt(8); } if (this.localHeaderOffset === utils.MAX_VALUE_32BITS) { this.localHeaderOffset = extraReader.readInt(8); } if (this.diskNumberStart === utils.MAX_VALUE_32BITS) { this.diskNumberStart = extraReader.readInt(4); } }, /** * Read the central part of a zip file and add the info in this object. * @param {DataReader} reader the reader to use. */ readExtraFields: function(reader) { var end = reader.index + this.extraFieldsLength, extraFieldId, extraFieldLength, extraFieldValue; if (!this.extraFields) { this.extraFields = {}; } while (reader.index < end) { extraFieldId = reader.readInt(2); extraFieldLength = reader.readInt(2); extraFieldValue = reader.readData(extraFieldLength); this.extraFields[extraFieldId] = { id: extraFieldId, length: extraFieldLength, value: extraFieldValue }; } }, /** * Apply an UTF8 transformation if needed. */ handleUTF8: function() { var decodeParamType = support.uint8array ? "uint8array" : "array"; if (this.useUTF8()) { this.fileNameStr = utf8.utf8decode(this.fileName); this.fileCommentStr = utf8.utf8decode(this.fileComment); } else { var upath = this.findExtraFieldUnicodePath(); if (upath !== null) { this.fileNameStr = upath; } else { // ASCII text or unsupported code page var fileNameByteArray = utils.transformTo(decodeParamType, this.fileName); this.fileNameStr = this.loadOptions.decodeFileName(fileNameByteArray); } var ucomment = this.findExtraFieldUnicodeComment(); if (ucomment !== null) { this.fileCommentStr = ucomment; } else { // ASCII text or unsupported code page var commentByteArray = utils.transformTo(decodeParamType, this.fileComment); this.fileCommentStr = this.loadOptions.decodeFileName(commentByteArray); } } }, /** * Find the unicode path declared in the extra field, if any. * @return {String} the unicode path, null otherwise. */ findExtraFieldUnicodePath: function() { var upathField = this.extraFields[0x7075]; if (upathField) { var extraReader = readerFor(upathField.value); // wrong version if (extraReader.readInt(1) !== 1) { return null; } // the crc of the filename changed, this field is out of date. if (crc32fn(this.fileName) !== extraReader.readInt(4)) { return null; } return utf8.utf8decode(extraReader.readData(upathField.length - 5)); } return null; }, /** * Find the unicode comment declared in the extra field, if any. * @return {String} the unicode comment, null otherwise. */ findExtraFieldUnicodeComment: function() { var ucommentField = this.extraFields[0x6375]; if (ucommentField) { var extraReader = readerFor(ucommentField.value); // wrong version if (extraReader.readInt(1) !== 1) { return null; } // the crc of the comment changed, this field is out of date. if (crc32fn(this.fileComment) !== extraReader.readInt(4)) { return null; } return utf8.utf8decode(extraReader.readData(ucommentField.length - 5)); } return null; } }; module.exports = ZipEntry; /***/ }), /* 111 */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(setImmediate, global) { !function (e, n) { true ? n() : undefined }(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); } }; Object.getOwnPropertyDescriptors = function (o) { var res = {}; for (var key in o) { res[key] = Object.getOwnPropertyDescriptor(o, key); } return res; }; // polifill is needed because it work on kindle 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; }; } })(); //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__(11))) /***/ }), /* 112 */ /***/ (function(module, exports, __webpack_require__) { var content = __webpack_require__(113); if(typeof content === 'string') content = [[module.i, content, '']]; var transform; var insertInto; var options = {"hmr":true} options.transform = transform options.insertInto = undefined; var update = __webpack_require__(5)(content, options); if(content.locals) module.exports = content.locals; if(false) {} /***/ }), /* 113 */ /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__(4)(false); // Module exports.push([module.i, ".as-center-table {\r\n display: table;\r\n}\r\n\r\n.as-center-cell {\r\n display: table-cell;\r\n}\r\n\r\n.as-relative-layout {\r\n position: relative;\r\n}\r\n\r\n.as-relative-layout>.as-relative-anchor-box {\r\n position: absolute;\r\n z-index: 1;\r\n}\r\n\r\n\r\n.as-relative-anchor-box {\r\n pointer-events: none;\r\n}\r\n\r\n\r\n\r\n/*\r\n width: auto | set\r\n left: set\r\n right: unset,\r\n*/\r\n.as-relative-layout>.as-relative-anchor-box.as-halign-left {\r\n left: 0;\r\n}\r\n\r\n/*\r\n width: auto | set\r\n right: set\r\n left: unset,\r\n*/\r\n.as-relative-layout>.as-relative-anchor-box.as-halign-right {\r\n right: 0;\r\n}\r\n\r\n/*\r\n left: unset\r\n right: unset\r\n width: auto | set\r\n warning: inner element should be set text-align to default to prevent error \r\n*/\r\n.as-relative-layout>.as-relative-anchor-box.as-halign-center {\r\n left: 0;\r\n right: 0;\r\n text-align: center;\r\n}\r\n\r\n/*\r\n left: set\r\n right: set\r\n width: unset\r\n*/\r\n.as-relative-layout>.as-relative-anchor-box.as-halign-fixed {\r\n left: 0;\r\n right: 0;\r\n}\r\n\r\n.as-relative-layout>.as-relative-anchor-box.as-halign-fixed>.as-base-component,\r\n.as-relative-layout>.as-relative-anchor-box.as-halign-fixed>.as-center-table,\r\n.as-relative-layout>.as-relative-anchor-box.as-halign-fixed>.as-center-table>.as-center-cell>.as-base-component {\r\n width: 100%;\r\n}\r\n\r\n\r\n\r\n.as-relative-layout>.as-relative-anchor-box.as-halign-center>.as-base-component {\r\n display: inline-block;\r\n}\r\n\r\n.as-relative-layout>.as-relative-anchor-box.as-halign-center>table.as-base-component {\r\n display: inline-table;\r\n}\r\n\r\n/*\r\n top: set\r\n height: auto | set\r\n bottom: unset\r\n*/\r\n.as-relative-layout>.as-relative-anchor-box.as-valign-top {\r\n top: 0;\r\n}\r\n\r\n\r\n/*\r\n bottom: set\r\n height: auto | set\r\n top: unset\r\n*/\r\n.as-relative-layout>.as-relative-anchor-box.as-valign-bottom {\r\n bottom: 0;\r\n}\r\n\r\n/*\r\n bottom: set\r\n height: unset\r\n top: set\r\n*/\r\n.as-relative-layout>.as-relative-anchor-box.as-valign-fixed {\r\n bottom: 0;\r\n top: 0\r\n}\r\n\r\n.as-relative-layout>.as-relative-anchor-box.as-valign-fixed>* {\r\n height: 100%;\r\n}\r\n\r\n\r\n.as-relative-layout>.as-relative-anchor-box.as-valign-center {\r\n top: 0;\r\n bottom: 0;\r\n}\r\n\r\n.as-relative-layout>.as-relative-anchor-box.as-valign-center>.as-center-table {\r\n height: 100%;\r\n}\r\n\r\n.as-relative-layout>.as-relative-anchor-box.as-valign-center>.as-center-table>.as-center-cell {\r\n vertical-align: middle;\r\n}\r\n\r\n\r\n.as-relative-layout>.as-relative-anchor-box.as-valign-center.as-halign-center>.as-center-table {\r\n width: 100%;\r\n}\r\n\r\n\r\n.as-base-component {\r\n pointer-events: all;\r\n box-sizing: border-box;\r\n}\r\n\r\n.as-base-component textarea {\r\n resize: none;\r\n}\r\n\r\n.as-component-content-scaleless,\r\n.as-relative-layout>.as-relative-anchor-box.as-halign-center>.as-component-content-scaleless {\r\n display: inline-table;\r\n}\r\n\r\n.as-component-content-scaleless-cell {\r\n display: table-cell;\r\n width: 100%;\r\n}\r\n\r\n.as-linear-layout::before {\r\n content: \"\";\r\n display: block;\r\n height: 1px;\r\n margin-bottom: -1px;\r\n}\r\n\r\n.as-linear-anchor-box {\r\n display: block;\r\n}", ""]); /***/ }), /* 114 */ /***/ (function(module, exports) { /** * When source maps are enabled, `style-loader` uses a link element with a data-uri to * embed the css on the page. This breaks all relative urls because now they are relative to a * bundle instead of the current page. * * One solution is to only use full urls, but that may be impossible. * * Instead, this function "fixes" the relative urls to be absolute according to the current page location. * * A rudimentary test suite is located at `test/fixUrls.js` and can be run via the `npm test` command. * */ module.exports = function (css) { // get current location var location = typeof window !== "undefined" && window.location; if (!location) { throw new Error("fixUrls requires window.location"); } // blank or null? if (!css || typeof css !== "string") { return css; } var baseUrl = location.protocol + "//" + location.host; var currentDir = baseUrl + location.pathname.replace(/\/[^\/]*$/, "/"); // convert each url(...) /* This regular expression is just a way to recursively match brackets within a string. /url\s*\( = Match on the word "url" with any whitespace after it and then a parens ( = Start a capturing group (?: = Start a non-capturing group [^)(] = Match anything that isn't a parentheses | = OR \( = Match a start parentheses (?: = Start another non-capturing groups [^)(]+ = Match anything that isn't a parentheses | = OR \( = Match a start parentheses [^)(]* = Match anything that isn't a parentheses \) = Match a end parentheses ) = End Group *\) = Match anything and then a close parens ) = Close non-capturing group * = Match anything ) = Close capturing group \) = Match a close parens /gi = Get all matches, not the first. Be case insensitive. */ var fixedCss = css.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi, function(fullMatch, origUrl) { // strip quotes (if they exist) var unquotedOrigUrl = origUrl .trim() .replace(/^"(.*)"$/, function(o, $1){ return $1; }) .replace(/^'(.*)'$/, function(o, $1){ return $1; }); // already a full url? no change if (/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(unquotedOrigUrl)) { return fullMatch; } // convert the url to a full url var newUrl; if (unquotedOrigUrl.indexOf("//") === 0) { //TODO: should we add protocol? newUrl = unquotedOrigUrl; } else if (unquotedOrigUrl.indexOf("/") === 0) { // path should be relative to the base url newUrl = baseUrl + unquotedOrigUrl; // already starts with '/' } else { // path should be relative to current directory newUrl = currentDir + unquotedOrigUrl.replace(/^\.\//, ""); // Strip leading './' } // send back the fixed url(...) return "url(" + JSON.stringify(newUrl) + ")"; }); // send back the fixed css return fixedCss; }; /***/ }), /* 115 */ /***/ (function(module, exports, __webpack_require__) { var content = __webpack_require__(116); if(typeof content === 'string') content = [[module.i, content, '']]; var transform; var insertInto; var options = {"hmr":true} options.transform = transform options.insertInto = undefined; var update = __webpack_require__(5)(content, options); if(content.locals) module.exports = content.locals; if(false) {} /***/ }), /* 116 */ /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__(4)(false); // Module exports.push([module.i, ".as-layout-editor {\r\n position: relative;\r\n box-sizing: border-box;\r\n}\r\n\r\n\r\n.as-layout-editor-v-align-line,\r\n.as-layout-editor-h-align-line {\r\n position: absolute;\r\n\r\n}\r\n\r\n\r\n.as-layout-editor-h-align-line {\r\n left: 0;\r\n right: 0;\r\n border-top: dashed 1px rgba(59, 154, 209, 0.753);\r\n}\r\n\r\n.as-layout-editor-v-align-line {\r\n top: 0;\r\n bottom: 0;\r\n border-left: dashed 1px rgba(59, 154, 209, 0.753);\r\n}\r\n\r\n\r\n\r\n.as-layout-editor-space-container {\r\n position: absolute;\r\n top: 1.5em;\r\n left: 1.5em;\r\n right: 0;\r\n bottom: 0;\r\n}\r\n\r\n.as-layout-editor-space {\r\n display: inline-block;\r\n position: relative;\r\n}\r\n\r\n\r\n.as-layout-editor-layout-container {\r\n padding: 0.4em;\r\n display: inline-block;\r\n}\r\n\r\n.as-layout-editor-layout-container>.as-relative-layout,\r\n.as-layout-editor-layout-container>.as-linear-layout {\r\n -webkit-box-shadow: 1px 1px 15px 0px rgba(0, 0, 0, 0.75);\r\n -moz-box-shadow: 1px 1px 15px 0px rgba(0, 0, 0, 0.75);\r\n box-shadow: 1px 1px 15px 0px rgba(0, 0, 0, 0.75);\r\n}\r\n\r\n\r\n.as-layout-editor-forceground-container {\r\n position: absolute;\r\n left: 0;\r\n right: 0;\r\n top: 0;\r\n bottom: 0;\r\n}\r\n\r\n\r\n.as-layout-editor-background {\r\n z-index: 0;\r\n}\r\n\r\n.as-layout-editor-layout-contaner {\r\n z-index: 1;\r\n}\r\n\r\n.as-layout-editor-forceground-container {\r\n z-index: 2;\r\n}\r\n\r\n.as-layout-editor-forceground {\r\n width: 100%;\r\n height: 100%;\r\n position: relative;\r\n}\r\n\r\n\r\n.as-layout-editor-hrule-container {\r\n position: absolute;\r\n top: 0;\r\n left: 1.5em;\r\n right: 0;\r\n height: 1.5em;\r\n z-index: 1;\r\n}\r\n\r\n.as-layout-editor-vrule-container {\r\n position: absolute;\r\n left: 0;\r\n top: 1.5em;\r\n bottom: 0;\r\n width: 1.5em;\r\n z-index: 2;\r\n\r\n}\r\n\r\n.as-layout-editor-vrule-container>.as-vruler,\r\n.as-layout-editor-hrule-container>.as-hruler {\r\n height: 100%;\r\n width: 100%;\r\n}\r\n\r\n.as-layout-editor-new-component-menu-trigger {\r\n position: absolute;\r\n width: 1.5em;\r\n height: 1.5em;\r\n top: -1.5em;\r\n left: -1.5em;\r\n}\r\n\r\n.as-layout-editor.mode-interact .as-layout-editor-forceground-container {\r\n visibility: hidden;\r\n}\r\n\r\n.as-layout-editor-mode-button-container {\r\n left: 0;\r\n top: 0;\r\n width: 1.5em;\r\n height: 1.45em;\r\n}\r\n\r\n.as-layout-editor-mode-button-container>button {\r\n border: none;\r\n width: 100%;\r\n height: 100%;\r\n padding: 0;\r\n outline: none;\r\n cursor: pointer;\r\n background-color: transparent;\r\n font-size: 1em;\r\n}\r\n\r\n.as-layout-editor-mode-button-container>button:hover {\r\n background-color: rgba(169, 169, 170, 0.2);\r\n}\r\n\r\n.as-layout-editor-mode-button-container>button:active {\r\n background-color: rgba(169, 169, 170, 0.4);\r\n}\r\n\r\n.as-layout-editor-mode-button-container .mdi {\r\n display: none;\r\n}\r\n\r\n.as-layout-editor.mode-interact>.as-layout-editor-mode-button-container .mdi-play-outline {\r\n display: inline;\r\n}\r\n\r\n.as-layout-editor.mode-design>.as-layout-editor-mode-button-container .mdi-pencil-box-multiple-outline {\r\n display: inline;\r\n}\r\n\r\n.as-layout-editor-layout-container .as-base-component .as-relative-layout,\r\n.as-layout-editor-layout-container .as-base-component .as-linear-layout {\r\n -webkit-box-shadow: 0px 0px 0px 1px rgba(169, 169, 255, 0.8);\r\n -moz-box-shadow: 0px 0px 0px 1px rgba(169, 169, 255, 0.8);\r\n box-shadow: 0px 0px 0px 1px rgba(169, 169, 255, 0.8);\r\n}", ""]); /***/ }), /* 117 */ /***/ (function(module, exports, __webpack_require__) { var content = __webpack_require__(118); if(typeof content === 'string') content = [[module.i, content, '']]; var transform; var insertInto; var options = {"hmr":true} options.transform = transform options.insertInto = undefined; var update = __webpack_require__(5)(content, options); if(content.locals) module.exports = content.locals; if(false) {} /***/ }), /* 118 */ /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__(4)(false); // Module exports.push([module.i, ".absol-span-input {\r\n white-space: pre;\r\n}\r\n\r\n.absol-span-input:focus {\r\n outline-color: rgba(30, 150, 255, 0.3);\r\n outline-width: 1px;\r\n}\r\n\r\n.absol-span-input:empty::before {\r\n content: \" \";\r\n display: inline;\r\n white-space: pre;\r\n}\r\n\r\n.absol-span-input.absol-span-input-empty-minus:empty::before {\r\n content: \"-\";\r\n}", ""]); /***/ }), /* 119 */ /***/ (function(module, exports, __webpack_require__) { var content = __webpack_require__(120); if(typeof content === 'string') content = [[module.i, content, '']]; var transform; var insertInto; var options = {"hmr":true} options.transform = transform options.insertInto = undefined; var update = __webpack_require__(5)(content, options); if(content.locals) module.exports = content.locals; if(false) {} /***/ }), /* 120 */ /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__(4)(false); // Module exports.push([module.i, "button.absol-button {\r\n text-align: left;\r\n background-color: #ebebeb;\r\n border: solid 1px #c0c0c0;\r\n border-radius: 0.2em;\r\n font-size: 1em;\r\n overflow: hidden;\r\n height: 2em;\r\n}\r\n\r\n.absol-icon-button {\r\n text-align: left;\r\n padding: 0;\r\n margin: 0;\r\n background-color: #ebebeb;\r\n border: solid 1px #c0c0c0;\r\n border-radius: 0.2em;\r\n font-size: 1em;\r\n overflow: hidden;\r\n line-height: 2em;\r\n box-sizing: content-box;\r\n height: 2em;\r\n white-space: nowrap; \r\n \r\n}\r\n\r\n.absol-icon-button,\r\n.absol-icon-button *{\r\n -webkit-user-select: none; /* Chrome 49+ */\r\n -moz-user-select: none; /* Firefox 43+ */\r\n -ms-user-select: none; /* No support yet */\r\n user-select: none;\r\n}\r\n\r\n\r\n.absol-icon-button:hover {\r\n background-color: rgb(213, 213, 213);\r\n}\r\n\r\n.absol-icon-button:active {\r\n -webkit-box-shadow: inset 0 0.2em 0.25em rgba(0, 0, 0, 0.125);\r\n box-shadow: inset 0 0.2em 0.25em rgba(0, 0, 0, 0.125);\r\n}\r\n\r\n.absol-icon-button:focus {\r\n outline: none;\r\n}\r\n\r\n.absol-icon-button-icon-container {\r\n display: inline-block;\r\n vertical-align: middle;\r\n width: 2em;\r\n height: 2em;\r\n text-align: center;\r\n background-color: rgba(0, 0, 0, 0.0893617021);\r\n line-height: inherit;\r\n box-sizing: border-box;\r\n}\r\n\r\n.absol-icon-button-icon-container>i {\r\n font-size: 1em;\r\n color: rgb(146, 146, 146);\r\n line-height: inherit;\r\n}\r\n\r\n.absol-icon-button-icon-container>svg {\r\n width: 1em;\r\n height: 1em;\r\n}\r\n\r\n.absol-icon-button-text-container:empty,\r\n.absol-icon-button-icon-container:empty {\r\n display: none;\r\n}\r\n\r\n.absol-icon-button-text-container {\r\n border-left: solid 1px #c0c0c0;\r\n display: inline-block;\r\n vertical-align: middle;\r\n height: 2em;\r\n box-sizing: border-box;\r\n line-height: 2em;\r\n text-align: center;\r\n}\r\n\r\n.absol-icon-button-text-container>span,\r\n.absol-icon-button-text-container>div {\r\n font-size: 1em;\r\n text-align: center;\r\n margin-left: 0.7em;\r\n margin-right: 0.7em;\r\n line-height: inherit;\r\n}\r\n\r\n.absol-icon-button.primary,\r\n.absol-button.primary {\r\n border-color: #357ebd;\r\n background-color: #428bca;\r\n color: white;\r\n}\r\n\r\n.absol-icon-button.primary .absol-icon-button-icon-container>i {\r\n color: white;\r\n}\r\n\r\n.absol-icon-button.primary .absol-icon-button-text-container {\r\n border-left-color: #357ebd;\r\n}\r\n\r\n.absol-icon-button.success,\r\n.absol-button.success {\r\n border-color: #398439;\r\n background-color: #47a447;\r\n color: white;\r\n}\r\n\r\n.absol-icon-button.success .absol-icon-button-icon-container>i {\r\n color: white;\r\n}\r\n\r\n.absol-icon-button.success .absol-icon-button-text-container {\r\n border-left-color: #398439;\r\n}\r\n\r\n.absol-icon-button.warning,\r\n.absol-button.warning {\r\n background-color: #ed9c28;\r\n border-color: #d58512;\r\n color: white;\r\n}\r\n\r\n.absol-icon-button.warning .absol-icon-button-icon-container>i {\r\n color: white;\r\n}\r\n\r\n.absol-icon-button.warning .absol-icon-button-text-container {\r\n border-left-color: #d58512;\r\n}\r\n\r\n.absol-icon-button.danger,\r\n.absol-button.danger {\r\n background-color: #d2322d;\r\n border-color: #ac2925;\r\n color: white;\r\n}\r\n\r\n.absol-icon-button.danger .absol-icon-button-icon-container>i {\r\n color: white;\r\n}\r\n\r\n.absol-icon-button.danger .absol-icon-button-text-container {\r\n border-left-color: #ac2925;\r\n}\r\n\r\n.absol-icon-button.info,\r\n.absol-button.info {\r\n background-color: #5bc0de;\r\n border-color: #46b8da;\r\n color: white;\r\n}\r\n\r\n.absol-icon-button.info .absol-icon-button-icon-container>i {\r\n color: white;\r\n}\r\n\r\n.absol-icon-button.info .absol-icon-button-text-container {\r\n border-left-color: #46b8da;\r\n}", ""]); /***/ }), /* 121 */ /***/ (function(module, exports, __webpack_require__) { var content = __webpack_require__(122); if(typeof content === 'string') content = [[module.i, content, '']]; var transform; var insertInto; var options = {"hmr":true} options.transform = transform options.insertInto = undefined; var update = __webpack_require__(5)(content, options); if(content.locals) module.exports = content.locals; if(false) {} /***/ }), /* 122 */ /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__(4)(false); // Module exports.push([module.i, ".absol-vscroller {\r\n position: relative;\r\n overflow-x: hidden;\r\n}\r\n\r\n\r\n.absol-vscroller.disabled>.absol-vscroller-viewport {\r\n overflow-y: visible;\r\n margin-right: 0px;\r\n min-width: 100%;\r\n}\r\n\r\n.absol-vscroller.disabled {\r\n overflow: visible;\r\n overflow-x: visible;\r\n\r\n}\r\n\r\n\r\n.absol-vscroller-viewport {\r\n overflow-y: scroll;\r\n box-sizing: content-box;\r\n\r\n}\r\n\r\n.absol-vscroller>.absol-vscroller-viewport {\r\n max-height: 100%;\r\n}\r\n\r\n.absol-vscroller.limited-height>.absol-vscroller-viewport {\r\n max-height: inherit;\r\n}\r\n\r\n\r\n/************ hscroller ***********/\r\n.absol-hscroller {\r\n position: relative;\r\n overflow-y: hidden;\r\n}\r\n\r\n.absol-hscroller.disabled {\r\n overflow: visible;\r\n overflow-y: visible;\r\n}\r\n\r\n.absol-hscroller-viewport {\r\n overflow-x: scroll;\r\n box-sizing: content-box;\r\n min-height: calc(100% + 17px);\r\n}\r\n\r\n.absol-hscroller.disabled>.absol-hscroller-viewport {\r\n overflow-x: visible;\r\n margin-bottom: 0px;\r\n}\r\n\r\n\r\n.absol-hscroller>.absol-hscroller-viewport {\r\n max-width: 100%;\r\n}\r\n\r\n\r\n/********** scroll bar *********************/\r\n.absol-scrollbar-force-modal {\r\n position: fixed;\r\n top: 5px;\r\n left: 5px;\r\n right: 5px;\r\n bottom: 5px;\r\n z-index: 1000000;\r\n}\r\n\r\n.absol-scrollbar-container {\r\n position: absolute;\r\n right: 0;\r\n bottom: 0;\r\n z-index: 10;\r\n}\r\n\r\n.absol-scrollbar-container.vertical {\r\n top: 0;\r\n width: 7px;\r\n}\r\n\r\n.absol-scrollbar-container.horizontal {\r\n height: 7px;\r\n left: 0;\r\n}\r\n\r\n.absol-scrollbar-container>.absol-scrollbar {\r\n width: 100%;\r\n height: 100%;\r\n}\r\n\r\n\r\n\r\n\r\n\r\n.absol-scrollbar-container.vertical>.absol-scrollbar>.absol-scrollbar-button {\r\n left: 1px;\r\n right: 1px;\r\n top: 0;\r\n}\r\n\r\n.absol-scrollbar-container.horizontal>.absol-scrollbar>.absol-scrollbar-button {\r\n top: 1px;\r\n bottom: 1px;\r\n left: 0;\r\n}\r\n\r\n.absol-scrollbar {\r\n position: relative;\r\n background: transparent;\r\n}\r\n\r\n.absol-scrollbar-button {\r\n position: absolute;\r\n background-color: rgba(0, 0, 0, 0.25);\r\n border-radius: 2px;\r\n}\r\n\r\n\r\n.absol-scrollbar.absol-hidden {\r\n visibility: hidden;\r\n}", ""]); /***/ }), /* 123 */ /***/ (function(module, exports, __webpack_require__) { var content = __webpack_require__(124); if(typeof content === 'string') content = [[module.i, content, '']]; var transform; var insertInto; var options = {"hmr":true} options.transform = transform options.insertInto = undefined; var update = __webpack_require__(5)(content, options); if(content.locals) module.exports = content.locals; if(false) {} /***/ }), /* 124 */ /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__(4)(false); // Module exports.push([module.i, ".absol-number-input {\r\n text-align: right;\r\n display: inline-block;\r\n vertical-align: middle;\r\n position: relative;\r\n min-width: calc(1em + 2px);\r\n height: calc(2em + 2px);\r\n border: solid 1px #d6d6d6;\r\n font-size: 14px;\r\n box-sizing: border-box;\r\n width: 4em;\r\n}\r\n\r\n.absol-number-input-button-up-container {\r\n top: 0;\r\n}\r\n\r\n.absol-number-input-button-down-container {\r\n bottom: 0;\r\n}\r\n\r\n.absol-number-input-button-up-container,\r\n.absol-number-input-button-down-container {\r\n right: 0;\r\n position: absolute;\r\n height: 1em;\r\n width: 1em;\r\n max-height: 50%;\r\n}\r\n\r\n.absol-number-input-button-up-container>button,\r\n.absol-number-input-button-down-container>button {\r\n width: 100%;\r\n height: 100%;\r\n line-height: 1;\r\n padding: 0;\r\n border: none;\r\n box-sizing: border-box;\r\n outline: none;\r\n color: rgb(101, 101, 101);\r\n background-color: transparent;\r\n background-color: rgb(101, 101, 101, 0.05);\r\n}\r\n\r\n.absol-number-input-button-up-container>button:active,\r\n.absol-number-input-button-down-container>button:active{\r\n color: black;\r\n background-color: rgb(101, 101, 101, 0.3);\r\n}\r\n\r\n.absol-number-input-text-container {\r\n left: 0em;\r\n right: 1.2em;\r\n top: 0;\r\n bottom: 0;\r\n position: absolute;\r\n}\r\n\r\n\r\n.absol-number-input-text-container>input[type=\"text\"] {\r\n border: none;\r\n outline: none;\r\n width: 100%;\r\n height: 100%;\r\n padding: 0;\r\n text-align: right;\r\n padding-left:0.2em;\r\n padding-right: 0.2em; \r\n box-sizing: border-box;\r\n}\r\n\r\n.absol-number-input.absol-disabled{\r\n pointer-events: none;\r\n}\r\n\r\n.absol-number-input.absol-disabled{\r\n pointer-events: none;\r\n}\r\n\r\n.absol-number-input.absol-disabled .absol-number-input-button-up-container,\r\n.absol-number-input.absol-disabled .absol-number-input-button-down-container\r\n{\r\n opacity: 0.3;\r\n}", ""]); /***/ }), /* 125 */ /***/ (function(module, exports, __webpack_require__) { var content = __webpack_require__(126); if(typeof content === 'string') content = [[module.i, content, '']]; var transform; var insertInto; var options = {"hmr":true} options.transform = transform options.insertInto = undefined; var update = __webpack_require__(5)(content, options); if(content.locals) module.exports = content.locals; if(false) {} /***/ }), /* 126 */ /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__(4)(false); // Module exports.push([module.i, ".absol-search-text-input {\r\n position: relative;\r\n height: 2em;\r\n border-radius: 0.3em;\r\n border: solid 1px #a9a9a9;\r\n font-size: 14px;\r\n}\r\n\r\n.absol-search-text-input.focus {\r\n outline: solid 1px rgba(30, 30, 255, 0.4);\r\n}\r\n\r\n.absol-search-text-input-container {\r\n position: absolute;\r\n left: 0;\r\n top: 0;\r\n bottom: 0;\r\n right: 2em;\r\n}\r\n\r\n.absol-search-text-button-container {\r\n position: absolute;\r\n top: 0;\r\n right: 0;\r\n width: 2em;\r\n bottom: 0em;\r\n}\r\n\r\n.absol-search-text-button-container button {\r\n width: 100%;\r\n height: 100%;\r\n outline: none;\r\n border: none;\r\n background: transparent;\r\n padding: 0;\r\n font-size: 1em;\r\n}\r\n\r\n.absol-search-text-button-container button>svg {\r\n height: 1.14285714286em;\r\n width: 1.14285714286em;\r\n fill: rgb(132, 132, 132);\r\n}\r\n\r\n.absol-search-text-input-container input {\r\n width: 100%;\r\n height: 100%;\r\n font-size: 1em;\r\n box-sizing: border-box;\r\n outline: none;\r\n border: none;\r\n background-color: transparent;\r\n padding-left: 0.6em;\r\n}\r\n\r\n.absol-search-text-input:not(.searching) svg.times{\r\n display: none;\r\n}\r\n\r\n.absol-search-text-input.searching svg.find{\r\n display: none;\r\n}", ""]); /***/ }), /* 127 */ /***/ (function(module, exports, __webpack_require__) { var content = __webpack_require__(128); if(typeof content === 'string') content = [[module.i, content, '']]; var transform; var insertInto; var options = {"hmr":true} options.transform = transform options.insertInto = undefined; var update = __webpack_require__(5)(content, options); if(content.locals) module.exports = content.locals; if(false) {} /***/ }), /* 128 */ /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__(4)(false); // Module exports.push([module.i, ".absol-select-table-render-space {\r\n position: fixed;\r\n top: 0;\r\n left: 0;\r\n z-index: -1000;\r\n visibility: hidden;\r\n font-size: 14px;\r\n}\r\n\r\n.absol-select-table {\r\n border: solid 1px #a9a9a9;\r\n min-width: 26em;\r\n overflow: hidden;\r\n}\r\n\r\n.absol-select-table-header {\r\n display: block;\r\n position: relative;\r\n box-sizing: content-box;\r\n height: 2.2857142857em;\r\n}\r\n\r\n.absol-select-table-searchtextinput-container {\r\n position: absolute;\r\n left: 0.14285714285em;\r\n top: 0.14285714285em;\r\n height: 2em;\r\n right: 10em;\r\n /* background-color: cyan; */\r\n}\r\n\r\n.absol-select-table.disable-move-all .absol-select-table-buttons-container {\r\n display: none;\r\n}\r\n\r\n.absol-select-table.disable-move-all .absol-select-table-searchtextinput-container {\r\n right: 0.14285714285em !important;\r\n}\r\n\r\n.absol-select-table-buttons-container {\r\n position: absolute;\r\n right: 0.14285714285em;\r\n top: 0.14285714285em;\r\n width: 10.7142857143em;\r\n height: 2em;\r\n white-space: nowrap;\r\n}\r\n\r\n.absol-select-table-buttons-container>button {\r\n height: 2em;\r\n font-size: 1em;\r\n background-color: transparent;\r\n border: none;\r\n padding: 0 0.5em;\r\n margin: 0;\r\n text-decoration: underline;\r\n cursor: pointer;\r\n}\r\n\r\n.absol-select-table-buttons-container>button:focus {\r\n outline: none;\r\n}\r\n\r\n.absol-select-table-buttons-container>button:hover {\r\n color: #a9a9a9;\r\n}\r\n\r\n.absol-select-table-buttons-container>button:active {\r\n color: #a9a9ff;\r\n}\r\n\r\n.absol-select-table-body {\r\n margin: 0.14285714285em;\r\n white-space: nowrap;\r\n}\r\n\r\n.absol-select-table-items-scroller {\r\n width: 50%;\r\n display: inline-block;\r\n box-sizing: border-box;\r\n vertical-align: top;\r\n}\r\n\r\n.absol-select-table-items-scroller .absol-scroll-button {\r\n background-color: rgba(1, 1, 30, 0.1);\r\n}\r\n\r\n.absol-select-table-items-scroller .absol-scroll-bar-v-container {\r\n width: 0.69em;\r\n}\r\n\r\n.absol-select-table-selected-search-items-container,\r\n.absol-select-table-nonselected-search-items-container,\r\n.absol-select-table.searching .absol-select-table-selected-items-container,\r\n.absol-select-table.searching .absol-select-table-nonselected-items-container {\r\n display: none;\r\n}\r\n\r\n.absol-select-table.searching .absol-select-table-selected-search-items-container,\r\n.absol-select-table.searching .absol-select-table-nonselected-search-items-container {\r\n display: block;\r\n padding-right: 0.7em;\r\n}\r\n\r\n.absol-select-table-nonselected-items-container,\r\n.absol-select-table-selected-items-container {\r\n padding-right: 0.7em;\r\n}\r\n\r\n.absol-select-table-nonselected-items-container>.absol-select-table-item,\r\n.absol-select-table-selected-items-container>.absol-select-table-item,\r\n.absol-select-table-nonselected-search-items-container>.absol-select-table-item,\r\n.absol-select-table-selected-search-items-container>.absol-select-table-item {\r\n margin: 0.14285714285em;\r\n}\r\n\r\n.absol-select-table-item {\r\n display: block;\r\n line-height: 2em;\r\n min-height: 2em;\r\n position: relative;\r\n background-color: rgba(169, 169, 169, 0.05);\r\n border: solid 1px rgb(235, 235, 235);\r\n border-radius: 0.2em;\r\n overflow: hidden;\r\n -webkit-user-select: none;\r\n /* Safari 3.1+ */\r\n -moz-user-select: none;\r\n /* Firefox 2+ */\r\n -ms-user-select: none;\r\n /* IE 10+ */\r\n user-select: none;\r\n /* Standard syntax */\r\n padding-left: 0.69em;\r\n padding-right: 1.8em;\r\n box-sizing: border-box;\r\n}\r\n\r\n.absol-select-table-item:hover {\r\n background-color: rgba(169, 169, 169, 0.1);\r\n}\r\n\r\n.absol-select-table-item-right-container {\r\n right: 0.3em;\r\n bottom: 0.3em;\r\n top: 0.3em;\r\n padding: 0.2em;\r\n width: 1.4em;\r\n position: absolute;\r\n border-radius: 0.2em;\r\n box-sizing: border-box;\r\n ;\r\n}\r\n\r\n.absol-select-table-item-right-container:hover {\r\n background-color: rgba(169, 169, 169, 0.3);\r\n}\r\n\r\nspan.absol-select-table-item-text {\r\n white-space: normal;\r\n \r\n}\r\n\r\n.absol-select-table-item-right-container-table{\r\n display: table;\r\n width: 100%;\r\n height: 100%;\r\n}\r\n.absol-select-table-item-right-container-cell{\r\n display: table-cell;\r\n vertical-align: middle;\r\n}\r\n\r\n.absol-select-table-item-right-container svg {\r\n width: 1em;\r\n height: 1em;\r\n display: none;\r\n}\r\n\r\n/* clearfix\r\n.absol-select-table-none-nonselected-items-container::after,\r\n.absol-select-table-none-selected-items-container::after {\r\n content: \"\";\r\n display:table;\r\n clear: both;\r\n} */\r\n\r\n.absol-select-table-selected-items-container .absol-select-table-item-right-container svg.sub-icon,\r\n.absol-select-table-selected-search-items-container .absol-select-table-item-right-container svg.sub-icon {\r\n display: block;\r\n stroke: rgb(243, 61, 61);\r\n fill: rgb(226, 100, 100);\r\n}\r\n\r\n.absol-select-table-nonselected-items-container .absol-select-table-item-right-container svg.add-icon,\r\n.absol-select-table-nonselected-search-items-container .absol-select-table-item-right-container svg.add-icon {\r\n display: block;\r\n fill: rgb(100, 226, 167);\r\n stroke: rgb(61, 185, 243);\r\n}\r\n\r\n.absol-select-table.portrait {}", ""]); /***/ }), /* 129 */ /***/ (function(module, exports, __webpack_require__) { var content = __webpack_require__(130); if(typeof content === 'string') content = [[module.i, content, '']]; var transform; var insertInto; var options = {"hmr":true} options.transform = transform options.insertInto = undefined; var update = __webpack_require__(5)(content, options); if(content.locals) module.exports = content.locals; if(false) {} /***/ }), /* 130 */ /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__(4)(false); // Module exports.push([module.i, ".absol-ico {\r\n width: 1em;\r\n height: 1em;\r\n}\r\n\r\n.absol-button {\r\n white-space: normal;\r\n -webkit-touch-callout: none;\r\n -webkit-user-select: none;\r\n -khtml-user-select: none;\r\n -moz-user-select: none;\r\n -ms-user-select: none;\r\n user-select: none;\r\n}\r\n\r\n.absol-dropdown {\r\n position: relative;\r\n}\r\n\r\n.absol-dropdown-content {\r\n z-index: 1;\r\n position: absolute;\r\n left: 0;\r\n top: 100%;\r\n}\r\n\r\n.absol-dropdown.top>.absol-dropdown-content {\r\n top: auto;\r\n bottom: 100%;\r\n}\r\n\r\n.absol-dropdown.overlap-left>.absol-dropdown-content {\r\n left: auto;\r\n right: 0;\r\n}\r\n\r\n.absol-dropright {\r\n position: relative;\r\n}\r\n\r\n.absol-dropright-content {\r\n z-index: 1;\r\n position: absolute;\r\n left: 100%;\r\n top: 0;\r\n -webkit-touch-callout: none;\r\n -webkit-user-select: none;\r\n -khtml-user-select: none;\r\n -moz-user-select: none;\r\n -ms-user-select: none;\r\n user-select: none;\r\n}\r\n\r\n.absol-drop-hidden>.absol-dropdown-content,\r\n.absol-drop-hidden>.absol-dropright-content {\r\n visibility: hidden;\r\n}\r\n\r\n\r\n\r\n.absol-hmenu {\r\n display: inline-block;\r\n background-color: rgb(252, 252, 255);\r\n /* background-color: rgb(33, 33, 33); */\r\n\r\n}\r\n\r\n.absol-hmenu>.absol-dropdown {\r\n display: inline-block;\r\n vertical-align: middle;\r\n}\r\n\r\n.absol-hmenu-button:hover,\r\n.absol-hmenu .absol-hmenu-button-hover {\r\n\r\n background-color: rgb(175, 175, 175);\r\n}\r\n\r\n.absol-hmenu-button {\r\n padding-left: 1em;\r\n padding-right: 1em;\r\n}\r\n\r\n.absol-hmenu-button:focus {\r\n outline: none;\r\n}\r\n\r\n.absol-hmenu-button,\r\n.absol-vmenu-button {\r\n color: rgb(55, 55, 55);\r\n height: 100%;\r\n background-color: transparent;\r\n font-size: 1em;\r\n border: none;\r\n padding: 0;\r\n margin: 0;\r\n outline: none;\r\n}\r\n\r\n.absol-hmenu-button {\r\n padding-left: 1em;\r\n padding-right: 1em;\r\n}\r\n\r\n.absol-vmenu {}\r\n\r\n.absol-hmenu .absol-dropdown-content,\r\n.absol-hmenu .absol-dropright-content {\r\n padding-top: 0.4em;\r\n padding-bottom: 0.4em;\r\n background-color: rgb(252, 252, 255);\r\n -webkit-box-shadow: 2px 2px 9px 0px rgba(20, 20, 20, 1);\r\n -moz-box-shadow: 2px 2px 9px 0px rgba(20, 20, 20, 1);\r\n box-shadow: 2px 2px 9px 0px rgba(20, 20, 20, 1);\r\n}\r\n\r\n.absol-vmenu-button {\r\n text-align: left;\r\n padding-left: 0.5em;\r\n padding-right: 2em;\r\n height: 1.8em;\r\n line-height: 1.8em;\r\n white-space: nowrap;\r\n position: relative;\r\n}\r\n\r\nimg.absol-vmenu-button-icon {\r\n opacity: 0;\r\n display: none;\r\n}\r\n\r\nimg.absol-vmenu-button-icon[src] {\r\n display: block;\r\n}\r\n\r\n.absol-vmenu-button-ext-icon-container {\r\n display: inline-block;\r\n width: 1.2em;\r\n height: 1.2em;\r\n vertical-align: middle;\r\n margin-right: 0.3em;\r\n}\r\n\r\n.absol-vmenu-button-ext-icon-container>span,\r\n.absol-vmenu-button-ext-icon-container>i {\r\n font-size: 1.2em;\r\n line-height: 1;\r\n display: block;\r\n}\r\n\r\n\r\n.absol-vmenu-button-ext-icon-container>svg,\r\n.absol-vmenu-button-ext-icon-container>img {\r\n height: 1.2em;\r\n width: 1.2em;\r\n display: block;\r\n}\r\n\r\n\r\n.absol-vmenu-button-text,\r\n.absol-vmenu-button-key {\r\n display: inline-block;\r\n vertical-align: middle;\r\n}\r\n\r\n.absol-vmenu-button-key {\r\n font-style: italic;\r\n text-align: right;\r\n margin-left: 1em;\r\n}\r\n\r\n.absol-vmenu-arrow-container {\r\n position: absolute;\r\n right: 0.2em;\r\n top: 0.3em;\r\n bottom: 0.3em;\r\n}\r\n\r\n.absol-vmenu-arrow {\r\n display: block;\r\n font-size: 1em;\r\n line-height: 1.2em;\r\n}\r\n\r\n.absol-menu-item-disable .absol-vmenu-arrow {\r\n display: none;\r\n}\r\n\r\n.absol-vmenu-button:hover,\r\n.absol-vmenu .absol-vmenu-button-hover {\r\n background-color: rgb(214, 214, 217);\r\n}\r\n\r\n.absol-menu-item-disable .absol-vmenu-button:hover,\r\n.absol-menu-item-disable .absol-vmenu .absol-vmenu-button-hover,\r\n.absol-menu-item-disable .absol-hmenu-button:hover,\r\n.absol-menu-item-disable .absol-hmenu .absol-hmenu-button-hover {\r\n background-color: transparent;\r\n}\r\n\r\n.absol-vmenu-line {\r\n text-align: center;\r\n padding: 0.2em 1em;\r\n}\r\n\r\n.absol-vmenu-line>div {\r\n height: 1px;\r\n background-color: rgb(97, 97, 97);\r\n}\r\n\r\n.absol-menu-item-disable {}\r\n\r\n.absol-menu-item-disable button {\r\n color: rgb(155, 155, 159);\r\n}\r\n\r\n.dark .absol-menu-item-disable button {\r\n color: rgb(100, 100, 100);\r\n}\r\n\r\n.dark .absol-vmenu-button:hover,\r\n.dark .absol-vmenu .absol-vmenu-button-hover {\r\n background-color: rgb(9, 71, 113);\r\n}\r\n\r\n\r\n.dark .absol-hmenu .absol-dropdown-content,\r\n.dark .absol-hmenu .absol-dropright-content {\r\n background-color: rgb(37, 37, 38);\r\n}\r\n\r\n\r\n.dark .absol-hmenu-button,\r\n.dark .absol-vmenu-button {\r\n color: rgb(200, 200, 200);\r\n\r\n}\r\n\r\n\r\n.dark .absol-hmenu-button:hover,\r\n.dark .absol-hmenu .absol-hmenu-button-hover {\r\n background-color: rgb(80, 80, 80);\r\n}\r\n\r\n\r\n.dark .absol-hmenu {\r\n background-color: rgb(33, 33, 33);\r\n}\r\n\r\n/*standard-alone*/\r\n.absol-vmenu-button.standard-alone {\r\n height: 2em;\r\n border-radius: 0.3em;\r\n border: solid rgb(169, 169, 170) 1px;\r\n outline: none;\r\n}", ""]); /***/ }), /* 131 */ /***/ (function(module, exports, __webpack_require__) { var content = __webpack_require__(132); if(typeof content === 'string') content = [[module.i, content, '']]; var transform; var insertInto; var options = {"hmr":true} options.transform = transform options.insertInto = undefined; var update = __webpack_require__(5)(content, options); if(content.locals) module.exports = content.locals; if(false) {} /***/ }), /* 132 */ /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__(4)(false); // Module exports.push([module.i, ".absol-context-menu-hook {\r\n position: absolute;\r\n z-index: -100000;\r\n width: 14px;\r\n height: 14px;\r\n top: 0;\r\n opacity: 0;\r\n resize: none;\r\n cursor: default;\r\n}\r\n\r\n.absol-context-hinge-fixed-container {\r\n position: fixed;\r\n left: 0;\r\n top: 0;\r\n z-index: 1000;\r\n}\r\n\r\n.absol-context-hinge {\r\n position: relative;\r\n width: 0;\r\n height: 0;\r\n}\r\n\r\n.absol-context-hinge>.absol-context-menu {\r\n position: absolute;\r\n top: -10000px;\r\n left: -10000px;\r\n visibility: hidden;\r\n z-index: 55;\r\n display: inline-block;\r\n\r\n}\r\n\r\n.absol-context-hinge .absol-vmenu,\r\n.absol-context-hinge .absol-hmenu {\r\n padding-top: 0.4em;\r\n padding-bottom: 0.4em;\r\n /* background-color: rgb(37, 37, 38);\r\n -webkit-box-shadow: 2px 2px 9px 0px rgba(7, 7, 7, 1);\r\n -moz-box-shadow: 2px 2px 9px 0px rgb(7, 7, 7, 1);\r\n box-shadow: 2px 2px 9px 0px rgba(7, 7, 7, 1); */\r\n color: black;\r\n background-color: rgb(252, 252, 255);\r\n -webkit-box-shadow: 2px 2px 9px 0px rgba(20, 20, 20, 1);\r\n -moz-box-shadow: 2px 2px 9px 0px rgba(20, 20, 20, 1);\r\n box-shadow: 2px 2px 9px 0px rgba(20, 20, 20, 1);\r\n}\r\n\r\n.absol-context-hinge.dark .absol-hmenu,\r\n.absol-context-hinge.dark .absol-vmenu,\r\n.dark .absol-context-hinge .absol-hmenu,\r\n.dark .absol-context-hinge .absol-vmenu {\r\n background-color: rgb(37, 37, 38);\r\n}", ""]); /***/ }), /* 133 */ /***/ (function(module, exports, __webpack_require__) { var content = __webpack_require__(134); if(typeof content === 'string') content = [[module.i, content, '']]; var transform; var insertInto; var options = {"hmr":true} options.transform = transform options.insertInto = undefined; var update = __webpack_require__(5)(content, options); if(content.locals) module.exports = content.locals; if(false) {} /***/ }), /* 134 */ /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__(4)(false); // Module exports.push([module.i, ".absol-modal {\r\n position: fixed;\r\n top: 0;\r\n left: 0;\r\n right: 0;\r\n bottom: 0;\r\n box-sizing: border-box;\r\n z-index: 1000;\r\n}\r\n\r\n.absol-modal-hidden {\r\n visibility: hidden;\r\n}\r\n\r\n.absol-modal-hcenter {\r\n display: table;\r\n text-align: center;\r\n width: 100%;\r\n height: 100%;\r\n}\r\n\r\n.absol-modal-vcenter {\r\n display: table-cell;\r\n vertical-align: middle;\r\n}\r\n\r\n.absol-modal-container {\r\n display: inline-block;\r\n text-align: initial;\r\n}", ""]); /***/ }), /* 135 */ /***/ (function(module, exports, __webpack_require__) { var content = __webpack_require__(136); if(typeof content === 'string') content = [[module.i, content, '']]; var transform; var insertInto; var options = {"hmr":true} options.transform = transform options.insertInto = undefined; var update = __webpack_require__(5)(content, options); if(content.locals) module.exports = content.locals; if(false) {} /***/ }), /* 136 */ /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__(4)(false); // Module exports.push([module.i, ".absol-text-editor {\r\n position: relative;\r\n /* for dev*/\r\n outline: none;\r\n font-family: Helvetica, Arial, sans-serif;\r\n font-size: 14px;\r\n}\r\n\r\n.absol-text-editor-text-layer {\r\n cursor: text;\r\n min-height: 1.5em;\r\n\r\n}\r\n\r\n.absol-text-editor-line {\r\n height: 1.5em;\r\n white-space: pre-wrap;\r\n}\r\n\r\n\r\n.absol-text-editor-position {\r\n pointer-events: none;\r\n right: 0.5em;\r\n bottom: 0.2em;\r\n position: absolute;\r\n color: rgba(169, 169, 169, 0.7);\r\n}\r\n\r\n.absol-text-editor-forceground {\r\n position: absolute;\r\n background: transparent;\r\n left: 0;\r\n right: 0;\r\n top: 0;\r\n bottom: 0;\r\n z-index: 80;\r\n}\r\n\r\n.absol-text-editor.absol-focus .absol-text-editor-cursor {\r\n position: absolute;\r\n z-index: 100;\r\n height: 1.5em;\r\n border-left: solid 1px black;\r\n}\r\n\r\n/* \r\n.absol-text-editor-cursor {\r\n animation: blink-cursor-animation 1s steps(2, start) infinite;\r\n -webkit-animation: blink-cursor-animation 1s steps(2, start) infinite;\r\n} */\r\n\r\n/* @keyframes blink-cursor-animation {\r\n to {\r\n visibility: hidden;\r\n }\r\n}\r\n\r\n@-webkit-keyframes blink-cursor-animation {\r\n to {\r\n visibility: hidden;\r\n }\r\n} */\r\n\r\n.absol-text-editor-edittable {\r\n position: absolute;\r\n left: 0;\r\n top: 0;\r\n /* width: 10px;\r\n height: 10px; */\r\n overflow: hidden;\r\n z-index: 0;\r\n opacity: 0.1;\r\n}", ""]); /***/ }), /* 137 */ /***/ (function(module, exports, __webpack_require__) { var content = __webpack_require__(138); if(typeof content === 'string') content = [[module.i, content, '']]; var transform; var insertInto; var options = {"hmr":true} options.transform = transform options.insertInto = undefined; var update = __webpack_require__(5)(content, options); if(content.locals) module.exports = content.locals; if(false) {} /***/ }), /* 138 */ /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__(4)(false); // Module exports.push([module.i, ".vmedia-no-show {\r\n position: fixed;\r\n top: 0;\r\n left: 0;\r\n width: 1;\r\n height: 1;\r\n z-index: -100000;\r\n opacity: 0;\r\n}\r\n\r\n.vmedia-no-select,\r\n.vmedia-no-select * {\r\n -webkit-user-select: none;\r\n -moz-user-select: none;\r\n -ms-user-select: none;\r\n user-select: none;\r\n}\r\n\r\ncoccocgrammar {\r\n display: none;\r\n}\r\n\r\n.vmedia-media-input {\r\n box-sizing: border-box;\r\n border: solid 1px rgba(0, 0, 0, 0.1)\r\n}\r\n\r\n\r\n.vmedia-media-input-text-container {\r\n position: relative;\r\n min-height: 2.5em;\r\n}\r\n\r\n.vmedia-media-input-text-container-editor:focus {\r\n outline: none;\r\n}\r\n\r\n.vmedia-media-input-text-container-editor img {\r\n display: none;\r\n}\r\n\r\n.vmedia-media-input-text-container-editor * {\r\n font-family: inherit;\r\n font-size: inherit;\r\n font-weight: inherit;\r\n text-decoration: inherit;\r\n color: inherit;\r\n background: none;\r\n padding: 0;\r\n margin: 0;\r\n white-space: pre;\r\n}\r\n\r\n.vmedia-media-input-text-container-editor {\r\n min-height: 2em;\r\n padding-left: 0.5em;\r\n padding-top: 0.25em;\r\n padding-bottom: 0.25em;\r\n margin-right: 0.5em;\r\n box-sizing: border-box;\r\n max-height: 6.66666666em;\r\n overflow-x: hidden;\r\n overflow-y: auto;\r\n}\r\n\r\n.vmedia-media-input-imagepreview-container {\r\n white-space: normal;\r\n}\r\n\r\n.vmedia-media-input:not(.dragover) .vmedia-media-input-dropover {\r\n display: none;\r\n}\r\n\r\n.vmedia-media-input-dropover {\r\n display: inline-block;\r\n width: 7em;\r\n height: 7em;\r\n}\r\n\r\n.vmedia-media-input-dropover>svg {\r\n width: 7em;\r\n height: 7em;\r\n}\r\n\r\n.vmedia-media-input-imagepreview-container .vmedia-media-input-filepreview,\r\n.vmedia-media-input-imagepreview-container .vmedia-media-input-imagepreview {\r\n margin: 0.3em;\r\n vertical-align: middle;\r\n}\r\n\r\n.vmedia-media-input-filepreview,\r\n.vmedia-media-input-imagepreview {\r\n position: relative;\r\n display: inline-block;\r\n}\r\n\r\n.vmedia-media-input-imagepreview img {\r\n height: 2.5em;\r\n width: auto;\r\n}\r\n\r\n.vmedia-media-input-filepreview svg.attachment {\r\n height: 2em;\r\n width: 2em;\r\n}\r\n\r\n.vmedia-media-input-filepreview svg.times,\r\n.vmedia-media-input-imagepreview svg.times {\r\n position: absolute;\r\n top: 0.1em;\r\n right: 0.1em;\r\n width: 1em;\r\n height: 1em;\r\n fill: rgba(69, 69, 69, 0.6);\r\n}\r\n\r\n.vmedia-media-input-filepreview svg.times:hover,\r\n.vmedia-media-input-imagepreview svg.times:hover {\r\n fill: rgba(144, 144, 144, 0.6);\r\n}\r\n\r\n.vmedia-media-input-filepreview svg.times:active,\r\n.vmedia-media-input-imagepreview svg.times:active {\r\n fill: rgba(220, 220, 240, 0.6);\r\n}\r\n\r\n.vmedia-media-input-plug-button-container {\r\n position: absolute;\r\n left: 0.25em;\r\n bottom: 0.25em;\r\n top: 0.25em;\r\n}\r\n\r\n.vmedia-media-input-plug-button-container svg {\r\n height: 1.5em;\r\n width: 1.5em;\r\n vertical-align: middle;\r\n transition: transform .22s cubic-bezier(.5, 0, .4, 1);\r\n}\r\n\r\n\r\n.vmedia-media-input-plug-button-container svg path {\r\n fill: rgba(66, 133, 244, 0.7);\r\n transition: fill .22s cubic-bezier(.5, 0, .4, 1);\r\n}\r\n\r\n.vmedia-media-input.show-plugin .vmedia-media-input-plug-button svg path {\r\n fill: rgba(134, 142, 153, 0.75);\r\n}\r\n\r\n\r\n\r\n.vmedia-media-input-plug-button {\r\n padding: 0;\r\n height: 100%;\r\n width: 2em;\r\n border: none;\r\n background: transparent;\r\n outline: none;\r\n\r\n}\r\n\r\n\r\n.vmedia-media-input-plugin-content-container {\r\n position: absolute;\r\n bottom: calc(1px + 100%);\r\n opacity: 1;\r\n transition: opacity .22s cubic-bezier(.5, 0, .4, 1);\r\n background-color: white;\r\n box-sizing: border-box;\r\n border: solid 1px rgba(0, 0, 0, 0.1);\r\n z-index: 20;\r\n background: white;\r\n}\r\n\r\n.vmedia-media-input-plugin-content-container:empty{\r\n display: none;\r\n}\r\n\r\n\r\n\r\n.vmedia-media-input-tool-container {\r\n position: relative;\r\n display: block;\r\n height: 1.5em;\r\n /* background: red; */\r\n}\r\n\r\n\r\n\r\n.vmedia-media-input-tool-container-left {\r\n position: absolute;\r\n left: 0;\r\n top: 0;\r\n bottom: 0;\r\n}\r\n\r\n.vmedia-media-input-tool-container-right {\r\n position: absolute;\r\n right: 0;\r\n top: 0;\r\n bottom: 0;\r\n}\r\n\r\n.vmedia-media-input-tool-container button {\r\n width: 2.5em;\r\n height: 100%;\r\n font-size: 1em;\r\n margin-left: 0.1em;\r\n margin-right: 0.1em;\r\n border: none;\r\n background-color: transparent;\r\n border-radius: 0.4em;\r\n}\r\n\r\n.vmedia-media-input-text-container-editor {\r\n scrollbar-width: thin;\r\n}\r\n\r\n.vmedia-media-input-text-container-editor::-webkit-scrollbar {\r\n width: 7px;\r\n}\r\n\r\n\r\n\r\n.vmedia-media-input-text-container-editor::-webkit-scrollbar-track {\r\n background: rgb(240, 240, 240);\r\n}\r\n\r\n.vmedia-media-input-text-container-editor::-webkit-scrollbar-thumb {\r\n background: rgb(205, 205, 205);\r\n}\r\n\r\n.vmedia-media-input-tool-container button svg {\r\n height: 1.25em;\r\n width: 1.25em;\r\n}\r\n\r\n.vmedia-media-input-tool-container button:hover {\r\n background-color: rgba(91, 192, 222, 0.1);\r\n}\r\n\r\n.vmedia-media-input-tool-container button:active {\r\n background-color: rgba(91, 192, 222, 0.4);\r\n}\r\n\r\n.vmedia-media-input-tool-container button svg.send {\r\n fill: rgba(66, 133, 244, 0.7);\r\n}\r\n\r\n.vmedia-media-input-tool-container button svg.add-file,\r\n.vmedia-media-input-tool-container button svg.add-image {\r\n fill: rgba(66, 66, 66, 0.5);\r\n}\r\n\r\n.vmedia-media-input-tool-container button .mdi{\r\n font-size:1.2em; \r\n}\r\n\r\n.vmedia-media-input-tool-container button:focus {\r\n outline: none;\r\n}\r\n\r\n.vmedia-media-input-tool-container button{\r\n vertical-align: middle;\r\n}\r\n\r\n.vmedia-media-input-plugin-content-container.blur{\r\n visibility: hidden;\r\n}", ""]); /***/ }), /* 139 */ /***/ (function(module, exports, __webpack_require__) { var content = __webpack_require__(140); if(typeof content === 'string') content = [[module.i, content, '']]; var transform; var insertInto; var options = {"hmr":true} options.transform = transform options.insertInto = undefined; var update = __webpack_require__(5)(content, options); if(content.locals) module.exports = content.locals; if(false) {} /***/ }), /* 140 */ /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__(4)(false); // Module exports.push([module.i, ".absol-resizablelayout{\r\n position: relative;\r\n}\r\n\r\n.absol-resizablelayout.debug *,\r\n.absol-resizablelayout.debug\r\n{\r\n background-color: rgba(100, 100, 100, 0.1); \r\n}\r\n\r\n.absol-resizablelayout-cell{\r\n position: absolute;\r\n left: 0;\r\n right: 0;\r\n top: 0;\r\n bottom: 0;\r\n}", ""]); /***/ }), /* 141 */ /***/ (function(module, exports, __webpack_require__) { var content = __webpack_require__(142); if(typeof content === 'string') content = [[module.i, content, '']]; var transform; var insertInto; var options = {"hmr":true} options.transform = transform options.insertInto = undefined; var update = __webpack_require__(5)(content, options); if(content.locals) module.exports = content.locals; if(false) {} /***/ }), /* 142 */ /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__(4)(false); // Module exports.push([module.i, ".absol-autocomplete-input {\r\n display: inline-block;\r\n position: relative;\r\n box-sizing: border-box;\r\n border: solid 1px #d6d6d6;\r\n}\r\n\r\n.absol-autocomplete-input.absol-disabled {\r\n pointer-events: none;\r\n color: rgb(84, 84, 84);\r\n background-color: rgb(235, 235, 228);\r\n}\r\n\r\n.absol-autocomplete-input>input {\r\n min-width: 100%;\r\n min-height: 100%;\r\n box-sizing: border-box;\r\n background-color: transparent;\r\n border: none;\r\n}\r\n\r\n\r\n.absol-autocomplete-input-dropdown {\r\n position: absolute;\r\n left: 0;\r\n top: 100%;\r\n min-width: 100%;\r\n z-index: 1005;\r\n border: solid 1px rgb(169, 169, 169);\r\n box-sizing: border-box;\r\n background-color: white;\r\n}\r\n\r\n.absol-autocomplete-input-dropdown.top {\r\n top: auto;\r\n bottom: 100%;\r\n}\r\n\r\n.absol-autocomplete-input-item {\r\n height: 30px;\r\n}\r\n\r\n.absol-autocomplete-input-item:hover {\r\n background-color: rgb(169, 169, 169, 0.18605);\r\n cursor: pointer;\r\n}\r\n\r\n.absol-autocomplete-input-item.active,\r\n.absol-autocomplete-input-item.active:hover {\r\n background-color: rgb(169, 169, 169, 0.37209);\r\n}\r\n\r\n.absol-autocomplete-input-item-text {\r\n line-height: 30px;\r\n margin-left: 5px;\r\n margin-right: 5px;\r\n}", ""]); /***/ }), /* 143 */ /***/ (function(module, exports, __webpack_require__) { var content = __webpack_require__(144); if(typeof content === 'string') content = [[module.i, content, '']]; var transform; var insertInto; var options = {"hmr":true} options.transform = transform options.insertInto = undefined; var update = __webpack_require__(5)(content, options); if(content.locals) module.exports = content.locals; if(false) {} /***/ }), /* 144 */ /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__(4)(false); // Module exports.push([module.i, ".absol-selectlist {\r\n font-family: \"Helvetica Neue\", Arial, Helvetica, sans-serif;\r\n}\r\n\r\n.absol-selectlist .absol-selectlist-item:hover {\r\n background-color: #efefef;\r\n}\r\n\r\n.absol-selectlist .absol-selectlist-item {\r\n height: 20px;\r\n font-size: 14px;\r\n cursor: pointer;\r\n}\r\n\r\n.absol-selectlist-item.selected {\r\n background-color: #dfdfdf;\r\n}\r\n\r\n.absol-selectlist-item>span {\r\n line-height: 20px;\r\n white-space: pre;\r\n padding-left: 7px;\r\n padding-right: 7px;\r\n -webkit-user-select: none;\r\n -moz-user-select: none;\r\n -ms-user-select: none;\r\n user-select: none;\r\n}\r\n\r\n.absol-selectlist-item {\r\n position: relative;\r\n}\r\n\r\n.absol-selectlist-item-desc-container {\r\n position: absolute;\r\n right: 0.3em;\r\n top: 0;\r\n bottom: 0;\r\n}\r\n\r\n.absol-selectlist-item-desc {\r\n font-style: italic;\r\n line-height: 20px;\r\n white-space: nowrap;\r\n color: rgb(37, 37, 37);\r\n}\r\n\r\n.absol-selectlist-item-desc:empty {\r\n display: none;\r\n}", ""]); /***/ }), /* 145 */ /***/ (function(module, exports, __webpack_require__) { var content = __webpack_require__(146); if(typeof content === 'string') content = [[module.i, content, '']]; var transform; var insertInto; var options = {"hmr":true} options.transform = transform options.insertInto = undefined; var update = __webpack_require__(5)(content, options); if(content.locals) module.exports = content.locals; if(false) {} /***/ }), /* 146 */ /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__(4)(false); // Module exports.push([module.i, ".absol-selectmenu-anchor-container {\r\n /* position: fixed; */\r\n\r\n /* top: 0; */\r\n /* left: 0; */\r\n width: 0;\r\n height: 0;\r\n overflow: visible;\r\n}\r\n\r\n.absol-selectmenu-anchor {\r\n position: relative;\r\n}\r\n\r\n.absol-selectmenu-anchor-content-container {\r\n position: absolute;\r\n z-index: 1002;\r\n top: 0;\r\n left: 0;\r\n}\r\n\r\n.absol-selectmenu-anchor-content-container .absol-bscroller {\r\n max-height: calc(100vh - 50px);\r\n}\r\n\r\n\r\n.absol-selectmenu-anchor.absol-disabled .absol-selectmenu-anchor-content-container {\r\n visibility: hidden;\r\n top: -100000px;\r\n left: -10000px;\r\n z-index: -1000;\r\n opacity: 0;\r\n}\r\n\r\n\r\n.absol-selectmenu-dropdown-box {\r\n border: solid 1px rgb(169, 169, 169);\r\n box-sizing: border-box;\r\n background-color: white;\r\n display: inline-block;\r\n vertical-align: top;\r\n}\r\n\r\n.absol-selectmenu-dropdown-box .absol-search-text-input {\r\n margin: 0.2em;\r\n}\r\n\r\n\r\n\r\n.absol-selectmenu.absol-hidden {\r\n display: none !important;\r\n}\r\n\r\n.absol-selectmenu-render-space {\r\n position: fixed;\r\n top: 0;\r\n left: 0;\r\n z-index: -1000;\r\n visibility: hidden;\r\n font-size: 14px;\r\n}\r\n\r\n.absol-selectmenu-render-space>div {\r\n display: inline-block;\r\n\r\n}\r\n\r\n\r\n\r\n.absol-selectmenu.disabled {\r\n pointer-events: none;\r\n}\r\n\r\n\r\n\r\n.absol-selectmenu.disabled {\r\n background-color: #ebebe4;\r\n}\r\n\r\n\r\n.absol-selectmenu {\r\n display: inline-block;\r\n position: relative;\r\n height: 30px;\r\n min-width: 30px;\r\n border: solid 1px #d6d6d6;\r\n border-radius: 2px;\r\n box-sizing: border-box;\r\n cursor: pointer;\r\n font-size: 14px;\r\n outline: none;\r\n font-family: \"Helvetica Neue\", Arial, Helvetica, sans-serif;\r\n}\r\n\r\n/* .absol-selectmenu:hover {\r\n border: solid 1px black;\r\n} */\r\n\r\n.absol-selectmenu-btn {\r\n position: absolute;\r\n top: 0;\r\n bottom: 0;\r\n right: 0;\r\n width: 30px;\r\n border: none;\r\n background: transparent;\r\n z-index: 2;\r\n pointer-events: none;\r\n}\r\n\r\n.absol-selectmenu-btn:focus {\r\n outline: none;\r\n}\r\n\r\n.absol-selectmenu-btn svg.dropdown {\r\n width: 10px;\r\n height: 10px;\r\n fill: #929292;\r\n}\r\n\r\n.absol-selectmenu:hover svg.dropdown {\r\n width: 10px;\r\n height: 10px;\r\n fill: black;\r\n}\r\n\r\n.absol-selectmenu-holder-item {\r\n position: absolute;\r\n left: 0;\r\n right: 0;\r\n top: 4px;\r\n bottom: 4px;\r\n /*1px for border*/\r\n}\r\n\r\n\r\n\r\n\r\n\r\n.absol-selectmenu .absol-selectlist-item span {\r\n padding-right: 28px;\r\n}\r\n\r\n.absol-selectmenu .absol-scroll-button {\r\n background-color: rgba(0, 0, 0, 0.1);\r\n border-radius: 3px;\r\n}\r\n\r\n.absol-selectmenu .absol-scroll-button:hover {\r\n background-color: rgba(0, 0, 0, 0.2);\r\n}\r\n\r\n.absol-scroll-bar-v-container {\r\n width: 10px;\r\n}\r\n\r\n.absol-selectmenu .absol-search-text-input {\r\n margin: 4px;\r\n}\r\n\r\n.absol-selectmenu-render-space .absol-selectlist-item span {\r\n padding-right: 0;\r\n}\r\n\r\n\r\n\r\n.absol-selectmenu .absol-selectlist-item-desc-container {\r\n right: 40px;\r\n}", ""]); /***/ }), /* 147 */ /***/ (function(module, exports, __webpack_require__) { var content = __webpack_require__(148); if(typeof content === 'string') content = [[module.i, content, '']]; var transform; var insertInto; var options = {"hmr":true} options.transform = transform options.insertInto = undefined; var update = __webpack_require__(5)(content, options); if(content.locals) module.exports = content.locals; if(false) {} /***/ }), /* 148 */ /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__(4)(false); // Module exports.push([module.i, ".absol-tree-list {}\r\n\r\n.absol-tree-list-item {}\r\n\r\n.absol-tree-list-item-parent:hover {\r\n background: #efefef;\r\n cursor: pointer;\r\n}\r\n\r\n.absol-tree-list-item-parent {\r\n padding-left: 0.3em;\r\n padding-right: 0.6em;\r\n position: relative;\r\n}\r\n\r\n.absol-tree-list-item.active>.absol-tree-list-item-parent {\r\n background: #dfdfdf;\r\n}\r\n\r\n.absol-tree-list-item-parent>span {\r\n line-height: 20px;\r\n white-space: nowrap;\r\n}\r\n\r\n.absol-tree-list-item-child {}\r\n\r\n.absol-tree-list-item>.absol-tree-list-item-child:empty {\r\n display: none;\r\n}\r\n\r\n.absol-tree-list-item-desc-container {\r\n right: 0.3em;\r\n top: 0;\r\n bottom: 0;\r\n position: absolute;\r\n}\r\n\r\n.absol-tree-list-item-desc {\r\n font-style: italic;\r\n line-height: 20px;\r\n white-space: nowrap;\r\n margin-left: 1em;\r\n color: rgb(37, 37, 37);\r\n}\r\n\r\n.absol-tree-list-item-desc:empty {\r\n display: none;\r\n}", ""]); /***/ }), /* 149 */ /***/ (function(module, exports, __webpack_require__) { var content = __webpack_require__(150); if(typeof content === 'string') content = [[module.i, content, '']]; var transform; var insertInto; var options = {"hmr":true} options.transform = transform options.insertInto = undefined; var update = __webpack_require__(5)(content, options); if(content.locals) module.exports = content.locals; if(false) {} /***/ }), /* 150 */ /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__(4)(false); // Module exports.push([module.i, ".absol-selecttreemenu .absol-tree-list-item-desc-container{\r\n right: 30px;\r\n}\r\n\r\n\r\n.absol-selectmenu-holder-item .absol-tree-list-item-parent:hover {\r\n background-color: transparent;\r\n}", ""]); /***/ }), /* 151 */ /***/ (function(module, exports, __webpack_require__) { var content = __webpack_require__(152); if(typeof content === 'string') content = [[module.i, content, '']]; var transform; var insertInto; var options = {"hmr":true} options.transform = transform options.insertInto = undefined; var update = __webpack_require__(5)(content, options); if(content.locals) module.exports = content.locals; if(false) {} /***/ }), /* 152 */ /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__(4)(false); // Module exports.push([module.i, "\r\n\r\n.absol-selectbox {\r\n position: relative;\r\n min-height: 30px;\r\n min-width: 40px;\r\n border: solid 1px #d6d6d6;\r\n border-radius: 3px;\r\n box-sizing: border-box;\r\n cursor: pointer;\r\n padding-right: 20px;\r\n}\r\n\r\n.absol-selectbox {\r\n white-space: normal;\r\n}\r\n\r\n.absol-selectbox .absol-selectbox-item {\r\n margin: 2px;\r\n}\r\n\r\n\r\n.absol-selectbox-item {\r\n display: inline-block;\r\n position: relative;\r\n height: 20px;\r\n border-radius: 2px;\r\n overflow: hidden;\r\n background-color: #5bc0de;\r\n border-color: #46b8da;\r\n font-size: 14px;\r\n vertical-align: top;\r\n white-space: normal;\r\n}\r\n\r\n.absol-selectbox-item-text {\r\n height: 20px;\r\n padding-right: 25px;\r\n color: white;\r\n padding-left: 5px;\r\n}\r\n\r\n.absol-selectbox-item-text:hover {\r\n background-color: rgba(0, 0, 0, 0.0893617021);\r\n}\r\n\r\n.absol-selectbox-item-text span {\r\n line-height: 20px;\r\n white-space: nowrap;\r\n}\r\n\r\n.absol-selectbox-item-close {\r\n position: absolute;\r\n right: 0;\r\n top: 0;\r\n bottom: 0;\r\n width: 20px;\r\n font-size: 10px;\r\n text-align: center;\r\n -webkit-user-select: none;\r\n -moz-user-select: none;\r\n -ms-user-select: none;\r\n user-select: none;\r\n cursor: pointer;\r\n background-color: rgba(0, 0, 0, 0.0893617021);\r\n}\r\n\r\n.absol-selectbox-item-close span {\r\n font-size: 10px;\r\n color: white;\r\n line-height: 20px;\r\n}\r\n\r\n.absol-selectbox {\r\n display: inline-block;\r\n vertical-align: middle;\r\n}\r\n\r\n.absol-selectbox .absol-search-text-input {\r\n margin: 4px;\r\n}\r\n\r\n.absol-selectbox:not(.focus) .absol-selectmenu-dropdown-box {\r\n display: none;\r\n}\r\n\r\n\r\n\r\n.absol-selectbox .absol-selectlist-item.selected {\r\n display: none;\r\n}", ""]); /***/ }), /* 153 */ /***/ (function(module, exports, __webpack_require__) { var content = __webpack_require__(154); if(typeof content === 'string') content = [[module.i, content, '']]; var transform; var insertInto; var options = {"hmr":true} options.transform = transform options.insertInto = undefined; var update = __webpack_require__(5)(content, options); if(content.locals) module.exports = content.locals; if(false) {} /***/ }), /* 154 */ /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__(4)(false); // Module exports.push([module.i, ".absol-radio {\r\n display: inline;\r\n cursor: pointer;\r\n}\r\n\r\n.absol-radio input {\r\n display: none;\r\n}\r\n\r\n.absol-radio label {\r\n white-space: pre;\r\n cursor: inherit;\r\n vertical-align: middle;\r\n margin: 0;\r\n}\r\n\r\n.absol-radio>svg {\r\n display: inline-block;\r\n vertical-align: middle;\r\n width: 18px;\r\n height: 18px;\r\n}\r\n\r\n.absol-radio>svg .bound {\r\n stroke: #929292;\r\n fill: white;\r\n}\r\n\r\n.absol-radio:hover>svg .bound {\r\n fill: #d6d6d6;\r\n stroke: black;\r\n}\r\n\r\n/* \r\n.absol-radio>svg .bound {\r\n fill: none;\r\n} */\r\n\r\n.absol-radio-icon .border {}\r\n\r\n.absol-radio .dot {\r\n transition: opacity 0.07s;\r\n opacity: 0;\r\n fill: #606060;\r\n}\r\n\r\n.absol-radio:hover .dot {\r\n transition: opacity 0.07s;\r\n opacity: 0;\r\n fill: black;\r\n}\r\n\r\n.absol-radio.checked .dot {\r\n opacity: 1;\r\n transition: opacity 0.1s;\r\n}\r\n\r\n.absol-radio:not(.right) .absol-radio-icon-right {\r\n display: none;\r\n}\r\n\r\n.absol-radio:not(.right) label {\r\n padding-left: 5px;\r\n}\r\n\r\n.absol-radio.right label {\r\n padding-right: 5px;\r\n}\r\n\r\n.absol-radio.right .absol-radio-icon-left {\r\n display: none;\r\n}\r\n\r\n.absol-radio.disabled {\r\n cursor: default;\r\n}\r\n\r\n.absol-radio.disabled:hover .dot,\r\n.absol-radio.disabled .dot {\r\n fill: #929292;\r\n}\r\n\r\n.absol-radio.disabled .bound,\r\n.absol-radio.disabled:hover .bound {\r\n stroke: #929292;\r\n fill: #ebebe4;\r\n}\r\n\r\n\r\n.absol-radio .standar-alone {\r\n display: inline-block;\r\n}", ""]); /***/ }), /* 155 */ /***/ (function(module, exports, __webpack_require__) { var content = __webpack_require__(156); if(typeof content === 'string') content = [[module.i, content, '']]; var transform; var insertInto; var options = {"hmr":true} options.transform = transform options.insertInto = undefined; var update = __webpack_require__(5)(content, options); if(content.locals) module.exports = content.locals; if(false) {} /***/ }), /* 156 */ /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__(4)(false); // Module exports.push([module.i, ".absol-switch {\r\n position: relative;\r\n display: inline-block;\r\n width: 2.2em;\r\n height: 1.2em;\r\n vertical-align: middle;\r\n}\r\n\r\n.absol-switch input {\r\n opacity: 0;\r\n width: 0;\r\n height: 0;\r\n}\r\n\r\n.absol-switch-slider {\r\n position: absolute;\r\n cursor: pointer;\r\n top: 0;\r\n left: 0;\r\n right: 0;\r\n bottom: 0;\r\n background-color: #ccc;\r\n -webkit-transition: .4s;\r\n transition: .4s;\r\n border-radius: 0.6em;\r\n}\r\n\r\n.absol-switch-slider:before {\r\n position: absolute;\r\n content: \"\";\r\n height: 1em;\r\n width: 1em;\r\n left: 0.1em;\r\n bottom: 0.1em;\r\n background-color: white;\r\n -webkit-transition: .4s;\r\n transition: .4s;\r\n border-radius: 0.5em;\r\n}\r\n\r\ninput:checked+.absol-switch-slider {\r\n background-color: #2196F3;\r\n}\r\n\r\ninput:focus+.absol-switch-slider {\r\n box-shadow: 0 0 1px #2196F3;\r\n}\r\n\r\ninput:checked+.absol-switch-slider:before {\r\n -webkit-transform: translateX(1em);\r\n -ms-transform: translateX(1em);\r\n transform: translateX(1em);\r\n}\r\n\r\n/* Rounded absol-switch-sliders */\r\n.absol-switch.square .absol-switch-slider {\r\n border-radius: 0;\r\n}\r\n\r\n.absol-switch.square .absol-switch-slider:before {\r\n border-radius: 0;\r\n}\r\n\r\n.absol-switch.disabled {\r\n pointer-events: none;\r\n}\r\n\r\n.absol-switch.disabled .absol-switch-slider:before{\r\n background-color: rgb(234, 234, 234);\r\n}\r\n\r\n.absol-switch.disabled input:checked+.absol-switch-slider {\r\n background-color: rgb(141, 188, 226);\r\n}\r\n\r\n.absol-switch.disabled .absol-switch-slider {\r\n background-color: rgb(171, 171, 171);\r\n}\r\n\r\n", ""]); /***/ }), /* 157 */ /***/ (function(module, exports, __webpack_require__) { var content = __webpack_require__(158); if(typeof content === 'string') content = [[module.i, content, '']]; var transform; var insertInto; var options = {"hmr":true} options.transform = transform options.insertInto = undefined; var update = __webpack_require__(5)(content, options); if(content.locals) module.exports = content.locals; if(false) {} /***/ }), /* 158 */ /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__(4)(false); // Module exports.push([module.i, "\r\n.absol-checkbox {\r\n display: inline;\r\n cursor: pointer;\r\n}\r\n\r\n.absol-checkbox input {\r\n display: none;\r\n}\r\n\r\n.absol-checkbox label {\r\n white-space: pre;\r\n cursor: inherit;\r\n vertical-align: middle;\r\n margin: 0;\r\n}\r\n\r\n.absol-checkbox>svg {\r\n display: inline-block;\r\n vertical-align: middle;\r\n width: 18px;\r\n height: 18px;\r\n}\r\n\r\n.absol-checkbox>svg .bound {\r\n stroke: #929292;\r\n fill: white;\r\n}\r\n\r\n.absol-checkbox:hover>svg .bound {\r\n fill: #d6d6d6;\r\n stroke: black;\r\n}\r\n\r\n/* \r\n.absol-checkbox>svg .bound {\r\n fill: none;\r\n} */\r\n\r\n.absol-checkbox-icon .border {}\r\n\r\n.absol-checkbox .tick {\r\n transition: opacity 0.07s;\r\n opacity: 0;\r\n fill: #606060;\r\n}\r\n\r\n.absol-checkbox:hover .tick {\r\n transition: opacity 0.07s;\r\n opacity: 0;\r\n fill: black;\r\n}\r\n\r\n.absol-checkbox.checked .tick {\r\n opacity: 1;\r\n transition: opacity 0.1s;\r\n}\r\n\r\n.absol-checkbox:not(.right) .absol-checkbox-icon-right {\r\n display: none;\r\n}\r\n\r\n.absol-checkbox:not(.right) label {\r\n padding-left: 5px;\r\n}\r\n\r\n.absol-checkbox.right label {\r\n padding-right: 5px;\r\n}\r\n\r\n.absol-checkbox.right .absol-checkbox-icon-left {\r\n display: none;\r\n}\r\n\r\n.absol-checkbox.disabled {\r\n cursor: default;\r\n}\r\n\r\n.absol-checkbox.disabled:hover .tick,\r\n.absol-checkbox.disabled .tick {\r\n fill: #929292;\r\n}\r\n\r\n.absol-checkbox.disabled .bound,\r\n.absol-checkbox.disabled:hover .bound {\r\n stroke: #929292;\r\n fill: #ebebe4;\r\n}\r\n", ""]); /***/ }), /* 159 */ /***/ (function(module, exports, __webpack_require__) { var content = __webpack_require__(160); if(typeof content === 'string') content = [[module.i, content, '']]; var transform; var insertInto; var options = {"hmr":true} options.transform = transform options.insertInto = undefined; var update = __webpack_require__(5)(content, options); if(content.locals) module.exports = content.locals; if(false) {} /***/ }), /* 160 */ /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__(4)(false); // Module exports.push([module.i, ".absol-candy-box{\r\n \r\n}\r\n\r\n.absol-candy-box-border{\r\n fill: none;\r\n stroke: #929292;\r\n stroke-width: 1;\r\n}", ""]); /***/ }), /* 161 */ /***/ (function(module, exports, __webpack_require__) { var content = __webpack_require__(162); if(typeof content === 'string') content = [[module.i, content, '']]; var transform; var insertInto; var options = {"hmr":true} options.transform = transform options.insertInto = undefined; var update = __webpack_require__(5)(content, options); if(content.locals) module.exports = content.locals; if(false) {} /***/ }), /* 162 */ /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__(4)(false); // Module exports.push([module.i, "\r\n.absol-editabe-text {\r\n display: inline;\r\n}\r\n\r\n.absol-editabe-text span {\r\n font-style: inherit;\r\n font-size: inherit;\r\n white-space: pre;\r\n}\r\n\r\n.absol-editabe-text-higne {\r\n display: inline-block;\r\n position: relative;\r\n width: 0px;\r\n height: 0ox;\r\n}\r\n\r\n.absol-editabe-text-higne input {\r\n position: absolute;\r\n display: none;\r\n border: none;\r\n top: -2;\r\n left: -2;\r\n padding-top: 0px;\r\n padding-left: 2px;\r\n padding-bottom: 4px;\r\n margin: 0;\r\n background: transparent;\r\n outline: none;\r\n font-style: inherit;\r\n font-size: inherit;\r\n}\r\n\r\n.absol-editabe-text.editing .absol-editabe-text-higne input {\r\n display: block;\r\n}\r\n\r\n.absol-editabe-text.editing span {\r\n visibility: hidden;\r\n}\r\n\r\n.absol-editabe-text.editing {\r\n -webkit-box-shadow: 0px 0px 2px 0px rgba(33, 77, 255, 1);\r\n -moz-box-shadow: 0px 0px 2px 0px rgba(33, 77, 255, 1);\r\n box-shadow: 0px 0px 2px 0px rgba(33, 77, 255, 1);\r\n border-radius: 0.17em;\r\n}\r\n", ""]); /***/ }), /* 163 */ /***/ (function(module, exports, __webpack_require__) { var content = __webpack_require__(164); if(typeof content === 'string') content = [[module.i, content, '']]; var transform; var insertInto; var options = {"hmr":true} options.transform = transform options.insertInto = undefined; var update = __webpack_require__(5)(content, options); if(content.locals) module.exports = content.locals; if(false) {} /***/ }), /* 164 */ /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__(4)(false); // Module exports.push([module.i, ".absol-width-height-resizer {\r\n position: relative;\r\n box-sizing: border-box;\r\n}\r\n\r\n.absol-width-height-resizer-anchor-bot-right {\r\n cursor: nwse-resize;\r\n position: absolute;\r\n z-index: 1;\r\n right: 0;\r\n bottom: 0;\r\n height: 13px;\r\n width: 13px;\r\n background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAANCAYAAABy6+R8AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAQUlEQVQoz2NgIBGkpaX9Z2IgA9BWU1pa2n+S/UGSZnRFBDVhU4BXEy4bcGrC5ySsmgj5AUMTMZ4mOehhmhjJ0QkA9TYwPsqIBKMAAAAASUVORK5CYII=');\r\n}\r\n\r\n.absol-width-height-resizer-anchor-bot-left {\r\n cursor: nesw-resize;\r\n position: absolute;\r\n z-index: 1;\r\n left: 0;\r\n bottom: 0;\r\n height: 13px;\r\n width: 13px;\r\n background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAANCAYAAABy6+R8AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAABCSURBVChTY0hLS/vPQCJggtIkAco0keRMZMVEa0RXSJRGbIoIaoQpIMlGZEmiNRJSiFUjNkGCGrGaRAAwkq6JgQEAnaEwPtyU/MEAAAAASUVORK5CYII=');\r\n}\r\n\r\n.absol-width-height-resizer-anchor-top-right {\r\n cursor: nesw-resize;\r\n position: absolute;\r\n z-index: 1;\r\n right: 0;\r\n top: 0;\r\n height: 13px;\r\n width: 13px;\r\n background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAANCAYAAABy6+R8AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAABMSURBVChTY0xLS/vPQGsAsoQJygYDdFuJdgUhjTgNwqcQpyYQwKURryYQwKaAoCYQwGUjQYCskGhNIABTTJImGABpQolcYgEZmhgYAEPpMD56IPESAAAAAElFTkSuQmCC')\r\n}\r\n\r\n.absol-width-height-resizer-anchor-top-left {\r\n cursor: nwse-resize;\r\n position: absolute;\r\n z-index: 1;\r\n top: 0;\r\n left: 0;\r\n height: 13px;\r\n width: 13px;\r\n background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAANCAYAAABy6+R8AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAABNSURBVChTnZFbCgAgCAStw3r/GxQLClaSj/kJckcFBzMvqtKRprwHd6OncRRwN7GfKQFoIS0Ar/gVQGmCYkMpAWgwLYBSWHCPG9GQiDbsRTA+Srvt5gAAAABJRU5ErkJggg==');\r\n}\r\n\r\n.absol-width-height-resizer-content {\r\n width: 100%;\r\n height: 100%;\r\n overflow: auto;\r\n}\r\n\r\n/* .absol-width-height-resizer */", ""]); /***/ }), /* 165 */ /***/ (function(module, exports, __webpack_require__) { var content = __webpack_require__(166); if(typeof content === 'string') content = [[module.i, content, '']]; var transform; var insertInto; var options = {"hmr":true} options.transform = transform options.insertInto = undefined; var update = __webpack_require__(5)(content, options); if(content.locals) module.exports = content.locals; if(false) {} /***/ }), /* 166 */ /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__(4)(false); // Module exports.push([module.i, ".absol-follower{\r\n position: relative;\r\n}\r\n\r\n.absol-follower-content-container{\r\n position: absolute;\r\n left: -10000px;\r\n top: -10000px;\r\n z-index: -1000;\r\n}\r\n\r\n.absol-follower.following .absol-follower-content-container{\r\n z-index: 100;\r\n}", ""]); /***/ }), /* 167 */ /***/ (function(module, exports, __webpack_require__) { var content = __webpack_require__(168); if(typeof content === 'string') content = [[module.i, content, '']]; var transform; var insertInto; var options = {"hmr":true} options.transform = transform options.insertInto = undefined; var update = __webpack_require__(5)(content, options); if(content.locals) module.exports = content.locals; if(false) {} /***/ }), /* 168 */ /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__(4)(false); // Module exports.push([module.i, ".absol-tooltip {\r\n margin: 0;\r\n position: relative;\r\n box-sizing: border-box;\r\n display: inline-block;\r\n}\r\n\r\n.absol-tooltip-content {\r\n display: inline-block;\r\n border-radius: 0.25rem;\r\n background-color: gray;\r\n padding: 0.25rem 0.5rem;\r\n}\r\n\r\n\r\n.absol-tooltip-arrow {\r\n width: 0;\r\n height: 0;\r\n position: absolute;\r\n box-sizing: content-box;\r\n}\r\n\r\n.absol-tooltip.top .absol-tooltip-arrow {\r\n border-left: 0.4rem solid transparent;\r\n border-right: 0.3rem solid transparent;\r\n\r\n border-top: 0.3rem solid gray;\r\n bottom: 0;\r\n left: calc(50% - 0.3rem);\r\n}\r\n\r\n\r\n\r\n.absol-tooltip.top .absol-tooltip-content {\r\n margin-bottom: 0.3rem;\r\n} \r\n\r\n\r\n.absol-tooltip.bottom .absol-tooltip-arrow {\r\n border-left: 0.3rem solid transparent;\r\n border-right: 0.4rem solid transparent;\r\n border-bottom: 0.3rem solid gray;\r\n\r\n top: 0;\r\n left: calc(50% - 0.3rem);\r\n}\r\n\r\n.absol-tooltip.bottom .absol-tooltip-content {\r\n margin-top: 0.3rem;\r\n}\r\n\r\n\r\n\r\n.absol-tooltip.left .absol-tooltip-arrow {\r\n border-top: 0.3rem solid transparent;\r\n border-bottom: 0.4rem solid transparent;\r\n border-left: 0.4rem solid gray;\r\n\r\n right: 0;\r\n top: calc(50% - 0.3rem);\r\n}\r\n\r\n.absol-tooltip.left .absol-tooltip-content {\r\n margin-right: 0.4rem;\r\n}\r\n\r\n\r\n.absol-tooltip.right .absol-tooltip-arrow {\r\n border-top: 0.4rem solid transparent;\r\n border-bottom: 0.4rem solid transparent;\r\n border-right: 0.4rem solid gray;\r\n\r\n left: 0;\r\n top: calc(50% - 0.3rem);\r\n}\r\n\r\n.absol-tooltip.right .absol-tooltip-content {\r\n margin-left: 0.4rem;\r\n}\r\n\r\n\r\n.absol-tooltip-root{\r\n position: relative;\r\n width: 0;\r\n height: 0;\r\n}\r\n\r\n.absol-tooltip-root-holder{\r\n position: absolute;\r\n left: 0;\r\n top: 0;\r\n}", ""]); /***/ }), /* 169 */ /***/ (function(module, exports, __webpack_require__) { var content = __webpack_require__(170); if(typeof content === 'string') content = [[module.i, content, '']]; var transform; var insertInto; var options = {"hmr":true} options.transform = transform options.insertInto = undefined; var update = __webpack_require__(5)(content, options); if(content.locals) module.exports = content.locals; if(false) {} /***/ }), /* 170 */ /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__(4)(false); // Module exports.push([module.i, ".absol-frame{\r\n \r\n}", ""]); /***/ }), /* 171 */ /***/ (function(module, exports, __webpack_require__) { var content = __webpack_require__(172); if(typeof content === 'string') content = [[module.i, content, '']]; var transform; var insertInto; var options = {"hmr":true} options.transform = transform options.insertInto = undefined; var update = __webpack_require__(5)(content, options); if(content.locals) module.exports = content.locals; if(false) {} /***/ }), /* 172 */ /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__(4)(false); // Module exports.push([module.i, ".absol-frame-view{\r\n position: relative;\r\n}\r\n\r\n\r\n.absol-frame-view-frame-container{\r\n position: absolute;\r\n left: 0;\r\n right: 0;\r\n top:0;\r\n bottom: 0;\r\n}\r\n\r\n\r\n.absol-frame-view-frame-container:not(.absol-active){\r\n z-index: -100;\r\n visibility: hidden;\r\n opacity: 0;\r\n}\r\n\r\n.absol-frame-view-frame-container>div{\r\n width: 100%;\r\n height: 100%;\r\n}", ""]); /***/ }), /* 173 */ /***/ (function(module, exports, __webpack_require__) { var content = __webpack_require__(174); if(typeof content === 'string') content = [[module.i, content, '']]; var transform; var insertInto; var options = {"hmr":true} options.transform = transform options.insertInto = undefined; var update = __webpack_require__(5)(content, options); if(content.locals) module.exports = content.locals; if(false) {} /***/ }), /* 174 */ /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__(4)(false); // Module exports.push([module.i, ".absol-tabbar {\r\n white-space: normal;\r\n height: 2em;\r\n white-space: nowrap;\r\n}\r\n\r\n\r\n.absol-tabbar .absol-hscroller-viewport {\r\n overflow-y: hidden;\r\n}\r\n\r\n.absol-tabbar .absol-tabbar-button {\r\n height: 100%;\r\n}\r\n\r\n/* .absol-tabbar .absol-scrollbar-container {\r\n height: 5px;\r\n} */\r\n\r\n.absol-tabbar .absol-scrollbar-container.horizontal {\r\n bottom: -2px;\r\n}\r\n\r\n.absol-tabbar .absol-scrollbar-container {\r\n opacity: 0;\r\n transition: opacity 0.2s;\r\n background: rgba(169, 169, 169, 0.1);\r\n}\r\n\r\n.absol-tabbar:hover .absol-scrollbar-container,\r\n.absol-tabbar .absol-scrollbar.absol-active {\r\n opacity: 1;\r\n}\r\n\r\n.absol-tabbar .absol-scrollbar-button {\r\n background-color: rgba(33, 33, 40, 0.1);\r\n}\r\n\r\n.absol-tabbar .absol-scrollbar-button:hover {\r\n background-color: rgba(33, 33, 40, 0.3);\r\n}\r\n\r\n\r\n\r\n.absol-tabbar .absol-scrollbar-button:active,\r\n.absol-tabbar .absol-hscrollbar.absol-active .absol-scrollbar-button {\r\n background-color: rgba(47, 47, 55, 0.4);\r\n\r\n}\r\n\r\n\r\n\r\n.absol-tabbar-button {\r\n padding-left: 1em;\r\n padding-right: 1em;\r\n background-color: rgb(45, 45, 45);\r\n color: rgb(200, 200, 200);\r\n margin-right: 1px;\r\n border: none;\r\n outline: none;\r\n font-size: 1em;\r\n}\r\n\r\n.absol-tabbar .absol-tabbar-button-active {\r\n background-color: rgb(30, 30, 30);\r\n color: rgb(250, 250, 252);\r\n}\r\n\r\n.absol-tabbar-button-text,\r\n.absol-tabbar-button-close {\r\n display: inline;\r\n vertical-align: middle;\r\n}\r\n\r\n.absol-tabbar-button .absol-tabbar-button-close {\r\n visibility: hidden;\r\n color: rgb(190, 190, 190);\r\n font-size: 1em\r\n}\r\n\r\n.absol-tabbar-button-icon-container{\r\n display: inline-block;\r\n vertical-align: middle;\r\n margin-left: 0.5em;\r\n}\r\n\r\n\r\n.absol-tabbar-button:hover .absol-tabbar-button-close,\r\n.absol-tabbar-button-active .absol-tabbar-button-close {\r\n visibility: visible;\r\n color: red;\r\n}\r\n\r\n.absol-tabbar-button-active .absol-tabbar-button-modified-flag {\r\n color: lightblue;\r\n}\r\n\r\n.absol-tabbar-button-modified-flag {\r\n color: mediumaquamarine;\r\n}\r\n\r\n.absol-tabbar-button:not(.absol-tabbar-button-modified) .absol-tabbar-button-modified-flag,\r\n.absol-tabbar-button.absol-tabbar-button-modified:not(.active) .absol-tabbar-button-icon-container:hover .absol-tabbar-button-modified-flag,\r\n.absol-tabbar-button.absol-tabbar-button-modified .absol-tabbar-button-icon-container:not(:hover) .absol-tabbar-button-close {\r\n display: none;\r\n}\r\n\r\n\r\n.absol-button-range {}\r\n\r\n\r\n.absol-tabview {\r\n position: relative;\r\n}\r\n\r\n\r\n.absol-tabview-container {\r\n position: absolute;\r\n top: 2em;\r\n left: 0;\r\n right: 0;\r\n bottom: 0;\r\n overflow: auto;\r\n}\r\n\r\n\r\n\r\n.absol-tabview-container.absol-tabview-container-hidden {\r\n z-index: -9999;\r\n visibility: hidden;\r\n opacity: 0;\r\n}\r\n\r\n\r\n.absol-tabview-container>div,\r\n.absol-tabview-container>pre {\r\n width: 100%;\r\n height: 100%;\r\n}\r\n\r\n.absol-tabview-container>pre {\r\n margin: 0;\r\n}\r\n\r\n.absol-tabview .absol-tabbar-button {\r\n border-radius: 10px 10px 0 0;\r\n height: 2em;\r\n box-sizing: border-box;\r\n border: solid 1px #ccc;\r\n background-color: white;\r\n color: black;\r\n padding-left: 1em;\r\n padding-right: 0.357em;\r\n margin-right: 0.357em;\r\n}\r\n\r\n.absol-tabview .absol-tabbar {\r\n height: 2em;\r\n overflow-y: hidden;\r\n border-bottom: 1px solid #ccc;\r\n box-sizing: border-box;\r\n}\r\n\r\n.absol-tabview .absol-tabbar-button-active {\r\n background-color: #5bc0de;\r\n border-color: #46b8da;\r\n color: white;\r\n}\r\n\r\n/* .absol-tabview .absol-tabbar-button-close {\r\n color: rgb(170, 170, 170);\r\n line-height: 1.5em;\r\n margin-left: 1em;\r\n font-size: 1.3em;\r\n} */\r\n\r\n.absol-tabview .absol-tabbar-button-close:hover {\r\n color: red;\r\n}\r\n\r\n\r\n\r\n\r\n/************** Mini version - like window form ***********************/\r\n\r\n.absol-tabview.xp-tiny .absol-tabbar {\r\n height: 22px;\r\n border-bottom: none;\r\n}\r\n\r\n.absol-tabview.xp-tiny .absol-tabbar-button {\r\n height: 20px;\r\n padding-left: 5px;\r\n padding-right: 5px;\r\n border-radius: 0;\r\n margin: 0;\r\n vertical-align: bottom;\r\n margin-top: 2px;\r\n background-color: rgb(242, 242, 242);\r\n color: black;\r\n position: relative;\r\n}\r\n\r\n.absol-tabview.xp-tiny::before {\r\n content: \"\";\r\n position: absolute;\r\n top: 18px;\r\n z-index: 0;\r\n left: 0;\r\n right: 0;\r\n height: 4px;\r\n border-bottom: solid 1px #ccc;\r\n box-sizing: border-box;\r\n}\r\n\r\n.absol-tabview.xp-tiny .absol-tabbar-button.absol-tabbar-button-active {\r\n height: 22px;\r\n margin-top: 0;\r\n background-color: white;\r\n border-top-color: #ccc;\r\n border-left-color: #ccc;\r\n border-right-color: #ccc;\r\n border-bottom-color: white;\r\n}\r\n\r\n\r\n\r\n.absol-hscroller.absol-tabbar.disabled .absol-scrollbar-container {\r\n visibility: hidden;\r\n}\r\n\r\n.absol-tabview.absol-tabview.xp-tiny .absol-tabbar-button-close {\r\n line-height: 18px;\r\n}\r\n\r\n.absol-tabview.xp-tiny .absol-tabbar-button-close.mdi.mdi-close {\r\n display: none;\r\n}\r\n\r\n.absol-tabview.xp-tiny .absol-tabview-container {\r\n top: 22px;\r\n}\r\n\r\n.absol-tabview.xp-tiny .absol-tab-absol {\r\n border-left: solid 1px #ccc;\r\n border-right: solid 1px #ccc;\r\n border-bottom: solid 1px #ccc;\r\n box-sizing: border-box;\r\n}", ""]); /***/ }), /* 175 */ /***/ (function(module, exports, __webpack_require__) { var content = __webpack_require__(176); if(typeof content === 'string') content = [[module.i, content, '']]; var transform; var insertInto; var options = {"hmr":true} options.transform = transform options.insertInto = undefined; var update = __webpack_require__(5)(content, options); if(content.locals) module.exports = content.locals; if(false) {} /***/ }), /* 176 */ /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__(4)(false); // Module exports.push([module.i, ".absol-single-page {\r\n position: relative;\r\n}\r\n\r\n\r\n\r\n.absol-single-page-header {\r\n position: absolute;\r\n top: 0;\r\n left: 0;\r\n right: 0;\r\n box-sizing: border-box;\r\n}\r\n\r\n.absol-single-page-footer {\r\n position: absolute;\r\n left: 0;\r\n right: 0;\r\n bottom: 0;\r\n box-sizing: border-box;\r\n}\r\n\r\n\r\n.absol-single-page-scroller-viewport {\r\n min-height: 100%;\r\n display: block;\r\n position: relative;\r\n box-sizing: border-box;\r\n}\r\n\r\n.absol-single-page-scroller {\r\n width: 100%;\r\n height: 100%;\r\n overflow-y: auto;\r\n}", ""]); /***/ }), /* 177 */ /***/ (function(module, exports, __webpack_require__) { var content = __webpack_require__(178); if(typeof content === 'string') content = [[module.i, content, '']]; var transform; var insertInto; var options = {"hmr":true} options.transform = transform options.insertInto = undefined; var update = __webpack_require__(5)(content, options); if(content.locals) module.exports = content.locals; if(false) {} /***/ }), /* 178 */ /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__(4)(false); // Module exports.push([module.i, ".absol-page-selector{\r\n white-space: normal;\r\n}\r\n\r\n.absol-page-selector > ul{\r\n margin-bottom: 0px;\r\n margin-top: 0;\r\n}\r\n\r\n.page-number-buttons{\r\n display: inline-block;\r\n vertical-align: middle;\r\n}\r\n\r\n.page-number-input > label{\r\n font-weight: 100;\r\n}\r\n\r\n.page-number-buttons > li.page-previous, \r\n.page-number-buttons > li.page-next,\r\n.page-number-buttons > li.page-first,\r\n.page-number-buttons > li.page-last\r\n{\r\n display: inline-block;\r\n height: 30px;\r\n padding-left: 10px;\r\n padding-right: 10px;\r\n text-align: center;\r\n transition: all .3s linear;\r\n background-color: transparent;\r\n cursor: pointer;\r\n}\r\n\r\n.page-number-buttons > li.page-number{\r\n display: inline-block;\r\n height: 30px;\r\n width: 40px;\r\n text-align: center;\r\n transition: all .3s linear;\r\n background-color: transparent;\r\n cursor: pointer;\r\n}\r\n\r\n\r\n.page-number-buttons > li.page-number.active{\r\n box-shadow: 0 2px 5px 0 rgba(0,0,0,.16), 0 2px 10px 0 rgba(0,0,0,.12);\r\n background-color: #4285f4;\r\n border-radius:2px; \r\n \r\n}\r\n\r\n.page-number-buttons > li.page-number.active > a{\r\n\tcolor: white;\r\n \r\n}\r\n\r\n.page-number-buttons > li> a{\r\n line-height: 30px;\r\n text-decoration:none;\r\n}\r\n\r\n.page-number-buttons > li:not(.active):hover{\r\n background-color: #eee;\r\n\r\n}\r\n\r\n.absol-page-selector .page-number-input{\r\n display: inline-block;\r\n vertical-align: middle;\r\n}\r\n\r\n.absol-page-selector .page-number-input input[type=\"text\"]{\r\n width: 3em;\r\n margin-left: 5px; \r\n margin-right: 10px;\r\n text-align: center;\r\n height: 26px;\r\n border: none;\r\n border: solid 1px #ccc; \r\n border-radius: 2px;\r\n\r\n}", ""]); /***/ }), /* 179 */ /***/ (function(module, exports, __webpack_require__) { var content = __webpack_require__(180); if(typeof content === 'string') content = [[module.i, content, '']]; var transform; var insertInto; var options = {"hmr":true} options.transform = transform options.insertInto = undefined; var update = __webpack_require__(5)(content, options); if(content.locals) module.exports = content.locals; if(false) {} /***/ }), /* 180 */ /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__(4)(false); // Module exports.push([module.i, ".absol-bscroller {\r\n overflow: auto;\r\n scrollbar-width: thin;\r\n scrollbar-color: rgba(151, 151, 151, 0.4) rgba(220, 220, 220, 0.4);\r\n\r\n}\r\n\r\n\r\n.absol-bscroller::-webkit-scrollbar {\r\n width: 6px;\r\n height: 6px;\r\n}\r\n\r\n.absol-bscroller::-webkit-scrollbar-track {\r\n background: rgb(220, 220, 220, 0.4);\r\n}\r\n\r\n.absol-bscroller::-webkit-scrollbar-thumb {\r\n background: rgb(182, 182, 182, 0.4);\r\n}\r\n\r\n.absol-bscroller::-webkit-scrollbar-thumb:hover {\r\n background: rgb(32, 32, 32, 0.4);\r\n}\r\n\r\n.absol-bscroller::-webkit-scrollbar-thumb:active {\r\n background: rgb(13, 13, 13, 0.6);\r\n}\r\n\r\n.absol-bscroller.dark,\r\n.dark .absol-bscroller {\r\n scrollbar-color: rgba(104, 104, 104, 0.4) rgba(35, 35, 35, 0.4);\r\n}\r\n\r\n\r\n.absol-bscroller.dark::-webkit-scrollbar-track,\r\n.dark .absol-bscroller::-webkit-scrollbar-track {\r\n background: rgb(35, 35, 35, 0.4);\r\n}\r\n\r\n.absol-bscroller.dark::-webkit-scrollbar-thumb,\r\n.dark .absol-bscroller::-webkit-scrollbar-thumb {\r\n background: rgb(73, 73, 73, 0.4);\r\n}\r\n\r\n.absol-bscroller.dark::-webkit-scrollbar-thumb:hover,\r\n.dark .absol-bscroller::-webkit-scrollbar-thumb:hover {\r\n background: rgb(223, 223, 223, 0.4);\r\n}\r\n\r\n.absol-bscroller.dark::-webkit-scrollbar-thumb:active,\r\n.dark .absol-bscroller::-webkit-scrollbar-thumb:active {\r\n background: rgb(242, 242, 242, 0.6);\r\n}", ""]); /***/ }), /* 181 */ /***/ (function(module, exports, __webpack_require__) { var content = __webpack_require__(182); if(typeof content === 'string') content = [[module.i, content, '']]; var transform; var insertInto; var options = {"hmr":true} options.transform = transform options.insertInto = undefined; var update = __webpack_require__(5)(content, options); if(content.locals) module.exports = content.locals; if(false) {} /***/ }), /* 182 */ /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__(4)(false); // Module exports.push([module.i, ".absol-search-list {\r\n padding-top: 2.5em;\r\n position: relative;\r\n border: solid 1px #a9a9a9;\r\n box-sizing: border-box;\r\n}\r\n\r\n.absol-search-list-search-input-container {\r\n position: absolute;\r\n top: 0;\r\n left: 0;\r\n right: 0;\r\n height: 2.5em;\r\n border-bottom: solid 1px #a9a9a9;\r\n\r\n}\r\n\r\n\r\n.absol-search-list-search-input-container input[type=\"text\"] {\r\n font-size: 1em;\r\n box-sizing: border-box;\r\n width: calc(100% - 1em);\r\n height: 1.5em;\r\n margin: 0.5em;\r\n}\r\n\r\n.absol-search-list-contents {\r\n height: 100%;\r\n box-sizing: border-box;\r\n background: white;\r\n}\r\n\r\n.absol-search-list-item {\r\n cursor: pointer;\r\n}\r\n\r\n.absol-search-list-item.default {\r\n line-height: 2em;\r\n padding-left: 1em;\r\n padding-right: 1em;\r\n}\r\n\r\n.absol-search-list-item:hover {\r\n background-color: rgba(169, 169, 169, 0.1);\r\n}\r\n\r\n.absol-search-list-item.active {\r\n background-color: rgba(169, 169, 169, 0.4);\r\n}", ""]); /***/ }), /* 183 */ /***/ (function(module, exports, __webpack_require__) { var content = __webpack_require__(184); if(typeof content === 'string') content = [[module.i, content, '']]; var transform; var insertInto; var options = {"hmr":true} options.transform = transform options.insertInto = undefined; var update = __webpack_require__(5)(content, options); if(content.locals) module.exports = content.locals; if(false) {} /***/ }), /* 184 */ /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__(4)(false); // Module exports.push([module.i, ".absol-static-tabbar {\r\n position: relative;\r\n}\r\n\r\n.absol-static-tabbar-button {\r\n height: 2em;\r\n background-color: transparent;\r\n border: none;\r\n font-size: 1em;\r\n padding-left: 0.5em;\r\n padding-right: 0.5em;\r\n color: rgb(104, 104, 104);\r\n}\r\n\r\n.absol-static-tabbar-button:hover {\r\n color: rgb(30, 30, 55);\r\n}\r\n\r\n.absol-static-tabbar-button.active {\r\n color: black;\r\n}\r\n\r\n.absol-static-tabbar-button:focus {\r\n outline: none;\r\n}\r\n\r\n.absol-static-tabbar-button>span {\r\n font-size: 0.7em;\r\n}\r\n\r\n.absol-static-tabbar-hline {\r\n border-bottom: solid 1px rgb(127, 127, 128);\r\n height: 100%;\r\n}\r\n\r\n.absol-static-tabbar-active-box {\r\n position: absolute;\r\n bottom: 0;\r\n top: 0;\r\n left: 0;\r\n width: 0;\r\n transition: left 0.15s, width 0.15s;\r\n padding-left: 0.5em;\r\n padding-right: 0.5em;\r\n box-sizing: border-box;\r\n /* z-index: 1; */\r\n}\r\n\r\n.absol-static-tabbar.dark .absol-static-tabbar-hline{\r\n border-bottom-color: white;\r\n}\r\n\r\n.absol-static-tabbar.dark .absol-static-tabbar-button.active{\r\n color: white;\r\n}\r\n\r\n.absol-static-tabbar.dark .absol-static-tabbar-button {\r\n color: rgb(204, 204, 204);\r\n}", ""]); /***/ }), /* 185 */ /***/ (function(module, exports, __webpack_require__) { var content = __webpack_require__(186); if(typeof content === 'string') content = [[module.i, content, '']]; var transform; var insertInto; var options = {"hmr":true} options.transform = transform options.insertInto = undefined; var update = __webpack_require__(5)(content, options); if(content.locals) module.exports = content.locals; if(false) {} /***/ }), /* 186 */ /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__(4)(false); // Module exports.push([module.i, ".absol-exp-node {\r\n height: 2em;\r\n text-align: left;\r\n background-color: transparent;\r\n border: none;\r\n outline: none;\r\n white-space: nowrap;\r\n font-size: inherit;\r\n overflow: hidden;\r\n text-overflow: ellipsis;\r\n position: relative;\r\n color: rgb(33, 33, 34);\r\n}\r\n\r\n.absol-exp-node .toggler-ico {\r\n width: 0.7em;\r\n height: 0.7em;\r\n margin-right: 0.35em;\r\n}\r\n\r\n.absol-exp-node .toggler-ico path {\r\n fill: rgb(104, 104, 104);\r\n}\r\n\r\n.absol-exp-node.status-removable .toggler-ico,\r\n.absol-exp-node.status-modified .toggler-ico {\r\n display: none;\r\n}\r\n\r\n.absol-exp-node:not(.status-open) .toggle-open {\r\n display: none;\r\n}\r\n\r\n.absol-exp-node:not(.status-close) .toggle-close {\r\n display: none;\r\n}\r\n\r\n\r\n\r\n.absol-exp-node:hover .remove-ico {\r\n visibility: visible;\r\n}\r\n\r\n\r\n\r\n.absol-exp-node.status-removable .remove-ico,\r\n.absol-exp-node.status-modified .remove-ico {\r\n display: inline-block;\r\n}\r\n\r\n.absol-exp-node.status-removable .remove-ico .modified {\r\n visibility: hidden;\r\n}\r\n\r\n.absol-exp-node.status-modified .remove-ico .close {\r\n visibility: hidden;\r\n}\r\n\r\n.absol-exp-node.status-modified .remove-ico:hover .close {\r\n visibility: visible;\r\n}\r\n\r\n.absol-exp-node.status-modified .remove-ico:hover .modified {\r\n visibility: hidden;\r\n}\r\n\r\n\r\n.absol-exp-node .remove-ico {\r\n width: 0.9em;\r\n height: 0.9em;\r\n display: none;\r\n visibility: hidden;\r\n margin-left: -0.3em;\r\n margin-right: 0.45em;\r\n}\r\n\r\n.absol-exp-node .remove-ico .close,\r\n.absol-exp-node .remove-ico .modified {\r\n fill: rgb(169, 169, 169);\r\n stroke: none;\r\n}\r\n\r\n\r\n.absol-exp-node.has-status {\r\n padding-right: 2.5em;\r\n}\r\n\r\n.absol-exp-node>div,\r\n.absol-exp-node>svg {\r\n display: inline-block;\r\n vertical-align: middle;\r\n}\r\n\r\n\r\n.absol-exp-node .editing input {\r\n color: khaki;\r\n padding-top: 2px;\r\n padding-bottom: 2px;\r\n}\r\n\r\n.absol-exp-node:hover {\r\n background-color: rgb(169, 169, 172, 0.1);\r\n}\r\n\r\n.absol-exp-node:focus,\r\n.absol-exp-node.active:focus {\r\n background-color: rgba(20, 185, 235, 0.3);\r\n}\r\n\r\n.absol-exp-node.active {\r\n background-color: rgb(169, 169, 172, 0.2);\r\n\r\n}\r\n\r\n\r\n\r\n.absol-exp-node-name {\r\n /* -webkit-touch-callout: none;\r\n -webkit-user-select: none;\r\n -khtml-user-select: none;\r\n -moz-user-select: none;\r\n -ms-user-select: none; */\r\n user-select: none;\r\n vertical-align: middle;\r\n color: black;\r\n margin-left: 0.5em;\r\n}\r\n\r\n.absol-exp-node-desc {\r\n color: rgb(104, 104, 104);\r\n margin-left: 0.5em;\r\n font-size: 0.85em;\r\n}\r\n\r\n.absol-exp-node-desc:empty {\r\n margin-left: 0;\r\n}\r\n\r\n\r\n.absol-exp-node-expand-icon {\r\n display: inline-block;\r\n vertical-align: middle;\r\n margin-right: 0.2em;\r\n height: 0.5em;\r\n width: 0.5em;\r\n}\r\n\r\nimg.absol-exp-node-ext-icon {\r\n display: none;\r\n}\r\n\r\n.absol-exp-node-ext-icon,\r\n.absol-exp-node-ext-icon>img {\r\n display: inline-block;\r\n vertical-align: middle;\r\n width: 1.5em;\r\n height: 1.5em;\r\n}\r\n\r\ndiv.absol-exp-node-ext-icon:empty {\r\n display: none;\r\n}\r\n\r\ndiv.absol-exp-node-ext-icon {\r\n text-align: center;\r\n}\r\n\r\n.absol-exp-node-ext-icon>.mdi,\r\n.absol-exp-node-ext-icon>span .absol-exp-node-ext-icon>svg {\r\n line-height: 1em;\r\n font-size: 1.5em;\r\n}\r\n\r\nimg.absol-exp-node-ext-icon[src] {\r\n display: inline-block;\r\n}\r\n\r\n\r\n.absol-exp-tree>.absol-exp-node {\r\n width: 100%;\r\n display: block;\r\n}\r\n\r\n.absol-exp-tree.hide-children>.absol-exp-items {\r\n display: none;\r\n}\r\n\r\n\r\n.dark .toggler-ico path {\r\n fill: rgb(169, 169, 169);\r\n}\r\n\r\n\r\n.dark .absol-exp-node-name {\r\n color: rgb(204, 204, 204);\r\n}\r\n\r\n.dark .absol-exp-node-desc {\r\n color: rgb(169, 169, 170);\r\n}\r\n\r\n.dark .absol-exp-node {\r\n color: rgb(169, 169, 170);\r\n}", ""]); /***/ }), /* 187 */ /***/ (function(module, exports, __webpack_require__) { var content = __webpack_require__(188); if(typeof content === 'string') content = [[module.i, content, '']]; var transform; var insertInto; var options = {"hmr":true} options.transform = transform options.insertInto = undefined; var update = __webpack_require__(5)(content, options); if(content.locals) module.exports = content.locals; if(false) {} /***/ }), /* 188 */ /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__(4)(false); // Module exports.push([module.i, ".absol-table-vscroller {\r\n position: relative;\r\n}\r\n\r\n.absol-table-vscroller-head {\r\n position: absolute;\r\n z-index: 2;\r\n width: 300px;\r\n height: 20px;\r\n top: 0;\r\n left: 0;\r\n}\r\n\r\n.absol-table-vscroller-head-line{\r\n position: absolute;\r\n left: 0;\r\n z-index: 3;\r\n pointer-events: none;\r\n border-bottom:solid 2px rgb(169, 169, 170); \r\n width: 100%;\r\n}\r\n\r\n.absol-table-vscroller.scroll-v .absol-table-vscroller-head-line{\r\n width: calc(100% - 7px);\r\n}\r\n\r\n.absol-table-vscroller-viewport {\r\n max-height: 100%;\r\n padding-bottom: 1px;\r\n padding-top: 1px;\r\n}", ""]); /***/ }), /* 189 */ /***/ (function(module, exports, __webpack_require__) { var content = __webpack_require__(190); if(typeof content === 'string') content = [[module.i, content, '']]; var transform; var insertInto; var options = {"hmr":true} options.transform = transform options.insertInto = undefined; var update = __webpack_require__(5)(content, options); if(content.locals) module.exports = content.locals; if(false) {} /***/ }), /* 190 */ /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__(4)(false); // Module exports.push([module.i, ".absol-table-scroller {\r\n position: relative;\r\n overflow: hidden;\r\n}\r\n\r\n.absol-table-scroller-render-space {\r\n position: fixed;\r\n overflow: scroll;\r\n left: 0;\r\n top: 0;\r\n max-width: calc(99vw - 30px);\r\n max-height: calc(99vh -30px);\r\n opacity: 0;\r\n z-index: -1000;\r\n visibility: hidden;\r\n}\r\n\r\n\r\n.absol-table-scroller-viewport {\r\n box-sizing: border-box;\r\n overflow: scroll;\r\n width: calc(100% + 17px);\r\n height: calc(100% + 17px);\r\n}\r\n\r\n.absol-table-scroller-fixed-viewport {\r\n position: absolute;\r\n left: 0;\r\n top: 0;\r\n z-index: 10;\r\n overflow: hidden;\r\n pointer-events: none;\r\n}\r\n\r\n.absol-table-scroller-fixed-viewport>table>thead,\r\n.absol-table-scroller-fixed-viewport>table {\r\n border-top-color: transparent !important;\r\n}\r\n\r\n.absol-table-scroller-fixed-hidden {\r\n visibility: hidden !important;\r\n opacity: 0 !important;\r\n border-color: transparent !important;\r\n\r\n}\r\n\r\n.absol-table-scroller-header-hscroller {\r\n position: absolute;\r\n left: 0;\r\n top: 0;\r\n right: 0;\r\n z-index: 9;\r\n overflow: hidden;\r\n pointer-events: none;\r\n}\r\n\r\n.absol-table-scroller-header-hscroller-viewport {\r\n max-width: 100%;\r\n overflow-x: scroll;\r\n margin-bottom: -17px;/*default*/\r\n}\r\n\r\n.absol-table-scroller-header-hscroller-viewport table {\r\n table-layout: fixed;\r\n}\r\n\r\n\r\n.absol-table-scroller-left-vscroller {\r\n position: absolute;\r\n top: 0;\r\n left: 0;\r\n bottom: 0;\r\n z-index: 7;\r\n /* width: 200px; */\r\n overflow-x: hidden;\r\n pointer-events: none;\r\n}\r\n\r\n.absol-table-scroller-left-vscroller-viewport {\r\n max-height: 100%;\r\n overflow-y: scroll;\r\n min-width: calc(100% + 19px);\r\n overflow-x: hidden;\r\n}\r\n\r\n\r\n.absol-table-scroller-head-line,\r\n.absol-table-scroller-left-line {\r\n z-index: 30;\r\n pointer-events: none;\r\n position: absolute;\r\n}\r\n\r\n.absol-table-scroller-head-line {\r\n left: 0;\r\n width: calc(100% - 6px);\r\n border-bottom: solid 2px rgb(169, 169, 170);\r\n width: 100%;\r\n}\r\n\r\n.absol-table-scroller-left-line {\r\n top: 0;\r\n border-right: solid 2px rgb(169, 169, 170);\r\n height: calc(100% - 6px);\r\n height: 100%;\r\n}\r\n\r\n\r\n.absol-table-scroller.scroll-v .absol-table-scroller-head-line {\r\n width: 100%;\r\n}\r\n\r\n.absol-table-scroller.scroll-h .absol-table-scroller-left-line {\r\n height: 100%;\r\n}\r\n\r\n\r\n.absol-table-scroller:not(.scroll-v) .absol-table-scroller-head-line {\r\n display: none;\r\n}\r\n\r\n.absol-table-scroller:not(.scroll-h) .absol-table-scroller-left-line {\r\n display: none;\r\n}\r\n\r\n\r\n\r\n.absol-table-scroller-vscrollbar-container {\r\n position: absolute;\r\n top: 0;\r\n right: 0;\r\n width: 8px;\r\n bottom: 0;\r\n z-index: 31;\r\n}\r\n\r\n.absol-table-scroller-vscrollbar-container .absol-scrollbar-button {\r\n left: 1px;\r\n right: 1px;\r\n}\r\n\r\n\r\n.absol-table-scroller-vscrollbar-container>div,\r\n.absol-table-scroller-hscrollbar-container>div {\r\n width: 100%;\r\n height: 100%;\r\n}\r\n\r\n.absol-table-scroller-hscrollbar-container {\r\n position: absolute;\r\n left: 0;\r\n right: 0;\r\n height: 12px;\r\n bottom: 0;\r\n z-index: 31;\r\n}\r\n\r\n\r\n.absol-table-scroller-hscrollbar-container .absol-scrollbar-button {\r\n top: 1px;\r\n bottom: 1px;\r\n}\r\n\r\n\r\n.absol-table-scroller:not(.scroll-v) .absol-table-scroller-vscrollbar-container {\r\n display: none;\r\n}\r\n\r\n.absol-table-scroller:not(.scroll-h) .absol-table-scroller-hscrollbar-container {\r\n display: none;\r\n}\r\n\r\n\r\n.absol-table-scroller.scroll-h .absol-table-scroller-vscrollbar-container {\r\n bottom: 12px;\r\n}\r\n\r\n.absol-table-scroller.scroll-v .absol-table-scroller-hscrollbar-container {\r\n right: 8px;\r\n}", ""]); /***/ }), /* 191 */ /***/ (function(module, exports, __webpack_require__) { var content = __webpack_require__(192); if(typeof content === 'string') content = [[module.i, content, '']]; var transform; var insertInto; var options = {"hmr":true} options.transform = transform options.insertInto = undefined; var update = __webpack_require__(5)(content, options); if(content.locals) module.exports = content.locals; if(false) {} /***/ }), /* 192 */ /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__(4)(false); // Module exports.push([module.i, ".absol-quick-path {\r\n height: 1.5em;\r\n position: relative;\r\n box-sizing: border-box;\r\n user-select: none;\r\n -webkit-user-select: none;\r\n -ms-user-select: none;\r\n -moz-user-select: none;\r\n}\r\n\r\n.absol-quick-path button {\r\n outline: none;\r\n color: rgb(69, 69, 69);\r\n}\r\n\r\n.absol-quick-path button:hover {\r\n color: black;\r\n}\r\n\r\n.absol-quick-path .toggler-ico path {\r\n fill: rgb(104, 104, 104);\r\n}\r\n\r\n.dark .absol-quick-path button {\r\n color: rgb(200, 200, 200);\r\n}\r\n\r\n\r\n.dark .absol-quick-path button:hover {\r\n color: white;\r\n}\r\n\r\n.dark .absol-quick-path .toggler-ico path {\r\n fill: rgb(169, 169, 169);\r\n}\r\n\r\n\r\n.absol-quick-path-btn {\r\n font-size: 1em;\r\n padding: 0;\r\n border: none;\r\n background: transparent;\r\n padding-right: 0.3em;\r\n}\r\n\r\n.absol-quick-path-btn:focus span {\r\n text-decoration: underline;\r\n}\r\n\r\n.absol-quick-path-btn-ext-ico {\r\n width: 1em;\r\n height: 1em;\r\n vertical-align: middle;\r\n margin-right: 0.3em;\r\n display: none;\r\n}\r\n\r\n.absol-quick-path-btn-ext-ico[src] {\r\n display: inline;\r\n}\r\n\r\n.absol-quick-path-btn .toggler-ico {\r\n height: 0.7em;\r\n width: 0.7em;\r\n}\r\n\r\n.absol-quick-path-btn.toggle svg .toggle-close {\r\n display: none;\r\n}\r\n\r\n.absol-quick-path-btn:not(.toggle) svg .toggle-open {\r\n display: none;\r\n}\r\n\r\n.absol-quick-path-btn .toggler-ico path {\r\n fill: rgb(104, 104, 104);\r\n}\r\n\r\n.absol-quick-path-dropdown {\r\n position: absolute;\r\n z-index: 2;\r\n -webkit-box-shadow: 2px 2px 9px 0px rgba(20, 20, 20, 1);\r\n -moz-box-shadow: 2px 2px 9px 0px rgba(20, 20, 20, 1);\r\n box-shadow: 2px 2px 9px 0px rgba(20, 20, 20, 1);\r\n background-color: rgb(252, 252, 255);\r\n box-sizing: border-box;\r\n}\r\n\r\n.dark .absol-quick-path-dropdown {\r\n background-color: rgb(37, 37, 38)\r\n}\r\n\r\n\r\n.absol-quick-path-dropdown .absol-vmenu-button-key {\r\n display: none;\r\n}\r\n\r\n.absol-quick-path-dropdown .absol-vmenu-button {\r\n min-width: unset;\r\n}", ""]); /***/ }), /* 193 */ /***/ (function(module, exports, __webpack_require__) { var content = __webpack_require__(194); if(typeof content === 'string') content = [[module.i, content, '']]; var transform; var insertInto; var options = {"hmr":true} options.transform = transform options.insertInto = undefined; var update = __webpack_require__(5)(content, options); if(content.locals) module.exports = content.locals; if(false) {} /***/ }), /* 194 */ /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__(4)(false); // Module exports.push([module.i, ".absol-drop-panel-head {\r\n height: 2.75em;\r\n line-height: 2.75em;\r\n -webkit-box-shadow: 0px 3px 4px -3px rgba(0, 0, 0, 0.75);\r\n -moz-box-shadow: 0px 3px 4px -3px rgba(0, 0, 0, 0.75);\r\n box-shadow: 0px 3px 4px -3px rgba(0, 0, 0, 0.75);\r\n background-color: rgba(240, 240, 242);\r\n color: black;\r\n}\r\n\r\n.absol-drop-panel-head .toggler-ico path {\r\n fill: rgb(104, 104, 104);\r\n}\r\n\r\n\r\n.dark .absol-drop-panel-head {\r\n background-color: rgba(54, 54, 56);\r\n color: rgb(204, 204, 204);\r\n}\r\n\r\n.absol-drop-panel.show .absol-drop-panel-body {\r\n height:auto;\r\n}\r\n\r\n.absol-drop-panel-body {\r\n transition: height 0.2s;\r\n height: 0;\r\n overflow-x: hidden;\r\n overflow-y: auto;\r\n}\r\n\r\n\r\n.absol-drop-panel.show>.absol-drop-panel-head .toggle-close{\r\n display: none;\r\n}\r\n\r\n.absol-drop-panel:not(.show)>.absol-drop-panel-head .toggle-open{\r\n display: none;\r\n}\r\n\r\n", ""]); /***/ }), /* 195 */ /***/ (function(module, exports, __webpack_require__) { var content = __webpack_require__(196); if(typeof content === 'string') content = [[module.i, content, '']]; var transform; var insertInto; var options = {"hmr":true} options.transform = transform options.insertInto = undefined; var update = __webpack_require__(5)(content, options); if(content.locals) module.exports = content.locals; if(false) {} /***/ }), /* 196 */ /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__(4)(false); // Module exports.push([module.i, ".absol-draggable-stack {\r\n position: relative;\r\n}\r\n\r\n.absol-draggable-stack .drag-zone {}\r\n\r\n.absol-draggable-stack>.dragging {\r\n opacity: 0.2 !important;\r\n}\r\n\r\n.absol-draggable-stack-child-container.dragging {\r\n opacity: 0.2 !important;\r\n}\r\n\r\n.absol-draggable-stack-clone-container {\r\n position: absolute;\r\n user-select: none;\r\n -moz-user-select: none;\r\n -webkit-user-select: none;\r\n -ms-user-select: none;\r\n z-index: 100;\r\n pointer-events: all;\r\n opacity: 0.5;\r\n background: white;\r\n}\r\n\r\n.absol-draggable-vstack>.absol-draggable-stack-clone-container {\r\n left: 0;\r\n right: 0;\r\n\r\n}\r\n\r\n.absol-draggable-stack-clone-container * {\r\n pointer-events: none !important;\r\n}\r\n\r\n.absol-draggable-stack-clone-container.home-going {\r\n transition: top 0.2s;\r\n}\r\n\r\n.absol-draggable-stack-dest-line {\r\n position: absolute;\r\n z-index: 99;\r\n box-sizing: content-box;\r\n}\r\n\r\n.absol-draggable-vstack>.absol-draggable-stack-dest-line {\r\n transition: top 0.1s;\r\n\r\n left: 0;\r\n right: 0;\r\n border-top: solid 3px rgb(74, 174, 233);\r\n border-bottom: solid 3px rgb(74, 174, 233);\r\n}\r\n\r\n.absol-draggable-hstack>.absol-draggable-stack-dest-line {\r\n transition: left 0.1s;\r\n top: 0;\r\n bottom: 0;\r\n border-left: solid 3px rgb(74, 174, 233);\r\n border-right: solid 3px rgb(74, 174, 233);\r\n}\r\n.absol-draggable-hstack>*{\r\n display: inline-block;\r\n vertical-align: middle;\r\n}", ""]); /***/ }), /* 197 */ /***/ (function(module, exports, __webpack_require__) { var content = __webpack_require__(198); if(typeof content === 'string') content = [[module.i, content, '']]; var transform; var insertInto; var options = {"hmr":true} options.transform = transform options.insertInto = undefined; var update = __webpack_require__(5)(content, options); if(content.locals) module.exports = content.locals; if(false) {} /***/ }), /* 198 */ /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__(4)(false); // Module exports.push([module.i, ".absol-chrome-calendar {\r\n display: inline-block;\r\n font-family: Arial;\r\n font-size: 14px;\r\n padding: 0.6em;\r\n border: solid 1px rgb(191, 191, 191);\r\n box-shadow: 1px 1px 2px rgb(240, 240, 240);\r\n z-index: 100;\r\n touch-action: manipulation;\r\n user-select: none;\r\n background-color: rgb(255, 255, 255);\r\n white-space: initial;\r\n}\r\n\r\n\r\n.absol-chrome-calendar-header {\r\n white-space: nowrap;\r\n position: relative;\r\n}\r\n\r\n\r\n.absol-chrome-calendar-title {\r\n display: inline-block;\r\n vertical-align: middle;\r\n}\r\n\r\n.absol-chrome-calendar-header-buttons {\r\n position: absolute;\r\n top: 0;\r\n bottom: 0;\r\n right: 0;\r\n}\r\n\r\n.absol-chrome-calendar-header-buttons>button {\r\n font-size: 1em;\r\n width: 1.5em;\r\n height: 1.5em;\r\n padding: 0;\r\n border-radius: 0.2em;\r\n border: solid 1px rgb(167, 167, 167);\r\n background: linear-gradient(rgb(240, 240, 240), rgb(233, 233, 233), rgb(223, 223, 223));\r\n cursor: pointer;\r\n outline: none;\r\n box-shadow: 1px 1px 2px #aaa;\r\n color: rgb(110, 110, 110);\r\n}\r\n\r\n.absol-chrome-calendar-header-buttons>button:nth-child(2) {\r\n margin-left: 0.2em;\r\n margin-right: 0.2em;\r\n}\r\n\r\n\r\n.absol-chrome-calendar-header-buttons>button:active {\r\n box-shadow: 0px 0px 2px #aaa;\r\n\r\n}\r\n\r\n.absol-chrome-calendar-title {\r\n cursor: pointer;\r\n}\r\n\r\n.absol-chrome-calendar-title>span {\r\n line-height: 1.5em;\r\n}\r\n\r\n.absol-chrome-calendar-instance {\r\n margin-top: 1em;\r\n border: solid 1px rgb(190, 190, 190);\r\n width: 14em;\r\n position: relative;\r\n height: calc(8.4em + 3px);\r\n overflow: hidden;\r\n /*border*/\r\n}\r\n\r\n.absol-chrome-calendar-dayofweek {\r\n background-color: rgb(241, 241, 241);\r\n height: 1.2em;\r\n white-space: nowrap;\r\n position: absolute;\r\n left: 0;\r\n right: 0;\r\n z-index: 10;\r\n}\r\n\r\n.absol-chrome-calendar-dayofweek>div {\r\n text-align: center;\r\n line-height: 1.2;\r\n display: inline-block;\r\n width: 14.2857142857%;\r\n border-bottom: solid 1px rgb(191, 191, 191);\r\n box-sizing: border-box;\r\n}\r\n\r\n.absol-chrome-calendar-month-animation-container {\r\n position: absolute;\r\n transition: top 0.2s;\r\n}\r\n\r\n.absol-chrome-calendar-month-animation-container.old {\r\n z-index: 7;\r\n /* background: red; */\r\n}\r\n\r\n.absol-chrome-calendar-month-animation-container.new {\r\n z-index: 8;\r\n /* background: blue; */\r\n}\r\n\r\n.absol-chrome-calendar-month-animation-container>.absol-chrome-calendar-month {\r\n width: 100%;\r\n height: 100%;\r\n margin-top: -1px;\r\n}\r\n\r\n\r\n.absol-chrome-calendar-month {\r\n display: table;\r\n width: 100%;\r\n margin-top: 1.2em;\r\n background-color: white;\r\n /*for header*/\r\n}\r\n\r\n.absol-chrome-calendar-week-in-mounth {\r\n display: table-row;\r\n height: 1.2em;\r\n}\r\n\r\n.absol-chrome-calendar-week-in-mounth>div {\r\n display: table-cell;\r\n text-align: right;\r\n padding-right: 0.4em;\r\n cursor: pointer;\r\n}\r\n\r\n.absol-chrome-calendar-week-in-mounth>div:hover {\r\n background-color: rgb(224, 245, 256);\r\n}\r\n\r\n\r\n.absol-chrome-calendar-not-in-month {\r\n color: rgb(190, 190, 190);\r\n}\r\n\r\n.absol-chrome-calendar-today {\r\n border: inset 1px rgb(191, 191, 191);\r\n box-sizing: border-box;\r\n}\r\n\r\n.absol-chrome-calendar-selected {\r\n background-color: rgb(188, 205, 236);\r\n}\r\n\r\n.absol-chrome-calendar-years {\r\n width: 100%;\r\n height: 100%;\r\n}\r\n\r\n\r\n.absol-chrome-calendar:not(.view-year) .absol-chrome-calendar-years {\r\n /* display: none; */\r\n position: absolute;\r\n left: 0;\r\n top: 0;\r\n width: 100%;\r\n height: 100%;\r\n z-index: -10000;\r\n opacity: 0;\r\n visibility: hidden;\r\n}\r\n\r\n.absol-chrome-calendar.view-year .absol-chrome-calendar-instance {\r\n border-color: rgb(77, 114, 254)\r\n}\r\n\r\n.absol-chrome-calendar:not(.view-month) .absol-chrome-calendar-month,\r\n.absol-chrome-calendar:not(.view-month) .absol-chrome-calendar-dayofweek {\r\n display: none;\r\n}\r\n\r\n.absol-chrome-calendar:not(.view-month) .absol-chrome-calendar-title {\r\n color: rgb(191, 191, 191);\r\n}\r\n\r\n\r\n.absol-chrome-calendar-year {\r\n overflow: hidden;\r\n}\r\n\r\n\r\n.absol-chrome-calendar-year-head {\r\n background-color: rgb(241, 241, 241);\r\n border-bottom: solid 1px rgb(191, 191, 191);\r\n height: 1.5em;\r\n text-align: center;\r\n line-height: 1.5em;\r\n}\r\n\r\n\r\n.absol-chrome-calendar-year:last-child .absol-chrome-calendar-year-head {\r\n border-bottom: solid 1px rgb(191, 191, 191);\r\n}\r\n\r\n.absol-chrome-calendar-year.start-opening .absol-chrome-calendar-year-mounths,\r\n.absol-chrome-calendar-year.closing .absol-chrome-calendar-year-mounths {\r\n margin-bottom: -6em;\r\n transition: margin-bottom linear 0.1s;\r\n}\r\n\r\n.absol-chrome-calendar-year.opening .absol-chrome-calendar-year-mounths,\r\n.absol-chrome-calendar-year.start-closing .absol-chrome-calendar-year-mounths {\r\n margin-bottom: 0;\r\n transition: margin-bottom linear 0.1s;\r\n\r\n}\r\n\r\n.absol-chrome-calendar-year-mounths {\r\n width: 100%;\r\n display: table;\r\n height: 6em;\r\n border-bottom: solid 1px rgb(191, 191, 191);\r\n}\r\n\r\n.absol-chrome-calendar-year-row-months {\r\n display: table-row;\r\n}\r\n\r\n.absol-chrome-calendar-year-month {\r\n text-align: center;\r\n display: table-cell;\r\n vertical-align: middle;\r\n}\r\n\r\n.absol-chrome-calendar-year-month:hover {\r\n background-color: rgb(224, 245, 256);\r\n}\r\n\r\n\r\n\r\n\r\n.absol-chrome-calendar-years:hover .absol-scrollbar {\r\n opacity: 1;\r\n\r\n}\r\n\r\n.absol-chrome-calendar-years .absol-scrollbar {\r\n background-color: rgba(169, 169, 172, 0.2);\r\n opacity: 0;\r\n transition: opacity 0.2s;\r\n}\r\n\r\n.absol-chrome-calendar-date-disabled {\r\n color: rgb(240, 230, 230);\r\n pointer-events: none;\r\n cursor: not-allowed;\r\n}\r\n\r\nbutton.absol-chrome-calendar-button-disabled {\r\n color: rgb(220, 210, 210);\r\n pointer-events: none;\r\n box-shadow: none;\r\n cursor: not-allowed;\r\n}", ""]); /***/ }), /* 199 */ /***/ (function(module, exports, __webpack_require__) { var content = __webpack_require__(200); if(typeof content === 'string') content = [[module.i, content, '']]; var transform; var insertInto; var options = {"hmr":true} options.transform = transform options.insertInto = undefined; var update = __webpack_require__(5)(content, options); if(content.locals) module.exports = content.locals; if(false) {} /***/ }), /* 200 */ /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__(4)(false); // Module exports.push([module.i, ".absol-calendar-input {\r\n font-size: 14px;\r\n width: 7em;\r\n height: 2em;\r\n box-sizing: content-box;\r\n display: inline-block;\r\n vertical-align: middle;\r\n border: solid 1px #d6d6d6;\r\n border-radius: 0.2em;\r\n}\r\n\r\n.absol-calendar-input>input {\r\n text-align: center;\r\n width: 100%;\r\n height: 100%;\r\n outline: none;\r\n cursor: pointer;\r\n border: none;\r\n background: transparent;\r\n}\r\n\r\n.absol-calendar-input>input:hover,\r\n.absol-calendar-input>input:focus {\r\n color: red;\r\n}\r\n\r\n.absol-calendar-input.absol-disabled {\r\n pointer-events: none;\r\n}\r\n\r\n.absol-calendar-input.absol-disabled input {\r\n color: rgb(169, 169, 171);\r\n}", ""]); /***/ }), /* 201 */ /***/ (function(module, exports, __webpack_require__) { var content = __webpack_require__(202); if(typeof content === 'string') content = [[module.i, content, '']]; var transform; var insertInto; var options = {"hmr":true} options.transform = transform options.insertInto = undefined; var update = __webpack_require__(5)(content, options); if(content.locals) module.exports = content.locals; if(false) {} /***/ }), /* 202 */ /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__(4)(false); // Module exports.push([module.i, ".absol-onscreen-window {\r\n z-index: 1002;\r\n position: fixed;\r\n left: 10px;\r\n top: 10px;\r\n width: 12em;\r\n height: 5em;\r\n /*default size*/\r\n /* min-width: 12em;\r\n min-height: 1.4em; */\r\n}\r\n\r\n.absol-onscreen-window-content {\r\n position: relative;\r\n width: 100%;\r\n height: 100%;\r\n background: white;\r\n -webkit-box-shadow: 2px 2px 17px -1px rgba(0, 0, 0, 0.54);\r\n -moz-box-shadow: 2px 2px 17px -1px rgba(0, 0, 0, 0.54);\r\n box-shadow: 2px 2px 17px -1px rgba(0, 0, 0, 0.54);\r\n}\r\n\r\n.absol-onscreen-window-head-bar {\r\n height: 1.4em;\r\n position: relative;\r\n background-color: rgba(169, 169, 169, 0.15);\r\n padding: 0.2em;\r\n box-sizing: border-box;\r\n}\r\n\r\nspan.absol-onscreen-window-head-bar-icon {\r\n line-height: 1.2em;\r\n font-size: 1em;\r\n margin-right: 0.2em;\r\n}\r\n\r\nspan.absol-onscreen-window-head-bar-title {\r\n line-height: 1.2em;\r\n font-size: 1em;\r\n color: rgba(33, 33, 34);\r\n}\r\n\r\n.absol-onscreen-window-head-bar-buttons {\r\n position: absolute;\r\n right: 0.1em;\r\n top: 0.1em;\r\n bottom: 0.1em;\r\n}\r\n\r\n.absol-onscreen-window-head-bar-buttons>button {\r\n height: 100%;\r\n width: 1em;\r\n font-size: 1em;\r\n padding: 0;\r\n margin: 0 0 0 0.1em;\r\n border: none;\r\n color: rgba(169, 169, 169);\r\n outline: none;\r\n}\r\n\r\n.absol-onscreen-window-head-bar-buttons>button:hover {\r\n color: rgba(103, 103, 103);\r\n}\r\n\r\n.absol-onscreen-window-head-bar-buttons>button:active {\r\n color: rgba(33, 33, 34);\r\n}\r\n\r\n.absol-onscreen-window-head-bar-buttons>button:hover>.mdi-close {\r\n color: rgb(255, 59, 59);\r\n}\r\n\r\n.absol-onscreen-window-head-bar-buttons>button>span {\r\n vertical-align: middle;\r\n}\r\n\r\n.absol-onscreen-window-body-container {\r\n position: absolute;\r\n left: 0;\r\n right: 0;\r\n top: 1.4em;\r\n bottom: 0;\r\n}\r\n\r\n\r\n.absol-onscreen-window-moving-modal {\r\n position: fixed;\r\n left: 1px;\r\n right: 1px;\r\n top: 1px;\r\n bottom: 1px;\r\n z-index: 100006;\r\n}\r\n\r\n.absol-onscreen-window-resizer {\r\n position: absolute;\r\n}\r\n\r\n.absol-onscreen-window-resizer.absol-onscreen-window-resize-bottom {\r\n bottom: -3px;\r\n height: 6px;\r\n left: 3px;\r\n right: 3px;\r\n z-index: 3;\r\n}\r\n\r\n.absol-onscreen-window-resizer.absol-onscreen-window-resize-top {\r\n top: -3px;\r\n height: 6px;\r\n left: 3px;\r\n right: 3px;\r\n z-index: 3;\r\n}\r\n\r\n.absol-onscreen-window-resizer.absol-onscreen-window-resize-left {\r\n left: -3px;\r\n top: 3px;\r\n bottom: 3px;\r\n width: 6px;\r\n cursor: ew-resize;\r\n}\r\n\r\n.absol-onscreen-window-resizer.absol-onscreen-window-resize-right {\r\n right: -3px;\r\n top: 3px;\r\n bottom: 3px;\r\n width: 6px;\r\n cursor: ew-resize;\r\n}\r\n\r\n.absol-onscreen-window-resizer.absol-onscreen-window-resize-bottom-right {\r\n width: 6px;\r\n height: 6px;\r\n right: -3px;\r\n bottom: -3px;\r\n}\r\n\r\n.absol-onscreen-window-resizer.absol-onscreen-window-resize-bottom-left {\r\n width: 6px;\r\n height: 6px;\r\n left: -3px;\r\n bottom: -3px;\r\n}\r\n\r\n.absol-onscreen-window-resizer.absol-onscreen-window-resize-top-left {\r\n width: 6px;\r\n height: 6px;\r\n left: -3px;\r\n top: -3px;\r\n}\r\n\r\n.absol-onscreen-window-resizer.absol-onscreen-window-resize-top-right {\r\n width: 6px;\r\n height: 6px;\r\n right: -3px;\r\n top: -3px;\r\n}\r\n\r\n\r\n.absol-onscreen-window-resize-top,\r\n.absol-onscreen-window-resize-bottom {\r\n cursor: ns-resize;\r\n\r\n}\r\n\r\n.absol-onscreen-window-resize-left,\r\n.absol-onscreen-window-resize-right {\r\n cursor: ew-resize;\r\n\r\n}\r\n\r\n\r\n.absol-onscreen-window-resize-bottom-right {\r\n cursor: se-resize;\r\n}\r\n\r\n.absol-onscreen-window-resize-bottom-left {\r\n cursor: sw-resize;\r\n}\r\n\r\n.absol-onscreen-window-resize-top-left {\r\n cursor: nw-resize;\r\n}\r\n\r\n.absol-onscreen-window-resize-top-right {\r\n cursor: ne-resize;\r\n}", ""]); /***/ }), /* 203 */ /***/ (function(module, exports, __webpack_require__) { var content = __webpack_require__(204); if(typeof content === 'string') content = [[module.i, content, '']]; var transform; var insertInto; var options = {"hmr":true} options.transform = transform options.insertInto = undefined; var update = __webpack_require__(5)(content, options); if(content.locals) module.exports = content.locals; if(false) {} /***/ }), /* 204 */ /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__(4)(false); // Module exports.push([module.i, "/*margin for border size*/\r\n.as-hruler {\r\n position: relative;\r\n height: 1.5em;\r\n border: solid 1px black;\r\n overflow: hidden;\r\n font-family: courier, \"courier new\", monospace;\r\n box-sizing: border-box;\r\n}\r\n\r\n\r\n.as-hruler-line {\r\n position: absolute;\r\n bottom: 0;\r\n height: 25%;\r\n border-left: solid 1px rgb(17, 48, 43);\r\n box-sizing: border-box;\r\n}\r\n\r\n.as-hruler-line.major {\r\n height: 50%;\r\n border-left: solid 1px rgb(5, 20, 18);\r\n}\r\n\r\n.as-hruler-major-number{\r\n position: absolute;\r\n text-align: center;\r\n width: 5em;\r\n pointer-events: none;\r\n font-size: 0.7em;\r\n bottom: 50%;\r\n} ", ""]); /***/ }), /* 205 */ /***/ (function(module, exports, __webpack_require__) { var content = __webpack_require__(206); if(typeof content === 'string') content = [[module.i, content, '']]; var transform; var insertInto; var options = {"hmr":true} options.transform = transform options.insertInto = undefined; var update = __webpack_require__(5)(content, options); if(content.locals) module.exports = content.locals; if(false) {} /***/ }), /* 206 */ /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__(4)(false); // Module exports.push([module.i, "/*margin for border size*/\r\n.as-vruler {\r\n position: relative;\r\n width: 1.5em;\r\n border: solid 1px black;\r\n overflow: hidden;\r\n font-family: courier, \"courier new\", monospace;\r\n box-sizing: border-box;\r\n}\r\n\r\n\r\n.as-vruler-line {\r\n position: absolute;\r\n right: 0;\r\n width: 25%;\r\n border-top: solid 1px rgb(17, 48, 43);\r\n box-sizing: border-box;\r\n\r\n}\r\n\r\n.as-vruler-line.major {\r\n width: 50%;\r\n border-top: solid 1px rgb(5, 20, 18);\r\n}\r\n\r\n.as-vruler-major-number {\r\n position: absolute;\r\n text-align: center;\r\n width: 5em;\r\n pointer-events: none;\r\n font-size: 0.7em;\r\n right: calc(52% - 2em);\r\n height: 1em;\r\n transform-origin: center;\r\n \r\n -webkit-transform:rotate(90deg);\r\n -moz-transform:rotate(90deg);\r\n -o-transform: rotate(90deg);\r\n -ms-transform:rotate(90deg);\r\n transform: rotate(-90deg);\r\n}", ""]); /***/ }), /* 207 */ /***/ (function(module, exports, __webpack_require__) { var content = __webpack_require__(208); if(typeof content === 'string') content = [[module.i, content, '']]; var transform; var insertInto; var options = {"hmr":true} options.transform = transform options.insertInto = undefined; var update = __webpack_require__(5)(content, options); if(content.locals) module.exports = content.locals; if(false) {} /***/ }), /* 208 */ /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__(4)(false); // Module exports.push([module.i, ".as-resize-box {\r\n position: absolute;\r\n /*or fixed*/\r\n z-index: 1;\r\n box-sizing: border-box;\r\n opacity: 0.5;\r\n pointer-events: none;\r\n}\r\n\r\n.as-resize-box-body {\r\n margin: -1px;\r\n width: calc(100% + 2px);\r\n height: calc(100% + 2px);\r\n position: relative;\r\n box-sizing: border-box;\r\n border: solid 2px rgb(32, 150, 218);\r\n}\r\n\r\n.as-resize-box.as-can-move .as-resize-box-body {\r\n cursor: move;\r\n pointer-events: all;\r\n}\r\n\r\n.as-resize-box.as-can-click .as-resize-box-body {\r\n pointer-events: all;\r\n}\r\n\r\n.as-resize-box.as-can-move .as-resize-box-dot,\r\n.as-resize-box.as-can-resize .as-resize-box-dot.right,\r\n.as-resize-box.as-can-resize .as-resize-box-dot.bottom,\r\n.as-resize-box.as-can-resize .as-resize-box-dot.right-bottom {\r\n display: unset;\r\n\r\n}\r\n\r\n.as-resize-box-dot {\r\n position: absolute;\r\n width: 0.6em;\r\n height: 0.6em;\r\n background: rgb(32, 150, 218);\r\n display: none;\r\n pointer-events: all;\r\n}\r\n\r\n.as-resize-box-dot.left-top {\r\n top: calc(-0.3em - 1px);\r\n left: calc(-0.3em - 1px);\r\n cursor: nw-resize;\r\n}\r\n\r\n.as-resize-box-dot.left-bottom {\r\n bottom: calc(-0.3em - 1px);\r\n left: calc(-0.3em - 1px);\r\n cursor: sw-resize;\r\n}\r\n\r\n.as-resize-box-dot.left {\r\n top: calc(50% - 0.3em);\r\n left: calc(-0.3em - 1px);\r\n cursor: w-resize;\r\n}\r\n\r\n.as-resize-box-dot.top {\r\n top: calc(-0.3em - 1px);\r\n left: calc(50% - 0.3em);\r\n cursor: n-resize;\r\n}\r\n\r\n.as-resize-box-dot.bottom {\r\n bottom: calc(-0.3em - 1px);\r\n left: calc(50% - 0.3em);\r\n cursor: s-resize;\r\n}\r\n\r\n.as-resize-box-dot.right-top {\r\n top: calc(-0.3em - 1px);\r\n right: calc(-0.3em - 1px);\r\n cursor: ne-resize;\r\n}\r\n\r\n.as-resize-box-dot.right-bottom {\r\n bottom: calc(-0.3em - 1px);\r\n right: calc(-0.3em - 1px);\r\n cursor: se-resize;\r\n}\r\n\r\n\r\n.as-resize-box-dot.right {\r\n top: calc(50% - 0.3em);\r\n right: calc(-0.3em - 1px);\r\n cursor: e-resize;\r\n}\r\n\r\n.as-resize-box-overiding .as-resize-box-dot,\r\n.as-resize-box-overiding .as-resize-box-body {\r\n cursor: unset;\r\n}\r\n\r\n.as-resize-box-overiding.body {\r\n cursor: move;\r\n}\r\n\r\n\r\n.as-resize-box-overiding.left-top {\r\n cursor: nw-resize;\r\n}\r\n\r\n.as-resize-box-overiding.left-bottom {\r\n cursor: sw-resize;\r\n}\r\n\r\n.as-resize-box-overiding.left {\r\n cursor: w-resize;\r\n}\r\n\r\n.as-resize-box-overiding.top {\r\n cursor: n-resize;\r\n}\r\n\r\n.as-resize-box-overiding.bottom {\r\n cursor: s-resize;\r\n}\r\n\r\n.as-resize-box-overiding.right-top {\r\n cursor: ne-resize;\r\n}\r\n\r\n.as-resize-box-overiding.right-bottom {\r\n cursor: se-resize;\r\n}\r\n\r\n\r\n.as-resize-box-overiding.right {\r\n cursor: e-resize;\r\n}", ""]); /***/ }), /* 209 */ /***/ (function(module, exports, __webpack_require__) { var content = __webpack_require__(210); if(typeof content === 'string') content = [[module.i, content, '']]; var transform; var insertInto; var options = {"hmr":true} options.transform = transform options.insertInto = undefined; var update = __webpack_require__(5)(content, options); if(content.locals) module.exports = content.locals; if(false) {} /***/ }), /* 210 */ /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__(4)(false); // Module exports.push([module.i, ".absol-debug-task {\r\n position: fixed;\r\n right: 10px;\r\n bottom: 10px;\r\n z-index: 999999;\r\n border-radius: 4px;\r\n background: rgba(169, 169, 171, 0.3);\r\n border: solid 1px rgba(21, 21, 214, 0.5);\r\n min-width: 45px;\r\n min-height: 30px;\r\n font-size: 12px;\r\n padding: 5px;\r\n pointer-events: none;\r\n}\r\n\r\n.absol-debug-task-name{\r\n color: darkcyan;\r\n}\r\n\r\n.absol-debug-task-value{\r\n color: rgb(159, 8, 197);\r\n}", ""]); /***/ }), /* 211 */ /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__(4)(false); // Module exports.push([module.i, "textarea.as-base-component {\r\n resize: none;\r\n\r\n}\r\n\r\ninput.as-base-component,\r\ntextarea.as-base-component {\r\n outline: none;\r\n border: solid 1px #d6d6d6;\r\n border-radius: 2px;\r\n}\r\n\r\n.as-base-component {\r\n box-sizing: border-box;\r\n}\r\n\r\n.absol-selectmenu.as-base-component .absol-selectmenu-holder-item {\r\n top: calc(50% - 10px);\r\n bottom: calc(50% - 10px);\r\n}\r\n\r\ntable.as-inner-table {\r\n border-collapse: collapse;\r\n box-sizing: border-box;\r\n min-width: calc(100% - 1px);\r\n min-height: calc(100% - 1px);\r\n background: white;\r\n box-sizing: border-box;\r\n}\r\n\r\ntable.as-inner-table>thead {\r\n font-style: italic;\r\n background: #f5f5f5;\r\n}\r\n\r\ntable.as-inner-table>tbody>tr>td,\r\ntable.as-inner-table>thead>tr>th {\r\n border: 1px solid #aaaaaa;\r\n box-sizing: border-box;\r\n padding: 0.25em;\r\n white-space: nowrap;\r\n\r\n}", ""]); /***/ }), /* 212 */ /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__(4)(false); // Module exports.push([module.i, ".as-resize-box.as-focus .as-resize-box-body {\r\n border-color: rgb(255, 174, 0);\r\n}\r\n\r\n\r\n.as-resize-box.as-focus .as-resize-box-dot {\r\n background: rgb(255, 174, 0);\r\n}", ""]); /***/ }), /* 213 */ /***/ (function(module, exports, __webpack_require__) { var content = __webpack_require__(214); if(typeof content === 'string') content = [[module.i, content, '']]; var transform; var insertInto; var options = {"hmr":true} options.transform = transform options.insertInto = undefined; var update = __webpack_require__(5)(content, options); if(content.locals) module.exports = content.locals; if(false) {} /***/ }), /* 214 */ /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__(4)(false); // Module exports.push([module.i, ".as-hline {\r\n position: absolute;\r\n pointer-events: none;\r\n opacity: 0.5;\r\n\r\n}\r\n\r\n.as-hline-body {\r\n position: relative;\r\n border-top: solid 2px rgb(55, 180, 159);\r\n box-sizing: border-box;\r\n width: 100%;\r\n margin-top: -1px;\r\n margin-bottom: -1px; \r\n\r\n}\r\n\r\n.as-hline-dot {\r\n position: absolute;\r\n top: calc(-0.2em - 1px);\r\n height: 0.4em;\r\n width: 0.4em;\r\n background-color: rgb(55, 180, 159);\r\n}\r\n\r\n\r\n.as-hline-dot.left {\r\n left: -0.2em;\r\n}\r\n\r\n\r\n.as-hline-dot.right {\r\n right: -0.2em;\r\n}", ""]); /***/ }), /* 215 */ /***/ (function(module, exports, __webpack_require__) { var content = __webpack_require__(216); if(typeof content === 'string') content = [[module.i, content, '']]; var transform; var insertInto; var options = {"hmr":true} options.transform = transform options.insertInto = undefined; var update = __webpack_require__(5)(content, options); if(content.locals) module.exports = content.locals; if(false) {} /***/ }), /* 216 */ /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__(4)(false); // Module exports.push([module.i, ".as-vline {\r\n position: absolute;\r\n pointer-events: none;\r\n opacity: 0.5;\r\n\r\n}\r\n\r\n.as-vline-body {\r\n position: relative;\r\n border-left: solid 2px rgb(55, 180, 159);\r\n box-sizing: border-box;\r\n height: 100%;\r\n margin-left: -1px;\r\n margin-right: -1px;\r\n\r\n}\r\n\r\n.as-vline-dot {\r\n position: absolute;\r\n left: calc(-0.2em - 1px);\r\n height: 0.4em;\r\n width: 0.4em;\r\n background-color: rgb(55, 180, 159);\r\n}\r\n\r\n\r\n.as-vline-dot.top {\r\n top: -0.2em;\r\n}\r\n\r\n\r\n.as-vline-dot.bottom {\r\n bottom: -0.2em;\r\n}", ""]); /***/ }), /* 217 */ /***/ (function(module, exports, __webpack_require__) { var content = __webpack_require__(218); if(typeof content === 'string') content = [[module.i, content, '']]; var transform; var insertInto; var options = {"hmr":true} options.transform = transform options.insertInto = undefined; var update = __webpack_require__(5)(content, options); if(content.locals) module.exports = content.locals; if(false) {} /***/ }), /* 218 */ /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__(4)(false); // Module exports.push([module.i, ".as-form-editor {\r\n position: relative;\r\n font-size: 14px;\r\n outline: none;\r\n}\r\n\r\n.as-form-editor-resizer {\r\n z-index: 10;\r\n position: absolute;\r\n}\r\n\r\n.as-form-editor-resizer.vertical {\r\n top: 0;\r\n bottom: 0;\r\n width: 0.4em;\r\n cursor: w-resize;\r\n}\r\n\r\n.as-form-editor-left-site-container {\r\n position: absolute;\r\n left: 0;\r\n top: 0;\r\n bottom: 0;\r\n width: 16em;\r\n border-right: 1px solid #ddd ;\r\n\r\n}\r\n\r\n.as-form-editor-left-site-container>.as-form-editor-left-site {\r\n width: 100%;\r\n height: 100%;\r\n}\r\n\r\n.as-form-editor-resizer.vertical.left-site {\r\n left: calc(16em - 0.2em);\r\n}\r\n\r\n.as-form-editor-editor-space-container {\r\n position: absolute;\r\n left: 16.2em;\r\n top: 0;\r\n bottom: 0;\r\n right: 23.2em;\r\n}\r\n\r\n.as-form-editor-resizer.vertical.right-site {\r\n right: calc(23em - 0.2em);\r\n}\r\n\r\n.as-form-editor-right-site-container {\r\n position: absolute;\r\n right: 0;\r\n top: 0;\r\n bottom: 0;\r\n width: 23em;\r\n border-left: 1px solid #ddd ;\r\n}\r\n\r\n.as-form-editor-right-site-container>.as-form-editor-right-site {\r\n width: 100%;\r\n height: 100%;\r\n}\r\n\r\n.as-form-editor-editor-space-container>.as-layout-editor {\r\n width: 100%;\r\n height: 100%;\r\n}\r\n\r\n\r\ntable.as-form-params {\r\n border-collapse: collapse;\r\n box-sizing: border-box;\r\n}\r\n\r\ntable.as-form-params>tbody>tr>td,\r\ntable.as-form-params>thead>tr>td {\r\n border: 1px solid #eeeeee;\r\n padding: 0.25em;\r\n\r\n}\r\n\r\n.as-form-property-tab>table.as-form-params {\r\n width: calc(100% - 10px);\r\n margin: 5px;\r\n}\r\n\r\ntable.as-form-params>tbody>tr>td>input[type=\"text\"],\r\ntable.as-form-params>tbody>tr>td>textarea {\r\n font-size: 1em;\r\n width: 100%;\r\n box-sizing: border-box;\r\n border: solid 1px #d6d6d6;\r\n outline: none;\r\n}\r\n\r\ntable.as-form-params>tbody>tr>td>textarea{\r\n width: 100% !important;\r\n}", ""]); /***/ }), /* 219 */ /***/ (function(module, exports, __webpack_require__) { var content = __webpack_require__(220); if(typeof content === 'string') content = [[module.i, content, '']]; var transform; var insertInto; var options = {"hmr":true} options.transform = transform options.insertInto = undefined; var update = __webpack_require__(5)(content, options); if(content.locals) module.exports = content.locals; if(false) {} /***/ }), /* 220 */ /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__(4)(false); // Module exports.push([module.i, ".as-compopnent-picker {}\r\n\r\n\r\n.as-compopnent-picker-forceground {\r\n position: fixed;\r\n z-index: 1000;\r\n cursor: none;\r\n left: 0;\r\n right: 0;\r\n top: 0;\r\n bottom: 0;\r\n overflow: hidden;\r\n /* background: rgba(169, 169, 169, 0.1); */\r\n}\r\n\r\n.as-compopnent-picker-higne {\r\n position: relative;\r\n left: 0;\r\n top: 0;\r\n}\r\n\r\n.as-compopnent-picker-add-box-container {\r\n position: absolute;\r\n left: 0;\r\n top: 0;\r\n}\r\n\r\n.as-compopnent-picker-add-box {\r\n position: relative;\r\n width: 2em;\r\n height: 2em;\r\n background: white;\r\n border: 1px solid #d6d6d6;\r\n text-align: center;\r\n opacity: 0.7;\r\n}\r\n\r\n.as-compopnent-picker-add-box.as-can-drop {\r\n opacity: 1;\r\n -webkit-box-shadow: 0px 0px 5px 3px rgba(40, 141, 224, 0.6);\r\n -moz-box-shadow: 0px 0px 5px 3px rgba(40, 141, 224, 0.6);\r\n box-shadow: 0px 0px 5px 3px rgba(40, 141, 224, 0.6);\r\n}\r\n\r\n.as-compopnent-picker-add-box-plus {\r\n position: absolute;\r\n left: -0.5em;\r\n top: -0.5em;\r\n width: 1em;\r\n height: 1em;\r\n text-align: center;\r\n z-index: 1;\r\n}\r\n\r\n.as-compopnent-picker-add-box-plus span {\r\n /* font-size: 0.5em; */\r\n vertical-align: top;\r\n}\r\n\r\n.as-compopnent-picker-add-box>svg,\r\n.as-compopnent-picker-add-box>span {\r\n width: 1.25em;\r\n height: 1.25em;\r\n font-size: 1.25em;\r\n line-height: 1.6;\r\n}", ""]); /***/ }), /* 221 */ /***/ (function(module, exports, __webpack_require__) { var content = __webpack_require__(222); if(typeof content === 'string') content = [[module.i, content, '']]; var transform; var insertInto; var options = {"hmr":true} options.transform = transform options.insertInto = undefined; var update = __webpack_require__(5)(content, options); if(content.locals) module.exports = content.locals; if(false) {} /***/ }), /* 222 */ /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__(4)(false); // Module exports.push([module.i, "table.as-property-editor {\r\n border-collapse: collapse;\r\n box-sizing: border-box;\r\n}\r\n\r\ntable.as-property-editor>thead{\r\n font-style: italic;\r\n background: #f5f5f5;\r\n}\r\n\r\ntable.as-property-editor>tbody>tr>td,\r\ntable.as-property-editor>thead>tr>td {\r\n border: 1px solid #aaaaaa;\r\n padding: 0.25em;\r\n\r\n}\r\n\r\n.as-form-property-tab>table.as-property-editor {\r\n width: calc(100% - 10px);\r\n margin: 5px;\r\n}\r\n\r\ntable.as-property-editor>tbody>tr>td>input[type=\"text\"],\r\ntable.as-property-editor>tbody>tr>td>textarea {\r\n font-size: 1em;\r\n width: 100%;\r\n box-sizing: border-box;\r\n border: solid 1px #d6d6d6;\r\n outline: none;\r\n}\r\n\r\ntable.as-property-editor>tbody>tr>td>textarea{\r\n width: 100% !important;\r\n}\r\n", ""]); /***/ }), /* 223 */ /***/ (function(module, exports, __webpack_require__) { var content = __webpack_require__(224); if(typeof content === 'string') content = [[module.i, content, '']]; var transform; var insertInto; var options = {"hmr":true} options.transform = transform options.insertInto = undefined; var update = __webpack_require__(5)(content, options); if(content.locals) module.exports = content.locals; if(false) {} /***/ }), /* 224 */ /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__(4)(false); // Module exports.push([module.i, ".as-list-editor-add-row {\r\n cursor: pointer;\r\n}\r\n\r\ntable.as-list-editor {\r\n border-collapse: collapse;\r\n}\r\n\r\ntable.as-list-editor,\r\ntable.as-list-editor>thead>tr>td,\r\ntable.as-list-editor>tbody>tr>td {\r\n border: 1px solid #d6d6d6;\r\n}\r\n\r\n.as-list-editor-text,\r\n.as-list-editor-value {\r\n outline: none;\r\n padding: 0.2em 1em;\r\n}\r\n\r\n.as-list-editor-cell.empty-cell {\r\n background-color: rgba(255, 20, 20, 0.3);\r\n}\r\n\r\n.as-list-editor-cell.duplicate-cell {\r\n background-color: rgba(235, 229, 151, 0.3);\r\n}\r\n\r\n.as-list-editor-quick-menu-trigger {\r\n border: none;\r\n width: 1.5em;\r\n height: 1.5em;\r\n font-size: 1em;\r\n padding: 0;\r\n border-radius: 0;\r\n margin: 0;\r\n}", ""]); /***/ }), /* 225 */ /***/ (function(module, exports, __webpack_require__) { var content = __webpack_require__(226); if(typeof content === 'string') content = [[module.i, content, '']]; var transform; var insertInto; var options = {"hmr":true} options.transform = transform options.insertInto = undefined; var update = __webpack_require__(5)(content, options); if(content.locals) module.exports = content.locals; if(false) {} /***/ }), /* 226 */ /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__(4)(false); // Module exports.push([module.i, ".as-font-icon-picker {\r\n font-size: 14px;\r\n background-color: white;\r\n display: inline-block;\r\n padding: 0.357em;\r\n -webkit-box-shadow: 2px 2px 17px -1px rgba(0, 0, 0, 0.54);\r\n -moz-box-shadow: 2px 2px 17px -1px rgba(0, 0, 0, 0.54);\r\n box-shadow: 2px 2px 17px -1px rgba(0, 0, 0, 0.54);\r\n}\r\n\r\n.as-font-icon-picker>.absol-search-text-input {\r\n margin-bottom: 0.357em;\r\n}\r\n\r\n.as-font-icon-picker-option {\r\n padding-bottom: 0.357em;\r\n}\r\n\r\nbutton.as-font-icon-picker-icon {\r\n height: 3em;\r\n width: 3em;\r\n padding: 0;\r\n margin: 0;\r\n margin: 0.1em;\r\n font-size: 1em;\r\n box-sizing: border-box;\r\n background-color: rgba(169, 169, 172, 0);\r\n border: 1px solid #dddd;\r\n}\r\n\r\nbutton.as-font-icon-picker-icon:hover {\r\n background-color: rgba(169, 169, 172, 0.2);\r\n}\r\n\r\nbutton.as-font-icon-picker-icon>span {\r\n font-size: 2em;\r\n}\r\n\r\n\r\n.as-font-icon-picker-content {\r\n text-align: center;\r\n height: 19.2em;\r\n width: 20.2em;\r\n}\r\n\r\n.as-font-icon-picker-selected {\r\n background-color: rgba(20, 185, 235, 0.3);\r\n}", ""]); /***/ }), /* 227 */ /***/ (function(module, exports, __webpack_require__) { var content = __webpack_require__(228); if(typeof content === 'string') content = [[module.i, content, '']]; var transform; var insertInto; var options = {"hmr":true} options.transform = transform options.insertInto = undefined; var update = __webpack_require__(5)(content, options); if(content.locals) module.exports = content.locals; if(false) {} /***/ }), /* 228 */ /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__(4)(false); // Module exports.push([module.i, ".as-component-outline-node-selected>.absol-exp-node {\r\n background-color: rgba(20, 185, 235, 0.3);\r\n}\r\n\r\n\r\n.as-component-outline-node-focus>.absol-exp-node {\r\n background-color: rgba(185, 235, 20, 0.3);\r\n}", ""]); /***/ }), /* 229 */ /***/ (function(module, exports, __webpack_require__) { var content = __webpack_require__(230); if(typeof content === 'string') content = [[module.i, content, '']]; var transform; var insertInto; var options = {"hmr":true} options.transform = transform options.insertInto = undefined; var update = __webpack_require__(5)(content, options); if(content.locals) module.exports = content.locals; if(false) {} /***/ }), /* 230 */ /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__(4)(false); // Module exports.push([module.i, ".as-undo-history {\r\n min-width: 200px;\r\n min-height: 200px;\r\n}\r\n\r\n.as-undo-history.as-minimize {\r\n left: 5px;\r\n top: calc(100vh - 1.4em - 5px);\r\n height: 1.4em;\r\n min-width: unset;\r\n min-height: unset;\r\n overflow: hidden;\r\n -webkit-box-shadow: 2px 2px 17px -1px rgba(0, 0, 0, 0.54);\r\n -moz-box-shadow: 2px 2px 17px -1px rgba(0, 0, 0, 0.54);\r\n box-shadow: 2px 2px 17px -1px rgba(0, 0, 0, 0.54);\r\n}\r\n\r\n\r\n.as-undo-history.as-minimize>.absol-onscreen-window-content>.absol-onscreen-window-head-bar .absol-onscreen-window-head-bar-button-minimize {\r\n display: none;\r\n}\r\n\r\n.as-undo-history:not(.as-minimize)>.absol-onscreen-window-content>.absol-onscreen-window-head-bar .absol-onscreen-window-head-bar-button-dock {\r\n display: none;\r\n}\r\n\r\n\r\n\r\n.as-undo-history-item-list {\r\n position: absolute;\r\n top: 1.6em;\r\n left: 0.1em;\r\n right: 0.1em;\r\n bottom: 0.1em;\r\n box-sizing: border-box;\r\n border: 1px solid #ddd;\r\n}\r\n\r\n.as-undo-history-active-buttons {\r\n height: 1.4em;\r\n padding: 0.1em;\r\n}\r\n\r\n.as-undo-history-active-buttons button {\r\n width: 1.4em;\r\n height: 1.4em;\r\n font-size: 1em;\r\n padding: 0;\r\n border: 0;\r\n margin-left: 0.2em;\r\n margin-right: 0.2em;\r\n outline: none;\r\n background-color: rgba(169, 169, 169, 0.1);\r\n}\r\n\r\n.as-undo-history-active-buttons button:disabled {\r\n pointer-events: none;\r\n}\r\n\r\n.as-undo-history-active-buttons button:hover {\r\n background-color: rgba(169, 169, 169, 0.2);\r\n}\r\n\r\n.as-undo-history-active-buttons button:active {\r\n background-color: rgba(169, 169, 169, 0.4);\r\n}\r\n\r\n.as-undo-history-active-buttons .mdi-delete {\r\n color: rgb(255, 59, 59);\r\n}\r\n\r\n.as-undo-history-active-buttons-right-container {\r\n position: absolute;\r\n top: 0.1em;\r\n right: 0.1em;\r\n}\r\n\r\n.as-undo-history-item {\r\n position: relative;\r\n padding-left: 1.4em;\r\n min-height: 1.4em;\r\n box-sizing: content-box;\r\n border-bottom: 1px solid #ddd;\r\n cursor: pointer;\r\n overflow: hidden;\r\n text-overflow: ellipsis;\r\n white-space: nowrap;\r\n\r\n}\r\n\r\n.as-undo-history-item>span{\r\n overflow: hidden;\r\n \r\n}\r\n\r\n.as-undo-history-item-icon-container {\r\n top: calc(50% - 0.6em);\r\n bottom: calc(50% - 0.6em);\r\n left: 0.1em;\r\n width: 1.2em;\r\n position: absolute;\r\n}\r\n\r\n.as-undo-history-item-icon-container>span {\r\n font-size: 1em;\r\n line-height: 1.2;\r\n}\r\n\r\n.as-undo-history-item-active {\r\n background: rgba(169, 169, 199, 0.3);\r\n}\r\n.as-undo-history-item-disabled{\r\n color: rgb(152, 152, 155);\r\n}", ""]); /***/ }), /* 231 */ /***/ (function(module, exports, __webpack_require__) { var content = __webpack_require__(232); if(typeof content === 'string') content = [[module.i, content, '']]; var transform; var insertInto; var options = {"hmr":true} options.transform = transform options.insertInto = undefined; var update = __webpack_require__(5)(content, options); if(content.locals) module.exports = content.locals; if(false) {} /***/ }), /* 232 */ /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__(4)(false); // Module exports.push([module.i, ".as-form-format-picker {\r\n font-size: 14px;\r\n width: 500px;\r\n height: 300px;\r\n left: calc(50vw - 250px);\r\n top: calc(30vh - 150px);\r\n z-index: 1000;\r\n}\r\n\r\n\r\n.as-form-format-picker .absol-onscreen-window-resizer {\r\n display: none;\r\n}\r\n\r\n.as-form-format-picker .absol-onscreen-window-body-container {\r\n padding: 5px;\r\n}\r\n\r\n.as-form-format-picker-input-box {\r\n display: inline-block;\r\n vertical-align: top;\r\n padding: 5px;\r\n}\r\n\r\n.as-form-format-picker-input-box-name{\r\n line-height: 1.3;\r\n}\r\n\r\n.as-form-format-picker-select-font{\r\n width: 100%;\r\n} \r\n\r\n\r\n.as-form-format-picker-input-box-select-font{\r\n width: 60%;\r\n}", ""]); /***/ }), /* 233 */ /***/ (function(module, exports, __webpack_require__) { var content = __webpack_require__(234); if(typeof content === 'string') content = [[module.i, content, '']]; var transform; var insertInto; var options = {"hmr":true} options.transform = transform options.insertInto = undefined; var update = __webpack_require__(5)(content, options); if(content.locals) module.exports = content.locals; if(false) {} /***/ }), /* 234 */ /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__(4)(false); // Module exports.push([module.i, ".as-size-box-editor {\r\n padding: 0.35em;\r\n border: 1px solid black;\r\n font-size: 12px;\r\n display: table;\r\n width: 100%;\r\n box-sizing: border-box;\r\n}\r\n\r\n.as-size-box-editor-title{\r\n width: 0;\r\n overflow: visible;\r\n white-space: nowrap;\r\n color: rgb(169, 169, 169);\r\n}\r\n\r\n.as-size-box-editor-position-top,\r\n.as-size-box-editor-position-bottom {\r\n height: 1.2em;\r\n text-align: center;\r\n display: table-row;\r\n}\r\n\r\n.as-size-box-editor-position-top>*,\r\n.as-size-box-editor-position-bottom>* {\r\n display: table-cell;\r\n}\r\n\r\n.as-size-box-editor-position-top>span,\r\n.as-size-box-editor-position-bottom>span {\r\n font-size: inherit;\r\n}\r\n\r\n\r\n.as-size-box-editor-top-text{\r\n outline: none;\r\n}\r\n\r\n.as-size-box-editor-position-top>span {\r\n font-size: inherit;\r\n}\r\n\r\n\r\n.as-size-box-editor-position-mid {\r\n display: table-row;\r\n}\r\n\r\n.as-size-box-editor-position-left,\r\n.as-size-box-editor-position-right {\r\n display: table-cell;\r\n width: 0;\r\n padding-left: 0.2em;\r\n padding-right: 0.2em;\r\n vertical-align: middle;\r\n\r\n}\r\n\r\n.as-size-box-editor-position-left>span,\r\n.as-size-box-editor-position-right>span {\r\n font-size: inherit;\r\n}\r\n\r\n\r\n.as-size-box-editor-position-center {\r\n display: table-cell;\r\n width: 100%;\r\n box-sizing: border-box;\r\n background-color: rgba(255, 0, 0, 0.3); \r\n}\r\n", ""]); /***/ }), /* 235 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); var stringGenerate_namespaceObject = {}; __webpack_require__.r(stringGenerate_namespaceObject); __webpack_require__.d(stringGenerate_namespaceObject, "identCharacters", function() { return identCharacters; }); __webpack_require__.d(stringGenerate_namespaceObject, "randomIdent", function() { return randomIdent; }); __webpack_require__.d(stringGenerate_namespaceObject, "parallelMatch", function() { return parallelMatch; }); __webpack_require__.d(stringGenerate_namespaceObject, "ipsumLoremWord", function() { return ipsumLoremWord; }); __webpack_require__.d(stringGenerate_namespaceObject, "randomWord", function() { return randomWord; }); __webpack_require__.d(stringGenerate_namespaceObject, "randomPhrase", function() { return randomPhrase; }); __webpack_require__.d(stringGenerate_namespaceObject, "randomSentence", function() { return randomSentence; }); __webpack_require__.d(stringGenerate_namespaceObject, "randomParagraph", function() { return randomParagraph; }); var Text_namespaceObject = {}; __webpack_require__.r(Text_namespaceObject); __webpack_require__.d(Text_namespaceObject, "getTextNodesIn", function() { return getTextNodesIn; }); __webpack_require__.d(Text_namespaceObject, "setSelectionRangeStart", function() { return setSelectionRangeStart; }); __webpack_require__.d(Text_namespaceObject, "setSelectionRangeEnd", function() { return setSelectionRangeEnd; }); __webpack_require__.d(Text_namespaceObject, "setSelectionRange", function() { return setSelectionRange; }); __webpack_require__.d(Text_namespaceObject, "getTextIn", function() { return getTextIn; }); __webpack_require__.d(Text_namespaceObject, "textToNodes", function() { return textToNodes; }); __webpack_require__.d(Text_namespaceObject, "getCaretPosition", function() { return Text_getCaretPosition; }); __webpack_require__.d(Text_namespaceObject, "setCaretPosition", function() { return setCaretPosition; }); __webpack_require__.d(Text_namespaceObject, "measureText", function() { return measureText; }); var file_namespaceObject = {}; __webpack_require__.r(file_namespaceObject); __webpack_require__.d(file_namespaceObject, "blobToFile", function() { return blobToFile; }); __webpack_require__.d(file_namespaceObject, "dataURItoBlob", function() { return dataURItoBlob; }); __webpack_require__.d(file_namespaceObject, "blobToArrayBuffer", function() { return blobToArrayBuffer; }); __webpack_require__.d(file_namespaceObject, "stringToBlob", function() { return stringToBlob; }); var base64_namespaceObject = {}; __webpack_require__.r(base64_namespaceObject); __webpack_require__.d(base64_namespaceObject, "base64EncodeUnicode", function() { return base64EncodeUnicode; }); __webpack_require__.d(base64_namespaceObject, "base64DecodeUnicode", function() { return base64DecodeUnicode; }); __webpack_require__.d(base64_namespaceObject, "UnicodeBase64Converter", function() { return UnicodeBase64Converter; }); var attribute_namespaceObject = {}; __webpack_require__.r(attribute_namespaceObject); __webpack_require__.d(attribute_namespaceObject, "parseStyleAttr", function() { return parseStyleAttr; }); __webpack_require__.d(attribute_namespaceObject, "parseClassAttr", function() { return parseClassAttr; }); var dom_namespaceObject = {}; __webpack_require__.r(dom_namespaceObject); __webpack_require__.d(dom_namespaceObject, "domVisitor", function() { return domVisitor; }); __webpack_require__.d(dom_namespaceObject, "parseDom", function() { return parseDom; }); // EXTERNAL MODULE: ./node_modules/atob/browser-atob.js var browser_atob = __webpack_require__(63); var browser_atob_default = /*#__PURE__*/__webpack_require__.n(browser_atob); // EXTERNAL MODULE: ./node_modules/btoa/index.js var node_modules_btoa = __webpack_require__(64); var btoa_default = /*#__PURE__*/__webpack_require__.n(node_modules_btoa); // CONCATENATED MODULE: ./node_modules/absol/src/Polyfill/polyfill.js if (!('atob' in window)) { window.atob = browser_atob_default.a; } if (!('btoa' in window)) { window.btoa = btoa_default.a; } // EXTERNAL MODULE: ./node_modules/absol/src/HTML5/EventEmitter.js var EventEmitter = __webpack_require__(2); // EXTERNAL MODULE: ./node_modules/absol/src/Detector/BrowserDetector.js var BrowserDetector = __webpack_require__(19); // EXTERNAL MODULE: ./node_modules/absol/src/HTML5/Element.js var Element = __webpack_require__(6); // EXTERNAL MODULE: ./node_modules/absol/src/HTML5/JSPath.js var JSPath = __webpack_require__(23); // EXTERNAL MODULE: ./node_modules/absol/src/JSMaker/TemplateString.js var TemplateString = __webpack_require__(10); // CONCATENATED MODULE: ./node_modules/absol/src/XML/XMLConstant.js var XMLConstant = { TYPE_ELEMENT:1, TYPE_TEXT:3, TYPE_COMMENT:8, TYPE_DECLARATION:16 }; /* harmony default export */ var XML_XMLConstant = (XMLConstant); // CONCATENATED MODULE: ./node_modules/absol/src/XML/XMLDeclarationNode.js function XMLDeclaretionNode() { this.nodeType = XML_XMLConstant.TYPE_DECLARATION; this.parentNode; /** * @type {String} */ this.tagName = ''; /** * @type {XMLElement} */ this.parentNode; this.attributes = {}; } /** * @param {String} name attribute name */ XMLDeclaretionNode.prototype.getAttribute = function (name) { return this.attributes[name]; }; /** * @param {String} name attribute name * @param {String} value */ XMLDeclaretionNode.prototype.setAttribute = function (name, value) { this.attributes[name] = value; }; /** * @param {String} name attribute name */ XMLDeclaretionNode.prototype.removeAttribute = function (name) { delete this.attributes[name]; }; XMLDeclaretionNode.prototype.remove = function () { if (this.parentNode) { this.parentNode.removeChild(this); } }; XMLDeclaretionNode.prototype.toObject = function () { return { nodeType: this.nodeType, tagName: this.tagName, attributes: Object.assign({}, this.attributes) }; }; /* harmony default export */ var XMLDeclarationNode = (XMLDeclaretionNode); // CONCATENATED MODULE: ./node_modules/absol/src/XML/XMLClassList.js /** * * @param {XMLElement} xmlNode */ function XMLClassList(xmlNode) { this.xmlNode = xmlNode; } /** * @param {String} name * @returns {Boolean} */ XMLClassList.prototype.contains = function (name) { var className = this.xmlNode.getAttribute('class'); if (className) { var classes = className.trim().split(/\s+/); for (var i = 0; i < classes.length; ++i) { if (classes[i] == name) return true; } return false; } else return false; }; /** * @param {Number} index * @returns {String} */ XMLClassList.prototype.item = function (index) { var className = this.xmlNode.getAttribute('class'); if (className) { var classes = className.trim().split(/\s+/); return classes[index]; } else return undefined; }; /** * @param {Array<String>} arguments */ XMLClassList.prototype.remove = function () { var dict = Array.prototype.reduce.call(arguments, function (ac, name) { ac[name] = true; return ac; }, {}); var className = this.xmlNode.getAttribute('class'); if (className) { var classes = className.trim().split(/\s+/); var newClasses = classes.filter(function (name) { dict[name]; }); this.xmlNode.setAttribute(newClasses.join(' ')); } }; /** * @param {Array<String>} arguments */ XMLClassList.prototype.add = function () { var className = this.xmlNode.getAttribute('class') || ''; var classes = className.trim().split(/\s+/); var dict = classes.reduce(function (ac, name) { ac[name] = true; return ac; }, {}); for (var i = 0; i < arguments.length; ++i) { var newClass = arguments[i].trim(); if (newClass.length == 0) return; if (!dict[newClass]) { classes.push(newClass); dict[newClass] = true; } } this.xmlNode.setAttribute('class', classes.join(' ')); }; /* harmony default export */ var XML_XMLClassList = (XMLClassList); // CONCATENATED MODULE: ./node_modules/absol/src/XML/XMLElement.js function XMLElement() { this.nodeType = XML_XMLConstant.TYPE_ELEMENT; /** * @type {String} */ this.tagName = ''; /** * @type {XMLElement} */ this.parentNode; this.attributes = {}; /** * @type {Array} Array of XMLElement or XMLText */ this.childNodes = []; Object.defineProperty(this, 'classList', { value: new XML_XMLClassList(this), writable: false }); } /** * @param {String} name attribute name */ XMLElement.prototype.getAttribute = function (name) { return this.attributes[name]; }; /** * @param {String} name attribute name * @param {String} value */ XMLElement.prototype.setAttribute = function (name, value) { this.attributes[name] = value; }; /** * @param {String} name attribute name */ XMLElement.prototype.removeAttribute = function (name) { delete this.attributes[name]; }; XMLElement.prototype.appendChild = function (node) { node.remove(); this.childNodes.push(node); node.parentNode = this; return node; }; /** * @param {XMLElement} child * @returns {XMLElement} removed node */ XMLElement.prototype.removeChild = function (child) { var result; if (this == child.parentNode) { var j = 0; for (var i = 0; i < this.childNodes.length; ++i) { if (child != this.childNodes[i]) { this.childNodes[j] = this.childNodes[i]; ++j; } else { child.parentNode = undefined; result = child; } } while (j > this.childNodes.length) { this.childNodes.pop(); } } return result; }; /** * @param {XMLElement|XMLText|XMLDeclaretionNode} node */ XMLElement.prototype.inserBefore = function (node, child) { if (node == child) return; var childIndex = -1; for (var i = 0; i < this.childNodes.length; ++i) { if (this.childNodes[i] == child) { childIndex = i; break; } } if (childIndex < 0) return; node.remove(); node.parentNode = this; this.childNodes.push(null); var cIndex = this.childNodes.length - 2; while (cIndex >= 0) { if (this.childNodes[cIndex] == child) { this.childNodes[cIndex + 1] = node; } else this.childNodes[cIndex + 1] = this.childNodes[cIndex]; } }; XMLElement.prototype.remove = function () { if (this.parentNode) { this.parentNode.removeChild(this); } }; XMLElement.prototype.toObject = function () { return { nodeType: this.nodeType, tagName: this.tagName, attributes: Object.assign({}, this.attributes), childNodes: this.childNodes.map(function (child) { return child.toObject(); }) }; }; /* harmony default export */ var XML_XMLElement = (XMLElement); // CONCATENATED MODULE: ./node_modules/absol/src/XML/XMLTextNode.js function XMLTextNode(data) { this.nodeType = XML_XMLConstant.TYPE_TEXT; /** * @type {XMLNode} */ this.parentNode; /** * @type {String} */ this.data = data || ''; } XMLTextNode.prototype.remove = function () { if (this.parentNode) { this.parentNode.removeChild(this); } }; XMLTextNode.prototype.toObject = function () { return { nodeType: this.nodeType, data: this.data }; }; /* harmony default export */ var XML_XMLTextNode = (XMLTextNode); // CONCATENATED MODULE: ./node_modules/absol/src/XML/XMLCommentNode.js function XMLCommentNode(data) { this.nodeType = XML_XMLConstant.TYPE_COMMENT; /** * @type {XMLNode} */ this.parentNode; /** * @type {String} */ this.data = data || ''; } XMLCommentNode.prototype.remove = function () { if (this.parentNode) { this.parentNode.removeChild(this); } }; XMLCommentNode.prototype.toObject = function () { return { nodeType: this.nodeType, data: this.data }; }; /* harmony default export */ var XML_XMLCommentNode = (XMLCommentNode); // CONCATENATED MODULE: ./node_modules/absol/src/XML/XML.js /** * * @param {RegExp} regex */ function getRegexBody(regex) { return regex.toString().match(/^\/(.+)\/([gimuy]*)$/)[1]; } var BEGIN_TAG = 1; var END_TAG = 2; var CDATA = 3; var DECLARATION = 4; var COMMENT = 5; var TEXT = 6; var identRgx = /[^\s\"\r\n\'\!\/=\>\<\]\[\?\+\.]+/; var spaceRgx = /[\s\r\n]+/; var stringRgx = /\"(([^\"\\]*|(\\.))*)\"/; var textRgx = /[^\<\-]+/; var doctypeOpenRgx = /\<\!DOCTYPE/; var commentOpenRgx = /\<!\-\-/; var commentCloseRgx = /\-\-\>/; var cdataOpenRgx = /\<\!\[CDATA\[/; var cdataCloseRgx = /\]\]\>/; var openRgx = /\</; var openEndTagRgx = /\<\//; var closeRgx = /\>/; var shortCloseRgx = /\/\>/; var declarationOpenRgx = /\<\?/; var declarationCloseRgx = /\?\>/; var assignOpRgx = /=/; var tokenRgxBody = '(' + [ spaceRgx, doctypeOpenRgx, declarationOpenRgx, cdataOpenRgx, commentOpenRgx, openEndTagRgx, openRgx, assignOpRgx, stringRgx, commentCloseRgx, identRgx, declarationCloseRgx, shortCloseRgx, closeRgx, cdataCloseRgx, textRgx ].map(function (e) { return getRegexBody(e); }).join(')|(') + ')'; var tokenType = { space: spaceRgx, doctypeOpen: doctypeOpenRgx, declarationOpen: declarationOpenRgx, cdataOpen: cdataOpenRgx, commentOpen: commentOpenRgx, openEndTag: openEndTagRgx, open: openRgx, ident: identRgx, assignOp: assignOpRgx, string: stringRgx, commentClose: commentCloseRgx, declarationClose: declarationCloseRgx, shortClose: shortCloseRgx, close: closeRgx, cdataClose: cdataCloseRgx, text: textRgx } var tokenRgx = new RegExp(tokenRgxBody); /** * * @typedef {Object} Token * @property {String} text * @property {*} matched */ /** * * @param {String} text * @returns {Array<Token>} */ function xmlTokenize(text) { var texts = text.match(new RegExp(tokenRgxBody, 'g')); return text.match(new RegExp(tokenRgxBody, 'g')) .map(function (tokenText, i) { var result = { text: tokenText, matched: {} }; for (var tType in tokenType) { var matched = tokenText.match(tokenType[tType]); if (matched) { if (matched[0] == tokenText) result.matched[tType] = matched; } } return result; }); } /** * @typedef {Object} XMLPaseInfo * @property {Array<Token>} tokens * @property {Number} type * @property {Number} start * @property {Number} end * @property {Error} error * @property {Boolean} closed * * * * @typedef {Object} XMLParseNode * @property {XMLPaseInfo} __xml__ * @property {String} tagName * @property {*} attributes * @property {String} text */ /** * * @param {Array<Token>} tokens * @param {Number} i * @returns {XMLParseNode} */ function matchAssign(tokens, i) { var result = { __xml__: { start: i } }; var cToken; if (i < tokens.length) { cToken = tokens[i]; if (cToken.matched['ident']) { result.key = cToken.text; ++i; if (i < tokens.length) { cToken = tokens[i]; if (cToken.matched['space']) { ++i; } if (i < tokens.length) { cToken = tokens[i]; if (cToken.matched['assignOp']) { ++i; if (i < tokens.length) { cToken = tokens[i]; if (cToken.matched['space']) { ++i; } if (i < tokens.length) { cToken = tokens[i]; if (cToken.matched['string']) { result.value = cToken.matched.string[1]; ++i; } else { result.__xml__.error = new Error('"' + cToken.text + '"' + 'found, expected string'); } } else { result.__xml__.error = new Error('End of data found, expected ident'); } } else { result.__xml__.error = new Error('End of data found, expected ident'); } } else { result.__xml__.error = new Error('"' + cToken.text + '"' + 'found, expected ='); } } else { result.__xml__.error = new Error('End of data found, expected ='); } } else { result.__xml__.error = new Error('End of data found, expected ='); } } else { result.__xml__.error = new Error('"' + cToken.text + '"' + 'found, expected ident'); } } else { result.__xml__.error = new Error('End of data found, expected ident'); } result.__xml__.end = i; return result; } /** * * @param {Array<Token>} tokens * @param {Number} i * @returns {XMLParseNode} */ function matchBeginTag(tokens, i) { var result = { __xml__: { type: BEGIN_TAG, start: i } }; var cToken; if (i < tokens.length) { cToken = tokens[i]; if (cToken.matched['open']) { ++i; if (i < tokens.length) { cToken = tokens[i]; if (cToken.matched['ident']) { result.tagName = cToken.text; ++i; if (i < tokens.length) { var finished = false;//when find the close symbol while (i < tokens.length) { cToken = tokens[i]; if (cToken.matched['space']) { ++i; }//skip space between attributes if (i < tokens.length) { cToken = tokens[i]; if (cToken.matched['shortClose']) { result.__xml__.closed = true; ++i; finished = true; break; } else if (cToken.matched['close']) { result.__xml__.closed = false; ++i; finished = true; break; } else if (tokens[i - 1].matched['space']) { var assign = matchAssign(tokens, i); if (!assign.__xml__.error) { result.attributes = result.attributes || {}; result.attributes[assign.key] = assign.value; i = assign.__xml__.end; } else if (cToken.matched['ident']) { result.attributes = result.attributes || {}; result.attributes[cToken.text] = true;// a flag ++i; } else { //TODO: we can ignore some error here, the same with order Match* function result.__xml__.error = new Error('"' + cToken.text + '"' + 'found, expected > or indent'); break; } } else { //TODO: we can ignore some error here result.__xml__.error = new Error('"' + cToken.text + '"' + 'found, expected > or indent'); break; } } else { result.__xml__.error = new Error('End of data found, expected /> or >'); break; } } if (!finished && !result.__xml__.error) { result.__xml__.error = new Error('End of data found, expected /> or >'); } } else { result.__xml__.error = new Error('End of data found, expected /> or >'); } } else { result.__xml__.error = new Error('Expected indent'); } } else { result.__xml__.error = new Error('End of data found, expected indent'); } result.__xml__.end = i; } else { result.__xml__.error = new Error('"' + cToken.text + '"' + 'found, expected <'); } } else { result.__xml__.error = new Error('End of data found, expected <'); } result.__xml__.end = i; return result; } /** * * @param {Array<Token>} tokens * @param {Number} i * @returns {XMLParseNode} */ function matchEndTag(tokens, i) { var result = { __xml__: { type: END_TAG, closed: true, start: i } }; var cToken; if (i < tokens.length) { cToken = tokens[i]; if (cToken.matched['openEndTag']) { ++i; if (i < tokens.length) { cToken = tokens[i]; if (cToken.matched['ident']) { result.tagName = cToken.text; ++i; if (i < tokens.length) { var finished = false;//when find the close symbol while (i < tokens.length) { cToken = tokens[i]; if (cToken.matched['space']) { ++i; }//skip space between attributes if (i < tokens.length) { cToken = tokens[i]; if (cToken.matched['close']) { ++i; finished = true; break; } else if (tokens[i - 1].matched['space']) { var assign = matchAssign(tokens, i); if (!assign.__xml__.error) { result.attributes = result.attributes || {}; result.attributes[assign.key] = assign.value; i = assign.__xml__.end; } else if (cToken.matched['ident']) { result.attributes = result.attributes || {}; result.attributes[cToken.text] = true;// a flag ++i; } else { result.__xml__.error = new Error('"' + cToken.text + '"' + 'found, expected > or indent'); } } else { result.__xml__.error = new Error('"' + cToken.text + '"' + 'found, expected > or indent'); } } else { result.__xml__.error = new Error('End of data found, expected /> or >'); } } if (!finished && !result.__xml__.error) { result.__xml__.error = new Error('End of data found, expected /> or >'); } } else { result.__xml__.error = new Error('End of data found, expected /> or >'); } } else { result.__xml__.error = new Error('Expected indent'); } } else { result.__xml__.error = new Error('End of data found, expected indent'); } result.__xml__.end = i; } else { result.__xml__.error = new Error('"' + cToken.text + '"' + 'found, expected <'); } } else { result.__xml__.error = new Error('End of data found, expected <'); } result.__xml__.end = i; return result; } /** * * @param {Array<Token>} tokens * @param {Number} i * @returns {XMLParseNode} */ function matchDeclaration(tokens, i) { var result = { __xml__: { type: DECLARATION, start: i } }; var cToken; if (i < tokens.length) { cToken = tokens[i]; if (cToken.matched['declarationOpen']) { ++i; if (i < tokens.length) { cToken = tokens[i]; if (cToken.matched['ident']) { result.tagName = cToken.text; ++i; if (i < tokens.length) { var finished = false;//when find the close symbol while (i < tokens.length) { cToken = tokens[i]; if (cToken.matched['space']) { ++i; }//skip space between attributes if (i < tokens.length) { cToken = tokens[i]; if (cToken.matched['declarationClose']) { result.__xml__.closed = false; ++i; finished = true; break; } else if (tokens[i - 1].matched['space']) { var assign = matchAssign(tokens, i); if (!assign.__xml__.error) { result.attributes = result.attributes || {}; result.attributes[assign.key] = assign.value; i = assign.__xml__.end; } else if (cToken.matched['ident']) { result.attributes = result.attributes || {}; result.attributes[cToken.text] = true;// a flag ++i; } else { result.__xml__.error = new Error('"' + cToken.text + '"' + 'found, expected > or indent'); } } else { result.__xml__.error = new Error('"' + cToken.text + '"' + 'found, expected > or indent'); } } else { result.__xml__.error = new Error('End of data found, expected /> or >'); } } if (!finished && !result.__xml__.error) { result.__xml__.error = new Error('End of data found, expected /> or >'); } } else { result.__xml__.error = new Error('End of data found, expected /> or >'); } } else { result.__xml__.error = new Error('Expected indent'); } } else { result.__xml__.error = new Error('End of data found, expected indent'); } result.__xml__.end = i; } else { result.__xml__.error = new Error('"' + cToken.text + '"' + 'found, expected <'); } } else { result.__xml__.error = new Error('End of data found, expected <'); } result.__xml__.end = i; return result; } /** * * @param {Array<Token>} tokens * @param {Number} i * @returns {XMLParseNode} */ function matchCData(tokens, i) { var result = { __xml__: { type: CDATA, start: i } }; var cToken; if (i < tokens.length) { cToken = tokens[i]; if (cToken.matched['cdataOpen']) { ++i; result.text = ''; var finished = false; while (i < tokens.length) { cToken = tokens[i]; if (cToken.matched['cdataClose']) { finished = true; ++i; break; } else { result.text += cToken.text; ++i; } } if (!finished) { result.__xml__.error = new Error('End of data found, expected ]]>'); } } else { result.__xml__.error = new Error('"' + cToken.text + '"' + 'found, expected <![CDATA['); } } else { result.__xml__.error = new Error('End of data found, expected <![CDATA['); } result.__xml__.end = i return result; } /** * * @param {Array<Token>} tokens * @param {Number} i * @returns {XMLParseNode} */ function matchComment(tokens, i) { var result = { __xml__: { type: COMMENT, start: i } }; var cToken; if (i < tokens.length) { cToken = tokens[i]; if (cToken.matched['commentOpen']) { ++i; result.text = ''; var finished = false; while (i < tokens.length) { cToken = tokens[i]; if (cToken.matched['commentClose']) { finished = true; ++i; break; } else { result.text += cToken.text; ++i; } } if (!finished) { result.__xml__.error = new Error('End of data found, expected -->'); } } else { result.__xml__.error = new Error('"' + cToken.text + '"' + 'found, expected <!--'); } } else { result.__xml__.error = new Error('End of data found, expected <!--'); } result.__xml__.end = i; return result; } /** * * @param {Token} tokens */ function parseXMLTab(tokens) { var tabs = []; var i = 0; while (i < tokens.length) { var comment = matchComment(tokens, i); if (!comment.__xml__.error) { tabs.push(comment); i = comment.__xml__.end; } else { var declaration = matchDeclaration(tokens, i); if (!declaration.__xml__.error) { tabs.push(declaration); i = declaration.__xml__.end; } else { var begin = matchBeginTag(tokens, i); if (!begin.__xml__.error) { tabs.push(begin); i = begin.__xml__.end; } else { var end = matchEndTag(tokens, i); if (!end.__xml__.error) { tabs.push(end); i = end.__xml__.end; } else { var cdata = matchCData(tokens, i); if (!cdata.__xml__.error) { tabs.push(cdata); i = cdata.__xml__.end; } else { ++i;//skip } } } } } } return tabs; } /** * * @param {Array<Token>} tokens * @param {Array<XMLParseNode>} tabs * @returns {Array<XMLParseNode>} */ function parseXMLText(tokens, tabs) { var texts = []; var ofs = 0; var text; var tab; for (var i = 0; i < tabs.length; ++i) { tab = tabs[i]; if (tab.__xml__.start > ofs) { text = tokens.slice(ofs, tab.__xml__.start) .map(function (token) { return token.text; }).join('').trim(); if (text.length > 0) texts.push({ __xml__: { type: TEXT, tokens: tokens, start: ofs, end: tab.__xml__.start }, text: text }); } ofs = tab.__xml__.end; } if (ofs < tokens.length) { text = tokens.slice(ofs) .map(function (token) { return token.text; }).join('').trim(); if (text.length > 0) texts.push({ __xml__: { type: TEXT, tokens: tokens, start: ofs, end: tab.__xml__.start }, text: text }); } return texts; } /** * * @param {Array<XMLParseNode>} tabs * @param {Array<XMLParseNode>} texts * @return {Array<XMLParseNode>} */ function mergeNodes(tabs, texts) { var nodes = []; var choose; var iTabs = 0, iTexts = 0; var diTabs, diTexts; var minStart; do { choose = undefined; diTabs = 0, diTexts = 0; minStart = 100000000; if (iTabs < tabs.length) { choose = tabs[iTabs]; minStart = choose.__xml__.start; diTabs = 1; } if (iTexts < texts.length && texts[iTexts].__xml__.start < minStart) { choose = texts[iTexts]; minStart = choose.__xml__.start; diTabs = 0; diTexts = 1; } if (choose) { iTexts += diTexts; iTabs += diTabs; nodes.push(choose); } } while (choose); return nodes; } /** * * @param {String} text * @return {Array<XMLParseNode>} */ function parseXMLTextToXMLParseNode(text) { text = text.trim(); var tokens = xmlTokenize(text.trim()); var tabs = parseXMLTab(tokens); var texts = parseXMLText(tokens, tabs); return mergeNodes(tabs, texts); } /** * * @param {Array<XMLParseNode>} nodes * @returns {Array} */ function paresNodesToXMLs(nodes) { var node; var parentXMLElement = new XML_XMLElement(); parentXMLElement.tagName = "FAKE_DOCUMENT"; var assignAttributes = function (node, attributes) { Object.keys(attributes).forEach(function (key) { node.setAttribute(key, attributes[key]); }) } var newXMLNode; for (var i = 0; i < nodes.length; ++i) { node = nodes[i]; newXMLNode = undefined; switch (node.__xml__.type) { case DECLARATION: newXMLNode = new XMLDeclarationNode(); newXMLNode.tagName = node.tagName; if (node.attributes) assignAttributes(newXMLNode, node.attributes); parentXMLElement.appendChild(newXMLNode); break; case BEGIN_TAG: newXMLNode = new XML_XMLElement(); newXMLNode.tagName = node.tagName; if (node.attributes) assignAttributes(newXMLNode, node.attributes); parentXMLElement.appendChild(newXMLNode); if (!node.__xml__.closed) parentXMLElement = newXMLNode; break; case END_TAG: if (parentXMLElement && node.tagName == parentXMLElement.tagName) { parentXMLElement = parentXMLElement.parentNode; } else if (parentXMLElement && (parentXMLElement.tagName == 'img' || parentXMLElement.tagName == 'input')) { // image can be not close while (parentXMLElement.tagName == 'img' || parentXMLElement.tagName == 'input') { parentXMLElement = parentXMLElement.parentNode; } parentXMLElement = parentXMLElement.parentNode; } else { throw new Error("Unknown close of tagName " + node.tagName + ', but ' + (parentXMLElement ? parentXMLElement.tagName : "EOF") + ' expected'); } break; case TEXT: newXMLNode = new XML_XMLTextNode(node.text); parentXMLElement.appendChild(newXMLNode); break; case COMMENT: newXMLNode = new XML_XMLCommentNode(node.text); parentXMLElement.appendChild(newXMLNode); break; } } return parentXMLElement.childNodes.slice().map(function (e) { e.remove(); return e; }); } /** * * @param {XMLElement} node */ function makeOpenXMLElementTab(node) { var res = '<' + node.tagName; var attributesText = Object.keys(node.attributes) .map(function (key) { var value = node.attributes[key]; if (value === null) { return key; } else { return key + '=' + '"' + value + '"'; } }).join(' '); if (attributesText.length > 0) { res += ' ' + attributesText; } res += '>'; return res; } /** * * @param {XMLDeclaretionNode} node */ function makeXMLDeclaretionTab(node) { var res = '<?' + node.tagName; var attributesText = Object.keys(node.attributes) .map(function (key) { var value = node.attributes[key]; if (value === null) { return key; } else { return key + '=' + '"' + value + '"'; } }).join(' '); if (attributesText.length > 0) { res += ' ' + attributesText; } res += '?>'; return res; } /** * * @param {XMLDeclaretionNode} node */ function makeXMLCommentTab(node) { var res = '<!--' + node.data + '-->'; return res; } var XML = {}; /** * @param {String} code * @returns {Array<XMLElement>} */ XML.parseLikeHTML = function (code) { var nodes = parseXMLTextToXMLParseNode(code); // console.log('nodes', nodes); var xmls = paresNodesToXMLs(nodes); return xmls; }; /** * @param {String} code * @returns {XMLElement} */ XML.parse = function (code) { var xmls = this.parseLikeHTML(code); if (xmls.length == 0) return undefined; var obj = xmls[xmls.length - 1].toObject(); return obj; }; XML.DFNodeVisit = function (node, handlers, accumulator) { if (!node.childNodes || node.childNodes.length == 0) { if (handlers.leaf) handlers.leaf(accumulator, node); } else { if (handlers.open) handlers.open(accumulator, node); for (var i = 0; i < node.childNodes.length; ++i) { this.DFNodeVisit(node.childNodes[i], handlers, accumulator); } if (handlers.close) handlers.close(accumulator, node); return accumulator; } }; /** * @typedef {Object} XMLBeautifyOption * @property {String} indent * @property {Number} initDepth */ /** * @param {Array<XMLElement>} o * @param {XMLBeautifyOption} beautifyOption * * */ XML.stringify = function (o, beautifyOption) { var texts = []; var indent = ''; var lineBreak = ''; var depth = 0; if (beautifyOption) { lineBreak = '\n'; indent = typeof (beautifyOption.indent) == 'string' ? beautifyOption.indent : ' '; depth = beautifyOption.initDepth || 0; } if (!(o instanceof Array)) { o = [o]; } var visitor = { open: function (ac, node) { var currentLineIndent = ac.lineIndentStack[ac.lineIndentStack.length - 1]; var openTabText = makeOpenXMLElementTab(node); ac.texts.push(currentLineIndent + openTabText); ac.lineIndentStack.push(currentLineIndent + ac.indent); }, close: function (ac, node) { ac.lineIndentStack.pop(); var currentLineIndent = ac.lineIndentStack[ac.lineIndentStack.length - 1]; var endTab = '</' + node.tagName + '>'; if (node.childNodes.length == 1 && node.childNodes[0].nodeType == XML_XMLConstant.TYPE_TEXT) { ac.texts[ac.texts.length - 1] += endTab; } else { ac.texts.push(currentLineIndent + endTab); } }, leaf: function (ac, node) { var currentLineIndent = ac.lineIndentStack[ac.lineIndentStack.length - 1]; var tab; if (node.nodeType == XML_XMLConstant.TYPE_TEXT) { if (node.parentNode && node.parentNode.childNodes.length == 1) { ac.texts[ac.texts.length - 1] += node.data; } else { ac.texts.push(currentLineIndent + node.data); } } else if (node.nodeType == XML_XMLConstant.TYPE_ELEMENT) { var openTabText = makeOpenXMLElementTab(node); var endTab = '</' + node.tagName + '>'; ac.texts.push(currentLineIndent + openTabText + endTab); } else if (node.nodeType == XML_XMLConstant.TYPE_DECLARATION) { tab = makeXMLDeclaretionTab(node); ac.texts.push(currentLineIndent + tab); } else if (node.nodeType == XML_XMLConstant.TYPE_COMMENT) { tab = makeXMLCommentTab(node); ac.texts.push(currentLineIndent + tab); } } }; for (var i = 0; i < o.length; ++i) { this.DFNodeVisit(o[i], visitor, { depth: 0, texts: texts, lineIndentStack: [''], indent: indent }); } return texts.join(lineBreak); }; /* harmony default export */ var XML_XML = (XML); // CONCATENATED MODULE: ./node_modules/absol/src/JSMaker/TemplateXML.js function TemplateXML(props) { this.xml = props.xml; } TemplateXML.prototype._xmlNodeToJSCode = function (node) { var body = []; if (node.nodeType == XML_XMLConstant.TYPE_ELEMENT) { body.push('tag:' + JSON.stringify(node.tagName)); var attributeKeys = Object.keys(node.attributes).filter(function (x) { return x != 'class' && x != 'style' && !x.startsWith('az-') }); if (attributeKeys && attributeKeys.length > 0) { body.push('attr: {' + attributeKeys.map(function (key) { return JSON.stringify(key) + ': ' + TemplateString["a" /* default */].parse(node.attributes[key]).toJSCode(); }).join(', ') + '}'); } if (node.attributes['az-props']) { body.push('props: ' + TemplateString["a" /* default */].parse(node.attributes['az-props']).toJSCode() ); } if (node.attributes['az-data']) { body.push('data: ' + TemplateString["a" /* default */].parse(node.attributes['az-data']).toJSCode() ); } if (node.attributes.style) { var styleSheet = node.attributes.style.split(';').map(function (s) { var t = s.split(':').map(function (text) { return text.trim() }); if (t.length == 2) { return JSON.stringify(t[0]) + ': ' + JSON.stringify(t[1]); } else return false; }).filter(function (e) { return !!e; }); if (styleSheet.length > 0) { body.push('style:{' + styleSheet.join(',') + '}'); } } if (node.attributes.class) { var classList = node.attributes.class.trim().split(/\s+/); if (classList.length > 0) body.push('class:' + JSON.stringify(classList)); } if (node.childNodes && node.childNodes.length > 0) { var childList = '[' + node.childNodes.filter(function (e) { return e.nodeType == XML_XMLConstant.TYPE_ELEMENT || e.nodeType == XML_XMLConstant.TYPE_TEXT; }).map(function (e) { return this._xmlNodeToJSCode(e); }.bind(this)).filter(function (e) { return !!e; }).join(', ') + ']'; if (childList && childList.length > 0) body.push('child: ' + childList); } } else if (node.nodeType == XML_XMLConstant.TYPE_TEXT) { body.push('text: ' + TemplateString["a" /* default */].parse(node.data).toJSCode()); } else return undefined; var res = '{' + body.join(', ') + '}'; return res; }; TemplateXML.prototype.toJSCode = function () { var res = this._xmlNodeToJSCode(this.xml); return res; }; /** * * @param {...any} args * @returns {Function} */ TemplateXML.compileToFunction = function () { var innerCode = 'return ' + this.parse(arguments[arguments.length - 1]).toJSCode() + ';'; var fParam = Array.prototype.slice.call(arguments, 0, arguments.length - 1); fParam.push(innerCode); return Function.apply(null, fParam); }; TemplateXML.parse = function (text) { var xml = XML_XML.parse(text); if (xml) { return new TemplateXML({ xml: xml }); } else return undefined; }; /* harmony default export */ var JSMaker_TemplateXML = (TemplateXML); // EXTERNAL MODULE: ./node_modules/absol/src/HTML5/Dom.js + 1 modules var Dom = __webpack_require__(1); // EXTERNAL MODULE: ./node_modules/absol/src/HTML5/Svg.js + 1 modules var Svg = __webpack_require__(9); // EXTERNAL MODULE: ./node_modules/absol/src/HTML5/OOP.js var OOP = __webpack_require__(3); // 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.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 ' + TemplateString["a" /* default */].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.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.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); } }; 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' }; /********************** 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 = (Color); // 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(' '); } // CONCATENATED MODULE: ./node_modules/absol/src/Network/IFrameBridge.js /** * * @param {Worker} host */ function IFrameBridge(host, origin) { EventEmitter["a" /* default */].call(this); this.detach(); this.origin = origin; if (host) this.attach(host); this.__azarResolveCallbacks = {}; } 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(EventEmitter["a" /* default */].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") { var result = this.__azarRelfInvoke(data.name, data.params); if (result && typeof result.then == 'function') { result.then(function (result) { this.__azarResolve(data.taskId, result); }.bind(this)); } else { this.__azarResolve(data.taskId, result); } } else if (data.type == "INVOKE_RESULT") { if (this.__azarResolveCallbacks[data.taskId]) { this.__azarResolveCallbacks[data.taskId](data.result); delete this.__azarResolveCallbacks[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) { var data = { type: "INVOKE_RESULT", taskId: taskId, result: result }; if (this.origin) { this.host.postMessage(data, this.origin); } else { this.host.postMessage(data); } }; IFrameBridge.prototype.__azarRelfInvoke = 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 = 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) { this.__azarResolveCallbacks[indent] = resolve; }.bind(this)); }.bind(this)); }; /* harmony default export */ var Network_IFrameBridge = (IFrameBridge); // EXTERNAL MODULE: ./node_modules/jszip/lib/index.js var lib = __webpack_require__(30); var lib_default = /*#__PURE__*/__webpack_require__.n(lib); // EXTERNAL MODULE: ./node_modules/absol/src/JSDocx/JSDocx.js var JSDocx = __webpack_require__(66); // CONCATENATED MODULE: ./node_modules/absol/src/Network/Broadcast.js // it can be replace BroadcastChanel function Broadcast(channel, id) { EventEmitter["a" /* default */].call(this); this.channel = channel; this.id = id; this._ev_message = this._ev_message.bind(this); this._ev_storage = this._ev_storage.bind(this); this._init(); } Object.defineProperties(Broadcast.prototype, Object.getOwnPropertyDescriptors(EventEmitter["a" /* default */].prototype)); Broadcast.prototype.constructor = Broadcast; Broadcast.prototype._init = function () { if ('BroadcastChannel' in window) { this.nativeBroadcastChannel = new BroadcastChannel(this.channel); this.nativeBroadcastChannel.onmessage = this._ev_message; } else if ('localStorage' in window) { if (!('onstorage' in window)) console.warn("Your browser may not support onstorage event."); if (window.addEventListener) { window.addEventListener('storage', this._ev_storage); } else { window.attachEvent('onstorage', this._ev_storage); } this.storageKey = '_broadcast_' + this.channel; } else { throw new Error("Your browser can not support broadcast!"); } }; Broadcast.prototype._ev_storage = function (event) { if (event.key == this.storageKey) { var data = JSON.parse(event.newValue); if (data.sourceId != this.id) this.handleMessData(data.message); } }; Broadcast.prototype._ev_message = function (event) { var data = event.data; this.handleMessData(data); }; Broadcast.prototype.handleMessData = function (data) { if (data.type == "EMIT") this.fire.apply(this, data.params); if (typeof this.onmessage == 'function') this.onmessage(event); }; /** * @param {Array<*>} */ Broadcast.prototype.emit = function () { var params = Array.prototype.slice.call(arguments); this.postMessage({ type: "EMIT", params, sourceId: this.id }); }; /** * @param {*} message */ Broadcast.prototype.postMessage = function (message) { if (this.nativeBroadcastChannel) { this.nativeBroadcastChannel.postMessage(message); } else { localStorage.setItem(this.storageKey, JSON.stringify({ message: message, sourceId: this.id })); } }; Broadcast.prototype.onmessage = null; Broadcast.prototype.close = function () { if (this.nativeBroadcastChannel) this.nativeBroadcastChannel.close(); }; /* harmony default export */ var Network_Broadcast = (Broadcast); // CONCATENATED MODULE: ./node_modules/absol/src/HTML5/Text.js function getTextNodesIn(node) { var textNodes = []; if (node.nodeType == 3) { textNodes.push(node); } else { var children = node.childNodes; for (var i = 0, len = children.length; i < len; ++i) { textNodes.push.apply(textNodes, getTextNodesIn(children[i])); } } return textNodes; } /** * * @param {Element} el * @param {Range} range * @param {Number} start * @returns {Number} -1: ok, ret >= 0(is length of text) : need move to next element * */ function setSelectionRangeStart(el, range, start) { if (start > 0) { if (el.nodeType == Node.TEXT_NODE) { var text = el.data; if (start <= text.length) { range.setStart(el, start); return -1; } else return text.length; } if (el.tagName.toLowerCase() == 'br') { return 0; } else { var delta = 0; var i = 0; var textLength = 0; var newLine = false; while (delta >= 0 && i < el.childNodes.length) { var childElt = el.childNodes[i]; if (newLine) { newLine = false; ++textLength; } delta = setSelectionRangeStart(childElt, range, start - textLength); if (delta >= 0) textLength += delta; if (childElt.nodeType != Node.TEXT_NODE && (window.getComputedStyle(childElt).display == 'block' || childElt.tagName.toLowerCase() == 'br')) { newLine = true; } ++i; } if (delta >= 0) return textLength; return -1; } } else { range.setStart(el, 0); return -1; } } /** * * @param {Element} el * @param {Range} range * @param {Number} end * @returns {Number} -1: ok, ret >= 0(is length of text) : need move to next element * */ function setSelectionRangeEnd(el, range, end) { if (end > 0) { if (el.nodeType == Node.TEXT_NODE) { var text = el.data; if (end <= text.length) { range.setEnd(el, end); return -1; } else return text.length; } if (el.tagName.toLowerCase() == 'br') { return 0; } else { var delta = 0; var i = 0; var textLength = 0; var newLine = false; while (delta >= 0 && i < el.childNodes.length) { var childElt = el.childNodes[i]; if (newLine) { newLine = false; ++textLength; } delta = setSelectionRangeEnd(childElt, range, end - textLength); if (delta >= 0) textLength += delta; if (childElt.nodeType != Node.TEXT_NODE && (window.getComputedStyle(childElt).display == 'block' || childElt.tagName.toLowerCase() == 'br')) { newLine = true; } ++i; } if (delta >= 0) return textLength; return -1; } } else { range.setEnd(el, 0); return -1; } } function setSelectionRange(el, start, end) { if (document.createRange && window.getSelection) { var range = document.createRange(); range.selectNodeContents(el); var delta; if (start >= 0) { delta = setSelectionRangeStart(el, range, start); if (delta >= 0) range.setStart(el, el.childNodes.length); } else { start = 0; range.setStart(el, 0); } if (end >= start) { delta = setSelectionRangeEnd(el, range, end); if (delta >= 0) range.setEnd(el, el.childNodes.length); } var sel = window.getSelection(); sel.removeAllRanges(); sel.addRange(range); } else if (document.selection && document.body.createTextRange) { var textRange = document.body.createTextRange(); textRange.moveToElementText(el); textRange.collapse(true); textRange.moveEnd("character", end); textRange.moveStart("character", start); textRange.select(); } } function getTextIn(e) { if (e.nodeType == Node.TEXT_NODE) { return e.data; } if (e.tagName && e.tagName.toLowerCase() == 'br') return ''; var texts = []; var newLine = false; for (var i = 0; i < e.childNodes.length; ++i) { if (newLine) { newLine = false; texts.push('\n'); } var childElt = e.childNodes[i]; texts.push(getTextIn(childElt)); if (childElt.nodeType != Node.TEXT_NODE && (window.getComputedStyle(childElt).display == 'block' || childElt.tagName.toLowerCase() == 'br')) { newLine = true; } } return texts.join(''); } function textToNodes(text) { var lines = text.split(/\r?\n/); return lines.map(function (text) { if (text.length == 0) { return Dom["a" /* default */].ShareInstance._({ child: { tag: 'br' } }); } else { return Dom["a" /* default */].ShareInstance._({ child: { text: text } }); } }); } /* ** Returns the caret (cursor) position of the specified text field (oField). ** Return value range is 0-oField.value.length. */ function Text_getCaretPosition(oField) { // Initialize var iCaretPos = 0; // IE Support if (document.selection) { // Set focus on the element oField.focus(); // To get cursor position, get empty selection range var oSel = document.selection.createRange(); // Move selection start to 0 position oSel.moveStart('character', -oField.value.length); // The caret position is selection length iCaretPos = oSel.text.length; } // Firefox support else if (oField.selectionStart || oField.selectionStart == '0') iCaretPos = oField.selectionDirection == 'backward' ? oField.selectionStart : oField.selectionEnd; // Return results return iCaretPos; } function setCaretPosition(oField, caretPos) { if (oField.createTextRange) { var range = oField.createTextRange(); range.move('character', caretPos); range.select(); } else { if (oField.selectionStart) { oField.focus(); oField.setSelectionRange(caretPos, caretPos); } else oField.focus(); } } function measureText(text, font) { // re-use canvas object for better performance var canvas = measureText.canvas || (measureText.canvas = document.createElement("canvas")); var context = canvas.getContext("2d"); if (font) context.font = font; var metrics = context.measureText(text); return metrics; } // CONCATENATED MODULE: ./node_modules/absol/src/Converter/file.js 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' }); } // CONCATENATED MODULE: ./node_modules/absol/src/Converter/base64.js 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 }; // CONCATENATED MODULE: ./node_modules/absol/src/Time/Alarm.js /** * * @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 */ var Time_Alarm = (Alarm); // CONCATENATED MODULE: ./node_modules/absol/src/AppPattern/Ref.js 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 */ var AppPattern_Ref = (Ref); // CONCATENATED MODULE: ./node_modules/absol/src/Network/XHR.js 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 () { rj(new Error("Network Error!")); }; }); }; XHR.postRepquest = function (url, payload, props, headers, success, failure) { return new Promise(function (rs, rj) { var method = "POST"; var shouldBeAsync = true; var request = new XMLHttpRequest(); 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 () { var error = new Error("Network Error!"); if (failure) failure(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(payload); }); }; /* harmony default export */ var Network_XHR = (XHR); // EXTERNAL MODULE: ./node_modules/absol/src/String/stringFormat.js var stringFormat = __webpack_require__(7); // EXTERNAL MODULE: ./node_modules/babylon/lib/index.js var babylon_lib = __webpack_require__(70); // CONCATENATED MODULE: ./node_modules/absol/src/JSX/attribute.js /** * * @param {String} text * @returns {Object} */ function parseStyleAttr(text) { return text.split(';').map(function (line) { var parts = line.split(':'); if (parts.length < 2) return null; var key = parts.shift().trim(); var value = parts.join(':').trim(); if (key.length == 0 || value.length == 0) return null; return [key, value]; }).filter(function (it) { return it != null }).reduce(function (ac, cr) { ac[cr[0]] = cr[1]; return ac; }, {}); } /** * * @param {String} text * @returns {Array<String>} */ function parseClassAttr(text) { return text.trim().split(/\s+/); } // CONCATENATED MODULE: ./node_modules/absol/src/JSX/dom.js function domVisitor(jsxCode) { var visitor = { File: function (node, ac) { return acept(node.program, ac); }, Program: function (node, ac) { ac.child = node.body.map(function (cNode) { return acept(cNode, {}); }); return ac; }, ExpressionStatement: function (node, ac) { return acept(node.expression, ac); }, JSXElement: function (node, ac) { acept(node.openingElement, ac); if (node.children && node.children.length > 0) { ac.child = node.children.map(function (cNode) { return acept(cNode, {}); }); } return ac; }, JSXOpeningElement: function (node, ac) { var name = {}; acept(node.name, name); ac.tag = name.value; if (node.attributes && node.attributes.length > 0) { node.attributes.forEach(function (aNode) { var attribute = {}; acept(aNode, attribute); if (attribute.key) { if (attribute.key.startsWith('data-')) { ac.data = ac.data || {}; ac.data[attribute.key.replace('data-', '')] = attribute.value; } else if (attribute.key.startsWith('prop-')) { ac.props = ac.props || {}; ac.props[attribute.key.replace('prop-', '')] = attribute.value; } else if (attribute.key.startsWith('on-')) { ac.on = ac.props || {}; ac.on[attribute.key.replace('on-', '')] = attribute.value; } else if (attribute.key == 'style') { ac.style = parseStyleAttr(attribute.value); } else if (attribute.key == 'class') { var classList = parseClassAttr(attribute.value); if (classList.length > 0) ac.class = classList; } else{ ac.attr = ac.attr || {}; ac.attr[attribute.key] = attribute.value; } } }, {}); } return ac; }, JSXIdentifier: function (node, ac) { ac.value = node.name; }, JSXAttribute: function (node, ac) { var key = {}; acept(node.name, key); ac.key = key.value; var value = {}; acept(node.value, value); ac.value = value.value; return ac; }, StringLiteral: function (node, ac) { ac.value = node.value; }, JSXExpressionContainer: function (node, ac) { ac.value = { expression: jsxCode.substring(node.expression.start, node.expression.end) }; return ac; }, JSXText: function (node, ac) { ac.text = node.value return ac; } }; function acept(node, ac) { return node && visitor[node.type] && visitor[node.type](node, ac); } return { acept: acept, visitor: visitor } } /*** * @param {String} jsxCode */ function parseDom(jsxCode) { jsxCode = jsxCode.trim().replace(/>\s+</gm, '><').replace(/<(\/?)(img|input|link|br|meta)([^>]*)>/g, function (sub, end, tag, content) { if (end == '/') return ''; return '<' + tag + content + '/>'; }); var ast = babylon_lib["parse"]( jsxCode, { plugins: [ "jsx" ] }); var xmlData = {}; domVisitor(jsxCode).acept(ast, xmlData); if (xmlData.child.length > 1) return xmlData.child; return xmlData.child[0]; }; // CONCATENATED MODULE: ./node_modules/absol/src/AppPattern/Context.js function Context() { this.state = "CREATE"; /** * @type {Context} */ this.parent = null; } /** * @returns {*} */ Context.prototype.getContext = function (key) { return this.getContextManager().get(key); }; /** * @returns {ContextManager} */ Context.prototype.getContextManager = function () { return this.parent.getContextManager(); }; /** * @param {Application} */ Context.prototype.attach = function (parent) { //stop before attach to new context this.stop(); /** * @type {Application} */ this.parent = parent; this.state = "ATTACHED"; this.onAttached && this.onAttached(); }; Context.prototype.detach = function () { this.stop(); this.state = "DETACHED"; this.onDetached && this.onDetached(); this.parent = null; }; Context.prototype.pause = function () { if (this.state.match(/RUNNING/)) { this.state = "PAUSE"; this.onPause && this.onPause(); } else { console.warn(this, "NOT RUNNING"); } }; Context.prototype.resume = function () { if (!this.state.match(/STANDBY||PAUSE/)) { console.error(this, 'NOT READY!'); return; } if (this.state == "RUNNING") return; this.state = "RUNNING"; this.onResume && this.onResume(); }; Context.prototype.start = function () { if (this.state.match(/DIE/)) { console.error(this, 'DIED!'); return; } if (this.state.match(/RUNNING/)) return; if (this.state.match(/STOP|CREATE|ATTACHED/)) { this.state = "STANDBY"; this.onStart && this.onStart(); } if (this.state.match(/STANDBY|PAUSE/)) { this.resume(); } }; Context.prototype.stop = function () { if (this.state.match(/STOP|DIE|CREATE|ATTACHED|DETACHED/)) return; if (this.state.match(/RUNNING/)) this.pause(); this.state = "STOP"; this.onStop && this.onStop(); }; Context.prototype.destroy = function () { if (this.state.match(/DIE/)) return; if (this.state.match(/RUNNING|PAUSE/)) this.stop(); this.state = "DIE"; this.onDestroy && this.onDestroy(); }; /* harmony default export */ var AppPattern_Context = (Context); // CONCATENATED MODULE: ./node_modules/absol/src/AppPattern/Activity.js //NOTE: !impotant : don't make setter, getter for activity, just code like JAVA /** * @class */ function Activity() { AppPattern_Context.call(this); } Object.defineProperties(Activity.prototype, Object.getOwnPropertyDescriptors(AppPattern_Context.prototype)); Activity.prototype.constructor = Activity; Activity.prototype.startActivity = function (activity) { if (this.parent) { this.parent.startActivity(activity); } else { } }; Activity.prototype.finish = function () { if (this.parent) { this.parent.stopActivity(this); } else { } }; /* harmony default export */ var AppPattern_Activity = (Activity); // CONCATENATED MODULE: ./node_modules/absol/src/AppPattern/ContextManager.js function ContextManager(){ this.__contextData__ = {}; } /** * @param {String} key * @returns {*} */ ContextManager.prototype.get = function(key){ return this.__contextData__[key]; }; /** * @param {String} key * @param {*} value * @returns {Context} */ ContextManager.prototype.set = function(key, value){ this.__contextData__[key] = value; return this; }; ContextManager.prototype.assign = function(obj){ Object.assign(this.__contextData__, obj); return this; }; ContextManager.prototype.remove = function(key){ delete this.__contextData__[key]; return this; }; ContextManager.prototype.contains = function(key){ return (key in this.__contextData__); }; /* harmony default export */ var AppPattern_ContextManager = (ContextManager); // CONCATENATED MODULE: ./node_modules/absol/src/AppPattern/Application.js /** * @class */ function Application() { AppPattern_Context.call(this); this.activityStack = []; /** @type {Activity} */ this.currentActivity = null; this.contextManager = new AppPattern_ContextManager(); } Object.defineProperties(Application.prototype, Object.getOwnPropertyDescriptors(AppPattern_Context.prototype)); Application.prototype.constructor = Application; Application.prototype.getContextManager = function () { return this.contextManager; }; /** * @param {Activity} activity */ Application.prototype.startActivity = function (activity) { if (this.currentActivity != null) { this.currentActivity.pause(); this.activityStack.push(this.currentActivity); } this.currentActivity = activity; this.appendChild(activity); activity.attach(this); this.setContentView(activity.getView(), true); activity.start(); }; /** * @param {Activity} activity */ Application.prototype.stopActivity = function (activity) { if (this.currentActivity == activity) { if (this.activityStack.length == 0) { //todo } else { activity.detach(); this.removeChild(this.currentActivity); this.currentActivity = this.activityStack.pop(); this.setContentView(this.currentActivity.getView()); this.currentActivity.resume(); } } else { console.error("NOT ON TOP ACTIVITY"); } }; /** * @param {HTMLElement} view */ Application.prototype.setContentView = function (view, overlay) { throw new Error("Not Implement!"); }; Application.prototype.backToTopActivity = function () { while (this.activityStack.length > 0) { this.currentActivity.stop(); this.currentActivity = this.activityStack.pop(); } this.setContentView(this.currentActivity.getView()); this.currentActivity.resume(); }; /* harmony default export */ var AppPattern_Application = (Application); // CONCATENATED MODULE: ./node_modules/absol/src/AppPattern/VarScope.js 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 */ var AppPattern_VarScope = (VarScope); // CONCATENATED MODULE: ./node_modules/absol/src/index.js var absol = { ContextManager: AppPattern_ContextManager, Application: AppPattern_Application, VarScope: AppPattern_VarScope, Context: AppPattern_Context, Activity: AppPattern_Activity, Element: Element["a" /* default */], JSPath: JSPath["a" /* default */], TemplateString: TemplateString["a" /* default */], TemplateXML: JSMaker_TemplateXML, Dom: Dom["a" /* default */], Svg: Svg["a" /* default */], BrowserDetector: BrowserDetector["a" /* default */], OOP: OOP["a" /* default */], XML: XML_XML, Color: Color_Color, EventEmitter: EventEmitter["a" /* default */], JSZip: lib_default.a, IFrameBridge: Network_IFrameBridge, JSDocx: JSDocx["a" /* default */], Broadcast: Network_Broadcast, text: Text_namespaceObject, file: file_namespaceObject, base64: base64_namespaceObject, Alarm: Time_Alarm, coreDom: Dom["a" /* default */].ShareInstance, coreSvg: Svg["a" /* default */].ShareInstance, _: Dom["a" /* default */].ShareInstance._, $: Dom["a" /* default */].ShareInstance.$, _svg: Svg["a" /* default */].ShareInstance._, $svg: Svg["a" /* default */].ShareInstance.$, Ref: AppPattern_Ref, XHR: Network_XHR, string: Object.assign({}, stringFormat, stringGenerate_namespaceObject), jsx: { dom: dom_namespaceObject, attribute: attribute_namespaceObject } }; /* harmony default export */ var src = (absol); // CONCATENATED MODULE: ./node_modules/absol/src/absol.js //for old plugin src.HTMLElement = src.Element; src.dom = src.Dom; src.event = src.EventEmitter; src.Event = src.EventEmitter; src.color = src.Color; src.ShareDom = src.Dom.ShareInstance; src.buildDom = src.ShareDom._; src.ShareSvg = src.Svg.ShareInstance; src.ShareSvgCreator = src.Svg.ShareInstance.creator; src._svg = src.ShareSvg._; src.$svg = src.ShareSvg.$; src.buildSvg = src.ShareSvg._; src.documentReady = src.Dom.documentReady; window.AComp = src.AComp; window.PhotoSwipeViewer = src.PhotoSwipeViewer; window.IFrameBridge = src.IFrameBridge; window.absol = src; // EXTERNAL MODULE: ./node_modules/absol/src/polyfill.js var polyfill = __webpack_require__(111); // EXTERNAL MODULE: ./css/base.css var base = __webpack_require__(112); // EXTERNAL MODULE: ./css/layouteditor.css var layouteditor = __webpack_require__(115); // EXTERNAL MODULE: ./node_modules/absol-acomp/ACore.js var ACore = __webpack_require__(0); // CONCATENATED MODULE: ./node_modules/absol-acomp/js/utils.js function insertTextAtCursor(text) { var sel, range; if (window.getSelection) { sel = window.getSelection(); if (sel.getRangeAt && sel.rangeCount) { range = sel.getRangeAt(0); range.deleteContents(); range.insertNode(document.createTextNode(text)); } } else if (document.selection && document.selection.createRange) { document.selection.createRange().text = text; } } function contenteditableTextOnly(element, processText) { if (element.__contenteditableTextOnly__) return; element.__contenteditableTextOnly__ = true; element.addEventListener("paste", function (e) { e.preventDefault(); if (e.clipboardData && e.clipboardData.getData) { var text = e.clipboardData.getData("text/plain"); if (processText) text = processText(text) document.execCommand("insertHTML", false, text); } else if (window.clipboardData && window.clipboardData.getData) { var text = window.clipboardData.getData("Text"); if (processText) text = processText(text) insertTextAtCursor(text); } }); } function utils_measureText(text, font) { // re-use canvas object for better performance var canvas = utils_measureText.canvas || (utils_measureText.canvas = document.createElement("canvas")); var context = canvas.getContext("2d"); if (font) context.font = font; var metrics = context.measureText(text); return metrics; } function utils_getCaretPosition(oField) { var iCaretPos = 0; if (document.selection) { oField.focus(); var oSel = document.selection.createRange(); oSel.moveStart('character', -oField.value.length); iCaretPos = oSel.text.length; } else if (oField.selectionStart || oField.selectionStart == '0') iCaretPos = oField.selectionDirection == 'backward' ? oField.selectionStart : oField.selectionEnd; return iCaretPos; } function preventNotNumberInput(elt) { elt.addEventListener('keyup', function () { var lastValue = (elt.tagname == "DIV" || elt.tagname == "SPAN") ? elt.innerHTML : elt.attributes.value; var cValue = parseFloat(this.value); if (this.value != lastValue) { elt.attributes.value = cValue; elt.emit('change', cValue, elt); } }); elt.addEventListener("paste", function (e) { e.preventDefault(); var text = ""; if (e.clipboardData && e.clipboardData.getData) { text = e.clipboardData.getData("text/plain"); } else if (window.clipboardData && window.clipboardData.getData) { text = window.clipboardData.getData("Text"); } var matched = text.match(/[+-]?([0-9]*[.])?[0-9]+/); if (matched) { this.value = matched[0]; } }); elt.addEventListener('keydown', function (event) { var key = event.key; if (key && key.length == 1 && !event.ctrlKey && !event.altKey) { if (key.match(/[0-9.\-\+]/)) { if (key == '.' && this.value.indexOf('.') >= 0) event.preventDefault(); if ((key == '+' || key == '-') && (this.value.indexOf('+') >= 0 || this.value.indexOf('-') >= 0 || utils_getCaretPosition(this) > 0)) event.preventDefault(); } else event.preventDefault(); } }); } // CONCATENATED MODULE: ./node_modules/absol-acomp/js/SpanInput.js var SpanInput_ = ACore["a" /* default */]._; var SpanInput_$ = ACore["a" /* default */].$; function SpanInput() { this.defineEvent(['change']); this._inputType = 0; this._lastValue = null; this.on('paste', this.eventHandler.paste) .on('keyup', this.eventHandler.keyup) .on('keydown', this.eventHandler.keydown) .on('blur', this.eventHandler.blur); } SpanInput.prototype.notifyValueChange = function (event) { var cValue = this.value; if (this._lastValue != cValue && (this._inputType != 1 || !isNaN(this._lastValue) || !isNaN(cValue))) { this._lastValue = cValue; this.emit('change', { type: 'change', value: cValue, originEvent: event }, this); } } SpanInput.eventHandler = {}; SpanInput.eventHandler.keyup = function (event) { if (this._inputType == 0) { this.notifyValueChange(event); } else if (this._inputType == 1) { this.eventHandler.numberKeyup(event) } }; SpanInput.eventHandler.keydown = function (event) { if (this._inputType == 0) { } else if (this._inputType == 1) { this.eventHandler.numberKeydown(event) } }; SpanInput.eventHandler.numberBlur = function () { this.notifyValueChange(event); }; SpanInput.eventHandler.textBlur = function (event) { this.notifyValueChange(event); }; SpanInput.eventHandler.blur = function (event) { if (this._inputType == 0) { this.eventHandler.textBlur(event); } else if (this._inputType == 1) { this.eventHandler.numberKeydown(event) } } SpanInput.eventHandler.numberKeyup = function (event) { this.notifyValueChange(); }; SpanInput.eventHandler.numberKeydown = function (event) { var key = event.key; if (key == 'Enter') { event.preventDefault(); this.blur(); this.notifyValueChange(); return; } if (key && key.length == 1 && !event.ctrlKey && !event.altKey) { if (key.match(/[0-9.\-\+]/)) { if (key == '.' && this.text.indexOf('.') >= 0) event.preventDefault(); if ((key == '+' || key == '-') && (this.text.indexOf('+') >= 0 || this.text.indexOf('-') >= 0 || getCaretPosition(this) > 0)) event.preventDefault(); } else event.preventDefault(); } }; SpanInput.eventHandler.paste = function (event) { event.preventDefault(); if (event.clipboardData && event.clipboardData.getData) { var text = event.clipboardData.getData("text/plain"); if (this._inputType == 1) text = text.replace(/[^0-9.\-+]/g, ''); document.execCommand("insertHTML", false, text); if (this._inputType == 1) { if (isNaN(this.value)) { this.value = NaN; } } } else if (window.clipboardData && window.clipboardData.getData) { var text = window.clipboardData.getData("Text"); if (this._inputType == 1) text = text.replace(/[^0-9.\-+]/g, ''); insertTextAtCursor(text); if (this._inputType == 1) { if (isNaN(this.value)) { this.value = NaN; } } } }; SpanInput.property = {}; SpanInput.property.value = { set: function (value) { if (this._inputType == 1 && isNaN(value)) value = null; this.clearChild(); if (value !== null) this.addChild(SpanInput_({ text: value + '' })); }, get: function () { if (this._inputType == 1) { return parseFloat(this.text); } else { return this.text; } } }; SpanInput.property.type = { set: function (value) { var index = ['text', 'number'].indexOf(value); if (index < 0) index = 0; this._inputType = index; if (index == 1) { this.addClass('absol-span-input-empty-minus'); } else { this.removeClass('absol-span-input-empty-minus'); } }, get: function () { return ['text', 'number'][this._inputType]; } }; SpanInput.property.text = { get: function () { return getTextIn(this); } } SpanInput.render = function () { return SpanInput_('span.absol-span-input[contenteditable="true"]'); }; ACore["a" /* default */].install('spaninput', SpanInput); /* harmony default export */ var js_SpanInput = (SpanInput); // EXTERNAL MODULE: ./node_modules/absol-acomp/css/spaninput.css var spaninput = __webpack_require__(117); // CONCATENATED MODULE: ./node_modules/absol-acomp/js/IconButton.js var IconButton_ = ACore["a" /* default */]._; var IconButton_$ = ACore["a" /* default */].$; function IconButton() { var res = IconButton_({ tag: "button", class: ['absol-icon-button'], child: ['.absol-icon-button-icon-container', '.absol-icon-button-text-container'] }); res.$iconContainer = IconButton_$('.absol-icon-button-icon-container', res); res.$textContainer = IconButton_$('.absol-icon-button-text-container', res); res.sync = res.afterAttached(); return res; }; IconButton.prototype.addChild = function (child) { if (child instanceof Array) { child.forEach(function () { this.addChild(child); }.bind(this)); } else { if (!this.$iconContainerChild) { this.$iconContainerChild = child; this.$iconContainer.addChild(child); this.sync = this.sync.then(this.updateTextPosition.bind(this)); } else if (!this.$textContainerChild) { this.$textContainerChild = child; this.$textContainer.addChild(child); this.sync = this.sync.then(this.updateTextPosition.bind(this)); } } return this; }; IconButton.prototype.updateTextPosition = function () { var heightStyle = parseFloat(this.getComputedStyleValue('height').replace('px', '')); var iconContainerHeightStyle = parseFloat(this.$iconContainerChild.getComputedStyleValue('height').replace('px', '')); if (heightStyle - iconContainerHeightStyle > 0) { this.$iconContainer.addStyle({ width: heightStyle + 'px', height: heightStyle + 'px' }); this.addStyle('line-height', heightStyle - 2 + 'px'); this.$textContainer.addStyle({ 'height': heightStyle + 'px', 'line-height': heightStyle + 'px' }); } if (this.$textContainerChild) { var textContainerBound = this.$textContainer.getBoundingClientRect(); var bound = this.getBoundingClientRect(); if (textContainerBound.right < bound.right - 2) { this.$textContainer.addStyle('width', textContainerBound.width + (bound.right - 2 - textContainerBound.right) + 'px'); } } } IconButton.prototype.clearChild = function () { res.$iconContainer.clearChild(); res.$textContainer.clearChild(); this.$textContainerChild = undefined; this.$iconContainerChild = undefined; return this; }; ACore["a" /* default */].creator.iconbutton = IconButton; /* harmony default export */ var js_IconButton = (IconButton); // EXTERNAL MODULE: ./node_modules/absol-acomp/css/iconbutton.css var iconbutton = __webpack_require__(119); // CONCATENATED MODULE: ./node_modules/absol/src/Math/int.js /** * * @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; } // CONCATENATED MODULE: ./node_modules/absol-acomp/js/Scroller.js var Scroller_ = ACore["a" /* default */]._; var Scroller_$ = ACore["a" /* default */].$; ACore["a" /* default */].$scrollStyle = (function () { var element = Scroller_('style#vscroller-style'); element.innerHTML = [ '.absol-vscroller-viewport{ margin-right: ' + (-17) + 'px; min-width: calc(100% + ' + (17) + 'px);}', '.absol-hscroller-viewport{ margin-bottom: ' + (-17) + 'px; min-height: calc(100% + ' + (17) + 'px);}' ].join('\n'); document.head.appendChild(element); Dom["a" /* default */].getScrollSize().then(function (size) { element.innerHTML = [ '.absol-vscroller-viewport{ margin-right: ' + (-size.width) + 'px; min-width: calc(100% + ' + (size.width) + 'px);}', '.absol-hscroller-viewport{ margin-bottom: ' + (-size.height) + 'px; min-height: calc(100% + ' + (size.height) + 'px);}' ].join('\n'); }); return element; } )(); function VScroller() { var res = Scroller_({ class: 'absol-vscroller', child: ['.absol-vscroller-viewport', { class: ['absol-scrollbar-container', 'vertical'], child: 'vscrollbar' } ] }); res.eventHandler = OOP["a" /* default */].bindFunctions(res, VScroller.eventHandler); res.$attachHook = Scroller_('attachhook').addTo(res); res.sync = new Promise(function (rs) { res.$attachHook.once('error', function () { rs(); }); }); res.$attachHook.on('error', function () { res.requestUpdateSize(); }); res.$vscrollbar = Scroller_$('vscrollbar', res).on('scroll', res.eventHandler.scrollScrollbar); res.$viewport = Scroller_$('.absol-vscroller-viewport', res) .on('scroll', res.eventHandler.scrollViewport); OOP["a" /* default */].extends(res.$viewport, { removeChild: function () { this.super.apply(this, arguments); res.requestUpdateSize(); return res; } }) return res; }; VScroller.prototype.requestUpdateSize = function () { // return; if (this._isRequestingUpdateSize) return this.sync; this._isRequestingUpdateSize = true; this.sync = this.sync.then(function () { this.$vscrollbar.outerHeight = this.$viewport.clientHeight; this.$vscrollbar.innerHeight = this.$viewport.scrollHeight - 2; this.$vscrollbar.innerOffset = this.$viewport.scrollTop; if (this.$vscrollbar.innerHeight <= this.$vscrollbar.outerHeight) { this.$vscrollbar.hidden = true; this.addClass('disabled'); } else { this.removeClass('disabled'); this.$vscrollbar.hidden = false; } this._isRequestingUpdateSize = false; }.bind(this)); return this.sync; }; VScroller.prototype.init = function (props) { this.super(props); this.requestUpdateSize(); }; VScroller.prototype.addChild = function () { var res = this.$viewport.addChild.apply(this.$viewport, arguments); this.requestUpdateSize(); return res; }; VScroller.prototype.clearChild = function () { var res = this.$viewport.clearChild.apply(this.$viewport, arguments); this.requestUpdateSize(); return res; }; VScroller.prototype.addChildBefore = function () { var res = this.$viewport.addChildBefore.apply(this.$viewport, arguments); this.requestUpdateSize(); return res; }; VScroller.prototype.addChildAfter = function () { var res = this.$viewport.addChildAfter.apply(this.$viewport, arguments); this.requestUpdateSize(); return res; }; VScroller.prototype.findChildAfter = function () { return this.$viewport.findChildAfter.apply(this.$viewport, arguments); }; VScroller.prototype.findChildBefore = function () { return this.$viewport.findChildBefore.apply(this.$viewport, arguments); }; VScroller.prototype.removeChild = function () { var res = this.$viewport.removeChild.apply(this.$viewport, arguments); this.requestUpdateSize(); return res; }; VScroller.prototype.scrollInto = function (element, padding, scrollTime, beforFrame, afterFrame) { padding = padding || 0; scrollTime = scrollTime || 0; var frameCount = Math.ceil(scrollTime / 15 + 1); var self = this; function onFrame() { beforFrame && beforFrame(); var elementBound = element.getBoundingClientRect(); var viewportBound = self.$viewport.getBoundingClientRect(); var currentScrollTop = self.$viewport.scrollTop; var newScrollTop = currentScrollTop; if (elementBound.bottom + padding > viewportBound.bottom) { newScrollTop = currentScrollTop + ((elementBound.bottom + padding) - viewportBound.bottom) / (Math.log(frameCount) + 1); } if (elementBound.top - padding < viewportBound.top) { newScrollTop = currentScrollTop - (viewportBound.top - (elementBound.top - padding)) / (Math.log(frameCount) + 1); } if (newScrollTop != currentScrollTop) { self.$viewport.scrollTop = newScrollTop; } afterFrame && afterFrame(); frameCount--; if (frameCount > 0) setTimeout(onFrame, 15) } if (Element["a" /* default */].prototype.isDescendantOf.call(element, this.$viewport)) { onFrame(); } }; VScroller.prototype.scrollBy = function (dy, duration) { duration = duration || 0; var frameCount = Math.ceil(duration / 20); var timeOut = duration / frameCount; var i = 0; var self = this; var start = self.$viewport.scrollTop; var end = start + dy; function onFrame() { self.$viewport.scrollTop = Math.max(map(i, 0, frameCount, start, end), 0); ++i; if (i <= frameCount) setTimeout(onFrame, timeOut); } onFrame(); }; VScroller.eventHandler = {}; VScroller.eventHandler.scrollViewport = function (event) { this.$vscrollbar.outerHeight = this.$viewport.clientHeight; this.$vscrollbar.innerHeight = this.$viewport.scrollHeight; this.$vscrollbar.innerOffset = this.$viewport.scrollTop; }; VScroller.eventHandler.scrollScrollbar = function (event) { this.$viewport.scrollTop = this.$vscrollbar.innerOffset; }; function HScroller() { var res = Scroller_({ class: 'absol-hscroller', child: ['.absol-hscroller-viewport', { class: ['absol-scrollbar-container', 'horizontal'], child: 'hscrollbar' } ] }); res.eventHandler = OOP["a" /* default */].bindFunctions(res, HScroller.eventHandler); res.$attachHook = Scroller_('attachhook').addTo(res) .on('error', function(){ this.requestUpdateSize =this.requestUpdateSize || res.requestUpdateSize.bind(res); Dom["a" /* default */].addToResizeSystem(this); }); res.sync = new Promise(function(rs, rj){ res.$attachHook.once('error', rs); }); res.$hscrollbar = Scroller_$('hscrollbar', res).on('scroll', res.eventHandler.scrollScrollbar); res.$viewport = Scroller_$('.absol-hscroller-viewport', res) .on('scroll', res.eventHandler.scrollViewport); OOP["a" /* default */].extends(res.$viewport, { removeChild: function () { this.super.apply(this, arguments); res.requestUpdateSize(); return res; } }); return res; }; HScroller.eventHandler = {}; HScroller.eventHandler.scrollViewport = function (event) { this.$hscrollbar.outerWidth = this.$viewport.clientWidth; this.$hscrollbar.innerWidth = this.$viewport.scrollWidth; this.$hscrollbar.innerOffset = this.$viewport.scrollLeft; }; HScroller.eventHandler.scrollScrollbar = function (event) { this.$viewport.scrollLeft = this.$hscrollbar.innerOffset; }; Object.assign(HScroller.prototype, VScroller.prototype); HScroller.prototype.requestUpdateSize = function () { // return; if (this._isRequestingUpdateSize) return this.sync; this._isRequestingUpdateSize = true; this.sync = this.sync.then(function () { this.$hscrollbar.outerWidth = this.$viewport.clientWidth; this.$hscrollbar.innerWidth = this.$viewport.scrollWidth ; this.$hscrollbar.innerOffset = this.$viewport.scrollLeft; if (this.$hscrollbar.innerWidth <= this.$hscrollbar.outerWidth) { this.$hscrollbar.hidden = true; this.addClass('disabled'); } else { this.removeClass('disabled'); this.$hscrollbar.hidden = false; } this._isRequestingUpdateSize = false; }.bind(this)); return this.sync; }; HScroller.prototype.scrollInto = function (element) { if (Element["a" /* default */].prototype.isDescendantOf.call(element, this.$viewport)) { var elementBound = element.getBoundingClientRect(); var viewportBound = this.$viewport.getBoundingClientRect(); var currentScrollLeft = this.$viewport.scrollLeft; var newScrollLeft = currentScrollLeft; if (elementBound.right > viewportBound.right) { newScrollLeft = currentScrollLeft + (elementBound.right - viewportBound.right); } if (elementBound.left < viewportBound.left) { newScrollLeft = currentScrollLeft - (viewportBound.left - elementBound.left); } if (newScrollLeft != currentScrollLeft) { this.$viewport.scrollLeft = newScrollLeft; } } } function Scrollbar() { var res = Scroller_({ class: ['absol-scrollbar'], extendEvent: ['scroll', 'active', 'deactive'], child: '.absol-scrollbar-button' }); res.$button = Scroller_$('.absol-scrollbar-button', res); res.on('active', function () { if (!res.$forceModal) res.$forceModal = Scroller_('.absol-scrollbar-force-modal'); res.$forceModal.addTo(document.body); }).on('deactive', function () { setTimeout(function () { res.$forceModal.remove(); }, 30); }); return res; }; Scrollbar.property = {}; Scrollbar.property.hidden = { set: function (value) { value = !!value; if (value != this._hidden) { this._hidden = value; if (value) this.addClass('absol-hidden'); else this.removeClass('absol-hidden'); } }, get: function () { return this.containsClass('absol-hidden') } }; function VScrollbar() { var res = Scroller_({ tag: 'scrollbar', class: 'absol-vscrollbar' }, true); var top0, innerOffset0; var pointerMoveEventHandler = function (event) { event.preventDefault(); var dy = event.clientY - top0; var newInnerOffset = innerOffset0 + dy * (res.innerHeight / res.outerHeight) * (res.outerHeight / res.getBoundingClientRect().height); if (newInnerOffset + res.outerHeight > res.innerHeight) newInnerOffset = res.innerHeight - res.outerHeight; if (newInnerOffset < 0) newInnerOffset = 0; res.innerOffset = newInnerOffset; //todo event.innerOffset = newInnerOffset; res.emit('scroll', event); }; var finishEventHandler = function (event) { var body = Scroller_$(document.body); body.off('pointerleave', finishEventHandler); body.off('pointerup', finishEventHandler); body.off('pointermove', pointerMoveEventHandler); res.removeClass('absol-active'); res.emit('deactive', { type: 'deactive', originEvent: event, tagert: res }); }; var pointerDownEventHandler = function (event) { var boundRes = res.getBoundingClientRect(); var boundButton = res.$button.getBoundingClientRect(); top0 = event.clientY; if (event.target == res.$button) { innerOffset0 = res.innerOffset; } else { var newInnerOffset = map(top0 - boundButton.height / 2 - boundRes.top, 0, boundRes.height, 0, res.innerHeight); if (newInnerOffset + res.outerHeight > res.innerHeight) newInnerOffset = res.innerHeight - res.outerHeight; if (newInnerOffset < 0) newInnerOffset = 0; res.innerOffset = newInnerOffset; //todo event.innerOffset = newInnerOffset; innerOffset0 = newInnerOffset; res.emit('scroll', event); } var body = Scroller_$(document.body); body.on('pointerleave', finishEventHandler); body.on('pointerup', finishEventHandler); body.on('pointermove', pointerMoveEventHandler); res.addClass('absol-active'); res.emit('active', { type: 'active', originEvent: event, tagert: res }); }; res.on('pointerdown', pointerDownEventHandler, true); return res; }; VScrollbar.prototype.updateValue = function () { this.$button.addStyle('height', Math.min(this.outerHeight / this.innerHeight, 1) * 100 + '%'); this.$button.addStyle('top', this.innerOffset / this.innerHeight * 100 + '%'); }; VScrollbar.property = { innerOffset: { set: function (value) { value = value || 0; if (this._innerOffset != value) { this._innerOffset = value; this.updateValue(); } }, get: function () { return this._innerOffset || 0; } }, innerHeight: { set: function (value) { value = value || 1; value = Math.max(value, 1); if (this._innerHeight != value) { this._innerHeight = value; this.updateValue(); } }, get: function () { return this._innerHeight || 1; } }, outerHeight: { set: function (value) { value = value || 0; value = Math.max(value, 0); if (this._outerHeight != value) { this._outerHeight = value; this.updateValue(); } }, get: function () { return this._outerHeight || 0; } } }; function HScrollbar() { var res = Scroller_({ tag: 'scrollbar', class: 'absol-hscrollbar' }, true); var left0, innerOffset0; var pointerMoveEventHandler = function (event) { event.preventDefault(); var dy = event.clientX - left0; var newInnerOffset = innerOffset0 + dy * (res.innerWidth / res.outerWidth) * (res.outerWidth / res.getBoundingClientRect().width); if (newInnerOffset + res.outerWidth > res.innerWidth) newInnerOffset = res.innerWidth - res.outerWidth; if (newInnerOffset < 0) newInnerOffset = 0; res.innerOffset = newInnerOffset; //todo event.innerOffset = newInnerOffset; res.emit('scroll', event); }; var finishEventHandler = function (event) { var body = Scroller_$(document.body); body.off('pointerleave', finishEventHandler); body.off('pointerup', finishEventHandler); body.off('pointermove', pointerMoveEventHandler); res.removeClass('absol-active'); res.emit('deactive', { type: 'deactive', originEvent: event, tagert: res }); }; var pointerDownEventHandler = function (event) { var boundRes = res.getBoundingClientRect(); var boundButton = res.$button.getBoundingClientRect(); left0 = event.clientX; if (event.target == res.$button) { innerOffset0 = res.innerOffset; } else { var newInnerOffset = map(left0 - boundButton.width / 2 - boundRes.left, 0, boundRes.width, 0, res.innerWidth); if (newInnerOffset + res.outerWidth > res.innerWidth) newInnerOffset = res.innerWidth - res.outerWidth; if (newInnerOffset < 0) newInnerOffset = 0; res.innerOffset = newInnerOffset; //todo event.innerOffset = newInnerOffset; innerOffset0 = newInnerOffset; res.emit('scroll', event); } var body = Scroller_$(document.body); body.on('pointerleave', finishEventHandler); body.on('pointerup', finishEventHandler); body.on('pointermove', pointerMoveEventHandler); res.addClass('absol-active'); res.emit('active', { type: 'deactive', originEvent: event, tagert: res }); }; res.on('pointerdown', pointerDownEventHandler, true); return res; } HScrollbar.prototype.updateValue = function () { this.$button.addStyle('width', Math.min(this.outerWidth / this.innerWidth, 1) * 100 + '%'); this.$button.addStyle('left', this.innerOffset / this.innerWidth * 100 + '%'); }; HScrollbar.property = { innerOffset: { set: function (value) { value = value || 0; if (this._innerOffset != value) { this._innerOffset = value; this.updateValue(); } }, get: function () { return this._innerOffset || 0; } }, innerWidth: { set: function (value) { value = value || 1; value = Math.max(value, 1); if (this._innerWidth != value) { this._innerWidth = value; this.updateValue(); } }, get: function () { return this._innerWidth || 1; } }, outerWidth: { set: function (value) { value = value || 0; value = Math.max(value, 0); if (this._outerWidth != value) { this._outerWidth = value; this.updateValue(); } }, get: function () { return this._outerWidth || 0; } } }; ACore["a" /* default */].creator.vscrollbar = VScrollbar; ACore["a" /* default */].creator.hscrollbar = HScrollbar; ACore["a" /* default */].creator.scrollbar = Scrollbar; ACore["a" /* default */].creator.vscroller = VScroller; ACore["a" /* default */].creator.hscroller = HScroller; // EXTERNAL MODULE: ./node_modules/absol-acomp/css/scroller.css var scroller = __webpack_require__(121); // CONCATENATED MODULE: ./node_modules/absol-acomp/js/NumberInput.js var NumberInput_ = ACore["a" /* default */]._; var NumberInput_$ = ACore["a" /* default */].$; function NumberInput() { var res = NumberInput_({ class: 'absol-number-input', extendEvent: ['change'], child: [ { class: 'absol-number-input-text-container', child: 'input[type="text"]' }, { class: 'absol-number-input-button-up-container', child: { tag: 'button', child: 'span.mdi.mdi-menu-up' } }, { class: 'absol-number-input-button-down-container', child: { tag: 'button', child: 'span.mdi.mdi-menu-down' } } ] }); res.eventHandler = OOP["a" /* default */].bindFunctions(res, NumberInput.eventHandler); res.$input = NumberInput_$('input', res) .on('keydown', res.eventHandler.keydown) .on('keyup', res.eventHandler.keyup) .on('paste', res.eventHandler.paste) .on('change', res.eventHandler.change); res.$input.value = 0; res._previusValue = 0;//to kwnow whenever the value changed res._value = 0; res._max = Infinity; res._min = -Infinity; res.$upBtn = NumberInput_$('.absol-number-input-button-up-container button', res) .on('mousedown', res.eventHandler.mouseDownUpBtn); res.$downBtn = NumberInput_$('.absol-number-input-button-down-container button', res) .on('mousedown', res.eventHandler.mouseDownDownBtn); res._decimalSeparator = '.'; res._thousandsSeparator = ''; res._floatFixed = -1;// unset res._decimalPadding = -1;//unset return res; } NumberInput.eventHandler = {}; NumberInput.eventHandler.mouseDownUpBtn = function (event) { if (EventEmitter["a" /* default */].isMouseRight(event)) return; var self = this; var body = NumberInput_$(document.body); var pressing = true; var timeout = -1; var i = 0; function tick() { if (pressing) { if (i == 0 || i >= 4) { self.value = Math.floor(self.value) + 1; self.notifyChanged({ by: 'long_press_button' }); } ++i; self.__pressingUpTimeout__ = setTimeout(tick, 100); } } function finish(event) { pressing = false; if (timeout >= 0) { clearTimeout(timeout); timeout = -1; } body.off('mouseup', finish); body.off('mouseleave', finish); if (event.type == 'mouseup') { self.$input.focus(); } self.notifyChanged({ originEvent: event, by: 'press_button' }); } body.on('mouseup', finish); body.on('mouseleave', finish); tick(); }; NumberInput.eventHandler.mouseDownDownBtn = function (event) { if (EventEmitter["a" /* default */].isMouseRight(event)) return; var self = this; var body = NumberInput_$(document.body); var pressing = true; var timeout = -1; var i = 0; function tick() { if (pressing) { if (i == 0 || i >= 4) { self.value = Math.ceil(self.value) - 1; self.notifyChanged({ by: 'long_press_button' }); } ++i; self.__pressingUpTimeout__ = setTimeout(tick, 100); } } function finish(event) { pressing = false; if (timeout >= 0) { clearTimeout(timeout); timeout = -1; } body.off('mouseup', finish); body.off('mouseleave', finish); if (event.type == 'mouseup') { self.$input.focus(); } self.notifyChanged({ originEvent: event, by: 'press_button' }); } body.on('mouseup', finish); body.on('mouseleave', finish); tick(); }; NumberInput.eventHandler.keyup = function (event) { var cValue = parseFloat(this.$input.value); if (!isNaN(cValue)) { this._value = cValue; this.notifyChanged({ originEvent: event, by: 'keyup' }); } }; NumberInput.eventHandler.keydown = function () { var key = event.key; var text = this.$input.value; if (key && key.length == 1 && !event.ctrlKey) { if (key.match(/[0-9.\-\+]/)) { if (key == '.' && text.indexOf('.') >= 0) event.preventDefault(); if ((key == '+' || key == '-') && (text.indexOf('+') >= 0 || text.indexOf('-') >= 0 || Text_getCaretPosition(this.$input) > 0)) event.preventDefault(); } else event.preventDefault(); } }; NumberInput.eventHandler.change = function (event) { this.value = parseFloat(this.$input.value); this.notifyChanged({ originEvent: event, by: 'input_change' }); }; NumberInput.eventHandler.paste = function (e) { e.preventDefault(); var text = ""; if (e.clipboardData && e.clipboardData.getData) { text = e.clipboardData.getData("text/plain"); } else if (window.clipboardData && window.clipboardData.getData) { text = window.clipboardData.getData("Text"); } var oldText = this.$input.value; var caretPos = Text_getCaretPosition(this.$input); var newText = oldText.substr(0, caretPos) + text + oldText.substr(caretPos); var matched = newText.match(/[+-]?([0-9]*[.])?[0-9]+/); if (matched) { this.value = parseFloat(matched[0]); } }; NumberInput.prototype.notifyChanged = function (option) { option = option || {}; if (this._previusValue != this.value || this._prevBy !== option.by) { this.emit('change', Object.assign({ target: this, value: this.value }, option || {}), this); this._previusValue = this.value; this._prevBy = option.by; } } NumberInput.prototype.numberToString = function (number) { return numberToString(this._value, this._floatFixed, this._decimalSeparator, this._thousandsSeparator, this._decimalPadding); }; NumberInput.prototype.updateTextValue = function () { if (this._value == Infinity || this._value == -Infinity) this.$input.value = this._value + ""; this.$input.value = this.numberToString(this._value); } NumberInput.prototype.stringToNumber = function (string) { var matchedInf = string.toLowerCase().match('/([+-])?infinity/'); if (matchedInf) { if (matchedInf[1] == '-') return Infinity; return -Infinity; } else if (this._thousandsSeparator == '.') { string = string.replace(/\./g, '').replace(/\,/, '.'); } else if (this._thousandsSeparator == ',') { string = string.replace(/\,/g, ''); } return parseFloat(string); }; NumberInput.property = {}; NumberInput.property.value = { set: function (value) { if (typeof (value) != 'number' || isNaN(value)) value = 0; this._value = Math.max(this._min, Math.min(this._max, value)); this.updateTextValue(); }, get: function () { return this._value; } }; NumberInput.property.max = { set: function (value) { if (!(typeof value == 'number') || isNaN(value)) { value = Infinity; } this._max = value; this._value = Math.min(value, this._value); this._min = Math.min(this._min, this._value); this.updateTextValue(); }, get: function () { return this._max; } }; NumberInput.property.min = { set: function (value) { if (!(typeof value == 'number') || isNaN(value)) { value = -Infinity; } this._min = value; this._value = Math.max(value, this._value); this._max = Math.max(this._max, this._value); this.updateTextValue(); }, get: function () { return this._min; } }; NumberInput.property.decimalSeparator = { set: function (value) { if (value == ',') { if (this._thousandsSeparator == ',') this._thousandsSeparator = '.'; } else if (value == '.') { if (this._thousandsSeparator == '.') this._thousandsSeparator = ','; } else { value = ''; } this._decimalSeparator = value; this.updateTextValue(); }, get: function () { return this._decimalSeparator; } }; NumberInput.property.thousandsSeparator = { set: function (value) { if (value == ',') { if (this._decimalSeparator == ',') this._decimalSeparator = '.'; } else if (value == '.') { if (this._decimalSeparator == '.') this._decimalSeparator = ','; } else { value = ''; } this._thousandsSeparator = value; this.updateTextValue(); }, get: function () { return this._thousandsSeparator; } }; NumberInput.property.floatFixed = { set: function (value) { if (typeof value == "number") { if (isNaN(value)) { value = -1; } else { value = Math.round(Math.max(-1, Math.min(100, value))); } } else { value = -1; } this._floatFixed = value; this.updateTextValue(); }, get: function () { return this._floatFixed; } }; NumberInput.property.decimalPadding = { set: function (value) { if (typeof value == "number") { if (isNaN(value)) { value = 0; } else { value = Math.round(Math.max(-1, Math.min(100, value))); } } else { value = 0; } this._decimalPadding = value; this.updateTextValue(); }, get: function () { return this._decimalPadding; } }; NumberInput.property.disabled = { set: function (value) { this.$input.disabled = !!value; this.$upBtn.disabled = !!value; this.$downBtn.disabled = !!value; if (value) this.addClass('absol-disabled'); else this.removeClass('absol-disabled'); }, get: function () { return this.$input.disabled; } }; ACore["a" /* default */].install('NumberInput'.toLowerCase(), NumberInput); /* harmony default export */ var js_NumberInput = (NumberInput); // EXTERNAL MODULE: ./node_modules/absol-acomp/css/numberinput.css var numberinput = __webpack_require__(123); // CONCATENATED MODULE: ./node_modules/absol-acomp/js/Searcher.js var Searcher_ = ACore["a" /* default */]._; var Searcher_$ = ACore["a" /* default */].$; ACore["a" /* default */].creator['find-ico'] = function () { var res = Searcher_( '<svg class="find" width="100mm" height="100mm" version="1.1" viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg">' + ' <g transform="matrix(-1 0 0 1 99.478 -193.73)">' + ' <path d="m62.128 199.18c-18.859 0-34.148 15.289-34.148 34.148 0 5.4138 1.26 10.533 3.5026 15.081 0.6886 1.3965 1.4698 2.7392 2.3357 4.02-1.9962 2.1685-31.467 31.596-31.404 33.295 0.21757 5.8346 4.9404 8.7289 9.464 7.855 1.3264-0.25627 30.938-30.639 31.774-31.529 1.3906 0.89633 2.8508 1.6948 4.3702 2.3848 4.2995 1.9526 9.0756 3.04 14.105 3.04 18.859 0 34.147-15.288 34.147-34.147 3e-6 -18.859-15.288-34.148-34.147-34.148zm0.49444 8.2454a26.067 26.067 0 0 1 26.068 26.067 26.067 26.067 0 0 1-26.068 26.068 26.067 26.067 0 0 1-26.067-26.068 26.067 26.067 0 0 1 26.067-26.067z"/>' + ' </g>' + '</svg>' ); return res; }; ACore["a" /* default */].creator['times-circle-ico'] = function () { var res = Searcher_( '<svg class="times" width="100mm" height="100mm" version="1.1" viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg">\ <g transform="translate(0,-197)">\ <path d="m49.979 236.2-14.231-14.231-10.696 10.696 14.257 14.257-14.351 14.351 10.737 10.737 14.292-14.292 14.292 14.292 10.761-10.761-14.257-14.257 14.316-14.316-10.725-10.725zm50.021 10.804a50 50 0 0 1-50 50 50 50 0 0 1-50-50 50 50 0 0 1 50-50 50 50 0 0 1 50 50z" />\ </g>\ </svg>' ); return res; }; function SearchTextInput() { var res = Searcher_( { class: 'absol-search-text-input', child: [ { class: 'absol-search-text-input-container', child: { tag: 'input', attr: { placeholder: 'search...' } } }, { class: 'absol-search-text-button-container', child: { tag: 'button', child: ['find-ico', 'times-circle-ico'] } } ] } ); res.defineEvent(['change', 'modify', 'stoptyping']); res.eventHandler = OOP["a" /* default */].bindFunctions(res, SearchTextInput.eventHandler); res.$button = Searcher_$('button', res); res.$input = Searcher_$('input', res); res.$input.on('change', res.eventHandler.inputChange); res.$input.on('keyup', res.eventHandler.inputKeyUp); res.$button.on('click', function (event) { res.$input.value = ''; res.eventHandler.inputKeyUp(event); setTimeout(function () { res.focus(); }, 50); }); return res; }; SearchTextInput.property = { value: { set: function (value) { value = value || ''; this.$input.value = value; this._lastTextModified = value; if (this.value.length > 0) { this.addClass('searching'); } else { this.removeClass('searching'); } }, get: function () { return this.$input.value; } }, placeholder: { set: function (value) { this.$input.attr('placeholder', value); }, get: function () { return this.$placeholder.getAttribute('placeholder'); } } }; SearchTextInput.prototype.focus = function () { this.$input.focus(); }; SearchTextInput.prototype.blur = function () { this.$input.blur(); }; SearchTextInput.eventHandler = {}; SearchTextInput.eventHandler.inputChange = function (event) { event.value = this.value; if (typeof this.onchange == 'function') { this.onchange(event, this); } this.emit('change', event); }; SearchTextInput.eventHandler.inputKeyUp = function (event) { if (this._lastTextModified != this.value) { if (this.value.length > 0) { this.addClass('searching'); } else { this.removeClass('searching'); } event.value = this.value; if (typeof this.onchange == 'function') { this.onchange(event, this); } this.emit('modify', event); if (this._updateTimeOut !== undefined) { clearTimeout(this._updateTimeOut); this._updateTimeOut = undefined; } this._updateTimeOut = setTimeout(function () { this.emit('stoptyping', event); }.bind(this), 500); this._lastTextModified = this.value; } }; ACore["a" /* default */].creator.searchcrosstextinput = function () { var res = Searcher_('searchtextinput', true); return res; }; ACore["a" /* default */].creator.searchtextinput = SearchTextInput; /* harmony default export */ var Searcher = (SearchTextInput); // EXTERNAL MODULE: ./node_modules/absol-acomp/css/searcher.css var searcher = __webpack_require__(125); // CONCATENATED MODULE: ./node_modules/absol/src/String/stringMatching.js /** * * @param {String} a * @param {String} b */ function wordLike(a, b) { var m = a.length; var n = b.length; function map(i, j) { return i * (n + 1) + j; } var Q = Array((m + 1) * (n + 1)).fill(0); for (var i = 0; i < m; ++i) for (var j = 0; j < n; ++j) if (a.charAt(i) == b.charAt(j)) { if (Q[map(i + 1, j + 1)]) { if (Q[map(i + 1, j + 1)] < Q[map(i, j)] + 1) Q[map(i + 1, j + 1)] = Q[map(i, j)] + 1; } else Q[map(i + 1, j + 1)] = Q[map(i, j)] + 1; } else Q[map(i + 1, j + 1)] = Math.max(Q[map(i + 1, j)], Q[map(i, j + 1)]); return Q[map(m, n)] / Math.max(m, n); } /** * * @param {Array<String>} sq1 * @param {Array<String>} sq2 */ function wordsMatch(sq1, sq2, matchWordPow) { matchWordPow = matchWordPow === undefined ? 1 : matchWordPow; var m = sq1.length; var n = sq2.length; function map(i, j) { return i * (n + 1) + j; } var Q = Array((m + 1) * (n + 1)).fill(0); var e = 0.0; for (var i = 0; i < m; ++i) for (var j = 0; j < n; ++j) { e = Math.pow(wordLike(sq1[i], sq2[j]), matchWordPow); if (Q[map(i + 1, j + 1)]) { if (Q[map(i + 1, j + 1)] < Q[map(i, j)] + e) Q[map(i + 1, j + 1)] = Q[map(i, j)] + e; } else Q[map(i + 1, j + 1)] = Q[map(i, j)] + e; e = Math.max(Q[map(i + 1, j)], Q[map(i, j + 1)]); if (e > Q[map(i + 1, j + 1)]) Q[map(i + 1, j + 1)] = e; } return Q[map(m, n)]; } function phraseMatch(a, b, matchWordPow) { matchWordPow = matchWordPow || 1; var spliter = /[\s,-\.+?\_]+/; var notEmp = function (e) { return e.length > 0; }; var sq1 = a.toLowerCase().split(spliter).filter(notEmp); var sq2 = b.toLowerCase().split(spliter).filter(notEmp); var wordsMatchScore = wordsMatch(sq1, sq2); var m = sq1.length; var n = sq2.length; return wordsMatchScore / Math.max(Math.min(m, n), 1); }; function phraseLike(a, b, matchWordPow) { matchWordPow = matchWordPow || 1; var spliter = /[\s,-\.+?\_]+/; var notEmp = function (e) { return e.length > 0; }; var sq1 = a.toLowerCase().split(spliter).filter(notEmp); var sq2 = b.toLowerCase().split(spliter).filter(notEmp); var m = sq1.length; var n = sq2.length; var wordsMatchScore = wordsMatch(sq1, sq2); return wordsMatchScore / Math.max(Math.max(m, n), 1); } // CONCATENATED MODULE: ./node_modules/absol-acomp/js/BScroller.js var BScroller_ = ACore["a" /* default */]._; var BScroller_$ = ACore["a" /* default */].$; function BScroller(data) { if (data && data.elt) { return BScroller_$(data.elt) } else return BScroller_('.absol-bscroller'); } BScroller.prototype.scrollInto = function (element) { if (Element["a" /* default */].prototype.isDescendantOf.call(element, this)) { var elementBound = element.getBoundingClientRect(); var viewportBound = this.getBoundingClientRect(); var currentScrollTop = this.scrollTop; var newScrollTop = currentScrollTop; if (elementBound.bottom > viewportBound.bottom) { newScrollTop = currentScrollTop + (elementBound.bottom - viewportBound.bottom); } if (elementBound.top < viewportBound.top) { newScrollTop = currentScrollTop - (viewportBound.top - elementBound.top); } if (newScrollTop != currentScrollTop) { this.scrollTop = newScrollTop; } var currentScrollLeft = this.scrollLeft; var newScrollLeft = currentScrollLeft; if (elementBound.right > viewportBound.right) { newScrollLeft = currentScrollLeft + (elementBound.right - viewportBound.right); } if (elementBound.left < viewportBound.left) { newScrollLeft = currentScrollLeft - (viewportBound.left - elementBound.left); } if (newScrollLeft != currentScrollLeft) { this.scrollLeft = newScrollLeft; } } } ACore["a" /* default */].install('bscroller', BScroller); /* harmony default export */ var js_BScroller = (BScroller); // CONCATENATED MODULE: ./node_modules/absol-acomp/js/SelectTable.js var privateDom = new Dom["a" /* default */]().install(ACore["a" /* default */]); var SelectTable_$ = privateDom.$; var SelectTable_ = privateDom._; function SelectTable() { var res = SelectTable_({ class: 'absol-select-table', extendEvent: ['change', 'addall', 'removeall', 'add', 'remove'], child: [ { class: 'absol-select-table-header', child: [ { class: 'absol-select-table-searchtextinput-container', child: 'searchtextinput' }, { class: 'absol-select-table-buttons-container', child: [ { tag: 'button', class: 'add-all', props: { innerHTML: 'Add All' } }, { tag: 'button', class: 'remove-all', props: { innerHTML: 'Remove All' } } ] } ] }, { class: 'absol-select-table-body', child: [ { tag: 'bscroller', attr: { id: 'nonselected' }, class: ['absol-select-table-items-scroller'], child: { child: ['.absol-select-table-nonselected-items-container', '.absol-select-table-nonselected-search-items-container'] } }, { tag: 'bscroller', attr: { id: 'selected' }, class: ['absol-select-table-items-scroller'], child: { child: ['.absol-select-table-selected-items-container', '.absol-select-table-selected-search-items-container'] } } ] } ] }); res.sync = res.afterAttached(); res.eventHandler = OOP["a" /* default */].bindFunctions(res, SelectTable.eventHandler); res.$buttonsContainer = SelectTable_$('.absol-select-table-buttons-container', res); res.$searchContainer = SelectTable_$('.absol-select-table-searchtextinput-container', res); res.$nonselectedItemsContainer = SelectTable_$('.absol-select-table-nonselected-items-container', res); res.$selectedItemsContainer = SelectTable_$('.absol-select-table-selected-items-container', res); res.$nonselectedSearchItemsContainer = SelectTable_$('.absol-select-table-nonselected-search-items-container', res); res.$selectedSearchItemsContainer = SelectTable_$('.absol-select-table-selected-search-items-container', res); res.$removeAllBtn = SelectTable_$('button.remove-all', res).on('click', res.eventHandler.removeAllBtnClick); res.$addAllBtn = SelectTable_$('button.add-all', res).on('click', res.eventHandler.addAllBtnClick); res.$vscrollerSelected = SelectTable_$('bscroller#selected', res) res.$vscrollerNonselected = SelectTable_$('bscroller#nonselected', res); res.$body = SelectTable_$('.absol-select-table-body', res); res.$header = SelectTable_$('.absol-select-table-header', res); res.$searchTextInput = SelectTable_$('searchtextinput', res).on('stoptyping', res.eventHandler.searchTextInputModify); res.$addAllBtn.updateSize = function () { res.updateScroller && res.updateScroller(); }; Dom["a" /* default */].addToResizeSystem(res.$addAllBtn); return res; }; SelectTable.prototype.updateButtonsContainerSize = function () { var rootBound = this.$buttonsContainer.getBoundingClientRect(); var containBound = this.$buttonsContainer.getBoundingRecursiveRect(); var fontSize = this.getFontSize(); this.$buttonsContainer.addStyle('width', (containBound.width + 1) / fontSize + 'em'); this.$searchContainer.addStyle('right', (containBound.width + 5) / fontSize + 'em'); }; SelectTable.prototype.addAll = function () { Array.apply(null, this.$nonselectedItemsContainer.childNodes).forEach(function (e) { e.addTo(this.$selectedItemsContainer); }.bind(this)); this.requestSort(); }; SelectTable.prototype.removeAll = function () { Array.apply(null, this.$selectedItemsContainer.childNodes).forEach(function (e) { e.addTo(this.$nonselectedItemsContainer); }.bind(this)) this.requestSort(); }; SelectTable.prototype.updateScroller = function () { var update = function () { if (this.style.height) { var height = parseFloat(this.getComputedStyleValue('height').replace('px', '')); var headerHeight = parseFloat(this.$header.getComputedStyleValue('height').replace('px', '')); var bodyMargin = parseFloat(this.$body.getComputedStyleValue('margin-top').replace('px', '')); var borderWidth = 1; var availableHeight = height - headerHeight - bodyMargin * 2 - borderWidth * 2; this.$vscrollerNonselected.addStyle('max-height', availableHeight + 'px'); this.$vscrollerSelected.addStyle('max-height', availableHeight + 'px'); } }.bind(this); setTimeout(update, 1); }; SelectTable.prototype.getAllItemElement = function () { var selectedItemElements = Array.apply(null, this.$selectedItemsContainer.childNodes); var nonselectedItemElements = Array.apply(null, this.$nonselectedItemsContainer.childNodes); return selectedItemElements.concat(nonselectedItemElements); }; SelectTable.prototype.init = function (props) { this.super(props); this.sync = this.sync.then(this.updateButtonsContainerSize.bind(this)); }; SelectTable.eventHandler = {}; SelectTable.eventHandler.addAllBtnClick = function (event) { this.addAll(); if (this.searching) { this.eventHandler.searchTextInputModify(event); } this.emit('addall', EventEmitter["a" /* default */].copyEvent(event, {}), this); this.updateScroller(); }; SelectTable.eventHandler.removeAllBtnClick = function (event) { this.removeAll(); if (this.searching) { this.eventHandler.searchTextInputModify(event); } this.emit('removeall', EventEmitter["a" /* default */].copyEvent(event, {}), this); this.updateScroller(); }; SelectTable.prototype._filter = function (items, filterText) { var result = []; if (filterText.length == 1) { result = items.map(function (item) { var res = { item: item, text: typeof item === 'string' ? item : item.text }; return res; }).map(function (it) { it.score = 0; var text = it.text.replace(/((\ )|(\s))+/g, ' ').trim(); it.score += text.toLowerCase().indexOf(filterText.toLowerCase()) >= 0 ? 100 : 0; text = Object(stringFormat["nonAccentVietnamese"])(text); it.score += text.toLowerCase().indexOf(filterText.toLowerCase()) >= 0 ? 100 : 0; return it; }); result.sort(function (a, b) { if (b.score - a.score == 0) { if (Object(stringFormat["nonAccentVietnamese"])(b.text) > Object(stringFormat["nonAccentVietnamese"])(a.text)) return -1; return 1; } return b.score - a.score; }); result = result.filter(function (x) { return x.score > 0; }); } else { var its = items.map(function (item) { var res = { item: item, text: typeof item === 'string' ? item : item.text }; var text = res.text.replace(/((\ )|(\s))+/g, ' ').trim(); res.score = (phraseMatch(text, filterText) + phraseMatch(Object(stringFormat["nonAccentVietnamese"])(text), Object(stringFormat["nonAccentVietnamese"])(filterText))) / 2; if (Object(stringFormat["nonAccentVietnamese"])(text).replace(/s/g, '').toLowerCase().indexOf(Object(stringFormat["nonAccentVietnamese"])(filterText).toLowerCase().replace(/s/g, '')) > -1) res.score = 100; return res; }); if (its.length == 0) return; its.sort(function (a, b) { if (b.score - a.score == 0) { if (Object(stringFormat["nonAccentVietnamese"])(b.text) > Object(stringFormat["nonAccentVietnamese"])(a.text)) return -1; return 1; } return b.score - a.score; }); var result = its.filter(function (x) { return x.score > 0.5; }); if (result.length == 0) { var bestScore = its[0].score; result = its.filter(function (it) { return it.score + 0.001 >= bestScore; }); } if (result[0].score == 0) result = []; } result = result.map(function (e) { return e.item; }); return result; }; SelectTable.prototype._stringcmp = function (s0, s1) { if (s0 == s1) return 0; if (s0 > s1) return 1; return -1; }; SelectTable.prototype._getString = function (item) { if (typeof item == "string") return item; return item.text; }; SelectTable.prototype._equalArr = function (a, b) { if (a.length != b.length) return false; for (var i = 0; i < a.length; ++i) { if (a[i] != b[i] && a[i].text != b[i].text && a[i].value != b[i].value) return false; } return true; }; SelectTable.prototype._applySort = function (items, sortFlag) { var res = items.slice(); if (sortFlag == 1 || sortFlag === true) { res.sort(function (a, b) { return this._stringcmp(this._getString(a), this._getString(b)) }.bind(this)) } else if (sortFlag == -1) { res.sort(function (a, b) { return - this._stringcmp(this._getString(a), this._getString(b)) }.bind(this)) } else if (typeof sortFlag == 'function') { res.sort(function (a, b) { return sortFlag(a, b) }.bind(this)) } return res; }; SelectTable.prototype.requestSort = function () { if (!this.sorted || this.sorted == 0) return; var selectedItems = this.selectedItems; var selectedItemsNew = this._applySort(selectedItems, this.sorted); if (!this._equalArr(selectedItems, selectedItemsNew)) { this.selectedItems = selectedItemsNew; } var nonselectedItems = this.nonselectedItems; var nonselectedItemsNew = this._applySort(nonselectedItems, this.sorted); if (!this._equalArr(nonselectedItems, nonselectedItemsNew)) { this.nonselectedItems = nonselectedItemsNew; } }; SelectTable.eventHandler.searchTextInputModify = function (event) { var filterText = this.$searchTextInput.value.trim(); if (filterText.length > 0) { var selectedItems = this.selectedItems; var nonselectedItems = this.nonselectedItems; this.selectedSearchItems = selectedItems; this.nonselectedSearchItems = this._filter(nonselectedItems, filterText); this.selectedSearchItems = this._filter(selectedItems, filterText); } else { } this.searching = filterText.length > 0; }; SelectTable.property = {}; SelectTable.property.disableMoveAll = { set: function (value) { if (value) this.addClass('disable-move-all'); else this.removeClass('disable-move-all'); }, get: function () { return this.containsClass('disable-move-all'); } }; SelectTable.property.removeAllText = { set: function (text) { this._removeAllText = text; //todo: update remove all text if (!text) this.$removeAllBtn.addStyle('display', 'none'); else { this.$removeAllBtn.removeStyle('display'); this.$removeAllBtn.innerHTML = this.removeAllText; this.updateButtonsContainerSize(); } }, get: function () { return this._removeAllText || 'Remove All' } }; SelectTable.property.addAllText = { set: function (text) { this._addAllText = text; if (!text) this.$addAllBtn.addStyle('display', 'none'); else { this.$addAllBtn.removeStyle('display'); this.$addAllBtn.innerHTML = this.removeAllText; this.updateButtonsContainerSize(); } }, get: function () { return this._addAllText || 'Add All' } }; SelectTable.property.searching = { set: function (value) { if (value) { this.addClass('searching'); } else { this.removeClass('searching'); } this.updateScroller(); }, get: function () { return this.containsClass('searching'); } }; SelectTable.property.sorted = { set: function (value) { this._sort = value; this.requestSort(); }, get: function () { return this._sort; } }; SelectTable.property.selectedItems = { set: function (items) { this.$selectedItemsContainer.clearChild(); var $nonselectedItemsContainer = this.$nonselectedItemsContainer; var $selectedItemsContainer = this.$selectedItemsContainer; var self = this; if (items instanceof Array) { items.map(function (item) { return SelectTable_({ tag: 'item', props: { data: item }, on: { requestmove: function (event) { if (this.parentElement == $selectedItemsContainer) { this.addTo($nonselectedItemsContainer); self.emit('remove', EventEmitter["a" /* default */].copyEvent(event, { item: item }), self); } else { this.addTo($selectedItemsContainer); self.emit('add', EventEmitter["a" /* default */].copyEvent(event, { item: item }), self); } self.updateScroller(); self.requestSort(); } } }).addTo(this.$selectedItemsContainer); }.bind(this)) } else { // error } this.updateScroller(); this.requestSort(); }, get: function () { return Array.prototype.map.call(this.$selectedItemsContainer.childNodes, function (e) { return e.data; }); } } SelectTable.property.nonselectedItems = { set: function (items) { this.$nonselectedItemsContainer.clearChild(); var $nonselectedItemsContainer = this.$nonselectedItemsContainer; var $selectedItemsContainer = this.$selectedItemsContainer; var self = this; if (items instanceof Array) { items.map(function (item) { return SelectTable_({ tag: 'item', props: { data: item }, on: { requestmove: function (event) { if (this.parentElement == $selectedItemsContainer) { this.addTo($nonselectedItemsContainer); self.emit('remove', EventEmitter["a" /* default */].copyEvent(event, { item: item }), self); } else { this.addTo($selectedItemsContainer); self.emit('add', EventEmitter["a" /* default */].copyEvent(event, { item: item }), self); } self.updateScroller(); self.requestSort(); } } }).addTo(this.$nonselectedItemsContainer); }.bind(this)) } else { // error } this.updateScroller(); this.requestSort(); }, get: function () { return Array.prototype.map.call(this.$nonselectedItemsContainer.childNodes, function (e) { return e.data; }); } }; SelectTable.property.selectedSearchItems = { set: function (items) { this.$selectedSearchItemsContainer.clearChild(); var $nonselectedSearchItemsContainer = this.$nonselectedSearchItemsContainer; var $selectedSearchItemsContainer = this.$selectedSearchItemsContainer; var table = this; if (items instanceof Array) { items.map(function (item) { return SelectTable_({ tag: 'item', props: { data: item }, on: { requestmove: function (event) { if (this.parentElement == $selectedSearchItemsContainer) { this.addTo($nonselectedSearchItemsContainer); table.getAllItemElement().filter(function (itemElement) { if (itemElement.data == this.data) { itemElement.addTo(table.$nonselectedItemsContainer); return true; } return false; }.bind(this)); table.emit('remove', EventEmitter["a" /* default */].copyEvent(event, { item: item }), table); } else { this.addTo($selectedSearchItemsContainer); table.getAllItemElement().filter(function (itemElement) { if (itemElement.data == this.data) { itemElement.addTo(table.$selectedItemsContainer); return true; } return false; }.bind(this)); table.emit('add', EventEmitter["a" /* default */].copyEvent(event, { item: item }), table); } table.updateScroller(); table.requestSort(); } } }).addTo(this.$selectedSearchItemsContainer); }.bind(this)) } else { // error } this.updateScroller(); }, get: function () { return Array.prototype.map.call(this.$selectedSearchItemsContainer.childNodes, function (e) { return e.data; }); } } SelectTable.property.nonselectedSearchItems = { set: function (items) { this.$nonselectedSearchItemsContainer.clearChild(); var $nonselectedSearchItemsContainer = this.$nonselectedSearchItemsContainer; var $selectedSearchItemsContainer = this.$selectedSearchItemsContainer; var table = this; if (items instanceof Array) { items.map(function (item) { return SelectTable_({ tag: 'item', props: { data: item }, on: { requestmove: function (event) { if (this.parentElement == $selectedSearchItemsContainer) { this.addTo($nonselectedSearchItemsContainer); table.getAllItemElement().filter(function (itemElement) { if (itemElement.data == this.data) { itemElement.addTo(table.$nonselectedItemsContainer); return true; } return false; }.bind(this)); table.emit('remove', EventEmitter["a" /* default */].copyEvent(event, { item: item }), table); } else { this.addTo($selectedSearchItemsContainer); table.getAllItemElement().filter(function (itemElement) { if (itemElement.data == this.data) { itemElement.addTo(table.$selectedItemsContainer); return true; } return false; }.bind(this)); table.emit('add', EventEmitter["a" /* default */].copyEvent(event, { item: item }), table); } table.updateScroller(); table.requestSort(); } } }).addTo(this.$nonselectedSearchItemsContainer); }.bind(this)) } else { // error } this.updateScroller(); }, get: function () { return Array.prototype.map.call(this.$nonselectedSearchItemsContainer.childNodes, function (e) { return e.data; }); } }; /* namespace of selecttable */ function Item() { var res = SelectTable_({ extendEvent: ['requestmove'], class: 'absol-select-table-item', child: ['span.absol-select-table-item-text', { class: 'absol-select-table-item-right-container', child: { class: 'absol-select-table-item-right-container-table', child: { class: 'absol-select-table-item-right-container-cell', child: ['addicon', 'subicon'] } } } ] }); res.$text = SelectTable_$('span', res); res.eventHandler = OOP["a" /* default */].bindFunctions(res, Item.eventHandler); res.$rightBtn = SelectTable_$('.absol-select-table-item-right-container', res); res.on('dblclick', res.eventHandler.dblclick); res.$rightBtn.on('click', res.eventHandler.rightBtClick); return res; }; Item.eventHandler = {}; Item.eventHandler.dblclick = function (event) { event.preventDefault(); if (!EventEmitter["a" /* default */].hitElement(this.$rightBtn, event)) this.emit('requestmove', event, this); }; Item.eventHandler.rightBtClick = function (event) { this.emit('requestmove', event, this); }; Item.property = {}; Item.property.data = { set: function (value) { this._data = value; if (value) { var text; if (typeof value == "string") { text = value; } else { text = value.text; } this.$text.innerHTML = text; } }, get: function () { return this._data; } }; Item.property.text = { get: function () { return this._data ? (typeof this._data == 'string' ? this._data : this._data.text) : ''; } }; /** * * <svg width="100mm" height="100mm" version="1.1" viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"> <g transform="translate(0,-197)"> <path d="m39.873 198.21v38.668h-38.668v20.252h38.668v38.668h20.253v-38.668h38.668v-20.252h-38.668v-38.668z" style="fill-rule:evenodd;fill:#5fbbc2;stroke-linejoin:round;stroke-width:2.4109;stroke:#002eea"/> </g> </svg> */ function AddIcon() { return Svg["a" /* default */].ShareInstance.buildSvg( '<svg class="add-icon" width="100mm" height="100mm" version="1.1" viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg">' + '<g transform="translate(0,-197)">' + '<path d="m39.873 198.21v38.668h-38.668v20.252h38.668v38.668h20.253v-38.668h38.668v-20.252h-38.668v-38.668z" style="fill-rule:evenodd;stroke-linejoin:round;stroke-width:2.4109;" />' + '</g>' + '</svg>' ); }; function SubIcon() { return Svg["a" /* default */].ShareInstance.buildSvg( '<svg class="sub-icon" width="100mm" height="100mm" version="1.1" viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg">' + ' <g transform="translate(0,-197)">' + ' <path d="m98.795 236.87v20.253h-97.589v-20.253z" style="fill-rule:evenodd;stroke-linejoin:round;stroke-width:2.411;"/>' + ' </g>' + '</svg>' ); }; privateDom.install({ subicon: SubIcon, addicon: AddIcon, item: Item }); SelectTable.privateDom = privateDom; ACore["a" /* default */].creator.selecttable = SelectTable; /* harmony default export */ var js_SelectTable = (SelectTable); // EXTERNAL MODULE: ./node_modules/absol-acomp/css/selecttable.css var selecttable = __webpack_require__(127); // CONCATENATED MODULE: ./node_modules/absol-acomp/js/Menu.js var Menu_ = ACore["a" /* default */]._; var Menu_$ = ACore["a" /* default */].$; function MenuButton() { var res = Menu_({ tag: 'button', class: 'absol-vmenu-button', child: [ { class: 'absol-vmenu-button-ext-icon-container', child: 'img.absol-vmenu-button-icon' }, '.absol-vmenu-button-text', '.absol-vmenu-button-key', { class: 'absol-vmenu-arrow-container', child: 'span.absol-vmenu-arrow' } ] }); res.$text = Menu_$('.absol-vmenu-button-text', res); res.$key = Menu_$('.absol-vmenu-button-key', res); res.$arrow = Menu_$('.absol-vmenu-arrow', res); res.$iconCtn = Menu_$('.absol-vmenu-button-ext-icon-container', res); OOP["a" /* default */].drillProperty(res, res.$text, 'text', 'innerHTML'); OOP["a" /* default */].drillProperty(res, res.$key, 'key', 'innerHTML'); return res; }; MenuButton.property = {}; MenuButton.property.extendClasses = { set: function (value) { var self = this; this.extendClasses.forEach(function (className) { self.removeClass(className); }); this._extendClass = []; if (!value) return; if (typeof value == 'string') { value = value.split(/\s+/).filter(function (c) { return c.length > 0 }); } if (value instanceof Array) { this._extendClass = value; this._extendClass.forEach(function (className) { self.addClass(className); }); } else { throw new Error('Invalid extendClasses'); } }, get: function () { return this._extendClass || []; } }; MenuButton.property.icon = { set: function (value) { this.$iconCtn.clearChild(); this._icon = value; if (value) { Menu_(value).addTo(this.$iconCtn); } }, get: function () { return this._icon; } }; MenuButton.property.iconSrc = { set: function (value) { this.icon = { tag: 'img', attr: { src: value } }; }, get: function () { return this.icon.attr.src; } }; MenuButton.property.extendStyle = { set: function (value) { this.removeStyle(this._extendStyle || {}); this._extendStyle = value || {}; this.addStyle(this.extendStyle); }, get: function () { return this._extendStyle || {}; } }; ACore["a" /* default */].install('menubutton', MenuButton); function Dropdown(data) { data = data || {}; var res = Menu_({ class: ['absol-drop-hidden', 'absol-dropdown'], child: '.absol-dropdown-content' }); res.$container = Menu_$('.absol-dropdown-content', res); return res; }; Dropdown.property = {}; Dropdown.property.show = { set: function (value) { if (value) { this.removeClass('absol-drop-hidden'); var aPst = this.findAvailablePosition(); if (aPst.overlapRight) { this.removeClass('overlap-left'); } else if (aPst.overlapLeft) { this.addClass('overlap-left'); } } else { this.addClass('absol-drop-hidden'); } }, get: function () { return !this.containsClass('absol-drop-hidden'); } }; Dropdown.prototype.findAvailablePosition = function () { var outBound = Dom["a" /* default */].traceOutBoundingClientRect(this); var containerBound = this.$container.getBoundingClientRect(); var bound = this.getBoundingClientRect(); var distTop = bound.top - outBound.top; var distLeft = bound.left - outBound.left; var distRight = -bound.right + outBound.right; var distBottom = -bound.right + outBound.right; var result = {}; if (distTop >= containerBound.height) result.top = true; if (distBottom >= containerBound.height) result.bottom = true; if (distLeft >= containerBound.width) result.left = true; if (distRight >= containerBound.width) result.right = true; if (distRight + bound.width >= containerBound.width) result.overlapRight = true; if (distLeft + bound.width >= containerBound.width) result.overlapLeft = true; //todo: more return result; }; Dropdown.prototype.addChild = function (child) { if (child instanceof Array) { for (var i = 0; i < child.length; ++i) this.addChild(child[i]); } else { if (!this.$trigger) { this.super(child); this.$trigger = child; } else { this.$container.addChild(child); } } }; Dropdown.prototype.clearChild = function () { if (this.$trigger) { this.$trigger.selfRemove(); this.$trigger = undefined; } this.$container.clearChild(); }; Dropdown.prototype.init = function (props) { props = props || {}; Object.assign(this, props); }; function Dropright(data) { data = data || {}; //default : hidden var res = Menu_({ class: ['absol-drop-hidden', 'absol-dropright'], child: '.absol-dropright-content', data: { $trigger: undefined, $content: undefined, _isShow: false } }); res.$container = Menu_$('.absol-dropright-content', res); return res; }; Object.assign(Dropright.prototype, Dropdown.prototype); //is the same Dropright.prototype.addChild = Dropdown.prototype.addChild; Dropright.prototype.clearChild = Dropdown.prototype.clearChild; Dropright.property = Object.assign({}, Dropdown.property); function VMenuLine() { return Menu_('<div class="absol-vmenu-line"><div></div></div>'); } function VMenuItem() { var res = Menu_({ tag: 'dropright', extendEvent: ['press', 'enter'], child: ['menubutton', { tag: 'vmenu', }] }); res.sync = new Promise(function (rs) { Menu_('attachhook').addTo(res).on('error', function () { this.remove(); rs(); }) }); res.$dropper = Menu_$('dropright', res); res.$vmenu = Menu_$('vmenu', res); res.$button = Menu_$('menubutton', res); res.$text = res.$button.$text; res.$key = res.$button.$key; res.$arrow = res.$button.$arrow; res.$iconCtn = res.$button.$iconCtn; OOP["a" /* default */].drillProperty(res, res.$button, ['text', 'extendClasses', 'extendStyle', 'key', 'icon', 'iconSrc']); OOP["a" /* default */].drillProperty(res, res.$vmenu, ['activeTab']); res.eventHandler = OOP["a" /* default */].bindFunctions(res, VMenuItem.eventHandler); res.$vmenu.on('press', res.eventHandler.pressItem, true); res.$button.on('click', res.eventHandler.clickButton, true); res.$button.on('mouseenter', res.eventHandler.enterButton, true); return res; }; VMenuItem.prototype.init = function (props) { Object.assign(this, props || {}); this.sync = this.sync.then(this.autoFixParrentSize.bind(this)); }; VMenuItem.prototype.autoFixParrentSize = function () { var parentWidth = this.$dropper.getBoundingClientRect().width;// dropper is fixed parent content size var buttonWidth = this.$button.getBoundingClientRect().width; var fontSize = this.$text.getFontSize(); this.$text.addStyle('margin-right', (parentWidth - buttonWidth) / fontSize + 'em'); }; VMenuItem.eventHandler = {}; VMenuItem.eventHandler.enterButton = function (event) { event.menuItem = this; var newEvent = EventEmitter["a" /* default */].copyEvent(event); this.emit('enter', newEvent, this); }; VMenuItem.eventHandler.pressItem = function (event) { var newEvent = EventEmitter["a" /* default */].copyEvent(event, { target: this }); this.emit('press', newEvent, this); }; VMenuItem.eventHandler.clickButton = function (event) { event.menuDontHide = this.items && this.items.length > 0; event.menuItem = this; event.vmenuItem = this; var newEvent = EventEmitter["a" /* default */].copyEvent(event, { target: this }); this.emit('press', newEvent, this); }; VMenuItem.property = {}; VMenuItem.property.items = { set: function (items) { items = items || []; if (items.length > 0) { this.$arrow.addClass(['mdi', 'mdi-chevron-right']); } else { this.$arrow.removeClass(['mdi', 'mdi-chevron-right']); } this.$vmenu.items = items; }, get: function () { return this.$vmenu.items; } }; VMenuItem.property.disable = { set: function (value) { if (value) { this.addClass('absol-menu-item-disable'); } else { this.removeClass('absol-menu-item-disable'); } }, get: function () { return this.containsClass('absol-menu-item-disable'); } }; function VMenu() { var res = Menu_({ class: 'absol-vmenu', extendEvent: 'press' }); res.sync = new Promise(function (rs) { Menu_('attachhook').addTo(res).on('error', function () { this.remove(); rs(); }) }); res.eventHandler = OOP["a" /* default */].bindFunctions(res, VMenu.eventHandler); return res; }; VMenu.property = {}; VMenu.property.activeTab = { set: function (tabIndex) { this._activeTab = tabIndex; if (this.$items) { for (var i = 0; i < this.$items.length; ++i) { var item = this.$items[i]; item.show = i == tabIndex && !item.disable; item.activeTab = -1; if (i == tabIndex && !item.disable) { item.$button && item.items && item.items.length > 0 && item.$button.addClass('absol-vmenu-button-hover'); } else { item.$button && item.$button.removeClass('absol-vmenu-button-hover'); } } } }, get: function () { return this._activeTab; } }; VMenu.property.extendStyle = { set: function (value) { this.removeStyle(this._extendStyle || {}); this._extendStyle = value || {}; this.addStyle(this.extendStyle); }, get: function () { return this._extendStyle || {}; } }; VMenu.property.extendClasses = { set: function (value) { var self = this; this.extendClasses.forEach(function (className) { self.removeClass(className); }); this._extendClass = []; if (!value) return; if (typeof value == 'string') { value = value.split(/\s+/).filter(function (c) { c.length > 0 }); } if (value instanceof Array) { this._extendClass = value; this._extendClass.forEach(function (className) { self.addClass(className); }); } else { throw new Error('Invalid extendClasses'); } }, get: function () { return this._extendClass || []; } }; VMenu.eventHandler = {}; VMenu.eventHandler.enterItem = function (event) { var tabIndex = event.menuItem._tabIndex; this.activeTab = tabIndex; }; VMenu.eventHandler.pressItem = function (event) { this.emit('press', EventEmitter["a" /* default */].copyEvent(event, { target: this }), this); }; VMenu.property.items = { set: function (items) { this._childFromItems(items || []); }, get: function () { return this.$items; } } VMenu.prototype.init = function (props) { Object.assign(this, props || {}); }; VMenu.prototype._childFromItems = function (items) { this.clearChild(); this.$items = items.map(function (item, index) { var res; if (typeof (item) == 'string') { res = Menu_('vmenuline'); } else { res = Menu_({ tag: 'vmenuitem', props: Object.assign({ _tabIndex: index }, item), on: { enter: { callback: this.eventHandler.enterItem, cap: true }, press: { callback: this.eventHandler.pressItem, cap: true } } }); } this.addChild(res); return res; }.bind(this)); //todo }; function HMenuItem() { var res = Menu_({ tag: 'dropdown', extendEvent: ['press', 'enter'], child: ['button.absol-hmenu-button', 'vmenu' ] }); res.$vmenu = Menu_$('vmenu', res); res.$dropDown = res; res.$button = Menu_$('button.absol-hmenu-button', res); OOP["a" /* default */].drillProperty(res, res.$button, 'text', 'innerHTML'); OOP["a" /* default */].drillProperty(res, res.$vmenu, 'items'); OOP["a" /* default */].drillProperty(res, res.$vmenu, 'activeTab'); res.eventHandler = OOP["a" /* default */].bindFunctions(res, HMenuItem.eventHandler); res.$button.on('click', res.eventHandler.clickButton); res.$button.on('mouseenter', res.eventHandler.enterButton, true); res.$vmenu.on('press', res.eventHandler.pressItem, true); //property show not need because dropdown is itself return res; }; HMenuItem.eventHandler = {}; HMenuItem.eventHandler.clickButton = function (event) { event.menuItem = this; event.hmenuItem = this; this.emit('press', EventEmitter["a" /* default */].copyEvent(event, { target: this }), this); }; HMenuItem.eventHandler.enterButton = function (event) { event.menuItem = this; this.emit('enter', EventEmitter["a" /* default */].copyEvent(event, { target: this }), this); }; HMenuItem.eventHandler.pressItem = function (event) { this.emit('press', EventEmitter["a" /* default */].copyEvent(event, { target: this }), this); }; HMenuItem.prototype = {}; HMenuItem.prototype.disable = VMenuItem.prototype.disable; HMenuItem.prototype.init = function (props) { props = props || {}; Object.assign(this, props); }; function HMenu() { var res = Menu_({ class: 'absol-hmenu', extendEvent: ['press', 'enter'] }); res.eventHandler = OOP["a" /* default */].bindFunctions(res, HMenu.eventHandler); return res; }; HMenu.eventHandler = {}; HMenu.eventHandler.pressItem = function (event) { /** * this.activeTab can be undefined * undefine >= 0 => false * undefine < 0 => false */ if (event.menuItem.items && event.menuItem.items.length > 0 && !(this.activeTab >= 0)) { this.activeTab = event.menuItem._tabIndex; setTimeout(function () { Menu_$(document.body).once('click', this.eventHandler.clickSomewhere, false); }.bind(this), 100); } else { this.emit('press', event, this); } }; HMenu.eventHandler.enterItem = function (event) { if (this.activeTab >= 0) { this.activeTab = event.menuItem._tabIndex; } }; HMenu.eventHandler.clickSomewhere = function (event) { if (event.menuItem) { // wait for next time setTimeout(function () { Menu_$(document.body).once('click', this.eventHandler.clickSomewhere, false); }.bind(this), 100); } else { this.activeTab = -1; } }; HMenu.prototype._childFromItems = function (items) { this.clearChild(); this.$items = items.map(function (item, index) { var res = Menu_({ tag: 'hmenuitem', props: Object.assign({ _tabIndex: index }, item), on: { press: { callback: this.eventHandler.pressItem, cap: true }, enter: { callback: this.eventHandler.enterItem, cap: true } } }); this.addChild(res); return res; }.bind(this)); }; HMenu.prototype.init = function (props) { Object.assign(this, props || {}); }; HMenu.property = {}; HMenu.property.items = { set: function (items) { this._childFromItems(items || []); }, get: function () { return this.$items; } }; HMenu.property.activeTab = { set: function (tabIndex) { this._activeTab = tabIndex; for (var i = 0; i < this.$items.length; ++i) { var item = this.$items[i]; item.show = i == tabIndex && !item.disable; item.activeTab = -1; if (i == tabIndex && !item.disable) { item.$button && item.items && item.items.length > 0 && item.$button.addClass('absol-hmenu-button-hover'); } else { item.$button && item.$button.removeClass('absol-hmenu-button-hover'); } } }, get: function () { return this._activeTab; } }; ACore["a" /* default */].creator.hmenu = HMenu; ACore["a" /* default */].creator.vmenuitem = VMenuItem; ACore["a" /* default */].creator.vmenu = VMenu; ACore["a" /* default */].creator.dropright = Dropright; ACore["a" /* default */].creator.vmenuline = VMenuLine; ACore["a" /* default */].creator.dropdown = Dropdown; ACore["a" /* default */].creator.hmenuitem = HMenuItem; // EXTERNAL MODULE: ./node_modules/absol-acomp/css/menu.css var css_menu = __webpack_require__(129); // CONCATENATED MODULE: ./node_modules/absol-acomp/js/ContextMenu.js var ContextMenu_ = ACore["a" /* default */]._; var ContextMenu_$ = ACore["a" /* default */].$; /** * If a element want to capture contextmenu event, it extendEvent: 'contextmenu' * */ function ContextHook() { var res = ContextMenu_({ tag: 'textarea', class: 'absol-context-menu-hook' }); res.eventHandler = OOP["a" /* default */].bindFunctions(res, ContextHook.eventHandler); res.on('contextmenu', res.eventHandler.contextmenu, true); return res; }; ContextHook.prototype.handle = function (event) { if (!this.parentElement) return; var isRightMB; event = event || window.event; var body = ContextMenu_$(document.body); 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; var needHandle = false; if (isRightMB) { var current = event.target; while (current && !needHandle) { if (current.isSupportedEvent && current.isSupportedEvent('contextmenu')) needHandle = true; current = current.parentElement; } if (needHandle) { this.$target = event.target; this.addStyle('z-index', '1000000'); this.removeStyle('display'); this.moveTo(event); body.on('mouseup', this.eventHandler.mousefinish); body.on('mouseleave', this.eventHandler.mousefinish); body.on('mousemove', this.eventHandler.mousemove); } } return needHandle; }; ContextHook.prototype.moveTo = function (event) { if (!this.parentElement) return; var parentBound = this.parentElement.getBoundingClientRect(); this.addStyle('left', -parentBound.left + event.clientX - 7 + 'px'); this.addStyle('top', -parentBound.top + event.clientY - 7 + 'px'); } ContextHook.eventHandler = {}; ContextHook.eventHandler.contextmenu = function (event) { this.addStyle('z-index', '-1000'); event.preventDefault(); var parentBound = this.parentElement.getBoundingClientRect(); var propagation = true; var localEvent = { clientX: event.clientX, clientY: event.clientY, target: this.$target, hinge: this.parentElement, relativeX: event.clientX - parentBound.left, relativeY: event.clientY - parentBound.top, showContextMenu: function (props, onSelectItems) { this.hinge.showContextMenu(props, event, onSelectItems); }, stopPropagation: function () { propagation = false; } } var current = this.$target; while (current && propagation) { if (current.isSupportedEvent && current.isSupportedEvent('contextmenu')) { current.emit('contextmenu', localEvent, current, this); } current = current.parentElement; } }; ContextHook.eventHandler.mousemove = function (event) { this.moveTo(event); }; ContextHook.eventHandler.mousefinish = function (event) { setTimeout(function () { this.addStyle('z-index', '-1000'); this.addStyle('display', 'none'); }.bind(this), 1); var body = ContextMenu_$(document.body); body.off('mouseup', this.eventHandler.mousefinish); body.off('mouseleave', this.eventHandler.mousefinish); body.off('mousemove', this.eventHandler.mousemove); }; /** * Add this element to some thing like body, and when mousedown event was fired, let call `thisElement.handle` * every element in event pathlist will fire contextmenu event if supported * */ function ContextCaptor() { var res = ContextMenu_({ extendEvent: 'requestcontextmenu', class: 'absol-context-hinge', child: ['contexthook', 'vmenu.absol-context-menu'] }); res.$contexHook = ContextMenu_$('contexthook', res); res.$contextMenu = ContextMenu_$('vmenu.absol-context-menu', res); res._contextMenuSync = Promise.resolve(); return res; }; ContextCaptor.prototype.handle = function (event) { return this.$contexHook.handle(event); }; /** * @param {HTMLElement} element * @returns {HTMLElement} */ ContextCaptor.prototype.attachTo = function (element) { if (!this._listener) { this._listener = this.handle.bind(this); } if (this._attachedElement) { this._attachedElement.removeEventListener('mousedown', this._listener, true); this._attachedElement = undefined; } this._attachedElement = element; if (element) { element.addEventListener('mousedown', this._listener, true); } return this; }; /** * * @param {Object} props vmenu property * @param {Event} event for align menu */ ContextCaptor.prototype.showContextMenu = function (props, event, onSelectItems) { Object.assign(this.$contextMenu, props); onSelectItems = onSelectItems || function () { }; var bound = this.getBoundingClientRect(); var viewableBound = Dom["a" /* default */].traceOutBoundingClientRect(this); var left = event.clientX - bound.left; var top = event.clientY - bound.top; var body = ContextMenu_$('body'); this.emit('requestcontextmenu', EventEmitter["a" /* default */].copyEvent(event, { target: this })); this._contextMenuSync = this._contextMenuSync.then(function () { return new Promise(function (resolve) { setTimeout(function () { this.$contextMenu.addStyle('z-index', '1000'); this.$contextMenu.addStyle('visibility', 'visible'); var viewBound = Dom["a" /* default */].traceOutBoundingClientRect(this.$contextMenu.parentElement); var menuBound = this.$contextMenu.getBoundingClientRect(); if (menuBound.width + event.clientX > viewBound.right) { this.$contextMenu.addStyle('left', left - menuBound.width + 'px'); } else { this.$contextMenu.addStyle('left', left + 'px'); } if (menuBound.height + event.clientY > viewBound.bottom) { this.$contextMenu.addStyle('top', top - menuBound.height + 'px'); } else { this.$contextMenu.addStyle('top', top + 'px'); } var finishCallback = function (event) { body.off('click', finishCallback); this.off('contextmenu', finishCallback); this.off('requestcontextmenu', finishCallback); this.$contextMenu.off('press', onSelectItems, true); this.$contextMenu.off('press', finishCallback); this.hideContextMenu(); resolve(); }.bind(this); var mouseDownEventHandler = function (event) { if (EventEmitter["a" /* default */].isMouseRight(event)) finishCallback.call(this, event); } body.on('mousedown', mouseDownEventHandler); body.on('click', finishCallback); this.on('contextmenu', finishCallback); this.on('requestcontextmenu', finishCallback); this.$contextMenu.on('press', onSelectItems, true); this.$contextMenu.on('press', finishCallback); }.bind(this), 50); }.bind(this)); }.bind(this)); }; ContextCaptor.prototype.hideContextMenu = function () { this.$contextMenu.addStyle({ 'z-index': ' -1000', top: '0', left: '-1000' }); this.$contextMenu.removeStyle('visibility'); }; ACore["a" /* default */].creator.contextcaptor = ContextCaptor; ACore["a" /* default */].creator.contexthook = ContextHook; //todo: may be need closeContextMenu // EXTERNAL MODULE: ./node_modules/absol-acomp/css/contextmenu.css var contextmenu = __webpack_require__(131); // CONCATENATED MODULE: ./node_modules/absol-acomp/js/Modal.js function Modal() { var $ = ACore["a" /* default */].$; var _ = ACore["a" /* default */]._; var res = _({ class: 'absol-modal', child: { class: 'absol-modal-hcenter', child: { class: 'absol-modal-vcenter', child: '.absol-modal-container' } } }); res.$container = $('.absol-modal-container', res); return res; }; Modal.prototype.addChild = function (child) { this.$container.addChild.apply(this.$container, arguments); return this; }; Modal.property = {}; Modal.property.show = { set: function (value) { if (value) this.removeClass('absol-modal-hidden'); else this.addClass('absol-modal-hidden'); }, get: function () { return !this.containsClass('absol-modal-hidden'); } }; ACore["a" /* default */].creator.modal = Modal; /* harmony default export */ var js_Modal = (Modal); // EXTERNAL MODULE: ./node_modules/absol-acomp/css/modal.css var modal = __webpack_require__(133); // CONCATENATED MODULE: ./node_modules/absol-acomp/js/TextEditor.js var TextEditor_ = ACore["a" /* default */]._; var TextEditor_$ = ACore["a" /* default */].$; function TextEditor() { var res = TextEditor_({ class: ['absol-text-editor'], attr: { tabindex: '1' }, child: [ { class: 'absol-text-editor-text-layer', attr: { contenteditable: 'true' }, child: { class: 'absol-text-editor-line', child: 'br' } }, { class: 'absol-text-editor-position', child: { text: 'Ln 1, Col 1' } } ] }); res.eventHandler = OOP["a" /* default */].bindFunctions(res, TextEditor.eventHandler); res._textFont = '14px Helvetica, Arial, sans-serif'; res.$textLayter = TextEditor_$('.absol-text-editor-text-layer', res) .on('keydown', res.eventHandler.keydown); res.$cursorPos = TextEditor_$('.absol-text-editor-position', res); res.on('mousedown', res.eventHandler.mousedown) .on('mouseup', res.eventHandler.mouseup) .on('paste', res.eventHandler.paste); // res.$attachook = _('attachhook').addTo(res) // .on('error', function () { // res.reloadFontInfo(); // }); // res.on('focus', res.eventHandler.focus, true); // res.$editable = $('.absol-text-editor-edittable', res) // .on('keydown', res.eventHandler.keydown, true); // res.$textLayer = $('.absol-text-editor-text-layer', res); // res._cursorCol = 0; // res._cursorRow = 0; // res.$cursor = $('.absol-text-editor-cursor', res); return res; } TextEditor.eventHandler = {}; // TextEditor.eventHandler.focus = function (event) { // this.focus(); // }; // TextEditor.eventHandler.editableBlur = function (event) { // this.removeClass('absol-focus'); // }; TextEditor.eventHandler.keydown = function (event) { this.isEmptyText(); if (event.key == 'Backspace') { if (this.isEmptyText()) event.preventDefault(); } setTimeout(this._updateCursorPosition.bind(this), 1); }; TextEditor.eventHandler.mousedown = function () { setTimeout(this._updateCursorPosition.bind(this), 1); }; TextEditor.eventHandler.mouseup = function () { setTimeout(this._updateCursorPosition.bind(this), 1); }; TextEditor.eventHandler.paste = function (event) { setTimeout(this._normalizeLineElt.bind(this, this._lineOf(event.target)), 1); }; TextEditor.prototype._normalizeLineEltFrom = function (elt){ } TextEditor.prototype._normalizeLineElt = function (elt) { if (elt.classList.contains('absol-text-editor-line') && elt.childNodes.length == 1) return false; var texts = getTextIn(elt).split('\n'); var text, childStruct; var newOffset; text = texts.shift(); newOffset = text.length; var cLine = TextEditor_$(elt).clearChild().addChild(TextEditor_({ text: text })); var lLine; while (texts.length > 1) { text = texts.shift(); newOffset = text.length; lLine = cLine; cLine = TextEditor_({ class: 'absol-text-editor-line', child: { text: text } }); this.$textLayter.addChildAfter(cLine, lLine); } if (texts.length == 1) { text = texts.shift(); newOffset = text.length; lLine = cLine; var lLineIndex = this._lineIndexOf(lLine); if (lLineIndex == this.$textLayter.childNodes.length - 1) { if (text == '') childStruct = 'br'; else childStruct = { text: text }; cLine = TextEditor_({ class: 'absol-text-editor-line', child: childStruct }); this.$textLayter.addChild(cLine); } else { cLine = TextEditor_$(this.$textLayter.childNodes[lLineIndex + 1]); text = text + getTextIn(cLine); cLine.clearChild() .addChild(TextEditor_({ text: text })); } } var range = document.createRange(); range.setStart(cLine.childNodes[0], newOffset); var sel = window.getSelection(); sel.removeAllRanges(); sel.addRange(range); }; TextEditor.prototype._updateCursorPosition = function () { var selection = document.getSelection(); this._selection = {}; this._selection.anchorNode = selection.anchorNode; this._selection.anchorOffset = selection.anchorOffset; this._selection.focusNode = selection.focusNode; this._selection.focusOffset = selection.focusOffset; this._selection.type = selection.type; var r = this._lineIndexOf(this._selection.focusNode); var c = this._selection.focusOffset; this.$cursorPos.innerHTML = "Ln " + (r + 1) + ', ' + 'Col ' + (c + 1); }; TextEditor.prototype._lineIndexOf = function (node) { while (node) { if (node.tagName == 'DIV' && node.classList.contains('absol-text-editor-line')) { return Array.prototype.indexOf.call(this.$textLayter.childNodes, node); } node = node.parentElement; } return -1; }; TextEditor.prototype._lineOf = function (node) { while (node) { if (node.tagName == 'DIV' && node.classList.contains('absol-text-editor-line')) { return node; } node = node.parentElement; } return undefined; }; TextEditor.prototype.getSelection = function () { }; TextEditor.prototype.getCursorPosition = function () { }; TextEditor.prototype.isEmptyText = function () { if (this.$textLayter.childNodes.length == 1 && this.$textLayter.childNodes[0].innerHTML == "" || this.$textLayter.childNodes[0].innerHTML == '<br>' || this.$textLayter.childNodes[0].innerHTML == '</br>') return true; return false; }; // TextEditor.prototype.flushEditable = function () { // var text = getTextIn(this.$editable); // var images = []; // $('img', this.$editable, function (elt) { // images.push(elt); // }); // this.$editable.clearChild(); // if (text) // this.insertText(text); // }; // TextEditor.prototype.focus = function () { // this.addClass('absol-focus'); // this.$editable.focus(); // }; // TextEditor.prototype.blur = function () { // this.removeClass('absol-focus'); // this.$editable.blur(); // }; // TextEditor.prototype.insertText = function (text) { // var lineElt = this.$textLayer.childNodes[this._cursorRow]; // var textNode = lineElt.childNodes[0]; // var oldText = textNode.data; // var newText = oldText.slice(0, this._cursorCol) + text; // this._cursorCol += text.length; // var textWidth = measureText(newText, this._textFont).width; // this.$cursor.addStyle('left', textWidth + 'px'); // newText += oldText.slice(this._cursorCol); // textNode.data = newText; // }; // TextEditor.prototype.insertLine = function (rowPos, text) { // rowPos = Math.min(this.$textLayer.childNodes.length, rowPos); // text = text || ''; // var newLineElt = _({ // class: 'absol-text-editor-line', // child: { text: text } // }); // var lineElt = this.$textLayer.childNodes[rowPos]; // if (lineElt) { // this.$textLayer.addChildBefore(newLineElt, lineElt); // } // else { // this.$textLayer.addChild(newLineElt); // } // if (this._cursorRow >= rowPos) { // ++this._cursorRow; // this.$cursor.addStyle('top', 1.5 * this._cursorRow + 'em'); // } // }; // TextEditor.prototype.reloadFontInfo = function () { // this._textFont = this.getComputedStyleValue('font'); // }; // TextEditor.prototype.setCursorPosition = function (row, col) { // }; // TextEditor.prototype.setText = function () { // }; // TextEditor.prototype.getText = function () { // }; ACore["a" /* default */].install('texteditor', TextEditor); // not comleted yet // EXTERNAL MODULE: ./node_modules/absol-acomp/css/texteditor.css var texteditor = __webpack_require__(135); // CONCATENATED MODULE: ./node_modules/absol-acomp/js/MediaInput.js var MediaCore = new Dom["a" /* default */]({ creator: Object.assign({}, ACore["a" /* default */].creator) }); var MediaInput_ = MediaCore._; var MediaInput_$ = MediaCore.$; function openFileDialog(props) { if (!MediaCore.$fileInput) { MediaCore.$fileInput = MediaInput_({ tag: 'input', class: 'vmedia-no-show', attr: { type: 'file' }, props: {} }).addTo(document.body); } props = props || {}; if (props.accept) { if (props.accept instanceof Array) MediaCore.$fileInput.attr('accept', props.accept.join(',')); else MediaCore.$fileInput.attr('accept', props.accept); } else { MediaCore.$fileInput.attr('accept', null); } if (props.multiple) { MediaCore.$fileInput.attr('multiple', 'true'); } else { MediaCore.$fileInput.attr('multiple'); } MediaCore.$fileInput.value = null; MediaCore.$fileInput.click(); return new Promise(function (resolve, reject) { var finish = false; var body = MediaInput_$('body'); MediaCore.$fileInput.once('change', function () { finish = true; resolve(Array.prototype.map.call(this.files, function (file) { return file; })); }); body.once('mousedown', function () { if (finish) return; resolve(); }); }); } function MediaInput() { var res = MediaInput_({ class: 'vmedia-media-input', extendEvent: ['send', 'update', 'releaseplugin'], child: { class: 'vmedia-media-input-text-container', child: [{ class: 'vmedia-media-input-imagepreview-container', child: { class: 'vmedia-media-input-dropover', child: 'download-ico' } }, { class: 'vmedia-media-input-text-container-editor', attr: { contenteditable: 'true' }, on: { } }, { class: 'vmedia-media-input-text-container-buttons', attr: { title: 'Send' } }, { class: 'vmedia-media-input-tool-container', child: [ { class: 'vmedia-media-input-tool-container-left', child: [ { tag: 'button', attr: { id: 'add-image-btn', title: 'Add image' }, child: 'add-image-ico' }, { tag: 'button', attr: { id: 'add-file-btn', title: 'Add file' }, child: 'add-file-ico' }, ] }, { class: 'vmedia-media-input-tool-container-right', child: [{ tag: 'button', id: 'send-btn', attr: { title: 'Send' }, child: 'send-ico' }] } ], }, '.vmedia-media-input-plugin-content-container.blur', ] } }); return res; } MediaInput.prototype.preInit = function () { this.eventHandler = OOP["a" /* default */].bindFunctions(this, MediaInput.eventHandler); this.$editor = MediaInput_$('.vmedia-media-input-text-container-editor', this); this.$editor.on('paste', this.eventHandler.paste); this.$editor.on('keydown', this.eventHandler.keydown, true); this.$addImagebtn = MediaInput_$('#add-image-btn', this); this.$addImagebtn.on('click', this.eventHandler.clickAddImage); this.$addFilebtn = MediaInput_$('#add-file-btn', this); this.$addFilebtn.on('click', this.eventHandler.clickAddFile); this.$imagePreviewContainer = MediaInput_$('.vmedia-media-input-imagepreview-container', this); this.on('dragover', this.eventHandler.dragOver); this.on('drop', this.eventHandler.drop); this.$sendbtn = MediaInput_$('#send-btn', this); this.$sendbtn.on('click', this.eventHandler.send); this.$toolLeftCtn = MediaInput_$('.vmedia-media-input-tool-container-left', this); this.$pluginContentCtn = MediaInput_$('.vmedia-media-input-plugin-content-container', this); this.snapData = []; this.snapDataHead = 0; this.sync = this.afterAttached(); this.snapText(); }; MediaInput.prototype.init = function (props) { this.preInit(); this.super(props); } MediaInput.prototype.addImage = function (url, title, data) { MediaInput_({ tag: 'imagepreview', attr: { title: title }, props: { data: data, imgSrc: url }, on: { pressremove: function () { this.selfRemove(); } } }).addTo(this.$imagePreviewContainer); }; MediaInput.prototype.addFile = function (url, ext, title, data) { MediaInput_({ tag: 'filepreview', attr: { title: title }, props: { fileSrc: url, ext: ext, data: data }, on: { pressremove: function () { this.selfRemove(); } } }).addTo(this.$imagePreviewContainer); }; MediaInput.property = {}; MediaInput.property.text = { set: function (value) { this.$editor.clearChild(); value = value || ''; var lines = value.split(/\r*\n/); if (lines.length < 1) return; this.$editor.addChild(document.createTextNode(lines[0])); lines.shift(); lines.forEach(function (line) { this.$editor.addChild(MediaInput_({ child: document.createTextNode(line) })); }.bind(this)); this.snapText(); }, get: function () { return this.getTextFromElements(this.$editor); } }; MediaInput.property.files = { get: function () { return Array.prototype.filter.call(this.$imagePreviewContainer.childNodes, function (e) { return e._azar_extendTags && e._azar_extendTags.filepreview; }).map(function (e) { return e.data; }); } }; MediaInput.property.images = { get: function () { return Array.prototype.filter.call(this.$imagePreviewContainer.childNodes, function (e) { return e._azar_extendTags && e._azar_extendTags.imagepreview; }).map(function (e) { return e.data; }); } }; // MediaInput.property MediaInput.property.plugins = { set: function (value) { this.sync = this.sync.then(this._dettachPlugins.bind(this, this._plugins)); if (value) { if (!(value instanceof Array)) value = [value]; this._plugins = value; this.addClass('has-plugin'); } else { //remove plugin this.sync.then(this._dettachPlugins.bind(this)); this._plugins = null; this.removeClass('has-plugin'); } this.sync = this.sync.then(this._attachPlugins.bind(this, this._plugins)); }, get: function () { return this._plugins || null; } } MediaInput.prototype.appendText = function (text) { var lastBr = null; if (this.$editor.childNodes && this.$editor.childNodes.length > 0 && this.$editor.childNodes[this.$editor.childNodes.length - 1].tagName && this.$editor.childNodes[this.$editor.childNodes.length - 1].tagName.toLowerCase() == 'br') { lastBr = this.$editor.childNodes[this.$editor.childNodes.length - 1]; } var lines = text.split(/\r?\n/); if (lastBr) { for (var i = 0; i < lines.length; ++i) { if (i > 0) this.$editor.addChild(MediaInput_('br')); var e = MediaInput_({ text: lines[i] }); this.$editor.addChild(e); } } else { for (var i = 0; i < lines.length; ++i) { if (i > 0) this.$editor.addChildBefore(MediaInput_('br'), lastBr); var e = MediaInput_({ text: lines[i] }); } this.$editor.addChildBefore(e, lastBr); } setSelectionRange(this.$editor, Infinity); }; MediaInput.prototype._attachPlugins = function (plugins) { if (!plugins) return; var self = this; plugins.forEach(function (plugin) { var oldContent = null; var $button = MediaInput_('button').addTo(self.$toolLeftCtn).on('click', function () { if (self._lastActivePlugin == plugin) return; self.releasePlugin(); self._lastActivePlugin = plugin; self.$pluginContentCtn.removeClass('blur'); self.$pluginContentCtn.clearChild(); if (plugin.getContent) { var newContent = plugin.getContent(self, MediaInput_, MediaInput_$, self.$pluginContentCtn, oldContent); oldContent = newContent; self.$pluginContentCtn.addChild(newContent); } var buttonBound = $button.getBoundingClientRect(); var rootBound = self.$pluginContentCtn.parentNode.getBoundingClientRect(); self.$pluginContentCtn.addStyle({ left: buttonBound.left + buttonBound.width / 2 - rootBound.left + 'px', bottom: rootBound.bottom - buttonBound.top + 'px' }); if (plugin.onActive) plugin.onActive(self); setTimeout(function () { var outListener = function (event) { if (EventEmitter["a" /* default */].hitElement(self.$pluginContentCtn, event)) { } else if (self._lastActivePlugin == plugin) { var prevented = true; if (plugin.onBlur) plugin.onBlur({ preventDefault: function () { prevented = false; } }); if (prevented) { self.releasePlugin(); MediaInput_$(document.body).off('click', outListener); } } else { MediaInput_$(document.body).off('click', outListener); } }; MediaInput_$(document.body).on('click', outListener); self.once('releaseplugin', function (ev) { if (ev.plugin == plugin) { MediaInput_$(document.body).off('click', outListener); } }); }, 100); }); var btnInners = plugin.getTriggerInner(self, MediaInput_, MediaInput_$, $button); if (!(btnInners instanceof Array)) btnInners = [btnInners]; btnInners.forEach(function (e) { if (typeof e == 'string') { e = MediaInput_({ text: e }); } $button.addChild(e); }); if (plugin.onAttached) plugin.onAttached(self); }); //todo return true; }; MediaInput.prototype.releasePlugin = function () { if (this._lastActivePlugin) { var plugin = this._lastActivePlugin; plugin.onDeactived && plugin.onDeactived(self); this.$pluginContentCtn.addClass('blur'); this.emit('releaseplugin', { target: this, plugin: plugin }, this); this._lastActivePlugin = null; } } MediaInput.prototype._dettachPlugins = function (plugins) { if (!plugins) return; var self = this; plugins.forEach(function (plugin) { if (plugin.onAttached) plugin.onAttached(self); }); //todo this._lastActivePlugin = null; return true; }; MediaInput.prototype.focus = function () { this.$editor.focus(); setSelectionRange(this.$editor, Infinity); }; MediaInput.prototype.clear = function () { Array.prototype.filter.call(this.$imagePreviewContainer.childNodes, function (e) { return e._azar_extendTags && e._azar_extendTags.imagepreview; }).forEach(function (e) { e.selfRemove(); }); Array.prototype.filter.call(this.$imagePreviewContainer.childNodes, function (e) { return e._azar_extendTags && e._azar_extendTags.filepreview; }).forEach(function (e) { return e.selfRemove(); }); this.$editor.innerHTML = ""; this.emit('update', { target: this }, this); }; MediaInput.prototype.escapeSpace = function (s) { return s.replace(/\s/g, ' '); }; MediaInput.prototype.unescapeSpace = function (s) { return s.replace(/ /g, ' '); }; MediaInput.prototype.getTextFromElements = function (element) { return getTextIn(element); // var self = this; // function visit(e, prevE) { // var ac = ''; // var isNewLine = false; // if (prevE && prevE.nodeType != Node.TEXT_NODE) { // if (prevE.tagName && prevE.tagName.toLowerCase() == 'br') { // isNewLine = true; // } // else if (Element.prototype.getComputedStyleValue.call(prevE, 'display') == 'block') { // isNewLine = true; // } // } // if (e.nodeType == Node.TEXT_NODE) { // if (isNewLine) ac += '\n'; // ac += e.data; // } // else { // var lastE = undefined; // for (var i = 0; i < e.childNodes.length; ++i) { // ac += visit(e.childNodes[i], i > 0 ? e.childNodes[i - 1] : null); // } // } // return ac; // } // return visit(element); }; MediaInput.prototype.getElementsFromText = function (text) { var newElements = text.split('\n') .map(function (text) { return document.createTextNode(text); }) .reduce(function (ac, cr, i, arr) { if (i > 0) ac.push(MediaInput_('br')); ac.push(cr); return ac; }, []); return newElements; }; // MediaInput.prototype.textOnly = function(e) { // if (e.nodeType == Node.TEXT_NODE) return e.textContent; // if (!e.tagName) return ''; // if (e.tagName.toLowerCase() == 'br') return '\n'; // return ($(e).getComputedStyleValue('display') == 'block' ? '\n' : '') + Array.prototype.map.call(e.childNodes, this.textOnly.bind(this)).join('') // }; MediaInput.prototype.makeTextOnly = function () { var self = this; var editor = this.$editor; Array.apply(null, this.$editor.childNodes).forEach(function (e) { e = MediaInput_$(e); if (e.nodeType == Node.TEXT_NODE) return; if (e.tagName) { var tagName = e.tagName.toLowerCase(); if (tagName == 'br') return; if (tagName.match(/img|script|svg|button|iframe|hr|video|canvas/)) { e.selfRemove(e); } if (tagName.match(/select|input|textarea/)) { e.selfReplace(document.createTextNode(e.value)); return; } var newElements = self.getElementsFromText(self.getTextFromElements(e)); var lastElement; if (e.getComputedStyleValue('display') == 'block') { lastElement = MediaInput_('br'); } else { lastElement = newElements.pop(); } e.selfReplace(lastElement); newElements.forEach(function (nE) { editor.addChildBefore(nE, lastElement); }); } }); this.emit('update', { target: editor }, this); }; MediaInput.eventHandler = {}; MediaInput.eventHandler.keydown = function (event) { if (event.key == "Enter") { if (!event.ctrlKey && !event.altKey && !event.shiftKey) { event.preventDefault(); this.eventHandler.send(event); this.snapText(); } } if (event.ctrlKey && event.key == 'z') { event.preventDefault(); this.undoText(); } if (event.ctrlKey && event.key == 'x') { setTimeout(this.snapText.bind(this), 100) } setTimeout(this.emit.bind(this, 'update', event, this), 1); }; MediaInput.eventHandler.send = function (event) { if (this.images.length == 0 && this.text.trim().length == 0 && this.files.length == 0) { return; } this.emit('send', event, this); this.snapText(); }; MediaInput.eventHandler.clickAddImage = function (event) { openFileDialog({ accept: 'image/*', multiple: true }).then(function (files) { if (!files) return; files.map(function (file) { var url = (window.URL || window.webkitURL).createObjectURL(file); this.addImage(url, file.name, { file: file, name: file.name, url: url }); this.emit('update', event, this); }.bind(this)); }.bind(this)); }; MediaInput.eventHandler.clickAddFile = function (event) { openFileDialog({ multiple: true }).then(function (files) { if (!files) return; files.map(function (file) { var url = (window.URL || window.webkitURL).createObjectURL(file); if (file.type.match(/^image/)) { this.addImage(url, file.name, { file: file, name: file.name, url: url }); } else { var p = file.name.split('.'); var ext = p.length > 1 ? p[p.length - 1] : ''; this.addFile(url, ext.toUpperCase(), file.name, { file: file, name: file.name, url: url }); } }.bind(this)); this.emit('update', event, this); }.bind(this)); }; MediaInput.eventHandler.dragOver = function (event) { event.preventDefault(); this._lastDragOver = new Date().getTime(); var currentDragOver = this._lastDragOver; if (!this.dragOver) { this.dragOver = true; this.addClass('dragover'); this.emit('update', event, this); } setTimeout(function () { this._waitDragFileOut if (this._lastDragOver == currentDragOver) { this.removeClass('dragover'); this.dragOver = false; this.emit('update', event, this); } }.bind(this), 200); }; MediaInput.eventHandler.drop = function (event) { event.preventDefault(); if (event.dataTransfer.items) { for (var i = 0; i < event.dataTransfer.items.length; i++) { if (event.dataTransfer.items[i].kind === 'file') { var file = event.dataTransfer.items[i].getAsFile(); if (!file.type && file.size % 4096 == 0) { //todo: folder } else { this.addSystemFile(file); this.emit('update', event, this); } } } } else { for (var i = 0; i < event.dataTransfer.files.length; i++) { var file = event.dataTransfer.files[i]; if (!file.type && file.size % 4096 == 0) { } else { this.addSystemFile(file); this.emit('update', event, this); } } } }; MediaInput.prototype.addSystemFile = function (file) { var url = (window.URL || window.webkitURL).createObjectURL(file); if (file.type.match(/^image/)) { this.addImage(url, file.name, { file: file, name: file.name, url: url }); } else { var p = file.name.split('.'); var ext = p.length > 1 ? p[p.length - 1] : ''; this.addFile(url, ext.toUpperCase(), file.name, { file: file, name: file.name, url: url }); } } MediaInput.eventHandler.paste = function (event) { var pasteData = (event.clipboardData || window.clipboardData); var beforePasteElement = []; var self = this; function visit(e, ac) { ac.push(e); if (e.childNodes) { for (var i = 0; i < e.childNodes.length; ++i) { visit(e.childNodes[i], ac) } } } visit(this.$editor, beforePasteElement); function relocalCursor() { var afterPasteElement = []; visit(self.$editor, afterPasteElement); var diffElts = afterPasteElement.filter(function (e) { return beforePasteElement.indexOf(e) < 0; }); if (diffElts.length > 0) { var last = diffElts.pop(); if (last.nodeType == Node.TEXT_NODE) { var range = document.createRange(); range.selectNodeContents(last); range.setStart(last, last.data.length); var sel = window.getSelection(); sel.removeAllRanges(); sel.addRange(range); } else { setSelectionRange(last, Infinity); } } } /**Safari bug */ if (pasteData && pasteData.items) { var items = pasteData.items; var isAddImage = false; for (var i = 0; i < items.length; i++) { if (items[i].type.indexOf('image') !== -1) { var blob = items[i].getAsFile(); var URLObj = (window.URL || window.webkitURL); var source = URLObj.createObjectURL(blob); var file = blobToFile(blob); var buffer = blobToArrayBuffer(blob).then(function (arrayBuffer) { this.addImage(source, 'Clipboard', { file: blob, name: null, url: source, blob: blob, arrayBuffer: arrayBuffer }); this.emit('update', event, this); }.bind(this)); isAddImage = true; this.emit('update', event, this); } } if (isAddImage) event.preventDefault(); requestAnimationFrame(function () { self.makeTextOnly(); relocalCursor(); }); } else { requestAnimationFrame(function () { var img = MediaInput_$('img', this.$editor, function (img) { if (img) { img = MediaInput_$(img); var source = img.getAttribute('src'); img.selfRemove(); Dom["a" /* default */].imageToCanvas(img).then(function (canvas) { var dataURI = canvas.toDataURL(); var blob = dataURItoBlob(dataURI); var file = blobToFile(blob); var buffer = blobToArrayBuffer(blob).then(function (arrayBuffer) { this.addImage(source, 'Clipboard', { dataURI: dataURI, file: blob, name: null, url: source, blob: blob, arrayBuffer: arrayBuffer }); this.emit('update', event, this); }.bind(this)); }.bind(this), function (e) { }).catch(function (e) { }); } }.bind(this)); this.makeTextOnly(); relocalCursor(); }.bind(this)); } }; MediaInput.prototype.undoText = function () { if (this.snapDataHead <= 1) return; this.snapDataHead--; if (this.snapDataHead <= 0) return; var newText = this.snapData[this.snapDataHead - 1]; this.text = newText; setSelectionRange(this.$editor, Infinity); }; MediaInput.prototype.redoText = function () { if (this.snapData.length <= this.snapDataHead) return; this.snapDataHead++; var newText = this.snapData[this.snapDataHead - 1]; var currentText = this.text; this.text = newText; setSelectionRange(this.$editor, Infinity); }; MediaInput.prototype.snapText = function () { while (this.snapData.length > this.snapDataHead && this.snapData.length > 0) this.snapData.pop(); var oldText = this.snapData[this.snapDataHead - 1]; var newText = this.text; if (newText == oldText) return; this.snapData.push(this.text); this.snapDataHead++; } function ImagePreview() { var res = MediaInput_({ extendEvent: 'pressremove', class: ['vmedia-media-input-imagepreview', 'vmedia-no-select'], child: ['img', 'times-ico'] }); res.$img = MediaInput_$('img', res); res.$timesIco = MediaInput_$('times-ico', res); res.$timesIco.on('click', function (event) { res.emit('pressremove', event, res); }); OOP["a" /* default */].drillProperty(res, res.$img, 'imgSrc', 'src'); return res; }; function FilePreview() { var res = MediaInput_({ extendEvent: 'pressremove', class: ['vmedia-media-input-filepreview', 'vmedia-no-select'], child: ['attachment-ico', 'times-ico'] }); res.$img = MediaInput_$('attachment-ico', res); OOP["a" /* default */].drillProperty(res, res.$img, 'ext'); res.$timesIco = MediaInput_$('times-ico', res); res.$timesIco.on('click', function (event) { res.emit('pressremove', event, res); }); return res; }; MediaCore.creator.mediainput = MediaInput; MediaCore.creator.imagepreview = ImagePreview; MediaCore.creator.filepreview = FilePreview; MediaCore.creator['send-ico'] = function () { return MediaInput_( [ '<svg class="send" width="100" height="100" version="1.1" viewBox="0 0 26.458 26.458">', ' <g transform="translate(0 -270.54)">', ' <path d="m0.64298 272.44 3.1712 9.5402 22.152 1.7742-22.152 1.7482-3.1712 9.4749 25.323-11.223z" />', ' </g>', '</svg>' ].join('') ); }; MediaCore.creator['add-file-ico'] = function () { return MediaInput_( [ '<svg class="add-file" width="100" height="100" version="1.1" viewBox="0 0 26.458 26.458" xmlns="http://www.w3.org/2000/svg">', ' <g transform="translate(0 -270.54)">', ' <path d="m4.2431 295.69c-0.74006-0.0759-1.4136-0.33772-2.0047-0.77942-0.19965-0.14919-0.60549-0.55475-0.75233-0.75182-0.45099-0.60524-0.7154-1.2913-0.77699-2.016-0.01275-0.15007-0.01628-2.6111-0.01252-8.7468 0.0049-8.0504 0.0068-8.5472 0.03338-8.6986 0.0883-0.50391 0.22692-0.91024 0.44705-1.3104 0.52794-0.95973 1.452-1.6645 2.5119-1.9158 0.44319-0.10508 0.12729-0.0972 4.1445-0.10308 2.5538-4e-3 3.6864-1e-4 3.7795 0.0121 0.38853 0.0508 0.80777 0.24687 1.2709 0.59434 0.44102 0.33085 0.68272 0.55272 1.7227 1.5813 0.46507 0.45998 1.2812 1.2664 1.8136 1.7921 0.96172 0.94958 1.3847 1.3824 1.696 1.7354 0.61073 0.69257 0.92 1.2063 1.0441 1.7344 0.02613 0.11122 0.02875 0.28598 0.03409 2.2731 0.0047 1.7451 0.0018 2.1574-0.01502 2.178-0.01424 0.0174-0.10685 0.0394-0.2936 0.0699-0.45695 0.0745-1.0078 0.22363-1.4356 0.38862-0.10025 0.0387-0.1888 0.0663-0.19678 0.0613-0.0085-5e-3 -0.01461-0.7983-0.01475-1.9156-2.09e-4 -1.6438-0.0036-1.9208-0.0245-2.0096-0.06972-0.29578-0.28642-0.50043-0.63767-0.60222-0.32942-0.0955-0.31104-0.0947-2.4299-0.10482l-1.9437-9e-3 -0.12495-0.0442c-0.25474-0.0901-0.45899-0.26526-0.5666-0.48578-0.10853-0.22238-0.10356-0.127-0.10407-1.9994-4.63e-4 -1.7153-0.01031-2.1544-0.05446-2.4288-0.06935-0.43095-0.22893-0.69171-0.5027-0.82138l-0.10904-0.0516h-3.1807c-3.4262 0-3.27-4e-3 -3.5482 0.0835-0.68034 0.21325-1.1718 0.754-1.3329 1.4666l-0.0345 0.15261v8.5059c0 8.1045 0.0014 8.5125 0.02871 8.6468 0.08088 0.39719 0.25808 0.72858 0.53956 1.0091 0.28082 0.27984 0.576 0.44186 0.98191 0.53896 0.11389 0.0273 0.36156 0.0293 4.5294 0.0374l4.409 9e-3 0.02019 0.0402c0.0111 0.0221 0.07695 0.15943 0.14632 0.30521s0.17519 0.3518 0.23515 0.45783c0.14341 0.25357 0.43703 0.69284 0.61725 0.92343 0.0793 0.10148 0.14077 0.19003 0.13659 0.19679-0.0073 0.0118-9.9306 0.0132-10.046 1e-3z" />', ' <path transform="matrix(.26458 0 0 .26458 0 270.54)" d="m72.469 65.742v7.4062h-7.4062v7.2852h7.4062v7.2812h7.2793v-7.2812h7.3535v-7.2852h-7.3535v-7.4062zm24.948 11.119a21.371 21.371 0 0 1-21.371 21.371 21.371 21.371 0 0 1-21.371-21.371 21.371 21.371 0 0 1 21.371-21.371 21.371 21.371 0 0 1 21.371 21.371z" style="fill-rule:evenodd;" />', ' <path d="m17.256 283.76 1.921-0.47607-0.04725-4.2884c0-0.50159-0.29516-1.2441-1.0789-2.0168l-4.6989-4.6324c-0.73814-0.72769-1.5947-0.97084-2.1519-0.97084h-7.0235c-2.1533 0.0144-3.4601 2.6226-3.4778 3.4778v17.284c0 2.121 2.2409 3.5346 3.5346 3.5346h10.058l-1.1146-1.9305h-8.6658c-1.1271 0-1.8503-1.1115-1.8503-1.8503v-16.867c0-1.0721 1.1373-1.6977 1.6977-1.6977h6.2175c0.43142 0 0.8103 0.28958 0.8103 1.1742v3.714c0 0.24768 0.36442 0.90967 0.90968 0.90967h3.2537c1.2453 0 1.6905 0.32876 1.6905 1.1613z" />', ' </g>', '</svg>' ].join('') ); }; MediaCore.creator['add-image-ico'] = function () { return MediaInput_( [ '<svg class="add-image" width="100" height="100" version="1.1" viewBox="0 0 26.458 26.458" xmlns="http://www.w3.org/2000/svg" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="absol/src/HTML5/Elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">', ' <g transform="translate(0 -270.54)">', ' <path d="m24.73 288.69a5.9808 5.9808 0 0 1-5.9808 5.9808 5.9808 5.9808 0 0 1-5.9808-5.9808 5.9808 5.9808 0 0 1 5.9808-5.9808 5.9808 5.9808 0 0 1 5.9808 5.9808zm1.503-0.037a7.5843 7.5843 0 0 1-7.5843 7.5843 7.5843 7.5843 0 0 1-7.5843-7.5843 7.5843 7.5843 0 0 1 7.5843-7.5843 7.5843 7.5843 0 0 1 7.5843 7.5843z" style="fill-rule:evenodd;fill:#414141"/>', ' <path d="m17.869 284.42v3.4127h-3.4081v1.6066h3.4081v3.438h1.6061v-3.438h3.4432v-1.6066h-3.4432v-3.4127z" style="fill-rule:evenodd;fill:#414141"/>', ' <path d="m24.614 281.39v-6.1305c0-1.6957-1.2841-2.6602-2.6602-2.6602h-18.412c-1.4547 0-2.7249 1.0223-2.7249 2.7249v14.986c0 1.2346 0.99768 2.6028 2.586 2.586h6.9542c-0.36184-0.63963-0.51495-1.0286-0.69323-1.6506h-6.4562c-0.29938 0-0.72246-0.40379-0.72246-0.72247v-1.8082l6.0428-6.7569 2.0296 2.0129 0.9605-1.3029-2.9734-3.1488-5.9885 6.7736v-11.426c0-0.24935 0.30766-0.63476 0.63476-0.63476h18.934c0.3592 0 0.84357 0.19284 0.84357 0.84357v5.2285c0.61147 0.22444 1.1564 0.59412 1.6454 1.0858z" style="fill:#414141"/>', ' <circle cx="17.869" cy="277.61" r="1.6891" style="fill-rule:evenodd;fill:#414141"/>', ' </g>', '</svg>' ].join('') ); }; MediaCore.creator['attachment-ico'] = function () { return MediaInput_( [ '<svg class="attachment" width="1024" height="1024" version="1.1" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" >', ' <path d="M145.6 0C100.8 0 64 35.2 64 80v862.4C64 987.2 100.8 1024 145.6 1024h732.8c44.8 0 81.6-36.8 81.6-81.6V324.8L657.6 0h-512z" fill="#8199AF"/>', ' <path d="M960 326.4v16H755.2s-100.8-20.8-99.2-108.8c0 0 4.8 92.8 97.6 92.8H960z" fill="#617F9B"/>', ' <path d="M657.6 0v233.6c0 25.6 17.6 92.8 97.6 92.8H960L657.6 0z" fill="#fff"/>', ' <path d="m491.77 770.31c17.6-19.2 17.6-48 0-67.2s-48-17.6-65.6 0l-147.2 147.2c-17.6 17.6-17.6 48 0 65.6s48 19.2 65.6 0l91.2-89.6c4.8-4.8 4.8-12.8 0-17.6s-14.4-6.4-19.2 0l-57.6 56c-8 8-19.2 8-27.2 0s-8-20.8 0-28.8l56-56c20.8-20.8 54.4-20.8 75.2 0s20.8 54.4 0 75.2l-89.6 89.6c-33.6 33.6-88 33.6-123.2 0-33.6-33.6-33.6-88 0-121.6l147.2-147.2c33.6-33.6 89.6-33.6 123.2 0s33.6 88 0 121.6l-14.4 14.4c-1.6-14.4-6.4-28.8-16-41.6z" style="fill:#fff"/>', ' <path d="m130.09 23.864h504.75v182.93h-545.65v-140.08c0.34155-16.845 13.608-42.414 40.9-42.847z" style="fill-opacity:.29648;fill-rule:evenodd;fill:#fff"/>', '</svg>' ] .join('') ); }; MediaCore.creator['attachment-ico'].property = { ext: { set: function (value) { value = value || ''; if (this.$ext) { this.$ext.selfRemove(); } this.$ext = Svg["a" /* default */].ShareInstance._('<text text-anchor="middle" x="321.39" y="170" font-size="145.76" style="fill:white;" >' + value + '</text>').addTo(this); }, get: function () { return this._ext || ''; } } }; MediaCore.creator['times-ico'] = function () { return MediaInput_( [ '<svg class="times" width="100" height="100" version="1.1" viewBox="0 0 26.458 26.458" xmlns="http://www.w3.org/2000/svg">', ' <g transform="translate(0 -270.54)">', ' <path d="m7.7013 276.49 5.4832 5.4832 5.5494-5.5494 1.7874 1.7874-5.5291 5.5291 5.4957 5.4957-1.754 1.754-5.5124-5.5124-5.5542 5.5542-1.7623-1.7623 5.5375-5.5375-5.5208-5.5208zm17.103 7.3351a11.558 11.558 0 0 1-11.558 11.558 11.558 11.558 0 0 1-11.558-11.558 11.558 11.558 0 0 1 11.558-11.558 11.558 11.558 0 0 1 11.558 11.558z" style="fill-rule:evenodd;"/>', ' </g>' ].join('') ); }; MediaCore.creator['download-ico'] = function () { return MediaInput_( [ '<svg class="download" width="100mm" height="100mm" version="1.1" viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg">', ' <g transform="translate(0,-197)">', ' <path d="m44.888 209.14h13.982c1.1087 0.0459 2.2328 0.74137 2.317 2.3612v23.694h13.622c1.9742-0.18801 3.004 2.6244 1.9175 4.1118l-23.469 23.918c-0.876 0.77477-1.9993 0.77232-2.9362 0l-23.559-24.009c-0.86532-1.0422 0.11658-4.1953 2.3821-4.2047h13.268v-22.939c-0.08167-1.1772 0.78292-2.9507 2.4768-2.9312z" style="fill:#00c3e5"/>', ' <path d="m86.97 276.99a3.5027 3.5696 0 0 1-3.5027 3.5696 3.5027 3.5696 0 0 1-3.5027-3.5696 3.5027 3.5696 0 0 1 3.5027-3.5696 3.5027 3.5696 0 0 1 3.5027 3.5696zm-12.768 0a3.5027 3.5696 0 0 1-3.5027 3.5696 3.5027 3.5696 0 0 1-3.5027-3.5696 3.5027 3.5696 0 0 1 3.5027-3.5696 3.5027 3.5696 0 0 1 3.5027 3.5696zm-60.003-16.135h24.609c9.1206 13.508 17.573 12.942 26.609 0h23.839c2.8529 5e-3 3.5087 2.3205 3.4679 3.8227v18.953c0.04867 1.3083-1.5145 2.9901-2.7505 2.9832h-76.253c-1.049 0.0441-2.6554-1.4851-2.6306-3.1451l-1.56e-4 -18.792c0.0024-1.3549 0.50958-3.7927 3.1091-3.8227z" style="fill-rule:evenodd;fill:#00c3e5"/>', ' </g>', '</svg>' ].join('') ); }; MediaCore.creator['plus-ico'] = function () { return MediaInput_( '<svg class="_7oal" height="24" width="24" viewBox="0 0 24 24"><g fill="none" fill-rule="evenodd"><polygon points="-6,30 30,30 30,-6 -6,-6 "></polygon><path d="m18,11l-5,0l0,-5c0,-0.552 -0.448,-1 -1,-1c-0.5525,0 -1,0.448 -1,1l0,5l-5,0c-0.5525,0 -1,0.448 -1,1c0,0.552 0.4475,1 1,1l5,0l0,5c0,0.552 0.4475,1 1,1c0.552,0 1,-0.448 1,-1l0,-5l5,0c0.552,0 1,-0.448 1,-1c0,-0.552 -0.448,-1 -1,-1m-6,13c-6.6275,0 -12,-5.3725 -12,-12c0,-6.6275 5.3725,-12 12,-12c6.627,0 12,5.3725 12,12c0,6.6275 -5.373,12 -12,12" ></path></g></svg>' ); }; ACore["a" /* default */].creator.mediainput = MediaInput; /* harmony default export */ var js_MediaInput = (MediaInput); // EXTERNAL MODULE: ./node_modules/absol-acomp/css/mediainput.css var mediainput = __webpack_require__(137); // CONCATENATED MODULE: ./node_modules/absol-acomp/js/ResizableLayout.js var ResizableLayout_ = ACore["a" /* default */]._; var ResizableLayout_$ = ACore["a" /* default */].$; function ResizableLayout() { var res = ResizableLayout_({ class: 'absol-resizablelayout', child: '.absol-resizablelayout-cell' }); res._colsSize = [1]; res._rowSize = [1]; return res; } ResizableLayout.prototype.debug = function(){ ResizableLayout_$('div', this, function(e){ e.addStyle('background-color', Color_Color.fromHSLA(Math.random(), Math.random(), 0.2, 0.2).toString()) }); }; /** * @param {Number} index -1: end of table * @param {Number} size * @returns {Array<Element>} */ ResizableLayout.prototype.insertRow = function (index, size) { if (!(size>=0 && size<=1)){ this._rowSize.reduce(function(ac, cr){return ac+ cr},0)/this._rowSize.length; } }; ResizableLayout.prototype.addRow = function (index) { } ResizableLayout.prototype.updateSize = function () { }; ResizableLayout.prototype.property = {}; ResizableLayout.prototype.property.nCol = { set: function (value) { if (value > 0) { value = Math.ceil(value); } else { throw new Error('Invalid number'); } }, get: function () { } }; ResizableLayout.prototype.property.nRow = { set: function (value) { if (value > 0) { value = Math.ceil(value); } else { throw new Error('Invalid number'); } }, get: function () { } }; ResizableLayout.prototype.init = function (props) { this._cell = []; Object.assign(this, props || {}); }; ACore["a" /* default */].creator.resizablelayout = ResizableLayout; // not completed yet /* harmony default export */ var js_ResizableLayout = (ResizableLayout); // EXTERNAL MODULE: ./node_modules/absol-acomp/css/resizablelayout.css var resizablelayout = __webpack_require__(139); // CONCATENATED MODULE: ./node_modules/absol-acomp/js/adapter/SearchStringArrayAdapter.js /** * @typedef {Object} SearchArrayAdapterOption * @property {function} searchFuntion * * * * @param {Array<String>} arr * @param {SearchArrayAdapterOption} options not implement yet */ function SearchStringArrayAdapter_SearchStringArrayAdapter(texts, options) { if (!this.queryItems) return new SearchStringArrayAdapter_SearchStringArrayAdapter(texts, options); this.texts = texts; } SearchStringArrayAdapter_SearchStringArrayAdapter.prototype.queryItems = function (query, mInput) { var query = query.toLocaleLowerCase(); return this.texts.map(function (text) { var start = text.toLocaleLowerCase().indexOf(query); if (start >= 0) { var hightlightedText = text.substr(0, start) + '<strong style="color:red">' + text.substr(start, query.length) + '</strong>' + text.substr(start + query.length); return { text: text, hightlightedText: hightlightedText } } else return null; }).filter(function (it) { return it !== null; }) }; SearchStringArrayAdapter_SearchStringArrayAdapter.onAttached = function(parent){ this.parent = parent; }; SearchStringArrayAdapter_SearchStringArrayAdapter.prototype.getItemText = function (item, mInput) { return item.text; }; SearchStringArrayAdapter_SearchStringArrayAdapter.prototype.getItemView = function (item, index, _, $, query, reuseItem, refParent, mInput) { if (reuseItem) { reuseItem.childNodes[0].innerHTML = item.hightlightedText; return reuseItem; } else return _({ tag: 'div', child: { tag: 'span', class: 'absol-autocomplete-input-item-text', props: { innerHTML: item.hightlightedText } } }) } /* harmony default export */ var adapter_SearchStringArrayAdapter = (SearchStringArrayAdapter_SearchStringArrayAdapter); // CONCATENATED MODULE: ./node_modules/absol-acomp/js/adapter/SearchObjectArrayAdapter.js /** * @typedef {Object} SearchObjectArrayAdapter * @property {function} getItemText * * * * @param {Array<Object>} arr * @param {SearchArrayAdapterOption} options */ function SearchObjectArrayAdapter_SearchObjectArrayAdapter(objects, options) { if (!this.queryItems) return new SearchObjectArrayAdapter_SearchObjectArrayAdapter(texts, options); this.objects = objects; this.options = options; } SearchObjectArrayAdapter_SearchObjectArrayAdapter.prototype.queryItems = function (query, mInput) { var query = query.toLocaleLowerCase(); return this.objects.map(function (object) { var text = this.getItemText(object); var start = text.toLocaleLowerCase().indexOf(query); if (start >= 0) { var hightlightedText = text.substr(0, start) + '<strong style="color:red">' + text.substr(start, query.length) + '</strong>' + text.substr(start + query.length); return Object.assign(object, { __hightlightedText__: hightlightedText }); } else return null; }.bind(this)).filter(function (it) { return it !== null; }) }; SearchObjectArrayAdapter_SearchObjectArrayAdapter.prototype.onAttached = function (parent) { this.parent = parent; parent.getSelectedObject = function () { if (this._selectedIndex >= 0) { return this.$poolItems[this._selectedIndex]._holderItem; } else { return null; } } }; SearchObjectArrayAdapter_SearchObjectArrayAdapter.prototype.getItemText = function (item, mInput) { if (this.options && this.options.getItemText) return this.options.getItemText.call(this, item, mInput); else if (typeof item.text == 'string') { return item.text; } else return item.toString(); }; SearchObjectArrayAdapter_SearchObjectArrayAdapter.prototype.getItemView = function (item, index, _, $, query, reuseItem, refParent, mInput) { if (reuseItem) { reuseItem.childNodes[0].innerHTML = item.__hightlightedText__; return reuseItem; } else return _({ tag: 'div', child: { tag: 'span', props: { innerHTML: item.__hightlightedText__ } } }) } /* harmony default export */ var adapter_SearchObjectArrayAdapter = (SearchObjectArrayAdapter_SearchObjectArrayAdapter); // CONCATENATED MODULE: ./node_modules/absol-acomp/js/AutoCompleteInput.js var AutoCompleteInput_ = ACore["a" /* default */]._; var AutoCompleteInput_$ = ACore["a" /* default */].$; function AutoCompleteInput() { var res = AutoCompleteInput_({ extendEvent: 'change', class: 'absol-autocomplete-input', child: [ 'input[type="text"].absol-autocomplete-input-text', { class: 'absol-autocomplete-input-dropdown', style: { display: 'none' }, child: { tag: 'bscroller', style: { 'max-height': '500px' } } } ] }); res.eventHandler = OOP["a" /* default */].bindFunctions(res, AutoCompleteInput.eventHandler); res.$input = AutoCompleteInput_$('input', res) .on('keyup', res.eventHandler.keyup) .on('keydown', res.eventHandler.keydown) .on('focus', res.eventHandler.focus) .on('blur', res.eventHandler.blur) ; res.$dropdown = AutoCompleteInput_$('.absol-autocomplete-input-dropdown', res); res.$vscroller = AutoCompleteInput_$('bscroller', res).on('click', res.eventHandler.vscrollerClick); res.$poolItems = []; res._currentData = []; res._sessionIndex = 0; res._updatedSession = -1; res._cache = {}; OOP["a" /* default */].drillProperty(res, res.$input, 'value'); return res; } AutoCompleteInput.eventHandler = {}; AutoCompleteInput.eventHandler.keyup = function (event) { if (this._keyTimeout) { clearTimeout(this._keyTimeout); this._keyTimeout = 0; } var cTimeout = setTimeout(function () { clearTimeout(cTimeout); this.find(); }.bind(this), 300); if (this._cacheTimeout) { clearTimeout(this._cacheTimeout); this._cacheTimeout = 0; } var cacheTimeout = setTimeout(function () { clearTimeout(cacheTimeout); this.clearCache(); }.bind(this), 300); this._cacheTimeout = cacheTimeout; this._keyTimeout = cTimeout; }; AutoCompleteInput.eventHandler.blur = function () { this.removeClass('focus'); }; AutoCompleteInput.eventHandler.focus = function () { this.addClass('focus'); AutoCompleteInput_$(document.body).on('mousedown', this.eventHandler.clickOut); //todo } AutoCompleteInput.eventHandler.clickOut = function (event) { if (EventEmitter["a" /* default */].hitElement(this, event)) return; AutoCompleteInput_$(document.body).off('mousedown', this.eventHandler.clickOut); var text = this.$input.value; if (this._lastValue != text) { this._lastValue = text; this.$dropdown.addStyle('display', 'none'); this._lastValue = text; this.emit('change', { target: this, value: text }, this); } } AutoCompleteInput.eventHandler.vscrollerClick = function (event) { var current = event.target; while (current && !current.containsClass('absol-autocomplete-input-item') && current != this.$vscroller) { current = current.parentElement; } if (current && current._holderItem) { var text = this.getItemText(current._holderItem); this.$input.value = text; this._lastQuery = text; this._selectedIndex = current._holderIndex; this.$dropdown.addStyle('display', 'none'); this._lastValue = text; this.emit('change', { target: this, value: text }, this); } }; AutoCompleteInput.eventHandler.keydown = function (event) { var key = event.key; if (key == 'ArrowDown') { if (this._selectedIndex + 1 < this._currentData.length) { if (this.$poolItems[this._selectedIndex]) { this.$poolItems[this._selectedIndex].removeClass('active'); } this._selectedIndex += 1; if (this.$poolItems[this._selectedIndex]) { this.$poolItems[this._selectedIndex].addClass('active'); this.$vscroller.scrollInto(this.$poolItems[this._selectedIndex]); } } event.preventDefault(); } else if (key == 'ArrowUp') { if (this._selectedIndex - 1 >= 0) { if (this.$poolItems[this._selectedIndex]) { this.$poolItems[this._selectedIndex].removeClass('active'); } this._selectedIndex -= 1; if (this.$poolItems[this._selectedIndex]) { this.$poolItems[this._selectedIndex].addClass('active'); this.$vscroller.scrollInto(this.$poolItems[this._selectedIndex]); } } event.preventDefault(); } else if (key == 'Enter') { var text; if (this._currentData[this._selectedIndex] === undefined) { text = this.$input.value; } else { text = this.getItemText(this._currentData[this._selectedIndex]); this.$input.value = text; } this._lastQuery = text; this.$dropdown.addStyle('display', 'none'); this._lastValue = text; this.emit('change', { target: this, value: text }, this); } }; AutoCompleteInput.prototype.focus = function () { if (this.disabled) return; this.$input.focus.apply(this.$input, arguments); }; AutoCompleteInput.prototype.blur = function () { this.$input.blur.apply(this.$input, arguments); }; AutoCompleteInput.prototype.select = function () { this.$input.select.apply(this.$input, arguments); } AutoCompleteInput.prototype.find = function () { var query = this.$input.value; if (query == this._lastQuery) return; this._lastQuery = query; var currentSession = ++this._sessionIndex; if (!query) { this.pushData([], currentSession, query) return; } if (this.disableCache) { var onReciveData = function (data) { cacheHolder.data = data; this.pushData(data, currentSession, query);//sessionIndex may be change }.bind(this); var result = this.queryItems(query); if (typeof result.then == 'function') result.then(onReciveData); else onReciveData(result) } else { if (this._cache[query]) { this._cache[query].sessionIndex = currentSession; if (!this._cache[query].pending) { var data = this._cache[query].data; this.pushData(data, currentSession); } } else { var cacheHolder = { pending: true, sessionIndex: currentSession }; var onReciveData = function (data) { cacheHolder.data = data; cacheHolder.pending = false; this.pushData(data, cacheHolder.sessionIndex, query);//sessionIndex may be change }.bind(this); var result = this.queryItems(query); if (typeof result.then == 'function') result.then(onReciveData); else onReciveData(result) this._cache[query] = cacheHolder; } } }; AutoCompleteInput.prototype.pushData = function (data, sessionIndex, query) { if (sessionIndex > this._updatedSession) { this._updatedSession = sessionIndex; this.$vscroller.clearChild(); this._currentData = data; if (data && data.length > 0) { this.$dropdown.removeStyle('display'); } else { this.$dropdown.addStyle('display', 'none'); } var maxHeight = this.getComputedStyleValue('max-height'); if (maxHeight == 'none' || !maxHeight) { maxHeight = 10000; } else { maxHeight = parseFloat(maxHeight.replace('px', '')); } var outBound = Dom["a" /* default */].traceOutBoundingClientRect(this); var bound = this.$input.getBoundingClientRect(); var aTop = bound.top - outBound.top; var aBotom = outBound.bottom - bound.bottom; this.$dropdown.removeClass('top'); if (aTop > aBotom) { maxHeight = Math.min(maxHeight, aTop - 10); } else { maxHeight = Math.min(maxHeight, aBotom - 10); } this.$vscroller.addStyle('max-height', maxHeight + 'px'); this._selectedIndex = -1; data.reduce(function (sync, item, i, arr) { return sync.then(function () { if (this._updatedSession != sessionIndex) return; return new Promise(function (rs) { if (this._updatedSession != sessionIndex) return; var reuseItem = this.$poolItems.length > i ? this.$poolItems[i] : undefined; if (reuseItem) { reuseItem.removeClass('active'); } var newView = this.getItemView(item, i, AutoCompleteInput_, AutoCompleteInput_$, query, reuseItem, this); newView.addClass('absol-autocomplete-input-item'); newView._holderItem = item; newView._holderIndex = i; if (i == this._selectedIndex) newView.addClass('active'); if (this.$poolItems.length <= i) { this.$poolItems.push(newView); } else { this.$poolItems[i] = newView; } this.$vscroller.addChild(newView); if (i == 0) { var estimateHeight = newView.getBoundingClientRect().height * arr.length; if (aTop > aBotom && estimateHeight > aBotom) { this.$dropdown.addClass('top'); } } if (i >= 50 && i % 50 == 0) setTimeout(rs, 0); else rs(); }.bind(this)); }.bind(this)) }.bind(this), Promise.resolve()); } }; AutoCompleteInput.prototype.getItemText = function (item) { if (this.adapter && this.adapter.getItemText) { return this.adapter.getItemText(item, this); } else if (typeof item == 'string') { return item; } else { throw Error('You need adapter.getItemText(item, mAutoCompleteInput) to handle your item text!'); } } AutoCompleteInput.prototype.getItemView = function (item, index, _, $, query, reuseItem, refParent) { if (this.adapter && this.adapter.getItemView) { return this.adapter.getItemView(item, index, _, $, query, reuseItem, refParent, this); } else { var text = this.getItemText(item); if (reuseItem) { reuseItem.childNodes[0].innerHTML = text; return reuseItem; } return _({ child: { tag: 'span', class: 'absol-autocomplete-input-item-text', child: { text: text } } }); } }; /** * @param {String} query * @returns {Array} */ AutoCompleteInput.prototype.queryItems = function (query) { if (this.adapter && this.adapter.queryItems) { return this.adapter.queryItems(query, this); } else { throw new Error('Invalid adapter: queryItems(query, mAutoCompleteInput) not found!'); } }; AutoCompleteInput.prototype.clearCache = function (old) { if (typeof old != "number") old = 30; for (var key in this._cache) { var cacheHolder = this._cache[key]; if (this._sessionIndex - cacheHolder.sessionIndex > old) { delete this._cache[key]; } } } AutoCompleteInput.property = {}; AutoCompleteInput.property.adapter = { set: function (value) { if (value instanceof Array) { if (value[0] == 'SearchStringArray') { this._adapter = new adapter_SearchStringArrayAdapter(value[1], value[2]); } else if (value[0] == 'SearchObjectArray') { this._adapter = new adapter_SearchObjectArrayAdapter(value[1], value[2]); } else { throw new Error("Unknown adapter type name"); } } else { this._adapter = value; } if (this.adapter && this.adapter.onAttached) { this.adapter.onAttached(this); } }, get: function () { return this._adapter; } }; AutoCompleteInput.property.disabled = { set: function (value) { if (value) { this.addClass('absol-disabled'); } else { this.removeClass('absol-disabled'); } }, get: function () { return this.containsClass('absol-disabled'); } }; AutoCompleteInput.attribute = {}; AutoCompleteInput.attribute.disabled = { set: function (value) { if (value === true || value === 'true' || value === null) { this.disabled = true; } else { this.disabled = false; } }, get: function () { return this.disabled ? 'true' : 'false' }, remove: function () { this.disabled = false; } }; ACore["a" /* default */].install('AutoCompleteInput'.toLowerCase(), AutoCompleteInput); /* harmony default export */ var js_AutoCompleteInput = (AutoCompleteInput); // EXTERNAL MODULE: ./node_modules/absol-acomp/css/autocompleteinput.css var autocompleteinput = __webpack_require__(141); // EXTERNAL MODULE: ./node_modules/absol-acomp/css/selectlist.css var selectlist = __webpack_require__(143); // CONCATENATED MODULE: ./node_modules/absol-acomp/js/SelectListItem.js var SelectListItem_ = ACore["a" /* default */]._; var SelectListItem_$ = ACore["a" /* default */].$; function SelectListItem() { var res = SelectListItem_({ class: 'absol-selectlist-item', child: [ { tag: 'span', class: 'absol-selectlist-item-text', child: { text: '' } }, { class: 'absol-selectlist-item-desc-container', child: { tag: 'span', class: 'absol-selectlist-item-desc', child: { text: '' } } } ] }); res.$text = SelectListItem_$('span.absol-selectlist-item-text', res); res.$textValue = res.$text.childNodes[0]; res.$descCtn = SelectListItem_$('.absol-selectlist-item-desc-container', res); res.$desc = SelectListItem_$('span.absol-selectlist-item-desc', res.$descCtn); res.$descValue = res.$desc.childNodes[0]; res._extendClasses = []; res._extendStyle = {}; res._data = ""; res._level = 0; return res; } //bold 14pt arial SelectListItem.property = {}; SelectListItem.property.extendClasses = { set: function (value) { var i; for (i = 0; i < this._extendClasses.length; ++i) { this.removeClass(this._extendClasses[i]); } this._extendClasses = []; if (typeof value == 'string') value = value.trim().split(/\s+/); value = value || []; for (i = 0; i < value.length; ++i) { this._extendClasses.push(value[i]); this.addClass(value[i]); } }, get: function () { return this._extendClasses; } }; SelectListItem.property.extendStyle = { set: function (value) { this.removeStyle(this._extendStyle); this._extendStyle = Object.assign({}, value || {}); this.addStyle(this._extendStyle); }, get: function () { return this._extendClasses; } }; SelectListItem.property.data = { set: function (value) { this._data = value; if (typeof value == 'string') { this.$textValue.data = value; this.$descValue.data = ''; this.level = 0; this.extendClasses = ''; this.extendStyle = {}; } else { this.$text.clearChild().addChild(SelectListItem_({ text: value.text || '' })); this.$descValue.data = value.desc || ''; this.level = value.level || 0; this.extendClasses = value.extendClasses; this.extendStyle = value.extendStyle; } }, get: function () { return this._data; } }; SelectListItem.property.value = { get: function () { return (typeof this._data == "string") ? this._data : this._data.value; } }; SelectListItem.property.text = { get: function () { return (typeof this._data == "string") ? this._data : this._data.text; } }; SelectListItem.property.desc = { get: function () { return (typeof this._data == "string") ? undefined : this._data.desc; } }; SelectListItem.property.level = { set: function (value) { value = value || 0; this._level = value; this.$text.addStyle('margin-left', value * 0.9 + 'em'); }, get: function () { return this._level; } } ACore["a" /* default */].install('SelectListItem'.toLowerCase(), SelectListItem); /* harmony default export */ var js_SelectListItem = (SelectListItem); // CONCATENATED MODULE: ./node_modules/absol-acomp/js/SelectList.js var SelectList_ = ACore["a" /* default */]._; var SelectList_$ = ACore["a" /* default */].$; var isSupportedVar = window.CSS && window.CSS.supports && window.CSS.supports('--fake-var', 'red'); /** * Setup css */ if (isSupportedVar) { SelectList.$dynamicStyle = (function () { var cssElt = SelectList_('style#selectlist-dynamic-style'); var cssCode = [ '.absol-selectlist-item>span {', ' margin-right: calc(1em + var(--select-list-desc-width));', '}', '.absol-selectlist-item-desc-container {', ' width: var(--select-list-desc-width);', '}' ]; cssElt.innerHTML = cssCode.join('\n'); cssElt.addTo(document.head); return cssElt; })(); } /*global absol*/ function SelectList() { var res = SelectList_('.absol-selectlist'); res.defineEvent(['change', 'pressitem']); res.$attachhook = SelectList_('attachhook').addTo(res); res.sync = new Promise(function (rs) { res.$attachhook.once('error', rs); }); res.$items = []; res.$itemByValue = {};//quick find element res._itemViewCount = 0;//for reuse res.$selectedItem = undefined; return res; }; SelectList.property = {}; SelectList.property.items = { set: function (value) { value = value || []; this._items = value; var itemCout = value.length; var i; var self = this; function mousedownItem(event) { if (EventEmitter["a" /* default */].isMouseRight(event)) return; var lastValue = self.value; self.value = this.value; self.emit('pressitem', { type: 'pressitem', target: self, itemElt: this, value: this.value, lastValue: lastValue, data: this.data }); if (this.value != lastValue) { self.emit('change', { type: 'change', target: self, itemElt: this, value: this.value, lastValue: lastValue, data: this.data }); } } while (this.$items.length < itemCout) { this.$items.push(SelectList_({ tag: 'selectlistitem', on: { mousedown: mousedownItem } })); } while (this._itemViewCount < itemCout) { this.addChild(this.$items[this._itemViewCount++]); } while (this._itemViewCount > itemCout) { this.$items[--this._itemViewCount].remove(); } utils_measureText('', 'italic 14px sans-serif')//cache font style var maxDescWidth = 0; for (i = 0; i < value.length; ++i) { if (value[i].desc) { maxDescWidth = Math.max(utils_measureText(value[i].desc).width, maxDescWidth); } } this._descWidth = maxDescWidth; this.$itemByValue = {}; for (i = 0; i < itemCout; ++i) { this.$items[i].data = this._items[i]; this.$items[i].__index__ = i; if (this.$itemByValue[this.$items[i].value]) { console.warn('Value ' + this.$items[i].value + ' is duplicated!'); } this.$itemByValue[this.$items[i].value] = this.$items[i]; } if (isSupportedVar) { this.style.setProperty('--select-list-desc-width', maxDescWidth + 'px'); //addStyle notWork because of convert to cameCase } else { for (i = 0; i < this._itemViewCount; ++i) { this.$items[i].$text.addStyle('margin-right', 'calc(1em + ' + maxDescWidth + 'px)'); this.$items[i].$descCtn.addStyle('width', maxDescWidth + 'px'); } } this.value = this.value; }, get: function () { return this._items || []; } }; SelectList.property.value = { set: function (value) { this._selectValue = value; var newSelectedItemElt = this.$itemByValue[value]; if (newSelectedItemElt != this.$selectedItem) { if (this.$selectedItem) { this.$selectedItem.removeClass('selected'); } if (newSelectedItemElt) { newSelectedItemElt.addClass('selected'); this.$selectedItem = newSelectedItemElt; } } }, get: function () { return this._selectValue; } }; SelectList.property.item = { get: function () { if (this.$selectedItem) return this.$selectedItem.data; return undefined; } }; SelectList.property.selectedIndex = { get: function () { if (this.$selectedItem) return this.$selectedItem.__index__; return -1; } }; SelectList.prototype.init = function (props) { props = props || {}; var value = props.value; delete props.value; this.super(props); if (value !== undefined) this.value = value; }; ACore["a" /* default */].creator.selectlist = SelectList; /* harmony default export */ var js_SelectList = (SelectList); // EXTERNAL MODULE: ./node_modules/absol-acomp/css/selectmenu.css var selectmenu = __webpack_require__(145); // CONCATENATED MODULE: ./node_modules/absol-acomp/js/SelectMenu.js /*global absol*/ var SelectMenu_ = ACore["a" /* default */]._; var SelectMenu_$ = ACore["a" /* default */].$; ACore["a" /* default */].creator['dropdown-ico'] = function () { return SelectMenu_([ '<svg class="dropdown" width="100mm" height="100mm" version="1.1" viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg">', '<g transform="translate(0,-197)">', '<path d="m6.3152 218.09a4.5283 4.5283 0 0 0-3.5673 7.3141l43.361 55.641a4.5283 4.5283 0 0 0 7.1421 7e-3l43.496-55.641a4.5283 4.5283 0 0 0-3.5673-7.3216z" />', '</g>', '</svg>' ].join('')); }; function SelectMenu() { var res = SelectMenu_({ class: ['absol-selectmenu'], extendEvent: ['change', 'minwidthchange'], attr: { tabindex: '1' }, child: [ '.absol-selectmenu-holder-item', { tag: 'button', class: 'absol-selectmenu-btn', child: ['dropdown-ico'] }, 'attachhook', ] }); res.eventHandler = OOP["a" /* default */].bindFunctions(res, SelectMenu.eventHandler); res.$holderItem = SelectMenu_$('.absol-selectmenu-holder-item', res); res.$anchorCtn = SelectMenu.getAnchorCtn(); res.$anchor = SelectMenu_('.absol-selectmenu-anchor.absol-disabled').addTo(res.$anchorCtn); res.$anchorContentCtn = SelectMenu_('.absol-selectmenu-anchor-content-container').addTo(res.$anchor); res.$dropdownBox = SelectMenu_('.absol-selectmenu-dropdown-box').addTo(res.$anchorContentCtn); res.$searchTextInput = SelectMenu_('searchtextinput').addStyle('display', 'none').addTo(res.$dropdownBox); res.$vscroller = SelectMenu_('bscroller').addTo(res.$dropdownBox); res.$selectlist = SelectMenu_('selectlist', res).addTo(res.$vscroller); res.$scrollTrackElts = []; res.$searchTextInput.on('stoptyping', res.eventHandler.searchModify); res._searchCache = {}; res.$selectlist.on('change', res.eventHandler.selectlistChange, true); res.$selectlist.on('pressitem', function () { res.isFocus = false; }, true); res.on('mousedown', res.eventHandler.click, true); res.on('blur', res.eventHandler.blur); OOP["a" /* default */].drillProperty(res, res.$selectlist, 'selectedIndex'); res.selectListBound = { height: 0, width: 0 }; res.$attachhook = SelectMenu_$('attachhook', res) .on('error', res.eventHandler.attached); res.sync = new Promise(function (rs) { SelectMenu_$('attachhook', res).once('error', function () { rs(); }); }); return res; }; // //will remove after SelectMenu completed SelectMenu.getRenderSpace = function () { if (!SelectMenu.getRenderSpace.warned) { console.warn('SelectMenu.getRenderSpace() will be removed in next version'); } SelectMenu.getRenderSpace.warned = true; if (!SelectMenu.$renderSpace) { SelectMenu.$renderSpace = SelectMenu_('.absol-selectmenu-render-space') .addTo(document.body); }; return SelectMenu.$renderSpace; }; SelectMenu.getAnchorCtn = function () { if (!SelectMenu.$anchorCtn) { SelectMenu.$anchorCtn = SelectMenu_('.absol-selectmenu-anchor-container') .addTo(document.body); }; return SelectMenu.$anchorCtn; }; SelectMenu.EXTRA_MATCH_SCORE = 2; SelectMenu.UNCASE_MATCH_SCORE = 1; SelectMenu.UVN_MATCH_SCORE = 3; SelectMenu.EQUAL_MATCH_SCORE = 4; SelectMenu.WORD_MATCH_SCORE = 3; SelectMenu.prepareItem = function (item) { if (typeof item == 'string') item = { text: item, value: item }; var spliter = /\s+/; item.__text__ = item.text.replace(/([\s\b\-()\[\]]| | | |\s)+/g, ' ').trim(); item.__words__ = item.__text__.split(spliter); item.__textNoneCase__ = item.__text__.toLowerCase(); item.__wordsNoneCase__ = item.__textNoneCase__.split(spliter); item.__nvnText__ = Object(stringFormat["nonAccentVietnamese"])(item.__text__); item.__nvnWords__ = item.__nvnText__.split(spliter); item.__nvnTextNoneCase__ = item.__nvnText__.toLowerCase(); item.__nvnWordsNoneCase__ = item.__nvnTextNoneCase__.split(spliter); return item; }; /** * @param {SearchItem} queryItem * @param {SearchItem} item */ SelectMenu.calScore = function (queryItem, item) { var score = 0; if (item.__text__ == queryItem.__text__) score += SelectMenu.EQUAL_MATCH_SCORE * queryItem.__text__.length; var extraIndex = item.__text__.indexOf(queryItem.__text__); if (extraIndex >= 0) { score += SelectMenu.EXTRA_MATCH_SCORE * queryItem.__text__.length - extraIndex / item.__text__.length; } extraIndex = item.__textNoneCase__.indexOf(queryItem.__textNoneCase__); if (extraIndex >= 0) { score += SelectMenu.UNCASE_MATCH_SCORE * queryItem.__text__.length - extraIndex / item.__text__.length; } extraIndex = item.__nvnTextNoneCase__.indexOf(queryItem.__nvnTextNoneCase__); if (extraIndex >= 0) { score += SelectMenu.UNCASE_MATCH_SCORE * queryItem.__text__.length - extraIndex / item.__text__.length; } score += wordsMatch(queryItem.__nvnWordsNoneCase__, item.__nvnWordsNoneCase__) / (queryItem.__nvnWordsNoneCase__.length + 1 + item.__nvnWordsNoneCase__.length) * 2 * SelectMenu.WORD_MATCH_SCORE; score += wordsMatch(queryItem.__wordsNoneCase__, item.__wordsNoneCase__) / (queryItem.__wordsNoneCase__.length + 1 + item.__wordsNoneCase__.length) * 2 * SelectMenu.WORD_MATCH_SCORE; return score; }; SelectMenu.prototype.updateItem = function () { this.$holderItem.clearChild(); if (this.$selectlist.$selectedItem) { var elt = SelectMenu_({ tag: 'selectlistitem', props: { data: this.$selectlist.$selectedItem.data } }).addTo(this.$holderItem); elt.$descCtn.addStyle('width', this.$selectlist._descWidth + 'px'); } }; SelectMenu.prototype.init = function (props) { props = props || {}; Object.keys(props).forEach(function (key) { if (props[key] === undefined) delete props[key]; }); if (!('value' in props)) { if (props.items && props.items.length > 0) props.value = typeof props.items[0] == 'string' ? props.items[0] : props.items[0].value; } this.super(props); }; SelectMenu.property = {}; SelectMenu.property.items = { set: function (value) { this._searchCache = {}; this._items = value; this.$dropdownBox.removeStyle('min-width'); this.$selectlist.items = value || []; this.selectListBound = this.$selectlist.getBoundingClientRect(); this.addStyle('min-width', this.selectListBound.width + 2 + 37 + 'px'); this.emit('minwidthchange', { target: this, value: this.selectListBound.width + 2 + 37, type: 'minwidthchange' }, this); this.updateItem(); this.updateDropdownPostion(); }, get: function () { return this._items || []; } }; SelectMenu.property.value = { set: function (value) { this.$selectlist.value = value; this.updateItem(); }, get: function () { return this.$selectlist.value; } }; SelectMenu.property.enableSearch = { set: function (value) { this._enableSearch = !!value; if (value) { this.$searchTextInput.removeStyle('display'); } else { this.$searchTextInput.addStyle('display', 'none'); } }, get: function () { return !!this._enableSearch; } }; SelectMenu.prototype.updateDropdownPostion = function (updateAnchor) { if (!this.isFocus) { this.$anchorContentCtn .removeStyle('left') .removeStyle('top'); this.$dropdownBox.removeStyle('min-width'); return; } var bound = this.getBoundingClientRect(); if (!updateAnchor) { var outBound = Dom["a" /* default */].traceOutBoundingClientRect(this); if (!this.isFocus || bound.top > outBound.bottom || bound.bottom < outBound.top) { this.isFocus = false; return; } var anchorOutBound = Dom["a" /* default */].traceOutBoundingClientRect(this.$anchor); var searchBound = this.$searchTextInput.getBoundingClientRect(); var availableTop = bound.top - anchorOutBound.top - (this.enableSearch ? searchBound.height + 8 : 0) - 20; var availableBottom = anchorOutBound.bottom - bound.bottom - (this.enableSearch ? searchBound.height + 8 : 0) - 20; if (this.forceDown || availableBottom >= this.selectListBound.height || availableBottom > availableTop) { this.isDropdowUp = false; this.$searchTextInput.selfRemove(); this.$dropdownBox.addChildBefore(this.$searchTextInput, this.$vscroller); this.$vscroller.addStyle('max-height', availableBottom + 'px'); } else { this.isDropdowUp = true; this.$searchTextInput.selfRemove(); this.$dropdownBox.addChild(this.$searchTextInput); this.$vscroller.addStyle('max-height', availableTop + 'px'); } this.$dropdownBox.addStyle('min-width', bound.width + 'px'); this.scrollToSelectedItem(); } var anchorBound = this.$anchor.getBoundingClientRect(); if (this.isDropdowUp) { this.$anchorContentCtn.addStyle({ left: bound.left - anchorBound.left + 'px', top: bound.top - anchorBound.top - this.$dropdownBox.clientHeight - 1 + 'px', }); } else { this.$anchorContentCtn.addStyle({ left: bound.left - anchorBound.left + 'px', top: bound.bottom - anchorBound.top + 'px', }); } }; SelectMenu.prototype.scrollToSelectedItem = function () { var self = this; setTimeout(function () { if (self.$selectlist.$selectedItem) { var listBound = self.$selectlist.getBoundingRecursiveRect(1); var itemBound = self.$selectlist.$selectedItem.getBoundingClientRect(); if (self.isDropdowUp) { var scrollBound = self.$vscroller.getBoundingClientRect(); self.$vscroller.scrollTop = Math.max(itemBound.bottom - scrollBound.height - listBound.top, 0); } else { self.$vscroller.scrollTop = itemBound.top - listBound.top; } } }.bind(this), 30); }; SelectMenu.prototype.startTrackScroll = function () { var trackElt = this.parentElement; while (trackElt) { if (trackElt.addEventListener) { trackElt.addEventListener('scroll', this.eventHandler.scrollParent, false); // trackElt.addEventListener('scroll', this.eventHandler.scrollParent, true); } else { trackElt.attachEvent('onscroll', this.eventHandler.scrollParent, false); // trackElt.attachEvent('onscroll', this.eventHandler.scrollParent, true); } this.$scrollTrackElts.push(trackElt); trackElt = trackElt.parentElement; } if (document.addEventListener) { document.addEventListener('scroll', this.eventHandler.scrollParent, false); document.addEventListener('wheel', this.eventHandler.wheelDocument, true); } else { document.attachEvent('onscroll', this.eventHandler.scrollParent, false); } this.$scrollTrackElts.push(document); }; SelectMenu.prototype.stopTrackScroll = function () { var trackElt; for (var i = 0; i < this.$scrollTrackElts.length; ++i) { trackElt = this.$scrollTrackElts[i]; if (trackElt.removeEventListener) { trackElt.removeEventListener('scroll', this.eventHandler.scrollParent, false); } else { trackElt.dettachEvent('onscroll', this.eventHandler.scrollParent, false); } } this.$scrollTrackElts = []; }; SelectMenu.property.isFocus = { set: function (value) { var self = this; value = !!value; if (value == this.isFocus) return; this._isFocus = value; if (value) { this.startTrackScroll(); var isAttached = false; setTimeout(function () { if (isAttached) return; SelectMenu_$('body').on('mousedown', self.eventHandler.bodyClick); isAttached = true; }, 1000); SelectMenu_$('body').once('click', function () { setTimeout(function () { if (isAttached) return; SelectMenu_$('body').on('mousedown', self.eventHandler.bodyClick); isAttached = true; }, 10); }); if (this.enableSearch) { setTimeout(function () { self.$searchTextInput.focus(); }, 50); } this.updateDropdownPostion(); this.$anchor.removeClass('absol-disabled'); } else { this.$anchor.addClass('absol-disabled'); this.stopTrackScroll(); SelectMenu_$('body').off('mousedown', this.eventHandler.bodyClick); setTimeout(function () { if (self.$searchTextInput.value != 0) { self.$searchTextInput.value = ''; self.$selectlist.items = self.items; } }, 100) this.updateItem(); } }, get: function () { return !!this._isFocus; } }; SelectMenu.property.disabled = { set: function (value) { if (value) { this.addClass('disabled'); } else { this.removeClass('disabled'); } }, get: function () { return this.containsClass('disabled'); } }; SelectMenu.property.hidden = { set: function (value) { if (value) { this.addClass('hidden'); } else { this.removeClass('hidden'); } }, get: function () { return this.addClass('hidden'); } }; SelectMenu.eventHandler = {}; SelectMenu.eventHandler.attached = function () { if (this._updateInterval) return; if (!this.$anchor.parentNode) this.$anchor.addTo(this.$anchorCtn); this.$attachhook.updateSize = this.$attachhook.updateSize || this.updateDropdownPostion.bind(this); Dom["a" /* default */].addToResizeSystem(this.$attachhook); this._updateInterval = setInterval(function () { if (!this.isDescendantOf(document.body)) { clearInterval(this._updateInterval); this._updateInterval = undefined; this.$anchor.selfRemove(); this.stopTrackScroll(); } }.bind(this), 10000); }; SelectMenu.eventHandler.scrollParent = function (event) { var self = this; if (this._scrollFrameout > 0) { this._scrollFrameout = 10; return; } this._scrollFrameout = this._scrollFrameout || 10; function update() { self.updateDropdownPostion(false); self._scrollFrameout--; if (self._scrollFrameout > 0) requestAnimationFrame(update); } update(); }; SelectMenu.eventHandler.click = function (event) { if (EventEmitter["a" /* default */].isMouseRight(event)) return; this.isFocus = !this.isFocus; }; SelectMenu.eventHandler.bodyClick = function (event) { if (!EventEmitter["a" /* default */].hitElement(this, event) && !EventEmitter["a" /* default */].hitElement(this.$anchor, event)) { setTimeout(function () { this.isFocus = false; }.bind(this), 5) } }; SelectMenu.eventHandler.selectlistChange = function (event) { this.updateItem(); this.selectMenuValue = this.value; if (this._lastValue != this.value) { setTimeout(function () { this.emit('change', event, this); }.bind(this), 1) this._lastValue = this.value; } }; SelectMenu.eventHandler.searchModify = function (event) { var filterText = this.$searchTextInput.value.replace(/((\ )|(\s))+/g, ' ').trim(); if (filterText.length == 0) { this.$selectlist.items = this.items; } else { var view = []; if (!this._searchCache[filterText]) { if (filterText.length == 1) { view = this.items.map(function (item) { var res = { item: item, text: typeof item === 'string' ? item : item.text }; return res; }).map(function (it) { it.score = 0; var text = it.text.replace(/((\ )|(\s))+/g, ' ').trim(); it.score += text.toLowerCase().indexOf(filterText.toLowerCase()) >= 0 ? 100 : 0; text = Object(stringFormat["nonAccentVietnamese"])(text); it.score += text.toLowerCase().indexOf(filterText.toLowerCase()) >= 0 ? 100 : 0; return it; }); view.sort(function (a, b) { if (b.score - a.score == 0) { if (Object(stringFormat["nonAccentVietnamese"])(b.text) > Object(stringFormat["nonAccentVietnamese"])(a.text)) return -1; return 1; } return b.score - a.score; }); view = view.filter(function (x) { return x.score > 0; }) } else { var its = this.items.map(function (item) { var res = { item: item, text: typeof item === 'string' ? item : item.text }; var text = res.text.replace(/((\ )|(\s))+/g, ' ').trim(); res.score = (phraseMatch(text, filterText) + phraseMatch(Object(stringFormat["nonAccentVietnamese"])(text), Object(stringFormat["nonAccentVietnamese"])(filterText))) / 2; if (Object(stringFormat["nonAccentVietnamese"])(text).replace(/s/g, '').toLowerCase().indexOf(Object(stringFormat["nonAccentVietnamese"])(filterText).toLowerCase().replace(/s/g, '')) > -1) res.score = 100; return res; }); if (its.length == 0) return; its.sort(function (a, b) { if (b.score - a.score == 0) { if (Object(stringFormat["nonAccentVietnamese"])(b.text) > Object(stringFormat["nonAccentVietnamese"])(a.text)) return -1; return 1; } return b.score - a.score; }); var view = its.filter(function (x) { return x.score > 0.5; }); if (view.length == 0) { var bestScore = its[0].score; view = its.filter(function (it) { return it.score + 0.001 >= bestScore; }); } if (view[0].score == 0) view = []; } view = view.map(function (e) { return e.item; }); this._searchCache[filterText] = view; } else { view = this._searchCache[filterText]; } this.$selectlist.items = view; } this.selectListBound = this.$selectlist.getBoundingClientRect(); this.updateDropdownPostion(true); }; ACore["a" /* default */].creator.selectmenu = SelectMenu; /* harmony default export */ var js_SelectMenu = (SelectMenu); // EXTERNAL MODULE: ./node_modules/absol-acomp/css/treelist.css var treelist = __webpack_require__(147); // CONCATENATED MODULE: ./node_modules/absol-acomp/js/TreeList.js var TreeList_ = ACore["a" /* default */]._; var TreeList_$ = ACore["a" /* default */].$; function TreeList() { var res = TreeList_({ class: 'absol-tree-list', extendEvent: 'press' }); return res; } TreeList.prototype.realignDescription = function (extMarginLeft) { extMarginLeft = extMarginLeft || 0; var maxWidth = 0; var ctns = []; TreeList_$('.absol-tree-list-item-desc-container', this, function (elt) { ctns.push(elt); var bound = elt.getBoundingClientRect(); maxWidth = Math.max(maxWidth, bound.width); }); var fontSize = this.getFontSize(); var cntWidth = maxWidth / fontSize + 'em'; var extMarginRight = maxWidth / fontSize + extMarginLeft + 'em'; ctns.forEach(function (e) { e.addStyle('width', cntWidth); }); TreeList_$('span.absol-tree-list-item-text', this, function (elt) { elt.addStyle('margin-right', extMarginRight); }); return this; }; TreeList.prototype.clearItems = function () { this._items = []; this.clearChild(); }; TreeList.prototype.getAllItem = function () { return this._items || []; }; TreeList.prototype.getAllItemElement = function () { return Array.apply(null, this.childNodes); } TreeList.prototype.addItem = function (item) { var self = this; var props = { level: this.level, data: item }; if (typeof item == 'string') { props.text = item; } else { props.text = item.text; if (item.items) { props.items = item.items; } if (item.desc){ props.desc = item.desc; } if (item.extendClasses){ props.extendClasses = item.extendClasses; } if (item.extendStyle){ props.extendStyle = item.extendStyle; } } var elt = TreeList_({ tag: 'treelistitem', props: props, on: { press: function (event) { self.emit('press', event, this); } } }); this.addChild(elt); this._items.push(item); return this; }; TreeList.property = {}; TreeList.property.items = { set: function (value) { this.clearItems(); (value || []).forEach(this.addItem.bind(this)); }, get: function () { return this.getAllItem(); } }; TreeList.property.level = { set: function (value) { value = value || 0; if (this.level == value) return; this._level = value; this.getAllItemElement().forEach(function (e) { e.level = value; }); }, get: function () { return this._level || 0; } }; ACore["a" /* default */].creator.treelist = TreeList; /* harmony default export */ var js_TreeList = (TreeList); // CONCATENATED MODULE: ./node_modules/absol-acomp/js/TreeListItem.js var TreeListItem_ = ACore["a" /* default */]._; var TreeListItem_$ = ACore["a" /* default */].$; function TreeListItem() { var res = TreeListItem_({ extendEvent: ['press', 'clickparent'], class: 'absol-tree-list-item', child: [ { class: 'absol-tree-list-item-parent', child: ['span.absol-tree-list-item-text', { class: 'absol-tree-list-item-desc-container', child: 'span.absol-tree-list-item-desc' } ] }, 'treelist' ] }); res.eventHandler = OOP["a" /* default */].bindFunctions(res, TreeListItem.eventHandler); res.$list = TreeListItem_$('treelist', res).on('press', function (event, sender) { res.emit('press', event, this); }); res.$parent = TreeListItem_$('.absol-tree-list-item-parent', res).on('mousedown', res.eventHandler.clickParent); res.$text = TreeListItem_$('span.absol-tree-list-item-text', res); res.$desc = TreeListItem_$('span.absol-tree-list-item-desc', res); res.$descCtn = TreeListItem_$('.absol-tree-list-item-desc-container', res); res.$list.level = 1; OOP["a" /* default */].drillProperty(res, res.$list, 'items'); return res; }; TreeListItem.eventHandler = {}; TreeListItem.eventHandler.clickParent = function (event) { event.preventDefault(); var prevented = false; var self = this; this.emit('press', { target: self, preventDefault: function () { prevented = true; }, isPrevented: function () { return prevented; }, data: this.data }, this); if (!prevented) { var top = self.getTopLevelElt(); TreeListItem_$('treelistitem', top, function (e) { if (e != self) e.active = false; }) self.active = true; } }; TreeListItem.prototype.getTopLevelElt = function () { var current = this; while (current) { var parent = current.parentNode; if (!parent || (!parent.classList.contains('absol-tree-list') && !parent.classList.contains('absol-tree-list-item'))) break; current = current.parentNode; } return current; }; TreeListItem.property = { text: { set: function (value) { value = value + ''; this.$text.innerHTML = value; }, get: function () { return this.$text.innerHTML; } }, desc: { set: function (value) { value = value + ''; this.$desc.innerHTML = value; }, get: function () { return this.$desc.innerHTML } }, level: { set: function (value) { value = value || 0; if (value == this.level) return; this._level = value; this.$parent.addStyle('padding-left', this._level * 0.4 * 3 + 'em'); this.$list.level = value + 1; }, get: function () { return this._level || 0; } }, active: { set: function (value) { if (value) { this.addClass('active'); } else { this.removeClass('active'); } }, get: function () { return this.containsClass('active'); } }, data: { set: function (value) { this._data = value; }, get: function () { return this._data; } }, value: { get: function () { var data = this.data; if (typeof data == 'string') return data; if (typeof data.value == "undefined") { return data.text; } else { return data.value; } } } }; TreeListItem.property.extendClasses = { set: function (value) { var self = this; this.extendClasses.forEach(function (className) { self.$parent.removeClass(className); }); this._extendClass = []; if (!value) return; if (typeof value == 'string') { value = value.split(/\s+/).filter(function (c) { return c.length > 0 }); } if (value instanceof Array) { this._extendClass = value; this._extendClass.forEach(function (className) { self.$parent.addClass(className); }); } else { throw new Error('Invalid extendClasses'); } }, get: function () { return this._extendClass || []; } }; TreeListItem.property.extendStyle = { set: function (value) { this.$parent.removeStyle(this._extendStyle || {}); this._extendStyle = value || {}; this.$parent.addStyle(this.extendStyle); }, get: function () { return this._extendStyle || {}; } }; ACore["a" /* default */].creator.treelistitem = TreeListItem; /* harmony default export */ var js_TreeListItem = (TreeListItem); // EXTERNAL MODULE: ./node_modules/absol-acomp/css/selecttreemenu.css var selecttreemenu = __webpack_require__(149); // CONCATENATED MODULE: ./node_modules/absol-acomp/js/SelectTreeMenu.js var SelectTreeMenu_ = ACore["a" /* default */]._; var SelectTreeMenu_$ = ACore["a" /* default */].$; function SelectTreeMenu() { var res = SelectTreeMenu_({ class: ['absol-selectmenu'], extendEvent: ['change', 'minwidthchange'], attr: { tabindex: '1' }, child: [ '.absol-selectmenu-holder-item', { tag: 'button', class: 'absol-selectmenu-btn', child: ['dropdown-ico'] }, 'attachhook', ] }); //only event is different with selectmenu res.eventHandler = OOP["a" /* default */].bindFunctions(res, SelectTreeMenu.eventHandler); res.$holderItem = SelectTreeMenu_$('.absol-selectmenu-holder-item', res); res.$anchorCtn = js_SelectMenu.getAnchorCtn(); res.$anchor = SelectTreeMenu_('.absol-selectmenu-anchor.absol-disabled').addTo(res.$anchorCtn); res.$anchorContentCtn = SelectTreeMenu_('.absol-selectmenu-anchor-content-container').addTo(res.$anchor); res.$dropdownBox = SelectTreeMenu_('.absol-selectmenu-dropdown-box').addTo(res.$anchorContentCtn); res.$searchTextInput = SelectTreeMenu_('searchtextinput').addStyle('display', 'none').addTo(res.$dropdownBox); res.$vscroller = SelectTreeMenu_('bscroller').addTo(res.$dropdownBox); res.$selectlist = SelectTreeMenu_('selectlist', res).addTo(res.$vscroller); res.$scrollTrackElts = []; res.$searchTextInput.on('stoptyping', res.eventHandler.searchModify); res._searchCache = {}; res.$selectlist.on('change', res.eventHandler.selectlistChange, true); res.$selectlist.on('pressitem', function () { res.isFocus = false; }, true); res.on('mousedown', res.eventHandler.click, true); res.on('blur', res.eventHandler.blur); OOP["a" /* default */].drillProperty(res, res.$selectlist, 'selectedIndex'); res.selectListBound = { height: 0, width: 0 }; res.$attachhook = SelectTreeMenu_$('attachhook', res) .on('error', res.eventHandler.attached); res.sync = new Promise(function (rs) { SelectTreeMenu_$('attachhook', res).once('error', function () { rs(); }); }); return res; } SelectTreeMenu.prototype.updateItem = js_SelectMenu.prototype.updateItem; SelectTreeMenu.prototype.init = js_SelectMenu.prototype.init; SelectTreeMenu.prototype.updateDropdownPostion = js_SelectMenu.prototype.updateDropdownPostion; SelectTreeMenu.prototype.scrollToSelectedItem = js_SelectMenu.prototype.scrollToSelectedItem; SelectTreeMenu.prototype.startTrackScroll = js_SelectMenu.prototype.startTrackScroll; SelectTreeMenu.prototype.stopTrackScroll = js_SelectMenu.prototype.stopTrackScroll; SelectTreeMenu.eventHandler = {}; SelectTreeMenu.eventHandler.attached = js_SelectMenu.eventHandler.attached; SelectTreeMenu.eventHandler.scrollParent = js_SelectMenu.eventHandler.scrollParent; SelectTreeMenu.eventHandler.click = js_SelectMenu.eventHandler.click; SelectTreeMenu.eventHandler.bodyClick = js_SelectMenu.eventHandler.bodyClick; SelectTreeMenu.eventHandler.selectlistChange = js_SelectMenu.eventHandler.selectlistChange; SelectTreeMenu.property = {}; SelectTreeMenu.property.disabled = js_SelectMenu.property.disabled; SelectTreeMenu.property.hidden = js_SelectMenu.property.hidden; SelectTreeMenu.property.value = js_SelectMenu.property.value; SelectTreeMenu.property.enableSearch = js_SelectMenu.property.enableSearch; SelectTreeMenu.treeToList = function (items) { var arr = []; function visit(level, node) { node.level = level; arr.push(node); if (node.items && node.items.length > 0) node.items.forEach(visit.bind(null, level + 1)); } items.forEach(visit.bind(null, 0)); return arr; }; SelectTreeMenu.eventHandler.searchModify = function (event) { var value = this.$searchTextInput.value; this.search(value); } SelectTreeMenu.prototype.notifyChange = function (eventData) { setTimeout(function () { this.emit('change', Object.assign({}, eventData), this) }.bind(this), 1) } SelectTreeMenu.property.items = { set: function (value) { value = value || []; this._items = value; SelectTreeMenu.prepareData(this._items); this.__searchcache__ = {}; this.__searchcache__['__EMPTY_QUERY__'] = SelectTreeMenu.treeToList(value); this.$selectlist.items = this.__searchcache__['__EMPTY_QUERY__']; //same with SelectMenu this.selectListBound = this.$selectlist.getBoundingClientRect(); this.addStyle('min-width', this.selectListBound.width + 2 + 37 + 'px'); this.emit('minwidthchange', { target: this, value: this.selectListBound.width + 2 + 37, type: 'minwidthchange' }, this); this.updateItem(); }, get: function () { return this._items; } }; SelectTreeMenu.property.isFocus = { set: function (value) { var self = this; value = !!value; if (value == this.isFocus) return; this._isFocus = value; if (value) { this.startTrackScroll(); this.$anchor.removeClass('absol-disabled'); var isAttached = false; setTimeout(function () { if (isAttached) return; SelectTreeMenu_$('body').on('mousedown', this.eventHandler.bodyClick); isAttached = true; }.bind(this), 1000); SelectTreeMenu_$('body').once('click', function () { setTimeout(function () { if (isAttached) return; SelectTreeMenu_$('body').on('mousedown', this.eventHandler.bodyClick); isAttached = true; }.bind(this), 10); }.bind(this)); if (this.enableSearch) { setTimeout(function () { this.$searchTextInput.focus(); }.bind(this), 50); } this.updateDropdownPostion(); } else { this.$anchor.addClass('absol-disabled'); this.stopTrackScroll(); SelectTreeMenu_$('body').off('mousedown', this.eventHandler.bodyClick); setTimeout(function () { if (self.$searchTextInput.value != 0) { self.$searchTextInput.value = ''; // different with SelectMenu self.$selectlist.items = self.__searchcache__['__EMPTY_QUERY__']; } }, 100) this.updateItem(); } }, get: function () { return !!this._isFocus; } }; // SelectTreeMenu.property.value = Sele; SelectTreeMenu.EXTRA_MATCH_SCORE = 2; SelectTreeMenu.UNCASE_MATCH_SCORE = 1; SelectTreeMenu.UVN_MATCH_SCORE = 3; SelectTreeMenu.EQUAL_MATCH_SCORE = 4; SelectTreeMenu.WORD_MATCH_SCORE = 3; /** * @typedef {{text:String, __words__: Array<String>, __textNoneCase__: String, __wordsNoneCase__: Array<String>, __nvnText__:String, __nvnWords__:Array<String>, __nvnTextNoneCase__: String, __nvnWordsNoneCase__: Array<String>}} SearchItem * @param {SearchItem} item * @returns {SearchItem} */ SelectTreeMenu.prepareItem = function (item) { var spliter = /\s+/; item.__text__ = item.text.replace(/([\s\b\-()\[\]]| | | |\s)+/g, ' ').trim(); item.__words__ = item.__text__.split(spliter); item.__textNoneCase__ = item.__text__.toLowerCase(); item.__wordsNoneCase__ = item.__textNoneCase__.split(spliter); item.__nvnText__ = Object(stringFormat["nonAccentVietnamese"])(item.__text__); item.__nvnWords__ = item.__nvnText__.split(spliter); item.__nvnTextNoneCase__ = item.__nvnText__.toLowerCase(); item.__nvnWordsNoneCase__ = item.__nvnTextNoneCase__.split(spliter); return item; }; SelectTreeMenu.prepareData = function (items) { var item; for (var i = 0; i < items.length; ++i) { if (typeof items[i] == 'string') { items[i] = { text: items[i], value: items[i] }; } item = items[i]; SelectTreeMenu.prepareItem(item); if (item.items) SelectTreeMenu.prepareData(item.items); } return items; } /** * @param {SearchItem} queryItem * @param {SearchItem} item */ SelectTreeMenu.calScore = function (queryItem, item) { var score = 0; if (item.__text__ == queryItem.__text__) score += SelectTreeMenu.EQUAL_MATCH_SCORE * queryItem.__text__.length; var extraIndex = item.__text__.indexOf(queryItem.__text__); if (extraIndex >= 0) { score += SelectTreeMenu.EXTRA_MATCH_SCORE * queryItem.__text__.length - extraIndex / item.__text__.length; } extraIndex = item.__textNoneCase__.indexOf(queryItem.__textNoneCase__); if (extraIndex >= 0) { score += SelectTreeMenu.UNCASE_MATCH_SCORE * queryItem.__text__.length - extraIndex / item.__text__.length; } extraIndex = item.__nvnTextNoneCase__.indexOf(queryItem.__nvnTextNoneCase__); if (extraIndex >= 0) { score += SelectTreeMenu.UNCASE_MATCH_SCORE * queryItem.__text__.length - extraIndex / item.__text__.length; } score += wordsMatch(queryItem.__nvnWordsNoneCase__, item.__nvnWordsNoneCase__) / (queryItem.__nvnWordsNoneCase__.length + 1 + item.__nvnWordsNoneCase__.length) * 2 * SelectTreeMenu.WORD_MATCH_SCORE; score += wordsMatch(queryItem.__wordsNoneCase__, item.__wordsNoneCase__) / (queryItem.__wordsNoneCase__.length + 1 + item.__wordsNoneCase__.length) * 2 * SelectTreeMenu.WORD_MATCH_SCORE; return score; }; SelectTreeMenu.queryTree = function (query, items) { var gmaxScore = 0; var gminScore = 1000; var queryItem = SelectTreeMenu.prepareItem({ text: query }); function makeScore(item) { var score = SelectTreeMenu.calScore(queryItem, item); gmaxScore = Math.max(score, gmaxScore); gminScore = Math.min(score, gminScore); var children = (item.items || []).map(function (item) { return makeScore(item); }); var maxScore = children.reduce(function (ac, cr) { return Math.max(ac, cr.maxScore); }, score); return { score: score, maxScore: maxScore, item: item, children: children } } function sortcmp(a, b) { return b.maxScore - a.maxScore; } function makeItems(nodes, medScore) { nodes.sort(sortcmp); return nodes.filter(function (node) { return node.maxScore >= medScore; }).map(function (node) { var res; if (typeof node.item == 'string') { res = node.item; } else { res = Object.assign({}, node.item); if (node.children && node.children.length > 0) { res.items = makeItems(node.children, medScore); if (res.items.length == 0) delete res.items; } } return res; }); } var scoredItems = items.map(makeScore); var medianScore = (gminScore + gmaxScore) / 2; var items = makeItems(scoredItems, medianScore); return SelectTreeMenu.treeToList(items); }; SelectTreeMenu.prototype.search = function (query) { if (query.length == 0) { this.$selectlist.items = this.__searchcache__['__EMPTY_QUERY__']; this.updateItem(); this.updateDropdownPostion(true); this.scrollToSelectedItem(); } else { var searchResult = this.__searchcache__[query] || SelectTreeMenu.queryTree(query, this.items); this.__searchcache__[query] = searchResult; this.$selectlist.items = searchResult; this.updateItem(); this.updateDropdownPostion(true); this.$vscroller.scrollTop = 0; } }; ACore["a" /* default */].creator.selecttreemenu = SelectTreeMenu; /* harmony default export */ var js_SelectTreeMenu = (SelectTreeMenu); // EXTERNAL MODULE: ./node_modules/absol-acomp/css/selectbox.css var selectbox = __webpack_require__(151); // CONCATENATED MODULE: ./node_modules/absol-acomp/js/SelectBoxItem.js var SelectBoxItem_ = ACore["a" /* default */]._; var SelectBoxItem_$ = ACore["a" /* default */].$; function SelectBoxItem() { var res = SelectBoxItem_({ class: 'absol-selectbox-item', extendEvent: 'close', child: [ '.absol-selectbox-item-text', { class: 'absol-selectbox-item-close', child: '<span class="mdi mdi-close"></span>' } ] }); res.eventHandler = OOP["a" /* default */].bindFunctions(res, SelectBoxItem.eventHandler); res.$text = SelectBoxItem_$('.absol-selectbox-item-text', res); res.$close = SelectBoxItem_$('.absol-selectbox-item-close', res); res.$close.on('click', res.eventHandler.clickClose); return res; }; SelectBoxItem.eventHandler = {}; SelectBoxItem.eventHandler.clickClose = function (event) { this.emit('close', event); }; SelectBoxItem.property = {}; SelectBoxItem.property.data = { set: function (value) { this._data = value; this.$text.clearChild(); this.$text.addChild(SelectBoxItem_('<span>' + this.text + '</span>')); }, get: function () { return this._data; } }; SelectBoxItem.property.text = { get: function () { if (typeof this._data == 'string') return this._data; else return this._data.text; } }; SelectBoxItem.property.value = { get: function () { if (typeof this._data == 'string') return this._data; else return this._data.value; } }; ACore["a" /* default */].install('SelectBoxItem'.toLowerCase(), SelectBoxItem); /* harmony default export */ var js_SelectBoxItem = (SelectBoxItem); // CONCATENATED MODULE: ./node_modules/absol-acomp/js/SelectBox.js var SelectBox_isSupportedVar = window.CSS && window.CSS.supports && window.CSS.supports('--fake-var', 'red'); var SelectBox_ = ACore["a" /* default */]._; var SelectBox_$ = ACore["a" /* default */].$; function SelectBox() { var res = SelectBox_({ class: ['absol-selectbox', 'absol-bscroller'], extendEvent: ['change', 'add', 'remove', 'minwidthchange'], attr: { tabindex: '1' }, child: 'attachhook' }); res.eventHandler = OOP["a" /* default */].bindFunctions(res, SelectBox.eventHandler); res.on('click', res.eventHandler.click); res.$anchorCtn = js_SelectMenu.getAnchorCtn(); res.$anchor = SelectBox_('.absol-selectmenu-anchor.absol-disabled').addTo(res.$anchorCtn); res.$anchorContentCtn = SelectBox_('.absol-selectmenu-anchor-content-container').addTo(res.$anchor); res.$scrollTrackElts = []; res.$attachhook = SelectBox_$('attachhook', res) .on('error', res.eventHandler.attached); res.$dropdownBox = SelectBox_('.absol-selectmenu-dropdown-box').addTo(res.$anchorContentCtn); res.$searchTextInput = SelectBox_('searchtextinput').addStyle('display', 'none').addTo(res.$dropdownBox); res.$vscroller = SelectBox_('bscroller').addTo(res.$dropdownBox); res.$selectlist = SelectBox_('.absol-selectlist').addTo(res.$vscroller);//reuse css res.$searchList = SelectBox_('selectlist').addStyle('display', 'none') .on('change', res.eventHandler.searchListChange).addTo(res.$vscroller);//todo: event res.$listItems = []; res._listItemViewCount = 0; res.$listItemByValue = {}; res.$boxItems = []; res._boxItemViewCount = 0; res._valueDict = {}; res.$searchTextInput.on('stoptyping', res.eventHandler.searchModify); res._searchCache = {}; return res; }; SelectBox.prototype.startTrackScroll = js_SelectMenu.prototype.startTrackScroll; SelectBox.prototype.stopTrackScroll = js_SelectMenu.prototype.stopTrackScroll; SelectBox.prototype.updateDropdownPostion = js_SelectMenu.prototype.updateDropdownPostion; SelectBox.eventHandler = {}; SelectBox.eventHandler.attached = js_SelectMenu.eventHandler.attached; SelectBox.eventHandler.scrollParent = js_SelectMenu.eventHandler.scrollParent; // SelectTreeMenu.eventHandler.click = SelectMenu.eventHandler.click; // SelectTreeMenu.eventHandler.bodyClick = SelectMenu.eventHandler.bodyClick; SelectBox.property = {}; SelectBox.property.disabled = js_SelectMenu.property.disabled; SelectBox.property.hidden = js_SelectMenu.property.hidden; SelectBox.property.enableSearch = js_SelectMenu.property.enableSearch; SelectBox.prototype.init = function (props) { props = props || []; Object.keys(props).forEach(function (key) { if (props[key] === undefined) delete props[key]; }); this.super(props); }; SelectBox.prototype.resetFilter = function () { Array.prototype.forEach.call(this.$selectlist.childNodes, function (e) { e.removeStyle('display'); }.bind(this)); }; SelectBox.prototype.scrollToSelectedItem = function () { //nothing to do; }; SelectBox.prototype.queryValues = function () { return Array.prototype.map.call(this.$holderItem.childNodes, function (e) { var data = e.data; return (typeof data == 'string') ? data : data.value; }) }; SelectBox.prototype.querySelectedItems = function () { return Array.prototype.map.call(this.$holderItem.childNodes, function (e) { return e.data; }); }; SelectBox.prototype.init = js_SelectMenu.prototype.init; SelectBox.property.isFocus = { set: function (value) { value = !!value; if (value == this.isFocus) return; var self = this; this._isFocus = value; if (value) { this.startTrackScroll(); this.$anchor.removeClass('absol-disabled'); var isAttached = false; setTimeout(function () { if (isAttached) return; SelectBox_$('body').on('mousedown', self.eventHandler.clickBody); isAttached = true; }, 1000); SelectBox_$('body').once('click', function () { setTimeout(function () { if (isAttached) return; SelectBox_$('body').on('mousedown', self.eventHandler.clickBody); isAttached = true; }, 10); }); if (this.enableSearch) { setTimeout(function () { self.$searchTextInput.focus(); }, 50); } this.updateDropdownPostion(); } else { this.$anchor.addClass('absol-disabled'); this.stopTrackScroll(); SelectBox_$('body').off('mousedown', this.eventHandler.clickBody); setTimeout(function () { if (self.$searchTextInput.value != 0) { self.$searchTextInput.value = ''; // different with SelectMenu self.$searchList.addStyle('display', 'none'); self.$selectlist.removeStyle('display'); } }, 100); } }, get: js_SelectMenu.property.isFocus.get }; SelectBox.property.items = { set: function (items) { var i; var self = this; items = items || []; this._items = items; this._searchCache = {}; var itemCount = items.length; utils_measureText('', 'italic 14px sans-serif')//cache font style this._descWidth = 0; for (i = 0; i < itemCount; ++i) { if (items[i].desc) { this._descWidth = Math.max(this._descWidth, utils_measureText(items[i].desc).width); } } function mousedownItem(event) { if (EventEmitter["a" /* default */].isMouseRight(event)) return; self.values.push(this.value); self.values = self.values;//update self.isFocus = false;//close after click item self.emit('add', { type: 'add', itemData: this.data, itemElt: this, value: this.value, values: self.values, target: self }, self); self.emit('change', { type: 'change', values: self.values, target: self }, self); } while (this.$listItems.length < itemCount) { this.$listItems.push(SelectBox_({ tag: 'selectlistitem', on: { mousedown: mousedownItem } })) } this.$listItemByValue = {}; for (i = 0; i < itemCount; ++i) { this.$listItems[i].data = items[i]; this.$listItems[i].__index__ = i; this.$listItemByValue[this.$listItems[i].value] = this.$listItems[i]; } while (this._listItemViewCount < itemCount) { this.$selectlist.addChild(this.$listItems[this._listItemViewCount++]); } while (this._listItemViewCount > itemCount) { this.$listItems[--this._listItemViewCount].remove(); } if (SelectBox_isSupportedVar) { this.$selectlist.style.setProperty('--select-list-desc-width', this._descWidth + 'px'); //addStyle notWork because of convert to cameCase } else { for (i = 0; i < this._itemViewCount; ++i) { this.$items[i].$text.addStyle('margin-right', 'calc(1em + ' + this._descWidth + 'px)'); this.$items[i].$descCtn.addStyle('width', this._descWidth + 'px'); } } this.selectListBound = this.$selectlist.getBoundingClientRect(); this.addStyle('min-width', this.selectListBound.width + 2 + 37 + 'px'); this.emit('minwidthchange', { target: this, value: this.selectListBound.width + 2 + 37, type: 'minwidthchange' }, this); this.values = this.values; }, get: function () { return this._items; } }; SelectBox.property.values = { set: function (values) { values = values || []; values = (values instanceof Array) ? values : [values]; this._values = values; this._searchCache = {}; var self = this; var i, key; var listItemElt; var boxItemElt; var lastDict = this._valueDict; function closeBoxItem(event) { var itemValue = this.value; var index = self.values.indexOf(itemValue); if (index >= 0) { self.values = self.values.slice(0, index).concat(self.values.slice(index + 1)); self.emit('remove', { type: 'remove', values: self.values, target: self, itemElt: this, value: this.value, itemData: this.data }, self); self.emit('change', { type: 'change', values: self.values, target: self }, self); } } if (this._orderly) values.sort(function (a, b) { var itA = self.$listItemByValue[a]; var itB = self.$listItemByValue[b]; var indexA = itA ? itA.__index__ : -10000; var indexB = itA ? itB.__index__ : 10000; return indexA - indexB; }); for (key in lastDict) { listItemElt = self.$listItemByValue[key]; if (listItemElt) listItemElt.removeStyle('display'); } this._valueDict = {}; for (i = 0; i < this._values.length; ++i) { this._valueDict[this._values[i]] = true; listItemElt = this.$listItemByValue[values[i]]; if (listItemElt) listItemElt.addStyle('display', 'none'); } //clear all item for (i = 0; i < this._boxItemViewCount; ++i) { this.$boxItems[i].remove(); } this._boxItemViewCount = 0; for (i = 0; i < values.length; ++i) { listItemElt = this.$listItemByValue[values[i]]; if (listItemElt) { if (this._boxItemViewCount >= this.$boxItems.length) { boxItemElt = SelectBox_({ tag: 'selectboxitem', on: { close: closeBoxItem } }); this.$boxItems.push(boxItemElt); } else { boxItemElt = this.$boxItems[this._boxItemViewCount]; } boxItemElt.data = listItemElt.data; this.addChild(boxItemElt); this._boxItemViewCount++; } } }, get: function () { return this._values || []; } }; SelectBox.property.orderly = { set: function (value) { this._orderly = !!value; if (value) { this.values = this.values; } }, get: function () { return !!this._orderly; } } SelectBox.eventHandler.click = function (event) { if (event.target == this) { this.isFocus = !this.isFocus; } }; SelectBox.eventHandler.clickBody = function (event) { if (!EventEmitter["a" /* default */].hitElement(this.$anchor, event) && event.target != this) { this.isFocus = false; }; }; SelectBox.eventHandler.searchListChange = function (event) { this.values.push(event.value); this.values = this.values; this.isFocus = false; this.emit('add', { type: 'add', itemData: event.itemElt.data, value: event.value, values: this.values }, this); this.emit('change', { type: 'change', values: self.values, target: self }, self); }; SelectBox.eventHandler.searchModify = function (event) { var self = this; var filterText = this.$searchTextInput.value.replace(/((\ )|(\s))+/g, ' ').trim(); if (filterText.length == 0) { this.$searchList.addStyle('display', 'none'); this.$selectlist.removeStyle('display'); } else { if (!this._searchCache['__EMPTY_QUERY__']) { this._searchCache['__EMPTY_QUERY__'] = this.items.map(function (item) { return js_SelectMenu.prepareItem(item); }).filter(function (it) {// filter items were added return !self._valueDict[it.value]; }); } this.$selectlist.addStyle('display', 'none'); this.$searchList.removeStyle('display'); var view = []; if (!this._searchCache[filterText]) { var gmaxScore = 0; var gminScore = 1000; var queryItem = js_SelectMenu.prepareItem({ text: filterText }); view = this._searchCache['__EMPTY_QUERY__'].map(function (it) { var score = js_SelectMenu.calScore(queryItem, it); gmaxScore = Math.max(gmaxScore, score); gminScore = Math.min(gminScore, score); return Object.assign({ score: score }, it); }); var medianScore = (gminScore + gmaxScore) / 2; view = view.filter(function (it) { return it.score >= medianScore; }); this._searchCache[filterText] = view; } else { view = this._searchCache[filterText]; } this.$searchList.items = view; } this.selectListBound = this.$selectlist.getBoundingClientRect(); this.updateDropdownPostion(true); }; ACore["a" /* default */].install('SelectBox'.toLowerCase(), SelectBox); /* harmony default export */ var js_SelectBox = (SelectBox); // EXTERNAL MODULE: ./node_modules/absol-acomp/css/radio.css var css_radio = __webpack_require__(153); // CONCATENATED MODULE: ./node_modules/absol-acomp/js/RadioButton.js var RadioButton_ = ACore["a" /* default */]._; var RadioButton_$ = ACore["a" /* default */].$; function RadioButton() { var res = RadioButton_( '<div class="absol-radio">\ <input type="radio" />\ <svg class="absol-radio-icon absol-radio-icon-left" width="20" height="20" version="1.1" viewBox="0 0 5.2917 5.2917" \ xmlns="http://www.w3.org/2000/svg">\ <g transform="translate(0 -291.71)">\ <circle class="bound" cx="2.6458" cy="294.35" r="2.4626" style="stroke-opacity:.99497;stroke-width:.26458;" />\ <circle class="dot" cx="2.6458" cy="294.35" r="0.92604" style="fill-rule:evenodd;" />\ </g>\ </svg>\ </div>' ); res.$attachHook = RadioButton_('attachhook').addTo(res); res.defineEvent('change'); res.defineEvent('uncheck'); res.defineEvent('check'); res.$input = RadioButton_$('input', res); OOP["a" /* default */].drillProperty(res, res.$input, 'value'); res.on('click', function (event) { if (!res.checked) { if (!this.disabled) { res.checked = true; res.emit('check', { target: res }, res); res.emit('change', { target: res, checked: true }, res); } } }); res.$attachHook.on('error', function () { res.checked = res.checked; }); return res; } RadioButton.prototype.getAllFriend = function () { return Radio.getAllByName(this.name); }; RadioButton.attribute = { checked: { set: function (value) { if (value == 'false' || value == null) { this.checked = false; } else { this.checked = true; } }, get: function () { return this.checked ? 'true' : 'false' }, remove: function () { this.checked = false; } }, disabled: { set: function (value) { if (value == 'false' || value == null) { this.disabled = false; } else { this.disabled = true; } }, get: function () { return this.disabled ? 'true' : 'false' }, remove: function () { this.disabled = false; } }, name: { set: function (value) { this.name = value; }, get: function () { return this.name; }, remove: function () { this.name = null; } } } RadioButton.property = { checked: { set: function (value) { this.$input.checked = !!value; if (this.checked) { this.addClass('checked'); var _this = this; setTimeout(function () { function finish(event) { if (!_this.checked) { _this.removeClass('checked') document.body.removeEventListener('click', finish, false); _this.emit('uncheck', { target: _this }, _this); _this.emit('change', { target: _this, checked: _this.checked }, _this); } } document.body.addEventListener('click', finish, false); }, 100); } else { this.removeClass('checked'); } }, get: function () { return this.$input.checked; } }, name: { set: function (name) { if (name == null) this.$input.removeAttribute('name'); else this.$input.setAttribute('name', name); }, get: function () { return this.$input.getAttribute('name'); } }, disabled: { set: function (value) { this.$input.disabled = !!value; if (value) { this.addClass('disabled'); } else { this.removeClass('disabled'); } }, get: function () { return this.$input.disabled; } } }; RadioButton.getAllByName = function (name) { return (document.getElementsByTagName('input') || []).filter(function (elt) { return elt.getAttribute('type') == 'radio' && elt.getAttribute('name') == name; }); }; RadioButton.getValueByName = function (name) { var inputs = Radio.getAllByName(name); var res = null; var input; for (var i = 0; i < inputs.length; ++i) { input = inputs[i]; if (input.checked) { res = input.value; } } return res; }; RadioButton.initAfterLoad = function () { return Dom["a" /* default */].documentReady.then(function () { Array.apply(null, document.getElementsByTagName('input')).filter(function (e) { return e.getAttribute('type') == 'radio' && e.classList.contains('absol-radio'); }).forEach(function (radio) { RadioButton_$(radio); radio.removeClass('absol-radio'); var classes = radio.attr('class').trim().split(/\s+/); var res = RadioButton_('<div class="absol-radio standar-alone">\ <svg class="absol-radio-icon absol-radio-icon-left" width="20" height="20" version="1.1" viewBox="0 0 5.2917 5.2917" \ xmlns="http://www.w3.org/2000/svg">\ <g transform="translate(0 -291.71)">\ <circle class="bound" cx="2.6458" cy="294.35" r="2.4626" style="stroke-opacity:.99497;stroke-width:.26458;" />\ <circle class="dot" cx="2.6458" cy="294.35" r="0.92604" style="fill-rule:evenodd;" />\ </g>\ </svg>\ </div>'); radio.selfReplace(res); res.addChild(radio); for (var i = 0; i < classes.length; ++i) { if (classes[i]) res.addClass(classes[i]); } res.defineEvent('change'); res.defineEvent('uncheck'); res.$input = radio; OOP["a" /* default */].drillProperty(res, res.$input, 'value'); res.on('click', function (event) { if (!res.checked) { if (!this.disabled) { res.checked = true; res.emit('change', event, res); } } }); res.defineAttributes(RadioButton.attribute); Object.defineProperties(res, RadioButton.property); Object.assign(res, RadioButton.prototype); if (radio.checked) res.attr('checked', 'true'); res.$input.on('change', function () { res.checked = this.checked; }); }); }); } ACore["a" /* default */].install('RadioButton'.toLowerCase(), RadioButton); /* harmony default export */ var js_RadioButton = (RadioButton); // CONCATENATED MODULE: ./node_modules/absol-acomp/js/Radio.js var Radio_ = ACore["a" /* default */]._; var Radio_$ = ACore["a" /* default */].$; function Radio_Radio() { var res = Radio_( '<div class="absol-radio">' + ' <input type="radio" />' + ' <svg class="absol-radio-icon absol-radio-icon-left" width="20" height="20" version="1.1" viewBox="0 0 5.2917 5.2917"' + ' xmlns="http://www.w3.org/2000/svg">' + ' <g transform="translate(0 -291.71)">' + ' <circle class="bound" cx="2.6458" cy="294.35" r="2.4626" style="stroke-opacity:.99497;stroke-width:.26458;" />' + ' <circle class="dot" cx="2.6458" cy="294.35" r= "0.92604" style="fill-rule:evenodd;" />' + ' </g>' + ' </svg>' + ' <label style="display:none"></label>' + ' <svg class="absol-radio-icon absol-radio-icon-right" width="20" height="20" version="1.1" viewBox="0 0 5.2917 5.2917"' + ' xmlns="http://www.w3.org/2000/svg">' + ' <g transform="translate(0 -291.71)">' + ' <circle class="bound" cx="2.6458" cy="294.35" r="2.4626" style="stroke-opacity:.99497;stroke-width:.26458;" />' + ' <circle class="dot" cx="2.6458" cy="294.35" r= "0.92604" style="fill-rule:evenodd; " />' + ' </g>' + ' </svg>' + '</div>' ); res.defineEvent('change'); res.$input = Radio_$('input', res); res.$label = Radio_$('label', res); OOP["a" /* default */].drillProperty(res, res.$input, 'value'); res.on('click', function (event) { if (!res.checked) { if (!this.disabled) { res.checked = true; res.emit('change', event, res); } } }); res.sync = res.afterAttached().then(function () { res.checked = res.checked; }); return res; }; Radio_Radio.prototype.getAllFriend = function () { return Radio_Radio.getAllByName(this.name); }; Radio_Radio.prototype.attribute = js_RadioButton; Radio_Radio.property = { checked: { set: function (value) { this.$input.checked = !!value; if (this.checked) { this.addClass('checked'); var _this = this; setTimeout(function () { function finish(event) { if (!_this.checked) { _this.removeClass('checked') document.body.removeEventListener('click', finish, false); } } document.body.addEventListener('click', finish, false); }, 100); } else { this.removeClass('checked'); } }, get: function () { return this.$input.checked; } }, name: { set: function (name) { this.$input.setAttribute('name', name); }, get: function () { return this.$input.getAttribute('name'); } }, text: { set: function (value) { value = (value || '').trim(); this.$label.innerHTML = value; if (value.length == 0) this.$label.addStyle('display', 'none'); else this.$label.removeStyle('display'); }, get: function () { return this.$label.innerHTML; } }, disabled: { set: function (value) { this.$input.disabled = !!value; if (value) { this.addClass('disabled'); } else { this.removeClass('disabled'); } }, get: function () { return this.$input.disabled; } } }; Radio_Radio.getAllByName = function (name) { return (Array.apply(null, document.getElementsByTagName('input')) || []).filter(function (elt) { return elt.getAttribute('type') == 'radio' && elt.getAttribute('name') == name; }); }; Radio_Radio.getValueByName = function (name) { var inputs = Radio_Radio.getAllByName(name); var res = null; var input; for (var i = 0; i < inputs.length; ++i) { input = inputs[i]; if (input.checked) { res = input.value; } } return res; }; ACore["a" /* default */].creator.radio = Radio_Radio; /* harmony default export */ var js_Radio = (Radio_Radio); // EXTERNAL MODULE: ./node_modules/absol-acomp/css/switch.css var css_switch = __webpack_require__(155); // CONCATENATED MODULE: ./node_modules/absol-acomp/js/Switch.js var Switch_ = ACore["a" /* default */]._; var Switch_$ = ACore["a" /* default */].$; function Switch() { var res = Switch_({ tag: 'label', class: 'absol-switch', extendEvent: 'change', child: [ 'input[type="checkbox"]', 'span.absol-switch-slider' ] }); res.$input = Switch_$('input', res); res.on('click', function (event) { res.emit('change', event, res); }); OOP["a" /* default */].drillProperty(res, res.$input, 'checked'); OOP["a" /* default */].drillProperty(res, res.$input, 'isOn', 'checked'); return res; } Switch.attribute = { checked: { set: function (value) { if (value == 'false' || value == null) { this.checked = false; } else { this.checked = true; } }, get: function () { return this.checked ? 'true' : 'false' }, remove: function () { this.checked = false; } }, disabled: { set: function (value) { if (value == 'false' || value == null) { this.disabled = false; } else { this.disabled = true; } }, get: function () { return this.disabled ? 'true' : 'false' }, remove: function () { this.disabled = false; } } }; Switch.property = { disabled: { set: function (value) { this.$input.disabled = !!value; if (value) { this.addClass('disabled'); } else { this.removeClass('disabled'); } }, get: function () { return this.$input.disabled; } } }; ACore["a" /* default */].install('switch', Switch); /* harmony default export */ var js_Switch = (Switch); // EXTERNAL MODULE: ./node_modules/absol-acomp/css/checkbox.css var css_checkbox = __webpack_require__(157); // CONCATENATED MODULE: ./node_modules/absol-acomp/js/CheckBox.js var CheckBox_ = ACore["a" /* default */]._; var CheckBox_$ = ACore["a" /* default */].$; function CheckBox() { var svgIcon = function (pos) { return CheckBox_([ '<svg class="absol-checkbox-icon absol-checkbox-icon-' + pos + '" width="18mm" height="18mm" version="1.1" viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg" >', ' <g transform="translate(0 -279)">', ' <path class="bound" d="m3 279.69h12c1.3434 0.0111 2.3298 1.5259 2.3131 2.4775v11.836c0.05005 0.89373-1.1834 2.2964-2.3131 2.3131h-12c-0.82692 0.0166-2.3131-1.1834-2.3131-2.3131v-12.237c0.0022374-1.171 0.3775-2.0759 2.3131-2.0759z" style="stroke-linejoin:round;"/>', ' <path class="tick" d="m3.1656 288.66c-0.10159 0.0612-0.11743 0.12506-0.12993 0.18899l3.7473 4.3467c0.066638 0.0459 0.11813 0.0263 0.16832 1e-3 0 0 1.7699-4.2166 4.7251-7.4568 1.4783-1.6208 3.2406-3.3659 3.2406-3.3659 0.0054-0.14125-0.10946-0.15807-0.1754-0.22551 0 0-2.5832 1.6364-4.7524 3.8336-1.8697 1.8939-3.6666 4.4016-3.6666 4.4016z"/>', ' </g>', '</svg>'].join('')); } var res = CheckBox_({ class: ['absol-checkbox'], child: [ '<input type="checkbox" />', svgIcon('left'), '<label style="display:none"></label>', svgIcon('right') ] }); res.defineEvent('change'); res.$input = CheckBox_$('input', res); res.$label = CheckBox_$('label', res); res.on('click', function (event) { event.preventDefault(); if (!this.disabled) { res.checked = !res.checked; res.emit('change', event, res); } }); return res; }; //v, labelText, checked CheckBox.attribute = { checked: { set: function (value) { if (value == 'false' || value == null) { this.checked = false; } else { this.checked = true; } }, get: function () { return this.checked ? 'true' : 'false' }, remove: function () { this.checked = false; } }, disabled: { set: function (value) { if (value == 'false' || value == null) { this.disabled = false; } else { this.disabled = true; } }, get: function () { return this.disabled ? 'true' : 'false' }, remove: function () { this.disabled = false; } } }; CheckBox.property = { checked: { set: function (value) { this.$input.checked = !!value; if (this.checked) { this.addClass('checked'); } else { this.removeClass('checked'); } }, get: function () { return this.$input.checked; } }, text: { set: function (value) { value = (value || '').trim(); this.$label.innerHTML = value; if (value.length == 0) this.$label.addStyle('display', 'none'); else this.$label.removeStyle('display'); }, get: function () { return this.$label.innerHTML; } }, disabled: { set: function (value) { this.$input.disabled = !!value; if (value) { this.addClass('disabled'); } else { this.removeClass('disabled'); } }, get: function () { return this.$input.disabled; } } }; ACore["a" /* default */].creator.checkbox = CheckBox; /* harmony default export */ var js_CheckBox = (CheckBox); // CONCATENATED MODULE: ./node_modules/absol-acomp/js/CheckboxButton.js var CheckboxButton_ = ACore["a" /* default */]._; var CheckboxButton_$ = ACore["a" /* default */].$; function CheckBoxButton() { var svgIcon = function (pos) { return CheckboxButton_([ '<svg class="absol-checkbox-icon absol-checkbox-icon-' + pos + '" width="18mm" height="18mm" version="1.1" viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg" >', ' <g transform="translate(0 -279)">', ' <path class="bound" d="m3 279.69h12c1.3434 0.0111 2.3298 1.5259 2.3131 2.4775v11.836c0.05005 0.89373-1.1834 2.2964-2.3131 2.3131h-12c-0.82692 0.0166-2.3131-1.1834-2.3131-2.3131v-12.237c0.0022374-1.171 0.3775-2.0759 2.3131-2.0759z" style="stroke-linejoin:round;"/>', ' <path class="tick" d="m3.1656 288.66c-0.10159 0.0612-0.11743 0.12506-0.12993 0.18899l3.7473 4.3467c0.066638 0.0459 0.11813 0.0263 0.16832 1e-3 0 0 1.7699-4.2166 4.7251-7.4568 1.4783-1.6208 3.2406-3.3659 3.2406-3.3659 0.0054-0.14125-0.10946-0.15807-0.1754-0.22551 0 0-2.5832 1.6364-4.7524 3.8336-1.8697 1.8939-3.6666 4.4016-3.6666 4.4016z"/>', ' </g>', '</svg>'].join('')); } var res = CheckboxButton_({ class: ['absol-checkbox'], child: [ '<input type="checkbox" />', svgIcon('left') ] }); res.defineEvent('change'); res.$input = CheckboxButton_$('input', res); res.$label = CheckboxButton_$('label', res); res.on('click', function (event) { event.preventDefault(); if (!this.disabled) { res.checked = !res.checked; res.emit('change', event, res); } }); return res; }; CheckBoxButton.attribute = { checked: { set: function (value) { if (value == 'false' || value == null) { this.checked = false; } else { this.checked = true; } }, get: function () { return this.checked ? 'true' : 'false' }, remove: function () { this.checked = false; } }, disabled: { set: function (value) { if (value == 'false' || value == null) { this.disabled = false; } else { this.disabled = true; } }, get: function () { return this.disabled ? 'true' : 'false' }, remove: function () { this.disabled = false; } } }; CheckBoxButton.property = { checked: { set: function (value) { this.$input.checked = !!value; if (this.checked) { this.addClass('checked'); } else { this.removeClass('checked'); } }, get: function () { return this.$input.checked; } }, disabled: { set: function (value) { this.$input.disabled = !!value; if (value) { this.addClass('disabled'); } else { this.removeClass('disabled'); } }, get: function () { return this.$input.disabled; } } }; CheckBoxButton.initAfterLoad = function () { return Dom["a" /* default */].documentReady.then(function () { Array.apply(null, document.getElementsByTagName('input')).filter(function (e) { return e.getAttribute('type') == 'checkbox' && e.classList.contains('absol-checkbox'); }).forEach(function (checkbox) { CheckboxButton_$(checkbox); checkbox.removeClass('absol-radio'); var classes = checkbox.attr('class').trim().split(/\s+/); var svgIcon = function (pos) { return CheckboxButton_([ '<svg class="absol-checkbox-icon absol-checkbox-icon-' + pos + '" width="18mm" height="18mm" version="1.1" viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg" >', ' <g transform="translate(0 -279)">', ' <path class="bound" d="m3 279.69h12c1.3434 0.0111 2.3298 1.5259 2.3131 2.4775v11.836c0.05005 0.89373-1.1834 2.2964-2.3131 2.3131h-12c-0.82692 0.0166-2.3131-1.1834-2.3131-2.3131v-12.237c0.0022374-1.171 0.3775-2.0759 2.3131-2.0759z" style="stroke-linejoin:round;"/>', ' <path class="tick" d="m3.1656 288.66c-0.10159 0.0612-0.11743 0.12506-0.12993 0.18899l3.7473 4.3467c0.066638 0.0459 0.11813 0.0263 0.16832 1e-3 0 0 1.7699-4.2166 4.7251-7.4568 1.4783-1.6208 3.2406-3.3659 3.2406-3.3659 0.0054-0.14125-0.10946-0.15807-0.1754-0.22551 0 0-2.5832 1.6364-4.7524 3.8336-1.8697 1.8939-3.6666 4.4016-3.6666 4.4016z"/>', ' </g>', '</svg>'].join('')); } var res = CheckboxButton_({ class: ['absol-checkbox'], child: [ svgIcon('left') ] }); checkbox.selfReplace(res); res.addChild(checkbox); for (var i = 0; i < classes.length; ++i) { if (classes[i]) res.addClass(classes[i]); } res.defineEvent('change'); res.$input = CheckboxButton_$('input', res); res.$label = CheckboxButton_$('label', res); res.$input = checkbox; res.on('click', function (event) { if (event.target == checkbox){ if (checkbox.checked) { this.addClass('checked'); } else { this.removeClass('checked'); } res.emit('change', event, res); } else{ event.preventDefault(); if (!this.disabled) { res.checked = !res.checked; res.emit('change', event, res); } } }); res.defineAttributes(CheckBoxButton.attribute); Object.defineProperties(res, CheckBoxButton.property); Object.assign(res, CheckBoxButton.prototype); if (checkbox.checked) res.attr('checked', 'true'); if (checkbox.disabled) res.attr('disabled', 'true'); }); }); } ACore["a" /* default */].install('CheckBoxButton'.toLowerCase(), CheckBoxButton); /* harmony default export */ var CheckboxButton = (CheckBoxButton); // EXTERNAL MODULE: ./node_modules/absol-acomp/css/candyboxbutton.css var candyboxbutton = __webpack_require__(159); // CONCATENATED MODULE: ./node_modules/absol-acomp/js/CandyBoxButton.js var CandyBoxButton_ = Svg["a" /* default */].ShareInstance._; var CandyBoxButton_$ = Svg["a" /* default */].ShareInstance.$; function CandyBoxButton() { var res = CandyBoxButton_({ tag: 'svg', attr: { width:'18', height:'18', }, child: [{ tag: 'rect', class:'absol-candy-box-border', attr: { x:'0.5', y:'0.5', width:'17', height:'17' } }] }); res._paths = {}; res._status = 'none'; return res; } CandyBoxButton.prototype.addPath = function (statusName, pathString) { }; CandyBoxButton.prototype.removePath = function (statusName) { }; CandyBoxButton.property = {}; CandyBoxButton.property.status = { set: function (value) { value = value || 'none'; }, get: function () { return this._status || 'none'; } }; CandyBoxButton.property.paths = { get: function () { return this._paths; } }; ACore["a" /* default */].install('candyboxbutton', CandyBoxButton); //not completed yet // CONCATENATED MODULE: ./node_modules/absol-acomp/js/TextClipboard.js var TextClipboard_ = ACore["a" /* default */]._; var TextClipboard_$ = ACore["a" /* default */].$; function TextClipboard() { var res = TextClipboard_({ style: { positon: 'fixed', opacity: 0, width: '1px', height: '1px', top: 0, left: 0 } }); res.$textarea = TextClipboard_('<textarea class="absol-text-clipboard" wrap="off" autocorrect="off"' + ' autocapitalize="off" spellcheck="false"></textarea>').addTo(res); return res; }; TextClipboard.prototype.copy = function (text) { this.$textarea.value = text; this.$textarea.select(); document.execCommand('copy'); }; TextClipboard.prototype.paste = function () { this.$textarea.select(); document.execCommand('paste'); }; ACore["a" /* default */].creator.textclipboard = TextClipboard; /* harmony default export */ var js_TextClipboard = (TextClipboard); // EXTERNAL MODULE: ./node_modules/absol-acomp/css/editabletext.css var editabletext = __webpack_require__(161); // CONCATENATED MODULE: ./node_modules/absol-acomp/js/EditableText.js var EditableText_ = ACore["a" /* default */]._; var EditableText_$ = ACore["a" /* default */].$; function EditableText() { var res = EditableText_({ class: 'absol-editabe-text', extendEvent: ['blur', 'focus', 'change', 'modify'], child: [ { class: 'absol-editabe-text-higne', child: '<input type="text">' }, 'span' ] }); res.$span = EditableText_$('span', res); res.$text = document.createTextNode(''); res.$span.addChild(res.$text); res.$higne = EditableText_$('.absol-editabe-text-higne', res); res.$input = EditableText_$('input', res); OOP["a" /* default */].drillProperty(res, res.$input, ['selectionStart', 'selectionEnd']); res.eventHanler = OOP["a" /* default */].bindFunctions(res, EditableText.eventHanler); res.sync = new Promise(function (rs) { EditableText_('attachhook').addTo(res).once('error', rs); }); res.$input.on('keydown', res.eventHanler.inputKeyDown, true); res.$input.on('change', res.eventHanler.inputChange); res.$input.on('blur', res.eventHanler.inputBlur); return res; }; EditableText.prototype.focus = function () { this.$input.focus(); }; EditableText.prototype.blur = function () { this.$input.blur(); }; EditableText.prototype.select = function () { this.$input.select(); }; EditableText.prototype.edit = function (flag, select) { this.editing = !!flag; this.sync = this.sync.then(function () { if (flag) { this.focus(); if (select) this.select(); } else this.blur(); }.bind(this)); return this.sync; } EditableText.prototype._update = function () { this.sync = this.sync.then(function () { return new Promise(function (rs) { // setTimeout(function () { var bound = this.getBoundingClientRect(); var higneBound = this.$higne.getBoundingClientRect(); var fsize = this.getFontSize(); this.$input.addStyle('width', bound.width + 4 + fsize * 0 + 'px'); this.$input.addStyle('height', bound.height + 4 + 'px'); this.$input.addStyle('left', bound.left - higneBound.left - 2 + 'px'); this.$input.addStyle('top', bound.top - higneBound.top + 'px'); rs(); }.bind(this)); }.bind(this)); } EditableText.property = {}; EditableText.property.text = { set: function (value) { this.$text.textContent = value; this.$input.value = value; }, get: function () { return this.$text.textContent; } } EditableText.property.editing = { set: function (value) { if (this._editting === value) return; this._editting = !!value; if (value) { this.$input.value = this.text; this._update(); this.sync = this.sync.then(function () { this.addClass('editing'); this.$input.value = this.text; this.$input.addStyle('font', this.$span.getComputedStyleValue('font')); this.$input.addStyle('font-style', this.$span.getComputedStyleValue('font-style')); this.$input.addStyle('color', this.$span.getComputedStyleValue('color')); }.bind(this)); } else { this.removeClass('editing'); } }, get: function () { return !!this._editting; } }; EditableText.eventHanler = {}; EditableText.eventHanler.inputKeyDown = function (event) { requestAnimationFrame(function () { this.text = this.$input.value; this._update(); event.text = this.text; this.emit('modify', event); }.bind(this)); }; EditableText.eventHanler.inputChange = function (event) { this.editing = false; this.emit('change', event); }; EditableText.eventHanler.inputBlur = function (event) { this.editing = false; this.emit('blur', event); }; ACore["a" /* default */].creator.editabletext = EditableText; /* harmony default export */ var js_EditableText = (EditableText); // EXTERNAL MODULE: ./node_modules/absol-acomp/css/widthheightresizer.css var widthheightresizer = __webpack_require__(163); // CONCATENATED MODULE: ./node_modules/absol-acomp/js/Draggable.js function Draggable(element) { if (!element) element = ACore["a" /* default */]._('div'); else ACore["a" /* default */].$(element); element.defineEvent(['predrag', 'drag', 'begindrag', 'enddrag']); var body = ACore["a" /* default */].$('body'); var isMoving = false; var firstMove = false; var offsetX; var offsetY; var fontSize; var left0em, top0em, left0, top0; var finishMoving = function (event) { if (isMoving) { isMoving = false; body.off('mousemove', mouseMoveEventHandler); event.moveDX = event.clientX - offsetX; event.moveDY = event.clientY - offsetY; event.moveDXem = event.moveDX / fontSize; event.moveDYem = event.moveDY / fontSize; event.moveToX = left0 + event.moveDX; event.moveToY = top0 + event.moveDY; element.emit('enddrag', event); } }; var mouseUpEventHandler = function (event) { finishMoving(event); }; var mouseMoveEventHandler = function (event) { event.preventDefault(); event.moveDX = event.clientX - offsetX; event.moveDY = event.clientY - offsetY; event.moveDXem = event.moveDX / fontSize; event.moveDYem = event.moveDY / fontSize; event.moveToX = left0 + event.moveDX; event.moveToY = top0 + event.moveDY; event.moveToXem = left0em + event.moveDXem; event.moveToYem = top0em + event.moveDYem; if (firstMove) { firstMove = false; element.emit('begindrag', event); } element.emit('drag', event); }; var mouseOutEventHandler = function (event) { finishMoving(event); }; var mouseDownEventHandler = function (event) { isMoving = true; firstMove = true; body.on('mousemove', mouseMoveEventHandler); body.once('mouseleave', mouseOutEventHandler); body.once('mouseup', mouseUpEventHandler); fontSize = this.getFontSize(); offsetX = event.clientX; offsetY = event.clientY; left0 = parseFloat(element.getComputedStyleValue('left').replace('px', '')); top0 = parseFloat(element.getComputedStyleValue('top').replace('px', '')); left0em = left0 / fontSize; top0em = top0 / fontSize; event.x0 = left0; event.y0 = top0; event.y0em = left0em; event.y0em = top0em; element.emit('predrag', event); }; element.on('mousedown', mouseDownEventHandler); return element; }; /* harmony default export */ var js_Draggable = (Draggable); // CONCATENATED MODULE: ./node_modules/absol-acomp/js/WidthHeightSizer.js var WidthHeightSizer_ = ACore["a" /* default */]._; var WidthHeightSizer_$ = ACore["a" /* default */].$; function WidthHeightResizer() { var res = WidthHeightSizer_({ extendEvent: 'sizechange', class: 'absol-width-height-resizer', child: ['.absol-width-height-resizer-content', '.absol-width-height-resizer-anchor-bot-right', '.absol-width-height-resizer-anchor-bot-left', '.absol-width-height-resizer-anchor-top-right', '.absol-width-height-resizer-anchor-top-left' ] }); res.eventHandler = OOP["a" /* default */].bindFunctions(res, WidthHeightResizer.eventHandler); res.$anchorBotRight = WidthHeightSizer_$('.absol-width-height-resizer-anchor-bot-right', res); res.$anchorTopRight = WidthHeightSizer_$('.absol-width-height-resizer-anchor-top-right', res); res.$anchorBotLeft = WidthHeightSizer_$('.absol-width-height-resizer-anchor-bot-left', res); res.$anchorTopLeft = WidthHeightSizer_$('.absol-width-height-resizer-anchor-top-left', res); res.$content = WidthHeightSizer_$('.absol-width-height-resizer-content', res); js_Draggable(res.$anchorBotRight).on('drag', res.eventHandler.dragBotRight).on('predrag', res.eventHandler.preDrag); js_Draggable(res.$anchorTopRight).on('drag', res.eventHandler.dragTopRight).on('predrag', res.eventHandler.preDrag); js_Draggable(res.$anchorBotLeft).on('drag', res.eventHandler.dragBotLeft).on('predrag', res.eventHandler.preDrag); js_Draggable(res.$anchorTopLeft).on('drag', res.eventHandler.dragTopLeft).on('predrag', res.eventHandler.preDrag); return res; } ['addChild', 'addChildBefore', 'addChildAfter', 'clearChild'].forEach(function (key) { WidthHeightResizer.prototype[key] = function () { return this.$content[key].apply(this.$content, arguments); } }); WidthHeightResizer.eventHandler = {}; WidthHeightResizer.eventHandler.preDrag = function (event) { this._whrWidth = parseFloat(this.getComputedStyleValue('width').replace('px', '')); this._whrHeight = parseFloat(this.getComputedStyleValue('height').replace('px', '')); }; WidthHeightResizer.eventHandler.dragBotRight = function (event) { var newEvent = { target: this, data: {} }; if (event.moveDX != 0) { this.addStyle('width', this._whrWidth + event.moveDX + 'px'); newEvent.data.changeWidth = true; } if (event.moveDY != 0) { this.addStyle('height', this._whrHeight + event.moveDY + 'px'); newEvent.data.changeHeight = true; } newEvent.data.height = this.getComputedStyleValue('height'); newEvent.data.width = this.getComputedStyleValue('width'); this.emit('sizechange', newEvent); }; WidthHeightResizer.eventHandler.dragTopRight = function (event) { var newEvent = { target: this, data: {} }; if (event.moveDX != 0) { this.addStyle('width', this._whrWidth + event.moveDX + 'px'); newEvent.data.changeWidth = true; } if (event.moveDY != 0) { this.addStyle('height', this._whrHeight - event.moveDY + 'px'); newEvent.data.changeHeight = true; } newEvent.data.height = this.getComputedStyleValue('height'); newEvent.data.width = this.getComputedStyleValue('width'); this.emit('sizechange', newEvent); }; WidthHeightResizer.eventHandler.dragBotLeft = function (event) { var newEvent = { target: this, data: {} }; if (event.moveDX != 0) { this.addStyle('width', this._whrWidth - event.moveDX + 'px'); newEvent.data.changeWidth = true; } if (event.moveDY != 0) { this.addStyle('height', this._whrHeight + event.moveDY + 'px'); newEvent.data.changeHeight = true; } newEvent.data.height = this.getComputedStyleValue('height'); newEvent.data.width = this.getComputedStyleValue('width'); this.emit('sizechange', newEvent); }; WidthHeightResizer.eventHandler.dragTopLeft = function (event) { var newEvent = { target: this, data: {} }; if (event.moveDX != 0) { this.addStyle('width', this._whrWidth - event.moveDX + 'px'); newEvent.data.changeWidth = true; } if (event.moveDY != 0) { this.addStyle('height', this._whrHeight - event.moveDY + 'px'); newEvent.data.changeHeight = true; } newEvent.data.height = this.getComputedStyleValue('height'); newEvent.data.width = this.getComputedStyleValue('width'); this.emit('sizechange', newEvent); }; ACore["a" /* default */].creator.widthheightresizer = WidthHeightResizer; /* harmony default export */ var WidthHeightSizer = (WidthHeightResizer); // CONCATENATED MODULE: ./node_modules/absol/src/Math/Vec2.js function Vec2(x, y) { this.x = x; this.y = y; } Vec2.prototype.copy = function () { return new Vec2(this.x, this.y); }; Vec2.prototype.toString = function () { return "(" + this.x + ", " + this.y + ")"; }; Vec2.prototype.abs = function () { return Math.sqrt(this.x * this.x + this.y * this.y); }; Vec2.prototype.normalized = function () { var l = this.abs(); if (l == 0) l = 1; return this.div(l); }; Vec2.prototype.mult = function (h) { return new Vec2(this.x * h, this.y * h); }; Vec2.prototype.div = function (h) { return new Vec2(this.x / h, this.y / h); }; Vec2.prototype.dist = function (v) { var dx = v.x - this.x; var dy = v.y - this.y; return Math.sqrt(dx * dx + dy * dy); }; Vec2.prototype.sub = function (v) { return new Vec2(this.x - v.x, this.y - v.y); }; Vec2.prototype.add = function (v) { return new Vec2(this.x + v.x, this.y + v.y); }; Vec2.prototype.inv = function () { return new Vec2(-this.x, -this.y); }; Vec2.prototype.linear = function (v, h) { return new Vec2(this.x * (1 - h) + v.x * h, this.y * (1 - h) + v.y * h); }; Vec2.prototype.dot = function (v1) { return this.x * v1.x + this.y * v1.y; }; Vec2.prototype.direction = function () { return Math.atan2(this.y, this.x); }; Vec2.fromDirection = function (angle) { return new Vec2(Math.cos(angle), Math.sin(angle)); }; 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 */ var Math_Vec2 = (Vec2); // CONCATENATED MODULE: ./node_modules/absol/src/Math/Rectangle.js /** * * @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; } Rectangle.prototype.A = function () { return new Math_Vec2(this.x, this.y); }; Rectangle.prototype.B = function () { return new Math_Vec2(this.x + this.width, this.y); }; Rectangle.prototype.C = function () { return new Math_Vec2(this.x + this.width, this.y + this.height); }; Rectangle.prototype.D = function () { return new Math_Vec2(this.x, this.y + this.height); }; Rectangle.prototype.square = function () { return this.width * this.height; }; Rectangle.prototype.nearestPoint = function (arg0, arg1) { if (arg1) arg0 = Math_Vec2.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 Math_Vec2(this.x + this.width / 2, this.y + this.height / 2); }; 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; }; Rectangle.prototype.collapsedSquare = function (r) { var margin = 0; var maxX, minX, maxY, minY; if (this.x > r.x + r.width + margin) return 0; if (this.y > r.y + r.height + margin) return 0; if (r.x > this.x + this.width + margin) return 0; if (r.y > this.y + this.height + margin) return 0; minX = this.x > r.x ? this.x : r.x; minY = this.y > r.y ? this.y : r.y; maxX = this.x + this.width < r.x + r.width ? this.x + this.width : r.x + r.width; maxY = this.y + this.height < r.y + r.height ? this.y + this.height : r.y + r.height; return (maxX - minX) * (maxY - minY); }; Rectangle.prototype.collapsedRect = function (r) { var margin = 0; var maxX, minX, maxY, minY; if (this.x > r.x + r.width + margin) return null; if (this.y > r.y + r.height + margin) return null; if (r.x > this.x + this.width + margin) return null; if (r.y > this.y + this.height + margin) return null; minX = this.x > r.x ? this.x : r.x; minY = this.y > r.y ? this.y : r.y; maxX = this.x + this.width < r.x + r.width ? this.x + this.width : r.x + r.width; maxY = this.y + this.height < r.y + r.height ? this.y + this.height : r.y + r.height; return new Rectangle(minX, minX, maxX - minX, maxY - minY); }; /** * @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 {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} clientRect * @returns {Rectangle} */ Rectangle.fromClientRect = function (clientRect) { return new Rectangle(clientRect.left, clientRect.top, clientRect.width, clientRect.height); }; /* harmony default export */ var Math_Rectangle = (Rectangle); // CONCATENATED MODULE: ./node_modules/absol-acomp/js/Follower.js var Follower_ = ACore["a" /* default */]._; var Follower_$ = ACore["a" /* default */].$; function Follower() { var res = Follower_({ class: 'absol-follower', child: ['.absol-follower-content-container', 'attachhook'], }); res.$attachHook = Follower_$('attachhook', res) .on('error', function () { res.updatePosition(); this.updateSize = this.updateSize || res.updatePosition.bind(this); Dom["a" /* default */].addToResizeSystem(res); }); res.$contentCtn = Follower_$('.absol-follower-content-container', res); res.$followTarget = undefined; res.$scrollTrackElts = []; res._scrollTrackEventHandler = undefined; res._anchor = Follower.ANCHOR_PRIORITY; return res; } ['addChild', 'addChildBefore', 'addChildAfter', 'clearChild'].forEach(function (key) { Follower.prototype[key] = function () { return this.$contentCtn[key].apply(this.$contentCtn, arguments); } }) /** * X = $target.x + F[anchor_index][0] * $target.width + F[anchor_index][1] * $content.width * Y = $target.y + F[anchor_index][2] * $target.height + F[anchor_index][3] * $content.height */ Follower.ANCHOR_FACTORS = [ [1, 0, 0, 0],//0 [0, 0, 1, 0],//1 [1, -1, 1, 0],//2 [0, -1, 0, 0],//3 [0, -1, 1, -1],//4 [1, -1, 0, -1],//5 [0, 0, 0, -1],//6 [1, 0, 1, -1],//7 [1, 0, 0.5, -0.5],//8 [0.5, -0.5, 1, 0],//9 [0, -1, 0.5, -0.5],//10 [0.5, -0.5, 0, -1],//11 [1, 0, 1, 0],//12 [0, -1, 1, 0],//13 [0, -1, 0, -1],//14 [1, 0, 0, -1],//15 ]; Follower.ANCHOR_PRIORITY = [1, 6, 2, 5, 0, 7, 3, 4, 9, 11, 8, 10, 12, 15, 13, 14]; Follower.prototype.updatePosition = function () { if (!this.$followTarget) return; var contentCtnBound = this.$contentCtn.getBoundingClientRect(); var targetBound = this.$followTarget.getBoundingClientRect(); var outRect = Math_Rectangle.fromClientRect(Dom["a" /* default */].traceOutBoundingClientRect(this)); var bound = this.getBoundingClientRect(); var x = 0; var y = 0; var score; var anchors = this._lastAnchor === undefined ? this.anchor : [this._lastAnchor].concat(this.anchor); var factor; var bestX, bestY, bestScore = -100000; var newContentRect; var bestAnchor; for (var i = 0; i < anchors.length; ++i) { factor = Follower.ANCHOR_FACTORS[anchors[i]]; x = targetBound.left + factor[0] * targetBound.width + factor[1] * contentCtnBound.width; y = targetBound.top + factor[2] * targetBound.height + factor[3] * contentCtnBound.height; newContentRect = new Math_Rectangle(x, y, contentCtnBound.width, contentCtnBound.height); score = newContentRect.collapsedSquare(outRect); if (score - 10 > bestScore) { bestAnchor = anchors[i]; bestScore = score; bestX = x; bestY = y; } } this._lastAnchor = bestAnchor; bestX -= bound.left; bestY -= bound.top; this.$contentCtn.addStyle({ left: bestX + 'px', top: bestY + 'px' }); }; Follower.prototype.refollow = function () { if (!this.$followTarget) return; this.addClass('following'); if (this._scrollTrackEventHandler) this.unfollow(); this._scrollTrackEventHandler = this.updatePosition.bind(this); this.$scrollTrackElts = []; var trackElt = this.$followTarget; while (trackElt) { if (trackElt.addEventListener) trackElt.addEventListener('scroll', this._scrollTrackEventHandler, false); else trackElt.attachEvent('onscroll', this._scrollTrackEventHandler, false); this.$scrollTrackElts.push(trackElt); trackElt = trackElt.parentElement; } if (document.addEventListener) { document.addEventListener('scroll', this._scrollTrackEventHandler, false); } else { document.attachEvent('onscroll', this._scrollTrackEventHandler, false); } this.$scrollTrackElts.push(document); }; Follower.prototype.unfollow = function () { if (!this._scrollTrackEventHandler) return;// nothing to do this.removeClass('following'); var trackElt; for (var i = 0; i < this.$scrollTrackElts.length; ++i) { trackElt = this.$scrollTrackElts[i]; if (trackElt.removeEventListener) trackElt.removeEventListener('scroll', this._scrollTrackEventHandler, false); else trackElt.dettachEvent('onscroll', this._scrollTrackEventHandler, false); } this.$scrollTrackElts = []; this._scrollTrackEventHandler = undefined; }; Follower.property = {}; Follower.property.followTarget = { set: function (elt) { if (elt === null || elt === undefined || !elt) { this.unfollow(); this.$followTarget = undefined; } else if (typeof elt == 'string') { elt = Follower_$(elt) || document.getElementById(elt); } if (Dom["a" /* default */].isDomNode(elt)) { this.$followTarget = elt; this._lastAncho = undefined; this.refollow(); this.updatePosition(); } else throw new Error("Invalid element"); }, get: function () { return this.$followTarget; } } Follower.property.anchor = { set: function (value) { value = value || Follower.ANCHOR_PRIORITY; if (value == 'auto') value = Follower.ANCHOR_PRIORITY; if (typeof value == null) value = [value]; if (!(value instanceof Array)) throw new Error('Invalid anchor ' + value); value = value.map(function (x) { x = Math.floor(x); if (x >= 0 && x < Follower.ANCHOR_FACTORS.length) { return x; } else throw new Error("Invalid anchor: " + x); }); this._anchor = value; this._lastAnchor = undefined; this.updatePosition(); }, get: function () { return this._anchor; } } ACore["a" /* default */].install('follower', Follower); /* harmony default export */ var js_Follower = (Follower); // EXTERNAL MODULE: ./node_modules/absol-acomp/css/follower.css var follower = __webpack_require__(165); // EXTERNAL MODULE: ./node_modules/absol-acomp/css/tooltip.css var tooltip = __webpack_require__(167); // CONCATENATED MODULE: ./node_modules/absol-acomp/js/Tooltip.js var Tooltip_ = ACore["a" /* default */]._; var Tooltip_$ = ACore["a" /* default */].$; function ToolTip() { var res = Tooltip_({ class: 'absol-tooltip', child: [ { class: 'absol-tooltip-content', child: '<span>No</span>' }, '.absol-tooltip-arrow' ] }); res.$content = Tooltip_$('.absol-tooltip-content', res); res.$arrow = Tooltip_$('.absol-tooltip-arrow', res); return res; } ['addChild', 'addChildBefore', 'addChildAfter', 'clearChild'].forEach(function (key) { ToolTip.prototype[key] = function () { return this.$content[key].apply(this.$content, arguments); } }); ACore["a" /* default */].install('tooltip', ToolTip); ToolTip.$root = Tooltip_('.absol-tooltip-root').addStyle('visibility', 'hidden'); ToolTip.$holder = Tooltip_('.absol-tooltip-root-holder').addTo(ToolTip.$root); ToolTip.$tooltip = Tooltip_('tooltip.top').addTo(ToolTip.$holder); ToolTip.$element = undefined; ToolTip.$content = undefined; ToolTip._orientation = 'top'; ToolTip._session = Math.random() * 10000000000 >> 0; ToolTip.updatePosition = function () { var element = ToolTip.$element; if (!element) return; var orientation = ToolTip._orientation; var tBound = ToolTip.$tooltip.getBoundingClientRect(); var rBound = ToolTip.$root.getBoundingClientRect(); var ebound = element.getBoundingRecursiveRect(); var dx, dy; if (orientation == 'top') { dy = ebound.top - rBound.top - tBound.height; dx = ebound.left + ebound.width / 2 - rBound.left - tBound.width / 2; } else if (orientation == 'left') { dy = ebound.top + ebound.height / 2 - rBound.top - tBound.height / 2; dx = ebound.left - rBound.left - tBound.width; } else if (orientation == 'right') { dy = ebound.top + ebound.height / 2 - rBound.top - tBound.height / 2; dx = ebound.right - rBound.left; } else if (orientation == 'bottom') { dy = ebound.bottom - rBound.top; dx = ebound.left + ebound.width / 2 - rBound.left - tBound.width / 2; } else { throw new Error("Invalid orientation, orientation:['left', 'right', 'top', 'bottom', 'auto'] "); } ToolTip.$holder.addStyle({ top: dy + 'px', left: dx + 'px' }); }; ToolTip.$tooltip.$arrow.updateSize = ToolTip.updatePosition.bind(ToolTip); ToolTip.show = function (element, content, orientation) { if (typeof content == 'string') { content = Tooltip_({ tag: 'span', style: { 'white-space': 'nowrap' }, props: { innerHTML: content } }); } Tooltip_$('', content, function (elt) { if (elt.tagName == "IMG" && elt.src) { Dom["a" /* default */].waitImageLoaded(elt).then(ToolTip.updatePosition.bind(ToolTip));; } else if (elt.sync) { elt.sync.then(ToolTip.updatePosition.bind(ToolTip)); } }); var currentSession = Math.random() * 10000000000 >> 0; ToolTip.$root.addTo(document.body); Dom["a" /* default */].addToResizeSystem(ToolTip.$tooltip.$arrow); ToolTip.$element = element; ToolTip._session = currentSession; ToolTip.$content = content; ToolTip._orientation = orientation; ToolTip.$tooltip.clearChild().addChild(content); ToolTip.$root.removeStyle('visibility'); ToolTip.$tooltip.removeClass('top').removeClass('left').removeClass('right').removeClass('bottom'); ToolTip.$tooltip.addClass(orientation); ToolTip.updatePosition(); return currentSession; }; ToolTip.closeTooltip = function (session) { if (session === true || session === this._session) { ToolTip.$root.addStyle('visibility', 'hidden'); ToolTip.$tooltip.clearChild(); ToolTip.$holder.addStyle({ top: false, left: false }); } } ToolTip.showWhenClick = function (element, content, orientation) { var mSession = undefined; element.addEventListener('click', function () { if (mSession !== undefined) return; mSession = ToolTip.show(element, content, orientation); var finish = function (event) { if (!EventEmitter["a" /* default */].hitElement(content, event)) { Tooltip_$(document.body).off('click', finish); ToolTip.closeTooltip(mSession); mSession = undefined; } }; setTimeout(function () { Tooltip_$(document.body).on('click', finish); }, 100) }); }; /* harmony default export */ var Tooltip = (ToolTip); // EXTERNAL MODULE: ./node_modules/absol-acomp/css/frame.css var css_frame = __webpack_require__(169); // EXTERNAL MODULE: ./node_modules/absol-acomp/css/frameview.css var frameview = __webpack_require__(171); // CONCATENATED MODULE: ./node_modules/absol-acomp/js/Frame.js var Frame_ = ACore["a" /* default */]._; var Frame_$ = ACore["a" /* default */].$; function Frame() { var res = Frame_({ class: 'absol-frame', attr: { id: randomIdent(12), }, extendEvent: ['attached', 'detached', 'deactive', 'active']// deactive and active event will be send by parent }); res.$parent = null;// FrameView or TabView return res; } Frame.prototype.notifyAttached = function (parentElt) { this.$parent = parentElt; this.emit('attached', { type: 'attached', target: this, parentElt: parentElt }, this); }; Frame.prototype.notifyDetached = function () { this.emit('detached', { type: 'detached', target: this, parentElt: this.$parent }, this); this.$parent = undefined; }; Frame.prototype.selfRemove = function () { if (this.$parent) this.$parent.removeChild(this); else this.super();// normal remove }; Frame.prototype.getParent = function () { return this.$parent; }; Frame.prototype.requestActive = function(){ if (this.$parent){ this.$parent.activeFrame(this); } }; ACore["a" /* default */].install('frame', Frame); /* harmony default export */ var js_Frame = (Frame); // CONCATENATED MODULE: ./node_modules/absol-acomp/js/FrameView.js var FrameView_ = ACore["a" /* default */]._; var FrameView_$ = ACore["a" /* default */].$; function FrameView() { var res = FrameView_({ class: 'absol-frame-view', extendEvent: ['activeframe', 'deactiveframe'] }); res.$containers = []; return res; } FrameView.prototype.addChild = function (elt) { if (elt.containsClass && elt.containsClass('absol-frame')) { elt.selfRemove(); var containerElt = FrameView_({ class: 'absol-frame-view-frame-container', child: elt, props: { __elt__: elt } }); this.$containers.push(containerElt); this.appendChild(containerElt); elt.notifyAttached(this); } else { throw new Error('Children must be a frame'); } }; FrameView.prototype.addChildBefore = function (elt, at) { if (elt.containsClass && elt.containsClass('absol-frame')) { elt.selfRemove(); var index = this.childIndexOf(at); if (index < 0) { throw new Error('Second param is not a child'); } var index = this.childIndexOf(at); var atCtnElt = this.$containers[index]; var containerElt = FrameView_({ class: 'absol-frame-view-frame-container', child: elt, props: { __elt__: elt } }); this.$containers.splice(index, 0, containerElt); this.super(containerElt, atCtnElt); elt.notifyAttached(this); } else { throw new Error('Children must be a frame'); } }; FrameView.prototype.addChildAfter = function (elt, at) { if (elt.containsClass && elt.containsClass('absol-frame')) { elt.selfRemove(); var index = this.childIndexOf(at); if (index < 0) { throw new Error('Second param is not a child'); } var index = this.childIndexOf(at); var atCtnElt = this.$containers[index]; var containerElt = FrameView_({ class: 'absol-frame-view-frame-container', child: elt, props: { __elt__: elt } }); this.$containers.splice(index + 1, 0, containerElt); this.super(containerElt, atCtnElt); elt.notifyAttached(this); } else { throw new Error('Children must be a frame'); } }; FrameView.prototype.removeChild = function (elt) { var ctnEltIndex = this.childIndexOf(elt) if (ctnEltIndex >= 0) { var ctnElt = this.$containers[ctnEltIndex]; this.$containers.splice(ctnEltIndex, 1); this.super(ctnElt); } else { throw new Error('Removed element is not a child!'); } }; FrameView.prototype.childIndexOf = function (elt) { for (var i = 0; i < this.$containers.length; ++i) { if (this.$containers[i].__elt__ == elt) return i; } return -1; }; FrameView.prototype.findChildBefore = function (elt) { var eltIndex = this.childIndexOf(elt); if (eltIndex < 0) return -1; return this.$containers[eltIndex - 1]; }; FrameView.prototype.findChildAfter = function (elt) { var eltIndex = this.childIndexOf(elt); if (eltIndex < 0) return -1; return this.$containers[eltIndex + 1]; }; FrameView.prototype.clearChild = function () { while (this.$containers.length > 0) { this.removeChild(this.$containers[0].__elt__); } return this; }; FrameView.prototype.findChildById = function (id) { var elt; for (var i = 0; i < this.$containers.length; ++i) { elt = this.$containers[i].__elt__; if (elt.getAttribute('id') == id) return elt; } return undefined; }; FrameView.prototype.getAllChild = function () { return this.$containers.map(function (ctnElt) { return ctnElt.__elt__; }); }; FrameView.prototype.activeFrame = function (frameElt) { var ctnElt, elt; for (var i = 0; i < this.$containers.length; ++i) { ctnElt = this.$containers[i]; elt = ctnElt.__elt__; if (frameElt == elt) { if (!ctnElt.containsClass('absol-active')) { ctnElt.addClass('absol-active'); this.notifyActiveFrame(elt); } // else do nothing } else { if (ctnElt.containsClass('absol-active')) { ctnElt.removeClass('absol-active'); this.notifyDeactiveFrame(elt); } // else do nonthing } } return this; }; FrameView.prototype.notifyActiveFrame = function (frameElt, originEvent) { frameElt.emit('active', {target:frameElt, type:'active', originEvent: originEvent}); this.emit('activeframe', { type: 'activeframe', target: this, frameElt: frameElt, originEvent: originEvent }, this); }; FrameView.prototype.notifyDeactiveFrame = function (frameElt, originEvent) { this.emit('deactiveframe', { type: 'deactiveframe', target: this, frameElt: frameElt, originEvent: originEvent }, this); }; FrameView.prototype.activeFrameById = function (id) { var frameElt = this.findChildById(id); if (frameElt) this.activeFrame(frameElt); return this; }; ACore["a" /* default */].install('frameview', FrameView); /* harmony default export */ var js_FrameView = (FrameView); // EXTERNAL MODULE: ./node_modules/absol-acomp/css/tabview.css var tabview = __webpack_require__(173); // CONCATENATED MODULE: ./node_modules/absol-acomp/js/TabBar.js var TabBar_ = ACore["a" /* default */]._; var TabBar_$ = ACore["a" /* default */].$; function TabBar() { var res = TabBar_('hscroller.absol-tabbar'); res.defineEvent(['active', 'close']); res.on('wheel', function (event) { var lastLeft = this.$viewport.scrollLeft; if (event.deltaY > 1) { this.$viewport.scrollLeft += 50; } else if (event.deltaY < -1) { this.$viewport.scrollLeft -= 50; } if (lastLeft != this.$viewport.scrollLeft) event.preventDefault(); }); res._tabs = []; return res; }; TabBar.prototype.getAllTabButtons = function () { var buttons = []; TabBar_$('tabbutton', this, function (e) { buttons.push(e); }); return buttons; }; TabBar.prototype.getButtonByIdent = function (ident) { return TabBar_$('tabbutton#tab-' + ident, this); }; TabBar.eventHander = {}; TabBar.property = {}; TabBar.property.tabs = { set: function (value) { this.clearChild(); this._tabs = []; (value || []).forEach(this.addTab.bind(this)); }, get: function () { //each hold item data return this._tabs || []; } }; /*** * * @param {{text}} * @return {tabbar} */ TabBar.prototype.addTab = function (value) { var self = this; var props = {}; if (typeof value == "string") { props.name = value; } else { if (value.name) { props.name = value.name; } else { throw new Error('Tab must has name attribute'); } if (value.desc) props.desc = value.desc; } var tabButton = TabBar_({ tag: 'tabbutton', props: props, on: { active: function (event, sender) { var prevented = false; self.emit('active', { target: this, value: value, preventDefault: function () { prevented = true; } }, self); if (!prevented) { self.getAllTabButtons().forEach(function (e) { e.active = false; }); this.active = true; } }, close: function (event, sender) { var prevented = false; self.emit('close', { target: this, value: value, preventDefault: function () { prevented = true; } }, self); if (!prevented) { //todo:active other this.remove(); } } } }).addTo(this); if (value.id) tabButton.attr('id', 'tabbuton-' + value.id); this._tabs.push(tabButton); return tabButton; }; TabBar.prototype.removeTab = function (id) { this._tabs = this._tabs.filter(function (value) { return value == id; }); TabBar_$('#tabbuton-' + id, this).remove(); }; TabBar.prototype.activeTab = function (id) { var activedbtn = TabBar_$('.absol-tabbar-button-active', this); if (activedbtn && activedbtn.attr('id') != id) { activedbtn.active = false; } var mButton = TabBar_$('#tabbuton-' + id, this); if (mButton) { mButton.active = true; } }; TabBar.prototype.setModified = function (ident, flag) { var bt = this.getButtonByIdent(ident); if (bt) { bt.modified = flag; } }; ACore["a" /* default */].creator.tabbar = TabBar; /* harmony default export */ var js_TabBar = (TabBar); // CONCATENATED MODULE: ./node_modules/absol-acomp/js/TabButton.js var TabButton_ = ACore["a" /* default */]._; var TabButton_$ = ACore["a" /* default */].$; function TabButton() { var res = TabButton_({ tag: 'button', class: 'absol-tabbar-button', extendEvent: ['close', 'active'], id: randomIdent(20), child: [{ class: 'absol-tabbar-button-text', }, { class: 'absol-tabbar-button-icon-container', child: [ { tag: 'span', class: ['absol-tabbar-button-close', 'mdi-close', 'mdi'], attr: { title: 'Close (Ctrl+F4)' }, on: { click: function (event) { event.tabButtonEventName = 'delete'; res.emit('close', event); } } }, { tag: 'span', class: ['absol-tabbar-button-modified-flag', 'mdi', 'mdi-checkbox-blank-circle'], on: { click: function (event) { event.tabButtonEventName = 'delete'; res.emit('close', event); } } } ] } ], on: { click: function (event) { if (event.tabButtonEventName) return; event.tabButtonEventName = 'active'; res.emit('active', event); } } }); res.$textView = TabButton_$('.absol-tabbar-button-text', res); return res; }; TabButton.property = {}; TabButton.property.active = { set: function (value) { this._active = value; if (value) this.addClass('absol-tabbar-button-active'); else this.removeClass('absol-tabbar-button-active'); }, get: function () { return this._active; } }; TabButton.property.name = { set: function (value) { this._name = value || ''; this.$textView.innerHTML = this._name; }, get: function () { return this._name; } }; TabButton.property.desc = { set:function(value){ this.attr('title', value); }, get:function(){ return this.attr('title'); } }; TabButton.property.modified = { set: function (value) { if (value) { this.addClass('absol-tabbar-button-modified'); } else { this.removeClass('absol-tabbar-button-modified'); } }, get: function () { return this.containsClass('absol-tabbar-button-modified'); } }; ACore["a" /* default */].creator.tabbutton = TabButton; /* harmony default export */ var js_TabButton = (TabButton); // CONCATENATED MODULE: ./node_modules/absol-acomp/js/TabFrame.js var TabFrame_$ = ACore["a" /* default */].$; var TabFrame_ = ACore["a" /* default */]._; function TabFrame() { var res = TabFrame_({ tag: 'frame', class: 'absol-tab-frame', extendEvent:['remove'] }, true); return res; } TabFrame.property = {}; TabFrame.property.name = { set: function (value) { if (typeof name == "undefined") { this._name = undefined; } else { this._name = value + ''; } if (this.$parent) { if (this.$parent.notifyUpdateName) this.$parent.notifyUpdateName(this); } }, get: function () { return this._name; } }; TabFrame.property.modified = { set: function (value) { this._modified = !!value; if (this.$parent) { if (this.$parent.notifyUpdateModified) this.$parent.notifyUpdateModified(this); } }, get: function () { return !!this._modified; } }; TabFrame.property.desc = { set: function (value) { if (typeof value == "undefined") { this._desc = undefined; } else { this._desc = value + ''; } if (this.$parent) { if (this.$parent.notifyUpdateDesc) this.$parent.notifyUpdateDesc(this); } }, get: function () { return this._desc; } } TabFrame.attribute = {}; TabFrame.attribute.name = { set: function (value) { this.name = value; }, get: function () { return this.name; }, remove: function () { this.name = undefined; } }; TabFrame.attribute.desc = { set: function (value) { this.desc = value; }, get: function () { return this.desc; }, remove: function () { this.desc = undefined; } }; TabFrame.attribute.modified = { set: function (value) { this.modified = value == 'true' || value == '1' || value === true; }, get: function () { return this.modified ? 'true' : undefined; }, remove: function () { this.desc = false; } }; ACore["a" /* default */].install('tabframe', TabFrame); /* harmony default export */ var js_TabFrame = (TabFrame); // CONCATENATED MODULE: ./node_modules/absol-acomp/js/TabView.js var TabView_ = ACore["a" /* default */]._; var TabView_$ = ACore["a" /* default */].$; function TabView() { var res = TabView_({ class: 'absol-tabview', extendEvent: ['activetab', 'removetab'], child: [ 'tabbar', ] }); res.$tabbar = TabView_$('tabbar', res); res.$tabbar.on({ close: TabView.eventHandler.closeTab.bind(res), active: TabView.eventHandler.activeTab.bind(res) }); res._frameHolders = []; res._history = []; return res; }; TabView.eventHandler = {}; TabView.eventHandler.closeTab = function (event) { event.preventDefault(); var id = event.value.id; this.removeTab(id, true); }; TabView.eventHandler.activeTab = function (event) { event.preventDefault(); var id = event.value.id; this.activeTab(id, true); }; TabView.prototype.activeTab = function (id, userActive) { var self = this; this._frameHolders.forEach(function (holder) { if (holder.id == id) { self._history.push(id); holder.containterElt.removeClass('absol-tabview-container-hidden'); var eventData = { type: 'active', id: id, userActive: !!userActive, target: holder.tabFrame, tabFrame: holder.tabFrame, tabButton: holder.tabButton, holder: holder, __promise__: Promise.resolve(), waitFor: function (promise) { this.__promise__ = promise; } }; holder.tabFrame.emit('active', eventData, holder.tabFrame); eventData.target = self; eventData.type = 'activetab'; self.emit('activetab', eventData, self); eventData.__promise__.then(function () { //if ok self.$tabbar.activeTab(holder.id); }, function () { //if reject }); } else { if (!holder.containterElt.containsClass('absol-tabview-container-hidden')) { holder.tabFrame.emit('deactive', { type: 'deactive', target: holder.tabFrame }, holder.tabFrame); holder.containterElt.addClass('absol-tabview-container-hidden'); } } }); }; TabView.prototype.removeTab = function (id, userActive) { var self = this; this._frameHolders.forEach(function (holder) { if (holder.id == id) { var eventData = { type:'renove', id: id, userActive: !!userActive, target: holder.tabFrame, tabFrame: holder.tabFrame, tabButton: holder.tabButton, holder: holder, __promise__: Promise.resolve(), waitFor: function (promise) { this.__promise__ = promise; } }; holder.tabFrame.emit('remove', eventData, holder.tabFrame); eventData.type = 'removetab'; eventData.target = self; self.emit('removetab', eventData, self); eventData.__promise__.then(function () { //if ok self._frameHolders = self._frameHolders.filter(function (x) { return x.id != id; }); holder.tabFrame.notifyDetached(); self.$tabbar.removeTab(holder.id); holder.containterElt.remove(); self.activeLastTab(); }, function () { //if reject }); } }); }; TabView.prototype.notifyUpdateDesc = function (elt) { var holder = this.findHolder(elt); if (holder) { holder.tabButton.desc = elt.desc; } }; TabView.prototype.notifyUpdateName = function (elt) { var holder = this.findHolder(elt); if (holder) { holder.tabButton.name = elt.name; } }; TabView.prototype.notifyUpdateModified = function (elt) { var holder = this.findHolder(elt); if (holder) { holder.tabButton.modified = elt.modified; } }; TabView.prototype.findHolder = function (elt) { for (var i = 0; i < this._frameHolders.length; ++i) { var holder = this._frameHolders[i]; if (holder.tabFrame == elt) { return holder; } } }; TabView.prototype.addChild = function () { var self = this; Array.prototype.forEach.call(arguments, function (elt) { if (!elt.notifyAttached || !elt.notifyDetached) { throw new Error('element is not a tabframe'); } var containterElt = TabView_('.absol-tabview-container'); self.appendChild(containterElt);//origin function elt.selfRemove(); var id = elt.attr('id'); var desc = elt.attr('desc') || undefined; var name = elt.attr('name') || 'NoName'; var modified = elt.modified; var tabButton = self.$tabbar.addTab({ name: name, id: id, desc: desc, modified: modified }); containterElt.addChild(elt); elt.notifyAttached(self); var holder = {}; OOP["a" /* default */].drillProperty(holder, elt, 'id'); OOP["a" /* default */].drillProperty(holder, elt, 'desc'); OOP["a" /* default */].drillProperty(holder, elt, 'name'); Object.defineProperties(holder, { tabButton: { value: tabButton, writable: false }, tabFrame: { value: elt, writable: false }, containterElt: { value: containterElt, writable: false } }); self._frameHolders.push(holder); self.activeTab(id); }); }; TabView.prototype.activeLastTab = function () { var dict = this._frameHolders.reduce(function (ac, holder) { ac[holder.id] = true; return ac; }, {}); while (this._history.length > 0) { var id = this._history.pop(); if (dict[id]) { this.activeTab(id); break; } } }; TabView.prototype.getChildAt = function (index) { return this._frameHolders[index].tabFrame; }; TabView.prototype.getAllChild = function () { return this._frameHolders.map(function (holder) { return holder.tabFrame; }); }; TabView.prototype.activeFrame = function (elt) { this.activeTab(elt.attr('id')); }; ACore["a" /* default */].install('tabview', TabView); /* harmony default export */ var js_TabView = (TabView); // CONCATENATED MODULE: ./node_modules/absol-acomp/js/SinglePage.js var SinglePage_ = ACore["a" /* default */]._; var SinglePage_$ = ACore["a" /* default */].$; function SinglePage() { var res = SinglePage_({ tag: 'tabframe', class: 'absol-single-page', child: { class: 'absol-single-page-scroller', child: { class: 'absol-single-page-scroller-viewport' } } }); res.$attachhook = SinglePage_('attachhook').addTo(res) .on('error', function () { this.updateSize = this.updateSize || res.updateSize.bind(res); this.updateSize(); Dom["a" /* default */].addToResizeSystem(this); }); res.$header = null; res.$footer = null; res.$viewport = SinglePage_$('.absol-single-page-scroller-viewport', res); res.$scroller = SinglePage_$('.absol-single-page-scroller', res); return res; } SinglePage.prototype.updateSize = function () { if (this.$header) { var viewportBound = this.$viewport.getBoundingClientRect(); this.$header.addStyle('width', viewportBound.width + 'px'); var headerBound = this.$header.getBoundingClientRect(); this.$viewport.addStyle('padding-top', headerBound.height + 'px'); } if (this.$footer) { var footerBound = this.$footer.getBoundingClientRect(); this.$viewport.addStyle('padding-bottom', footerBound.height + 'px'); } }; SinglePage.prototype.addChild = function (elt) { if (elt.classList.contains('absol-single-page-header')) { this.appendChild(elt); this.$header = elt; this.updateSize(); } else if (elt.classList.contains('absol-single-page-footer')) { this.$viewport.addChild(elt); this.$footer = elt; this.updateSize(); } else { this.$viewport.addChild(elt); } }; SinglePage.prototype.removeChild = function (elt) { if (elt == this.$footer) { this.$viewport.removeChild(elt); this.$footer = undefined; this.updateSize(); } else if (elt == this.$header) { this.super(elt); this.$header = undefined; this.updateSize(); } else { this.$viewport.removeChild(elt); } }; ACore["a" /* default */].install('singlepage', SinglePage); /* harmony default export */ var js_SinglePage = (SinglePage); // EXTERNAL MODULE: ./node_modules/absol-acomp/css/singlepage.css var singlepage = __webpack_require__(175); // EXTERNAL MODULE: ./node_modules/absol-acomp/css/pageselector.css var pageselector = __webpack_require__(177); // CONCATENATED MODULE: ./node_modules/absol-acomp/js/PageSelector.js var PageSelector_ = ACore["a" /* default */]._; var PageSelector_$ = ACore["a" /* default */].$; function PageSelector() { var res = PageSelector_({ class: ['absol-page-selector'], extendEvent: ['change'], child: [ { class: 'page-number-input', child: [{ tag: 'label', child: { text: "Page" } }, { tag:'input', attr:{ type:'text' } }] }, { tag: 'ul', class: 'page-number-buttons', child: [ ' <li class="page-first">\ <a href="#" aria-controls="dtBasicExample" data-dt-idx="0" tabindex="0" class="page-link">First</a>\ </li>', ' <li class="page-previous">\ <a href="#" aria-controls="dtBasicExample" data-dt-idx="0" tabindex="0" class="page-link">Previous</a>\ </li>', '<li class="page-next" >\ <a href="#" aria-controls="dtBasicExample" data-dt-idx="7" tabindex="0" class="page-link">Next</a>\ </li>', ' <li class="page-last">\ <a href="#" aria-controls="dtBasicExample" data-dt-idx="0" tabindex="0" class="page-link">Last</a>\ </li>', ] } ] }); res.$pageInput = PageSelector_$('.page-number-input input', res); res.$pageInput.on('keyup', PageSelector.eventHandler.pressEnterKey.bind(res)); res.$prevBtn = PageSelector_$('li.page-previous', res); res.$nextBtn = PageSelector_$('li.page-next', res); res.$firstBtn = PageSelector_$('li.page-first', res); res.$lastBtn = PageSelector_$('li.page-last', res); res.$nextBtn.on('click', PageSelector.eventHandler.clickNext.bind(res)); res.$prevBtn.on('click', PageSelector.eventHandler.clickPrev.bind(res)); res.$firstBtn.on('click', PageSelector.eventHandler.clickFirst.bind(res)); res.$lastBtn.on('click', PageSelector.eventHandler.clickLast.bind(res)); res.$buttonContainer = PageSelector_$('.page-number-buttons', res); res._buttons = []; res._pageOffset = 1; res._selectedIndex = 1; res._pageCount = 1; res._pageRange = 1; res.$pageInput.value = res._selectedIndex; return res; }; PageSelector.eventHandler = {}; PageSelector.eventHandler.pressEnterKey = function(event){ if (event.keyCode != 13) return; var index = parseInt(this.$pageInput.value.trim(), 10); if ((index < 1) || (index > this._pageCount)) { this.$pageInput.value = this._selectedIndex; return; } this.selectPage(index, true); } PageSelector.eventHandler.clickLast = function (event) { this.selectPage(this._pageCount, true); }; PageSelector.eventHandler.clickFirst = function (event) { this.selectPage(1, true); }; PageSelector.eventHandler.clickNext = function (event) { if (this._selectedIndex == this._pageCount) return; this.selectPage(this._selectedIndex + 1, true); }; PageSelector.eventHandler.clickPrev = function (event) { if (this._selectedIndex == 1) return; this.selectPage(this._selectedIndex - 1, true); } PageSelector.eventHandler.clickIndex = function (index, event) { this.selectPage(index + this._pageOffset, true); }; PageSelector.prototype._createButton = function (index) { var button = PageSelector_({ tag: 'li', class: 'page-number', child: { tag: 'a', attr: { href: '#', 'data-index': index }, child: { text: '' + index } }, on: { click: PageSelector.eventHandler.clickIndex.bind(this, index) } }); this.$buttonContainer.addChildBefore(button, this.$nextBtn); return button; }; PageSelector.prototype.setPageRange = function (pageCount) { this._pageRange = pageCount; if (this._buttons.length > 0) throw new Error("Not implement change pageCount"); while (this._buttons.length < pageCount) { this._buttons.push(this._createButton(this._buttons.length)); } }; PageSelector.prototype.setStartPage = function (index) { this._buttons.forEach(function (e, i) { e.childNodes[0].innerHTML = i + index + ''; }); this._pageOffset = index; }; PageSelector.prototype.selectPage = function (index, userActive) { if (index == this._selectedIndex) this.setStartPage(index - parseInt(this._pageRange / 2)); if (index > this._selectedIndex){ if (index == (this._pageOffset + this._pageRange - 1)) this.setStartPage(index - parseInt(this._pageRange / 2)); } if (index < this._selectedIndex){ if (index == this._pageOffset) this.setStartPage(index - parseInt(this._pageRange / 2)); } if (index > (this._pageCount - parseInt(this._pageRange / 2))) this.setStartPage(this._pageCount - this._pageRange + 1); if (index <= (parseInt(this._pageRange / 2))) this.setStartPage(1); var pageOffset = this._pageOffset; this._buttons.forEach(function (e, i) { if (i + pageOffset == index) { e.addClass('active'); } else { e.removeClass('active'); } }); if (this._selectedIndex != index) { this._selectedIndex = index; this.$pageInput.value = index; this.emit('change', { target: this, selectedIndex: index, userActive: !!userActive }, this); } }; PageSelector.prototype.getSelectedPage = function () { return this._selectedIndex; } PageSelector.prototype.setPageCount = function (count) { this._pageCount = count; }; PageSelector.property = {}; PageSelector.prototype.init = function (props) { props = props || {}; props.pageOffset = props.pageOffset || 1; props.pageRange = props.pageRange || 5; props.pageCount = props.pageCount || 15; props.selectedIndex = typeof (props.selectedIndex) == "number" ? props.selectedIndex : props.pageOffset; if (props.pageCount < props.pageRange) props.pageRange = props.pageCount; this.setPageCount(props.pageCount); this.setPageRange(props.pageRange); this.setStartPage(props.pageOffset); this.selectPage(props.selectedIndex); }; ACore["a" /* default */].install('pageselector', PageSelector); /* harmony default export */ var js_PageSelector = (PageSelector); // EXTERNAL MODULE: ./node_modules/absol-acomp/css/bscroller.css var bscroller = __webpack_require__(179); // EXTERNAL MODULE: ./node_modules/absol-acomp/css/searchlist.css var searchlist = __webpack_require__(181); // CONCATENATED MODULE: ./node_modules/absol-acomp/js/adapter/SearchListAdapter.js function SearchListAdapter() { this.searchList = null; } SearchListAdapter.prototype.onAttach = function (searchList) { this.searchList = searchList; }; SearchListAdapter.prototype.getItemText = function (item, index) { return item.text; }; SearchListAdapter.prototype.getItemValue = function (item, index) { return item.value; }; SearchListAdapter.prototype.getItemIcon = function (item, index) { return item.icon; }; SearchListAdapter.prototype.getItemView = function (item, index, _, $, query, reuseItem, refParent) { var list = []; var isFirst = false; var marginLeft = ""; for (var i in item) { marginLeft = "" if (isFirst) marginLeft = "10px" isFirst = true; if (i === "icon") { list.push({ tag: 'i', class: 'material-icons', style: { verticalAlign: "middle", marginLeft: marginLeft, }, props: { innerHTML: this.getItemIcon(item) } }) } else if (i === "text") { list.push({ tag: 'span', style: { verticalAlign: "middle", marginLeft: marginLeft, }, props: { innerHTML: this.getItemText(item) } }); } else if (i === "value") { } } if (reuseItem) { return reuseItem.clearChild().addChild( _({ tag: 'div', child: list }) ); } else { return _({ tag: 'div', child: list }) } }; SearchListAdapter.prototype.queryItems = function (self, query, mInput) { var query = query.toLowerCase(); return self.items.map(function (item) { var start = item.text.toLowerCase().indexOf(query); if (start >= 0) { var hightlightedText = item.text.substr(0, start) + '<strong style="color:red">' + item.text.substr(start, query.length) + '</strong>' + item.text.substr(start + query.length); return { item: item, hightlightedText: hightlightedText } } else return null; }).filter(function (it) { return it !== null; }) }; /* harmony default export */ var adapter_SearchListAdapter = (SearchListAdapter); // CONCATENATED MODULE: ./node_modules/absol-acomp/js/SearchList.js var SearchList_ = ACore["a" /* default */]._; var SearchList_$ = ACore["a" /* default */].$; function SearchList() { var res = SearchList_({ class: 'absol-search-list', style: { // height:'300px', }, child: [ { class: 'absol-search-list-search-input-container', child: 'input[type="text"]' }, { tag: 'bscroller', class: 'absol-search-list-contents', } ] }); res._pool = []; res.eventHandler = OOP["a" /* default */].bindFunctions(res, SearchList.eventHandler); res.$dropdown = SearchList_$('.absol-search-list-contents', res).on('click', res.eventHandler.clickContent); res.$dropdown.addStyle('display', 'none'); res.$vscroller = SearchList_$('bscroller', res).on('click', res.eventHandler.vscrollerClick); res.$input = SearchList_$('.absol-search-list-search-input-container input[type="text"]', res) .on('keydown', res.eventHandler.keydown) .on('keyup', res.eventHandler.keyup); res._cache = {}; res.$poolItems = []; res._currentData = []; res._sessionIndex = 0; res._updatedSession = -1; return res; } SearchList.eventHandler = {}; SearchList.eventHandler.clickContent = function (event) { var item = this._findItem(event.target); if (item) { this._value = this.adapter.getItemValue(item.__data__.item); this.$input.value = item.__data__.item.text; this.updateSelectedItem(); this.$dropdown.addStyle('display', 'none'); } else { } }; SearchList.eventHandler.keydown = function (event) { var key = event.key; if (key == 'ArrowDown') { if (this._selectedIndex + 1 < this._currentData.length) { if (this.$poolItems[this._selectedIndex]) { this.$poolItems[this._selectedIndex].removeClass('active'); } this._selectedIndex += 1; if (this.$poolItems[this._selectedIndex]) { this.$poolItems[this._selectedIndex].addClass('active'); this.$vscroller.scrollInto(this.$poolItems[this._selectedIndex]); } } event.preventDefault(); } else if (key == 'ArrowUp') { if (this._selectedIndex - 1 >= 0) { if (this.$poolItems[this._selectedIndex]) { this.$poolItems[this._selectedIndex].removeClass('active'); } this._selectedIndex -= 1; if (this.$poolItems[this._selectedIndex]) { this.$poolItems[this._selectedIndex].addClass('active'); this.$vscroller.scrollInto(this.$poolItems[this._selectedIndex]); } } event.preventDefault(); } else if (key == 'Enter') { var text; if (this._currentData[this._selectedIndex] === undefined) { text = this.$input.value; } else { text = this.getItemText(this._currentData[this._selectedIndex]); this.$input.value = text; } this._lastQuery = text; this.$dropdown.addStyle('display', 'none'); this._lastValue = text; this.emit('change', { target: this, value: text }, this); } }; SearchList.eventHandler.keydown = function (event) { var key = event.key; if (key == 'ArrowDown') { if (this._selectedIndex + 1 < this._currentData.length) { if (this.$poolItems[this._selectedIndex]) { this.$poolItems[this._selectedIndex].removeClass('active'); } this._selectedIndex += 1; if (this.$poolItems[this._selectedIndex]) { this.$poolItems[this._selectedIndex].addClass('active'); this.$vscroller.scrollInto(this.$poolItems[this._selectedIndex]); } } event.preventDefault(); } else if (key == 'ArrowUp') { if (this._selectedIndex - 1 >= 0) { if (this.$poolItems[this._selectedIndex]) { this.$poolItems[this._selectedIndex].removeClass('active'); } this._selectedIndex -= 1; if (this.$poolItems[this._selectedIndex]) { this.$poolItems[this._selectedIndex].addClass('active'); this.$vscroller.scrollInto(this.$poolItems[this._selectedIndex]); } } event.preventDefault(); } else if (key == 'Enter') { var text; if (this._currentData[this._selectedIndex] === undefined) { text = this.$input.value; } else { text = this.getItemText(this._currentData[this._selectedIndex]); this.$input.value = text; } this._lastQuery = text; this.$dropdown.addStyle('display', 'none'); this._lastValue = text; this.emit('change', { target: this, value: text }, this); } }; SearchList.prototype.clearCache = function (old) { if (typeof old != "number") old = 30; for (var key in this._cache) { var cacheHolder = this._cache[key]; if (this._sessionIndex - cacheHolder.sessionIndex > old) { delete this._cache[key]; } } } SearchList.eventHandler.keyup = function (event) { if (this._keyTimeout) { clearTimeout(this._keyTimeout); this._keyTimeout = 0; } var cTimeout = setTimeout(function () { clearTimeout(cTimeout); this.find(); }.bind(this), 300); if (this._cacheTimeout) { clearTimeout(this._cacheTimeout); this._cacheTimeout = 0; } var cacheTimeout = setTimeout(function () { clearTimeout(cacheTimeout); this.clearCache(); }.bind(this), 300); this._cacheTimeout = cacheTimeout; this._keyTimeout = cTimeout; }; SearchList.prototype.find = function () { var query = this.$input.value; if (query == this._lastQuery) return; this._lastQuery = query; var currentSession = ++this._sessionIndex; if (!query) { this.pushData([], currentSession, query) return; } var result; if (this.disableCache) { var onReciveData = function (data) { cacheHolder.data = data; this.pushData(data, currentSession, query);//sessionIndex may be change }.bind(this); result = this.adapter.queryItems(this, query); if (typeof result.then == 'function') result.then(onReciveData); else onReciveData(result) } else { if (this._cache[query]) { this._cache[query].sessionIndex = currentSession; if (!this._cache[query].pending) { var data = this._cache[query].data; this.pushData(data, currentSession); } } else { var cacheHolder = { pending: true, sessionIndex: currentSession }; var onReciveData = function (data) { cacheHolder.data = data; cacheHolder.pending = false; this.pushData(data, cacheHolder.sessionIndex, query);//sessionIndex may be change }.bind(this); result = this.adapter.queryItems(this, query); if (typeof result.then == 'function') result.then(onReciveData); else onReciveData(result) this._cache[query] = cacheHolder; } } }; SearchList.prototype.pushData = function (data, sessionIndex, query) { if (sessionIndex > this._updatedSession) { this._updatedSession = sessionIndex; this.$vscroller.clearChild(); this._currentData = data; if (data && data.length > 0) { this.$dropdown.removeStyle('display'); } else { this.$dropdown.addStyle('display', 'none'); } var maxHeight = this.getComputedStyleValue('max-height'); if (maxHeight == 'none' || !maxHeight) { maxHeight = 10000; } else { maxHeight = parseFloat(maxHeight.replace('px', '')); } var outBound = Dom["a" /* default */].traceOutBoundingClientRect(this); var bound = this.$input.getBoundingClientRect(); var aTop = bound.top - outBound.top; var aBotom = outBound.bottom - bound.bottom; this.$dropdown.removeClass('top'); if (aTop > aBotom) { maxHeight = Math.min(maxHeight, aTop - 10); } else { maxHeight = Math.min(maxHeight, aBotom - 10); } this.$vscroller.addStyle('max-height', maxHeight + 'px'); this._selectedIndex = -1; data.reduce(function (sync, item, i, arr) { return sync.then(function () { if (this._updatedSession != sessionIndex) return; return new Promise(function (rs) { if (this._updatedSession != sessionIndex) return; var reuseItem = this.$poolItems.length > i ? this.$poolItems[i] : undefined; if (reuseItem) { reuseItem.removeClass('active'); } var newView = this.adapter.getItemView(item.item, i, SearchList_, SearchList_$, query, reuseItem, this); newView.addClass('absol-search-list-item'); newView.__data__ = item; newView.__index__ = i; if (i == this._selectedIndex) newView.addClass('active'); if (this.$poolItems.length <= i) { this.$poolItems.push(newView); } else { this.$poolItems[i] = newView; } this.$vscroller.addChild(newView); if (i == 0) { var estimateHeight = newView.getBoundingClientRect().height * arr.length; if (aTop > aBotom && estimateHeight > aBotom) { this.$dropdown.addClass('top'); } } if (i >= 50 && i % 50 == 0) setTimeout(rs, 0); else rs(); }.bind(this)); }.bind(this)) }.bind(this), Promise.resolve()); } }; SearchList.adapter = { DEFAULT: adapter_SearchListAdapter } SearchList.property = {}; SearchList.property.adapter = { set: function (value) { if (typeof value == 'string' || typeof value == 'number') { if (value in SearchList.adapter) { this._adapter = new SearchList.adapter[value](); } else { throw new Error("Unknown build-in adapter name") } } else if (typeof value == 'object') { if (value instanceof Array) { if (value[0] == 'SearchStringArray') { this._adapter = new SearchStringArrayAdapter(value[1], value[2]); } else if (value[0] == 'SearchObjectArray') { this._adapter = new SearchObjectArrayAdapter(value[1], value[2]); } else { throw new Error("Unknown adapter type name"); } } else { this._adapter = Object.assign(new adapter_SearchListAdapter(), value) } if (this.adapter && this.adapter.onAttached) { this.adapter.onAttached(this); } } else { if (value) { if ((value.queryItems && value.getItemView && value.getItemText) || (value.extend && (value.extend in SearchList.adapter))) { if (value.extend && (value.extend in SearchList.adapter)) { this.adapter = Object.assign(new SearchList.adapter[value.extend](), value) } else { this._adapter = value; } } else { throw new Error("Invalid adapter"); } } else { this._adapter = new SearchList.adapter.DEFAULT(); } } }, get: function () { return this._adapter; } }; SearchList.property.items = { set: function (value) { this._items = value; if (this._verifyParams()) { this.updateItems(); } }, get: function () { return this._items; } }; SearchList.prototype._findItem = function (elt) { while (elt) { if (elt.containsClass && elt.containsClass('absol-search-list-item')) { return elt; } else { elt = elt.parentNode; } if (elt == this) return; } return undefined; }; SearchList.prototype.updateItems = function () { this.removeAllToPool(); var self = this; var reusedItem; var query = ''; this.itemEltsDict = {}; this.itemEltArr = []; this.items.forEach(function (item, index) { if (!reusedItem) reusedItem = self.getOneFromPool(); var itemView = self.adapter.getItemView(item, index, SearchList_, SearchList_$, query, reusedItem, self.$dropdown); var valueKey = JSON.stringify(self.adapter.getItemValue(item)) self.itemEltsDict[valueKey] = itemView; self.itemEltArr.push(itemView); SearchList_$(itemView).addClass('absol-search-list-item'); itemView.__data__ = item;// item wil hold the data of itself itemView.__index__ = index;// item wil hold the data of itself self.$dropdown.addChild(itemView); if (itemView == reusedItem) reusedItem = undefined; }); }; SearchList.prototype.updateSelectedItem = function () { var key = JSON.stringify(this._value); if (this.activeItemElt) { this.activeItemElt.removeClass('active'); } this.activeItemElt = this.itemEltsDict[key]; if (this.activeItemElt) { this.activeItemElt.addClass('active'); } }; SearchList.prototype.getPrevItem = function () { var index = this.activeItemElt ? this.__index__ : 0; }; SearchList.prototype.removeAllToPool = function () { while (this.$dropdown.childNodes.length > 0) { this._pool.push(this.$dropdown.childNodes[0]); this.$dropdown.childNodes[0].remove(); } }; SearchList.prototype.getOneFromPool = function () { if (this._pool.length > 0) { return this._pool.pop(); } else return undefined; }; SearchList.prototype.clearPool = function () { this._pool = []; }; SearchList.prototype._verifyParams = function () { if (this.items && this.adapter) return true; return false; }; SearchList.prototype.init = function (props) { this.ready = false; var myProps = Object.assign({}, props || {}); if ('adapter' in myProps) { //todo: this.adapter = myProps.adapter; delete myProps.adapter; } else { this.adapter = 'DEFAULT'; } if ('items' in myProps) { this.items = myProps.items; delete myProps.items } else { } Object.assign(this, myProps); if (this.adapter) { this.ready = true; //this.adapter.onAttach(this); } }; ACore["a" /* default */].install('SearchList'.toLowerCase(), SearchList); /* harmony default export */ var js_SearchList = (SearchList); // EXTERNAL MODULE: ./node_modules/absol-acomp/css/statictabbar.css var statictabbar = __webpack_require__(183); // CONCATENATED MODULE: ./node_modules/absol-acomp/js/StaticTabbar.js var StaticTabbar_$ = ACore["a" /* default */].$; var StaticTabbar_ = ACore["a" /* default */]._; function StaticTabbar() { var res = StaticTabbar_({ class: 'absol-static-tabbar', extendEvent: 'change', child: [ { class: 'absol-static-tabbar-active-box', child: '.absol-static-tabbar-hline' }, ] }); res.$activeBox = StaticTabbar_$('.absol-static-tabbar-active-box', res) res.$hline = StaticTabbar_$('.absol-static-tabbar-hline', res); res.$buttons = []; res._btDict = {}; res._activedButton = undefined; res.sync = new Promise(function (resolve) { StaticTabbar_('attachhook').on('error', function () { this.remove(); resolve(); }) }); return res; } StaticTabbar.prototype.fireChange = function (data) { this.emit('change', { target: this, data, value: this.value }, self); } StaticTabbar.property = {}; StaticTabbar.property.items = { set: function (value) { this.$buttons.forEach(function (e) { e.remove() }); this._items = value; var self = this; this.$buttons = this.items.map(function (tab) { var ident = (tab.value || randomIdent()); var button = StaticTabbar_({ tag: 'button', class: 'absol-static-tabbar-button', id: 'tab-' + ident, child: { tag: 'span', child: { text: tab.text } }, on: { click: function (event) { if (self.value != tab.value) { self.value = ident; self.fireChange(tab); } } } }).addTo(self); self._btDict[ident] = button; return button; }); if (this.value !== undefined) { this.sync.then(this.activeTab.bind(this, this.value)); } }, get: function () { return this._items || []; } }; StaticTabbar.property.value = { set: function (value) { this._value = value; if (this.$buttons.length > 0) { this.sync.then(this.activeTab.bind(this, value)); } }, get: function () { return this._value; } }; StaticTabbar.prototype.activeTab = function (ident) { if (this._activedButton) this._activedButton.removeClass('active'); var button = this._btDict[ident]; this._activedButton = button; if (button) { button.addClass('active'); var bound = this.getBoundingClientRect(); var buttonBound = button.getBoundingClientRect(); var dx = buttonBound.left - bound.left; var fontSize = this.getFontSize(); this.$activeBox.addStyle({ left: dx / fontSize + 'em', width: buttonBound.width / fontSize + 'em' }); } else { this.$activeBox.addStyle({ left: '0', width: '0' }); } }; ACore["a" /* default */].install('statictabbar', StaticTabbar); /* harmony default export */ var js_StaticTabbar = (StaticTabbar); // CONCATENATED MODULE: ./node_modules/absol-acomp/js/RemoteSvg.js var RemoteSvg_ = ACore["a" /* default */]._; var RemoteSvg_$ = ACore["a" /* default */].$; function RemoteSvg() { return RemoteSvg_('svg').defineEvent('load'); } RemoteSvg.property = { src: { set: function (value) { this._src = value; var self = this; RemoteSvg.loadIcon(value).then(function (data) { self.emit('load', { target: self, src: value, data: data }, self); self.attr(data.attr); self.init(data.props); }); }, get: function () { return this._name; } } } RemoteSvg.attribute = { src: { set: function (value) { }, get: function () { }, remove: function () { } } } RemoteSvg.__cache__ = {}; RemoteSvg.__div_parser__ = document.createElement('div'); RemoteSvg.loadIcon = function (path) { if (RemoteSvg.__cache__[path]) { return RemoteSvg.__cache__[path] } else { RemoteSvg.__cache__[path] = Network_XHR.getRequest(path, 'text').then(function (result) { RemoteSvg.__div_parser__.innerHTML = result; var svgElt = RemoteSvg_$('svg', RemoteSvg.__div_parser__); var res = { attr: {}, props: {} }; if (svgElt) { Array.prototype.forEach.call(svgElt.attributes, function (attribute) { res.attr[attribute.name] = attribute.value; }); res.props.innerHTML = svgElt.innerHTML; } return res; }, function () { return {}; }); return RemoteSvg.__cache__[path] ; } }; ACore["a" /* default */].install('remotesvg', RemoteSvg); /* harmony default export */ var js_RemoteSvg = (RemoteSvg); // EXTERNAL MODULE: ./node_modules/absol-acomp/css/exptree.css var exptree = __webpack_require__(185); // CONCATENATED MODULE: ./node_modules/absol-acomp/js/ExpTree.js var ExpTree_ = ACore["a" /* default */]._; var ExpTree_$ = ACore["a" /* default */].$; ACore["a" /* default */].install('toggler-ico', function () { var res = ExpTree_( '<svg class="toggler-ico" width="14" height="14" version="1.1" viewBox="0 0 3.7042 3.7042" xmlns="http://www.w3.org/2000/svg" >' + ' <g transform="translate(0 -293.3)" class="toggle-close">' + ' <path d="m0.52917 293.82v2.6458l2.6458-1.3229z" />' + ' </g>' + ' <g transform="translate(0 -293.3)" class="toggle-open">' + ' <path d="m3.175 294.09-2.6458 2.1167h2.6458z"/>' + ' </g>' + '</svg>' ); return res; }); ACore["a" /* default */].install('remove-ico', function () { return ExpTree_('<svg class="remove-ico" width="24" height="24" viewBox="0 0 24 24">\ <path class="close" d="M3,16.74L7.76,12L3,7.26L7.26,3L12,7.76L16.74,3L21,7.26L16.24,12L21,16.74L16.74,21L12,16.24L7.26,21L3,16.74" />\ <circle class="modified" cx="12" cy="12" r="10" />\ </svg>'); }); function ExpNode() { var res = ExpTree_({ tag: 'button', extendEvent: ['pressremove', 'press'], class: 'absol-exp-node', child: [ '.absol-exp-node-level', 'remove-ico', 'toggler-ico', 'img.absol-exp-node-ext-icon', 'div.absol-exp-node-ext-icon', 'span.absol-exp-node-name', 'span.absol-exp-node-desc' ] }); res.$level = ExpTree_$('.absol-exp-node-level', res); res.$removeIcon = ExpTree_$('remove-ico', res) .on('click', function (event) { this.emit('pressremove', { target: res, type: 'pressremove' }, this); }); res.on('click', function (event) { if (!EventEmitter["a" /* default */].hitElement(res.$removeIcon, event)) res.emit('press', { target: res, type: 'press' }, this); }) res.$iconCtn = ExpTree_$('div.absol-exp-node-ext-icon', res); res.$extIcon = ExpTree_$('img.absol-exp-node-ext-icon', res); res.$name = ExpTree_$('span.absol-exp-node-name', res); res.$desc = ExpTree_$('span.absol-exp-node-desc', res); contenteditableTextOnly(res.$name, function (text) { return text.replace(/[\\\/\|\?\:\<\>\*\r\n]/, '').trim(); }); OOP["a" /* default */].drillProperty(res, res.$extIcon, 'extSrc', 'src'); res._level = 0; res.__isExpNode__ = true; return res; }; ExpNode.property = {}; ExpNode.property.icon = { set: function (value) { if (this.$iconP) { this.$iconP.remove(); this.$iconP = undefined; } if (value && value != null) { var newE; if (!Dom["a" /* default */].isDomNode(value)) { newE = ExpTree_(value); } this.$iconCtn.addChild(newE); this._icon = value; } else { this._icon = undefined; } }, get: function () { return this._icon; } }; ExpNode.property.level = { set: function (value) { value = value || 0; if (value != this.level) { this._level = value || 0; this.$level.innerHTML = ' '.repeat(this._level * 4); } }, get: function () { return this._level || 0; } }; ExpNode.property.name = { set: function (value) { this._name = value + ''; this.$name.clearChild(); if (this.name && this.name.length > 0) this.$name.addChild(ExpTree_({ text: this._name })) }, get: function () { return this._name || ''; } }; ExpNode.property.desc = { set: function (value) { this._desc = value + ''; this.$desc.clearChild(); this.$desc.addChild(ExpTree_({ text: this._desc })) }, get: function () { return this._desc || ''; } }; ExpNode.property.status = { set: function (value) { this.removeClass('status-open') .removeClass('status-close') .removeClass('status-modified') .removeClass('status-removable'); if (!value || value == 'none') { //todo } else if (value == 'close') { this.addClass('status-close') } else if (value == 'open') { this.addClass('status-open'); } else if (value == 'removable') { this.addClass('status-removable'); } else if (value == 'modified') { this.addClass('status-modified'); } else { throw new Error('Invalid status ' + value) } this._status = value; }, get: function () { return this._status; } } ExpNode.property.active = { set: function (value) { if (value) this.addClass('active'); else this.removeClass('active'); }, get: function () { return this.containsClass('active'); } } ExpNode.prototype.rename = function (resolveCallback, rejectCallback) { var self = this; var span = this.$name; var lastName = span.innerHTML; span.attr('contenteditable', 'true'); span.focus(); document.execCommand('selectAll', false, null); function keydowEventHandle(event) { var key = event.key; if (key == 'Enter') { event.preventDefault(); span.blur(); span.attr('contenteditable', undefined); } } function blurEventHandle(event) { finish(); var curentName = span.innerHTML.replace(/[\\\/\|\?\:\<\>\*\r\n]/, '').trim(); if (curentName == lastName) { rejectCallback && rejectCallback(); } else { if (curentName.length == 0) { span.innerHTML = lastName; rejectCallback && rejectCallback(); } else { var res = resolveCallback && resolveCallback(curentName); if (res === false) { span.innerHTML = lastName; } else if (res && res.then) { res.then(function (result) { if (result === false) { span.innerHTML = lastName; //faile } else { //success } }, function () { //reject value span.innerHTML = lastName; }) } else { //success } } } } function finish() { span.off('keydown', keydowEventHandle); span.off('blur', blurEventHandle); ExpTree_$(document.body).once('click', function () { setTimeout(function () { span.attr('contenteditable', undefined); }, 2); }); } span.on('keydown', keydowEventHandle); span.on('blur', blurEventHandle); } function ExpTree() { var res = ExpTree_({ class: 'absol-exp-tree', extendEvent: 'press', child: [ 'expnode', '.absol-exp-items' ] }); res.$node = ExpTree_$('expnode', res) .on('press', function (event) { res.emit('press', { target: res, node: this, type: 'press' }, res) }); // console.log(res.$node); res.$itemsContainer = ExpTree_$('.absol-exp-items', res); OOP["a" /* default */].drillProperty(res, res.$node, ['desc', 'name', 'title', 'extSrc', 'active', 'icon']); res.__isExpTree__ = true; res._level = 0; return res; } ExpTree.property = {}; ExpTree.property.level = { set: function (value) { value = value || 0; if (value != this.level) { this.$node.level = value; Array.prototype.forEach.call(this.$itemsContainer.childNodes, function (e) { e.level = value + 1; }) } }, get: function () { return this.$node.level; } }; ExpTree.property.status = { set: function (value) { this.$node.status = value; if (value != 'open') { this.addClass('hide-children'); } else { this.removeClass('hide-children'); } }, get: function () { return this.$node.status; } }; ['findChildBefore', 'findChildAfter', 'removeChild', 'clearChild'] .forEach(function (key) { ExpTree.prototype[key] = function () { this.$itemsContainer[key].apply(this.$itemsContainer, arguments); } }); ExpTree.prototype.addChild = function (child) { if (!child.__isExpTree__) throw new Error('Child node must be a ExpTree'); child.level = this.level + 1; this.$itemsContainer.addChild(child); }; ExpTree.prototype.addChildBefore = function (child, at) { child.level = this.level + 1; this.$itemsContainer.addChildBefore(child, at); }; ExpTree.prototype.addChildAfter = function (child, at) { child.level = this.level + 1; this.$itemsContainer.addChildAfter(child, at); }; ExpTree.prototype.getParent = function () { var current = this.parentNode; while (current) { if (current.__isExpTree__) break; current = current.parentNode; } return current; }; ExpTree.prototype.getNode = function () { return this.$node; }; ExpTree.prototype.getChildren = function () { return Array.apply(null, this.$itemsContainer.childNodes); }; ExpTree.prototype.getPath = function () { var path = []; var current = this; while (current) { path.push(current.name); current = current.getParent(); } return path.reverse(); }; ExpTree.prototype.accessByPath = function (path) { if (path.length == 0) return this; var childs = this.getChildren(); var res; for (var i = 0; i < childs.length; ++i) { if (childs[i].name == path[0]) { res = childs[i].accessByPath(path.slice(1)); break; } } return res; }; ACore["a" /* default */].install('expnode', ExpNode); ACore["a" /* default */].install('exptree', ExpTree); /* harmony default export */ var js_ExpTree = (ExpTree); // EXTERNAL MODULE: ./node_modules/absol-acomp/css/tablevscroller.css var tablevscroller = __webpack_require__(187); // CONCATENATED MODULE: ./node_modules/absol-acomp/js/TableVScroller.js var TableVScroller_ = ACore["a" /* default */]._; var TableVScroller_$ = ACore["a" /* default */].$; function TableVScroller() { var res = TableVScroller_( { class: 'absol-table-vscroller', child: [ 'bscroller.absol-table-vscroller-viewport', 'table.absol-table-vscroller-head', '.absol-table-vscroller-head-line', ] } ); res.$attachHook = TableVScroller_('attachhook').addTo(res); res.sync = new Promise(function (rs) { res.$attachHook.on('error', rs) }); res.$viewport = TableVScroller_$('bscroller.absol-table-vscroller-viewport', res); res.$attachHook.on('error', function () { Dom["a" /* default */].addToResizeSystem(res.$attachHook); }); res.$topTable = TableVScroller_$('.absol-table-vscroller-head', res); res.$headLine = TableVScroller_$('.absol-table-vscroller-head-line', res); return res; } TableVScroller.prototype.clearChild = function () { this.$viewport.clearChild(); this.$topTable.clearChild(); }; TableVScroller.prototype.addChild = function (elt) { if (this.$viewport.childNodes.length == 0) { if (elt.tagName && elt.tagName.toLowerCase() == 'table') { this.$viewport.addChild(elt); this.$table = TableVScroller_$(elt); this.$thead = TableVScroller_$('thead', elt); this.$tr = TableVScroller_$('tr', this.$thead); this.$topThead = this.$thead.cloneNode(true); this.$topTr = TableVScroller_$('tr', this.$topThead); this.$topTable.addChild(this.$topThead).addStyle('display', 'none'); } else { throw new Error('Element must be a table!'); } } else { throw new Error("Only 1 table accepted!"); } }; TableVScroller.prototype._trackBackgroundColor = function (element) { var current = this.$thead; var res; while (current && !res && res != 'rgba(0, 0, 0, 0)') { res = window.getComputedStyle(element).getPropertyValue('background-color'); current = current.parentNode; } if (res == 'rgba(0, 0, 0, 0)') return 'white'; return res; } TableVScroller.prototype.updateStyle = function () { if (!this.$thead) return; var clazz = this.$table.attr('class'); if (clazz) { clazz = clazz.trim().split(/\s+/); for (var i = 0; i < clazz.length; ++i) { this.$topTable.addClass(clazz[i]); } } var bgColor = this._trackBackgroundColor(this.$thead); this.$topTable.addStyle('background-color', bgColor); }; TableVScroller.prototype.updateSize = function () { var theadBound = this.$thead.getBoundingClientRect(); var tableBound = this.$table.getBoundingClientRect(); this.$topTable.addStyle({ width: tableBound.width + 'px', height: theadBound.height + 'px' }); this.$headLine.addStyle({ top: theadBound.height + 'px', maxWidth: tableBound.width + 'px' }); if (this.$viewport.clientHeight < this.$viewport.scrollHeight ){ this.addClass('scroll-v'); } else{ this.removeClass('scroll-v'); } var realNodes = this.$tr.childNodes; var topNodes = this.$topTr.childNodes; for (var i = 0; i < realNodes.length; ++i) { if (!realNodes[i].tagName) continue; var wstyle = window.getComputedStyle(TableVScroller_$(realNodes[i])).getPropertyValue('width'); TableVScroller_$(topNodes[i]).attr('style', realNodes[i].attr('style')).addStyle('width', wstyle); } this.$topTable.removeStyle('display'); } TableVScroller.prototype.update = function () { if (!this.$thead) return; this.updateStyle(); this.updateSize(); }; TableVScroller.prototype.init = function (props) { this.super(props); this.sync.then(this.update.bind(this)); this.$attachHook.updateSize = this.update.bind(this); }; ACore["a" /* default */].install('tablevscroller', TableVScroller); /* harmony default export */ var js_TableVScroller = (TableVScroller); // EXTERNAL MODULE: ./node_modules/absol-acomp/css/tablescroller.css var tablescroller = __webpack_require__(189); // CONCATENATED MODULE: ./node_modules/absol-acomp/js/TableScroller.js var TableScroller_$ = ACore["a" /* default */].$; var TableScroller_ = ACore["a" /* default */]._; function TableScroller() { var res = TableScroller_({ class: 'absol-table-scroller', child: [ '.absol-table-scroller-viewport', '.absol-table-scroller-fixed-viewport',//place holder { class: 'absol-table-scroller-header-hscroller', child: '.absol-table-scroller-header-hscroller-viewport' }, { class: 'absol-table-scroller-left-vscroller', child: '.absol-table-scroller-left-vscroller-viewport' }, '.absol-table-scroller-head-line', '.absol-table-scroller-left-line', { class: 'absol-table-scroller-vscrollbar-container', child: { tag: 'vscrollbar' } }, { class: 'absol-table-scroller-hscrollbar-container', child: { tag: 'hscrollbar' } } ] }); res.eventHandler = OOP["a" /* default */].bindFunctions(res, TableScroller.eventHandler); res.$content = undefined; res.$fixedViewport = TableScroller_$('.absol-table-scroller-fixed-viewport', res); res.$leftScroller = TableScroller_$('.absol-table-scroller-left-vscroller', res); res.$leftViewport = TableScroller_$('.absol-table-scroller-left-vscroller-viewport', res) .on('scroll', res.eventHandler.scrollLeftScrollerViewport);; res.$headScroller = TableScroller_$('.absol-table-scroller-header-hscroller', res); res.$headScrollerViewport = TableScroller_$('.absol-table-scroller-header-hscroller-viewport', res) .on('scroll', res.eventHandler.scrollHeadScrollerViewport); res.$attachHook = TableScroller_('attachhook').addTo(res); res.$attachHook.on('error', function () { Dom["a" /* default */].addToResizeSystem(res.$attachHook); res.$attachHook.updateSize = res.$attachHook.updateSize||res._updateContentSize.bind(res); }); res.sync = new Promise(function (rs) { res.$attachHook.once('error', rs) }); res.$viewport = TableScroller_$('.absol-table-scroller-viewport', res) .on('scroll', res.eventHandler.scrollViewport); res.$viewport.scrollInto = js_BScroller.prototype.scrollInto; res.$leftLine = TableScroller_$('.absol-table-scroller-left-line', res); res.$headLine = TableScroller_$('.absol-table-scroller-head-line', res); res.$vscrollbarCtn = TableScroller_$('.absol-table-scroller-vscrollbar-container', res); res.$vscrollbar = TableScroller_$('.absol-table-scroller-vscrollbar-container vscrollbar', res) .on('scroll', function () { res.$viewport.scrollTop = this.innerOffset; }); res.$hscrollbarCtn = TableScroller_$('.absol-table-scroller-hscrollbar-container', res); res.$hscrollbar = TableScroller_$('.absol-table-scroller-hscrollbar-container hscrollbar', res) .on('scroll', function () { res.$viewport.scrollLeft = this.innerOffset; }); res.$vscrollbar.hidden = false; res.$hscrollbar.hidden = false; return res; } TableScroller.scrollSize = 17;//default Dom["a" /* default */].getScrollSize().then(function (size) { TableScroller.scrollSize = size.width;//default scroller TableScroller.$style = TableScroller_('style[id="table-scroller-css"]').addTo(document.head); TableScroller.$style.innerHTML = [ '.absol-table-scroller .absol-table-scroller-viewport {',// ' width: calc(100% + ' + size.width + 'px);', ' height: calc(100% + ' + size.width + 'px);', '}', '.absol-table-scroller .absol-table-scroller-header-hscroller-viewport {', ' margin-bottom: -' + size.width + 'px;/*default*/', '}' ].join('\n'); Dom["a" /* default */].updateResizeSystem(); setTimeout(Dom["a" /* default */].updateResizeSystem.bind(Dom["a" /* default */]), 30);// css load delay }); TableScroller.eventHandler = {}; TableScroller.eventHandler.scrollViewport = function (event) { if (!this.__scrollingElement__ || this.__scrollingElement__ == this.$viewport) { this.__scrollingElement__ = this.$viewport; this.$headScrollerViewport.scrollLeft = this.$viewport.scrollLeft; this.$leftViewport.scrollTop = this.$viewport.scrollTop; this.$vscrollbar.innerOffset = this.$viewport.scrollTop; this.$hscrollbar.innerOffset = this.$viewport.scrollLeft; if (this.__scrollTimer__ > 0) { clearTimeout(this.__scrollTimer__); } this.__scrollTimer__ = setTimeout(function () { this.__scrollingElement__ = undefined; this.__scrollTimer__ = -1; }.bind(this), 300); } }; TableScroller.eventHandler.scrollHeadScrollerViewport = function (event) { if (!this.__scrollingElement__ || this.__scrollingElement__ == this.$headScrollerViewport) { this.__scrollingElement__ = this.$headScrollerViewport; this.$viewport.scrollLeft = this.$headScrollerViewport.scrollLeft; if (this.__scrollTimer__ > 0) { clearTimeout(this.__scrollTimer__); } this.__scrollTimer__ = setTimeout(function () { this.__scrollingElement__ = undefined; this.__scrollTimer__ = -1; }.bind(this), 100); } }; TableScroller.eventHandler.scrollLeftScrollerViewport = function () { if (!this.__scrollingElement__ || this.__scrollingElement__ == this.$leftViewport) { this.__scrollingElement__ = this.$leftViewport; this.$viewport.scrollTop = this.$leftViewport.scrollTop; if (this.__scrollTimer__ > 0) { clearTimeout(this.__scrollTimer__); } this.__scrollTimer__ = setTimeout(function () { this.__scrollingElement__ = undefined; this.__scrollTimer__ = -1; }.bind(this), 100); } } TableScroller.prototype.clearChild = function () { this.$viewport.clearChild(); this.$fixedViewport.clearChild(); this.$headScrollerViewport.clearChild(); this.$leftViewport.clearChild(); this.$content = null; return this; }; TableScroller.prototype.addChild = function (elt) { if (this.$viewport.childNodes.length == 0) { if (elt.tagName && elt.tagName.toLowerCase() == 'table') { this.$viewport.addChild(elt); this.$content = elt; this._updateContent(); this.sync.then(this._updateContentSize.bind(this)).then(function () { setTimeout(this._updateContentSize.bind(this), 30); }.bind(this)); } else { throw new Error('Element must be a table!'); } } else { throw new Error("Only 1 table accepted!"); } }; TableScroller.prototype._updateFixedTable = function () { var fixedCol = this.fixedCol; this.$fixedViewport.clearChild(); this.$fixedTable = TableScroller_$(this.$content.cloneNode(false)).addClass('absol-table-scroller-fixed-table').addTo(this.$fixedViewport); this.$fixedTableThead = TableScroller_$(this.$contentThead.cloneNode(false)).addTo(this.$fixedTable); this.$fixedTableThead.clearChild(); this._fixedTableThsVisible = []; var self = this; this._fixedTableTr = Array.prototype.filter.call(this.$contentThead.childNodes, function (elt) { return elt.tagName == "TR"; }).map(function (tr) { var cloneTr = TableScroller_$(tr.cloneNode(false)); cloneTr.__originElement__ = tr; self.$fixedTableThead.appendChild(cloneTr); return cloneTr; }); this._fixedTableThs = this._fixedTableTr.map(function (tr) { return Array.prototype.filter.call(tr.__originElement__.childNodes, function (elt1) { return elt1.tagName == "TH" || elt1.tagName == "TD"; }).reduce(function (ac, th) { var colspan = th.getAttribute('colspan'); if (colspan) { colspan = parseInt(colspan); } else { colspan = 1; } ac.colspanSum += colspan; var cloneTh = TableScroller_$(th.cloneNode(true)); tr.appendChild(cloneTh); cloneTh.__originElement__ = th; ac.result.push(cloneTh); if (ac.colspanSum <= fixedCol) { self._fixedTableThsVisible.push(th); } return ac; }, { result: [], colspanSum: 0 }).result; }); }; TableScroller.prototype._updateHeaderScroller = function () { var self = this; this.$headScrollerViewport.clearChild(); this.$headScrollerTable = TableScroller_$(this.$content.cloneNode(false)) .addTo(this.$headScrollerViewport); this.$headScrollerThead = TableScroller_$(this.$contentThead.cloneNode(false)) .addTo(this.$headScrollerTable); this._headScrollerTr = Array.prototype.filter.call(this.$contentThead.childNodes, function (elt) { return elt.tagName == "TR"; }).map(function (tr) { var cloneTr = TableScroller_$(tr.cloneNode(false)); cloneTr.__originElement__ = tr; self.$headScrollerThead.appendChild(cloneTr); return cloneTr; }); this._headScrollerTds = this._headScrollerTr.map(function (tr) { return Array.prototype.filter.call(tr.__originElement__.childNodes, function (elt1) { return elt1.tagName == "TH"; }).map(function (th) { var cloneTh = TableScroller_$(th.cloneNode(true)).addTo(tr); cloneTh.__originElement__ = th; return cloneTh; }); }); }; TableScroller.prototype._updateLeftTable = function () { this.$leftViewport.clearChild(); this.$leftTable = TableScroller_$(this.$content.cloneNode(true)).addTo(this.$leftViewport); }; TableScroller.prototype._updateContent = function () { this.$contentThead = TableScroller_$('thead', this.$content); this._updateFixedTable(); this._updateHeaderScroller(); this._updateLeftTable(); }; TableScroller.prototype._updateFixedTableSize = function () { var l = 1000; var r = -1000; this._fixedTableThsVisible.forEach(function (elt) { var b = elt.getBoundingClientRect(); l = Math.min(l, b.left); r = Math.max(r, b.right); }); this._leftWidth = Math.max(r - l, 0); this.$fixedViewport.addStyle('width', this._leftWidth + 2 + 'px'); this._fixedTableTr.forEach(function (elt) { var styleHeight = elt.__originElement__.getBoundingClientRect().height + 'px'; elt.addStyle('height', styleHeight); }); this._fixedTableThs.forEach(function (row) { row.forEach(function (elt) { var styleWidth = elt.__originElement__.getBoundingClientRect().width + 'px'; elt.addStyle('width', styleWidth); }); }); this.$fixedTable.addStyle({ height: this.$contentThead.getBoundingClientRect().height + 'px', width: this.$content.getBoundingClientRect().width + 'px', }); }; TableScroller.prototype._updateHeaderScrollerSize = function () { var headHeight = this.$contentThead.getBoundingClientRect().height + 'px'; this.$headScrollerTable.addStyle('height', headHeight); this.$headScrollerTable.addStyle('width', this.$content.getBoundingClientRect().width + 'px'); this._headScrollerTr.forEach(function (elt) { var styleHeight = elt.__originElement__.getBoundingClientRect().height + 'px'; elt.addStyle('height', styleHeight); }); this._headScrollerTds.forEach(function (row) { row.forEach(function (elt) { var styleWidth = elt.__originElement__.getBoundingClientRect().width + 'px'; elt.addStyle('width', styleWidth); }); }); }; TableScroller.prototype._updateLeftTableSize = function () { this.$leftTable.addStyle('width', this.$content.getBoundingClientRect().width + 'px'); this.$leftTable.addStyle('height', this.$content.getBoundingClientRect().height + 'px'); this.$leftScroller.addStyle('width', this._leftWidth + 2 + 'px'); }; TableScroller.prototype._updateLinesSize = function () { if (this.$viewport.clientHeight < this.$viewport.scrollHeight) { this.addClass('scroll-v'); } else { this.removeClass('scroll-v'); } if (this.$viewport.clientWidth < this.$viewport.scrollWidth) { this.addClass('scroll-h'); } else { this.removeClass('scroll-h'); } this.$leftLine.addStyle({ maxHeight: this.$content.getBoundingClientRect().height + 'px', left: this._leftWidth + 'px' }); this.$headLine.addStyle({ top: this.$contentThead.getBoundingClientRect().height + 'px', maxWidth: this.$content.getBoundingClientRect().width + 'px' }); }; TableScroller.prototype._updateScrollBarSize = function () { var viewportBound = this.$viewport.getBoundingClientRect(); var tableBound = this.$content.getBoundingClientRect(); this.$vscrollbar.innerHeight = this.$viewport.scrollHeight; this.$vscrollbar.outerHeight = viewportBound.height - TableScroller.scrollSize; this.$hscrollbar.innerWidth = this.$viewport.scrollWidth; this.$hscrollbar.outerWidth = viewportBound.width - TableScroller.scrollSize; var overHeight = this.$viewport.clientHeight < this.$viewport.scrollHeight; var overWidth = this.$viewport.clientWidth < this.$viewport.scrollWidth; if (overHeight) { if (overWidth) { this.$hscrollbarCtn.removeStyle('bottom'); this.$vscrollbarCtn.removeStyle('right'); } else { this.$vscrollbarCtn.addStyle('right', viewportBound.width - TableScroller.scrollSize - tableBound.width + 'px'); } } else { if (overWidth) { this.$hscrollbarCtn.addStyle('bottom', viewportBound.height - TableScroller.scrollSize - tableBound.height + 'px'); } } }; TableScroller.prototype._updateContentSize = function () { this._updateFixedTableSize(); this._updateHeaderScrollerSize(); this._updateLeftTableSize(); this._updateLinesSize(); this._updateScrollBarSize(); }; TableScroller.property = {}; TableScroller.property.fixedCol = { set: function (value) { value = value || 0; this._fixedCol = value; if (this.$content) { this._updateContent(); this.sync.then(this._updateContentSize.bind(this)).then(function () { setTimeout(this._updateContentSize.bind(this), 30) }.bind(this)); } }, get: function () { return this._fixedCol || 0; } }; ACore["a" /* default */].install('TableScroller'.toLowerCase(), TableScroller); /* harmony default export */ var js_TableScroller = (TableScroller); // EXTERNAL MODULE: ./node_modules/absol-acomp/css/quickpath.css var quickpath = __webpack_require__(191); // CONCATENATED MODULE: ./node_modules/absol-acomp/js/QuickPath.js var QuickPath_ = ACore["a" /* default */]._; var QuickPath_$ = ACore["a" /* default */].$; function QuickPath() { var res = QuickPath_({ class: 'absol-quick-path', extendEvent: ['change', 'press'] }); res.eventHandler = OOP["a" /* default */].bindFunctions(res, QuickPath.eventHandler); res._itemSeq = []; res.on('click', res.eventHandler.click); return res; } QuickPath.eventHandler = {}; QuickPath.eventHandler.click = function (event) { var button = this._fileButton(event.target) if (button) this.pressButton(button); }; QuickPath.prototype.pressButton = function (button) { var index = parseInt(button.attr('data-index')); this.emit('press', { target: this, button: button, isActive: button.containsClass('toggle'), index: index, pathElement: this.path[index] }, this); if (button.containsClass('toggle')) return; if (!this.path[index].items || this.path[index].items.length == 0) return;// don't display dropdown var self = this; button.addClass('toggle'); var buttonBound = button.getBoundingClientRect(); var rootBound = this.getBoundingClientRect(); var outBound = Dom["a" /* default */].traceOutBoundingClientRect(this); var atop = rootBound.top - outBound.top - 5; var abot = outBound.bottom - buttonBound.bottom - 10; var dx = buttonBound.left - rootBound.left; var dropdown = QuickPath_({ class: 'absol-quick-path-dropdown', style: { left: dx + 'px', 'min-width': buttonBound.width + 'px' }, tag: 'bscroller', child: 'vmenu' }).addTo(this); var menu = QuickPath_$('vmenu', dropdown).on('press', function (event) { var text = event.menuItem.text; var iconSrc = event.menuItem.iconSrc; self.path[index].text = text; button.$text.clearChild().addChild(QuickPath_({ text: text })); if (iconSrc) { button.$iconImg.attr('src', iconSrc); } else { button.$iconImg.attr('src', undefined); } self.emit('change', { type: 'change', target: self, text: text, index: index, iconSrc: iconSrc }); }); var items = this.path[index].items; if (atop > abot) { menu.items = items; dropdown.addStyle({ 'max-height': atop + 'px', bottom: '100%' }); var dropdownBound = dropdown.getBoundingClientRect(); if (dropdownBound.height < abot) { dropdown.addStyle({ 'max-height': abot + 'px', top: '100%', overflow: 'visible' }).removeStyle('bottom'); } else if (dropdownBound.height < atop) { dropdown.addStyle('overflow', 'visible') } } else { menu.items = items; dropdown.addStyle({ 'max-height': abot + 'px', top: '100%' }); var dropdownBound = dropdown.getBoundingClientRect(); if (dropdownBound.height < abot) { dropdown.addStyle('overflow', 'visible') } } setTimeout(function () { QuickPath_$(document.body).once('click', function () { dropdown.remove(); button.removeClass('toggle'); }); }, 100); }; QuickPath.prototype._fileButton = function (elt) { while (elt != this && elt) { if (elt.tagName == 'BUTTON' && elt.containsClass && elt.containsClass('absol-quick-path-btn')) { return elt; } elt = elt.parentNode; } return false; }; QuickPath.prototype.updatePath = function () { this.clearChild(); var self = this; this.path.forEach(function (data, index) { var buttom = self._createButton(data, index); self.addChild(buttom); }); }; QuickPath.prototype._createButton = function (data, index) { var buttom = QuickPath_({ tag: 'button', class: 'absol-quick-path-btn', attr: { 'data-index': '' + index }, child: [ 'toggler-ico', { tag: 'img', class: "absol-quick-path-btn-ext-ico", }, { tag: 'span', child: { text: data.text } } ] }); buttom.$iconImg = QuickPath_$('.absol-quick-path-btn-ext-ico', buttom); if (data.iconSrc) { buttom.$iconImg.src = data.iconSrc; } buttom.$text = QuickPath_$('span', buttom); return buttom; } QuickPath.prototype.push = function (item) { this.path.push(item); var buttom = this._createButton(item, this.path.length - 1); this.addChild(buttom); }; QuickPath.prototype.clear = function () { this.path = []; } QuickPath.prototype.pop = function () { //todo var res = this.path.pop(); var button = QuickPath_$('button[data-index="' + this.path.length + '"]'); if (button) button.remove(); return res; }; QuickPath.property = {}; /** * @typedef PathElement * @property {String} name * @property {Array<String>} items * */ QuickPath.property.path = { /** * @param {Array<PathElement>} value */ set: function (value) { this._path = value || []; this.updatePath(); }, get: function () { return this._path || []; } }; QuickPath.property.textPath = { get: function () { } }; ACore["a" /* default */].install('quickpath', QuickPath); /* harmony default export */ var js_QuickPath = (QuickPath); // CONCATENATED MODULE: ./node_modules/absol-acomp/js/QuickMenu.js var QuickMenu_ = ACore["a" /* default */]._; var QuickMenu_$ = ACore["a" /* default */].$; function QuickMenu() { //like context menu without right-click var res = QuickMenu_({ extendEvent: 'requestcontextmenu', class: ['absol-context-hinge'], child: { tag: 'vmenu', class: [ 'absol-context-menu', 'absol-bscroller' ], style: { 'overflow-y': 'auto', 'box-sizing': 'border-box' } } }); res.$contextMenu = QuickMenu_$('vmenu.absol-context-menu', res); res._contextMenuSync = Promise.resolve(); return res; }; // QuickMenu.prototype.show = function(element, menuProps, anchor){ // var elementBound = element.getBoundingClientRect(); // }; ACore["a" /* default */].install('quickmenu', QuickMenu); QuickMenu.PRIORITY_ANCHORS = [0, 3, 7, 4, 1, 2, 6, 5]; QuickMenu.DEFAULT_ANCHOR = 0; QuickMenu.$ctn = QuickMenu_('.absol-context-hinge-fixed-container'); QuickMenu.$elt = QuickMenu_('quickmenu').addTo(QuickMenu.$ctn); QuickMenu.$element = undefined; QuickMenu._acceptAnchors = 0; QuickMenu._previewAnchor = QuickMenu.DEFAULT_ANCHOR; QuickMenu._session = Math.random() * 10000000000 >> 0; QuickMenu._menuListener = undefined; QuickMenu.$elt.$contextMenu.on('press', function (event) { if (QuickMenu._menuListener) QuickMenu._menuListener(event.menuItem); }); QuickMenu.updatePosition = function () { if (!QuickMenu.$element) return; var qmenu = QuickMenu.$elt; var menu = qmenu.$contextMenu; var ebound = QuickMenu.$element.getBoundingClientRect(); var menuBound = menu.getBoundingRecursiveRect(3); var qBound = qmenu.getBoundingClientRect(); var outBound = Dom["a" /* default */].traceOutBoundingClientRect(qmenu); //padding outBound.left += 2; outBound.top += 2; outBound.bottom -= 2; outBound.right -= 2; outBound.height -= 4; outBound.width -= 4; var getPos = function (anchor) { anchor = anchor % 8; var x = 0; var y = 0; if (anchor == 0 || anchor == 3) { y = ebound.top; } if (anchor == 0 || anchor == 7) { x = ebound.right; } if (anchor == 1 || anchor == 6) { x = ebound.left; } if (anchor == 1 || anchor == 2) { y = ebound.bottom; } if (anchor == 2 || anchor == 5) { x = ebound.right - menuBound.width; } if (anchor == 3 || anchor == 4) { x = ebound.left - menuBound.width; } if (anchor == 4 || anchor == 7) { y = ebound.bottom - menuBound.height; } if (anchor == 5 || anchor == 6) { y = ebound.top - menuBound.height; } return { x: x, y: y }; }; var pos; var bestSquare = -1; var bestRect; var priority = [QuickMenu._previewAnchor].concat(QuickMenu._acceptAnchors); var cAnchor; var outRect = new Math_Rectangle(outBound.left, outBound.top, outBound.width, outBound.height); var menuRect; var viewSquare; var cPos; for (var i = 0; i < priority.length; ++i) { cAnchor = priority[i]; cPos = getPos(cAnchor); menuRect = new Math_Rectangle(cPos.x, cPos.y, menuBound.width, menuBound.height); viewSquare = outRect.collapsedSquare(menuRect); if (viewSquare - 0.01 > bestSquare) { bestSquare = viewSquare; pos = cPos; QuickMenu._previewAnchor = cAnchor; bestRect = outRect.collapsedRect(menuRect); } } // if (bestRect && pos.y < ebound.bottom) { // pos.y += menuBound.height - Math.min(menuBound.height, bestRect.height - 5); // } pos.x -= qBound.left; pos.y -= qBound.top; menu.addStyle({ left: pos.x + 'px', top: pos.y + 'px' }); // if (bestRect) { // menu.addStyle('max-height', bestRect.height + 'px'); // } // else { // menu.removeStyle('max-height'); // } }; QuickMenu._scrollEventHandler = QuickMenu.updatePosition.bind(QuickMenu); QuickMenu.$scrollTrackElements = []; QuickMenu.show = function (element, menuProps, anchor, menuListener, darkTheme) { //untrack all element QuickMenu.$scrollTrackElements.forEach(function (e) { if (e.removeEventListener) e.removeEventListener('scroll', QuickMenu._scrollEventHandler, false); else e.dettachEvent('onscroll', QuickMenu._scrollEventHandler, false); }); QuickMenu.$scrollTrackElements = []; if (typeof anchor == 'number') { QuickMenu._acceptAnchors = [anchor]; } else if (anchor instanceof Array) { QuickMenu._acceptAnchors = anchor; } else { QuickMenu._acceptAnchors = QuickMenu.PRIORITY_ANCHORS; } QuickMenu._previewAnchor = QuickMenu._acceptAnchors[0]; QuickMenu._session = Math.random() * 10000000000 >> 0; QuickMenu.$ctn.addTo(document.body); Dom["a" /* default */].addToResizeSystem(QuickMenu.$ctn); QuickMenu.$ctn.updateSize = QuickMenu.updatePosition.bind(QuickMenu); QuickMenu.$element = element; QuickMenu._menuListener = menuListener; var qmenu = QuickMenu.$elt; var menu = qmenu.$contextMenu; Object.assign(menu, menuProps); if (darkTheme) qmenu.addClass('dark'); else qmenu.removeClass('dark'); menu.removeStyle('visibility');//for prevent size change blink QuickMenu.updatePosition(); setTimeout(function () { menu.addStyle('visibility', 'visible'); }, 2); //track element var trackElt = element.parentElement; while (trackElt) { // trackElt.addEventListener('scroll', QuickMenu._scrollEventHandler, false); if (trackElt.addEventListener) trackElt.addEventListener('scroll', QuickMenu._scrollEventHandler, false); else trackElt.attachEvent('onscroll', QuickMenu._scrollEventHandler, false); QuickMenu.$scrollTrackElements.push(trackElt); trackElt = trackElt.parentElement; } if (document.addEventListener) { document.addEventListener('scroll', QuickMenu._scrollEventHandler, false); } else { document.attachEvent('onscroll', QuickMenu._scrollEventHandler, false); } QuickMenu.$scrollTrackElements.push(document); return QuickMenu._session; }; QuickMenu.close = function (session) { if (session !== true && session != QuickMenu._session) return; QuickMenu.$element = undefined; QuickMenu._menuListener = undefined; QuickMenu._previewAnchor = QuickMenu.DEFAULT_ANCHOR; //untrack all element QuickMenu.$scrollTrackElements.forEach(function (e) { e.removeEventListener('scroll', QuickMenu._scrollEventHandler, false); }); QuickMenu.$scrollTrackElements = []; var qmenu = QuickMenu.$elt; var menu = qmenu.$contextMenu; menu.removeStyle('visibility');//for prevent size change blink menu.removeStyle({ left: true, top: true }); QuickMenu.$ctn.remove(); }; QuickMenu.showWhenClick = function (element, menuProps, anchor, menuListener, darkTheme) { var res = { menuProps: menuProps, anchor: anchor, currentSession: undefined, element: element, menuListener: menuListener, darkTheme: darkTheme }; var clickHandler = function () { if (QuickMenu._session == res.currentSession) return; res.currentSession = QuickMenu.show(res.element, res.menuProps, res.anchor, res.menuListener, res.darkTheme); var finish = function () { document.body.removeEventListener('click', finish, false); QuickMenu.close(res.currentSession); res.currentSession = undefined; }; setTimeout(function () { document.body.addEventListener('click', finish, false); }, 10) }; res.remove = function () { element.removeEventListener('click', clickHandler, false); }; element.addEventListener('click', clickHandler, false); return res; }; /** * @typedef {Object} QuickMenuAdaptor * @property {Function} getFlowedElement default is trigger * @property {Function} getMenuProps define menuProps if un-change * @property {Function} getAnchor default is 'auto', define anchor if un-change * @property {Function} onClose callback * @property {Function} onOpen callback * @property {Function} onSelect calback * @property {Function} isDarkTheme default is false, define darkThem if un-change * * * @typedef {Object} QuickMenuDataHolder * @property {Function} remove * * @param {Element} trigger * @param {QuickMenuAdaptor} adaptor * @returns {QuickMenuDataHolder} */ QuickMenu.toggleWhenClick = function (trigger, adaptor) { var res = { trigger: trigger, adaptor: adaptor, currentSession: undefined, }; var clickHandler = function () { if (QuickMenu._session == res.currentSession) return; res.currentSession = QuickMenu.show(res.adaptor.getFlowedElement ? res.adaptor.getFlowedElement() : trigger, res.adaptor.getMenuProps ? res.adaptor.getMenuProps() : (adaptor.menuProps || []), res.adaptor.getAnchor ? res.adaptor.getAnchor() : (adaptor.anchor || 'auto'), res.adaptor.onSelect, res.adaptor.isDarkTheme ? res.adaptor.isDarkTheme() : !!res.adaptor.darkTheme); if (res.adaptor.onOpen) res.adaptor.onOpen(); var finish = function () { document.body.removeEventListener('click', finish, false); QuickMenu.close(res.currentSession); if (adaptor.onClose) adaptor.onClose(); res.currentSession = undefined; }; setTimeout(function () { document.body.addEventListener('click', finish, false); }, 10); }; res.remove = function () { trigger.removeEventListener('click', clickHandler, false); }; trigger.addEventListener('click', clickHandler, false); return res; }; /* harmony default export */ var js_QuickMenu = (QuickMenu); // EXTERNAL MODULE: ./node_modules/absol-acomp/css/droppanel.css var droppanel = __webpack_require__(193); // CONCATENATED MODULE: ./node_modules/absol-acomp/js/DropPanel.js var DropPanel_ = ACore["a" /* default */]._; var DropPanel_$ = ACore["a" /* default */].$; function DropPanel() { var res = DropPanel_({ class: 'absol-drop-panel', extendEvent: ['toggle'], child: [ { class: 'absol-drop-panel-head', child: [ 'toggler-ico', { tag: 'span', class: "absol-drop-panel-name" } ] }, { class: ['absol-drop-panel-body', 'absol-bscroller'] } ] }); res.eventHandler = OOP["a" /* default */].bindFunctions(res, DropPanel.eventHandler); res.$body = DropPanel_$('.absol-drop-panel-body', res); res.$head = DropPanel_$('.absol-drop-panel-head', res) .on('click', res.eventHandler.clickHead); res.$name = DropPanel_$('.absol-drop-panel-name', res); OOP["a" /* default */].drillProperty(res, res.$name, 'name', 'innerHTML'); return res; } DropPanel.eventHandler = {}; DropPanel.eventHandler.clickHead = function (event) { if (!this._childOfButton(event.target)) { var event = { target: this, isShowed: this.show, preventDefault: function () { this.prevented = true; } }; this.emit('toggle', event, this); if (!event.prevented) { this.toggle(); } } }; ['findChildBefore', 'findChildAfter', 'removeChild', 'clearChild', 'addChild'] .forEach(function (key) { DropPanel.prototype[key] = function () { this.$body[key].apply(this.$body, arguments); } }); DropPanel.prototype._childOfButton = function (elt) { while (elt && elt != this) { if (elt.tagName == "BUTTON") { return true; } elt = elt.parentElement } return false; }; DropPanel.prototype.toggle = function () { this.show = !this.show; }; DropPanel.property = {}; DropPanel.property.show = { set: function (value) { if (value) { var maxHeight = parseFloat(this.getComputedStyleValue('max-height').replace('px', '')); var headBound = this.$head.getBoundingClientRect(); if (maxHeight != 'none' && maxHeight != 'auto') { this.$body.addStyle('max-height', maxHeight - headBound.height + 'px'); } this.$body.addStyle('height', this.$body.scrollHeight + 'px'); setTimeout(function () { this.$body.removeStyle('height'); window.dispatchEvent(new Event('resize')); }.bind(this), 200); this.addClass('show'); } else { this.$body.addStyle('height', this.$body.scrollHeight + 'px'); setTimeout(function () { this.$body.addStyle('height', '0'); }.bind(this), 0); setTimeout(function () { this.$body.removeStyle('height'); window.dispatchEvent(new Event('resize')); }.bind(this), 200); this.removeClass('show'); } }, get: function () { return this.containsClass('show'); } }; ACore["a" /* default */].install('DropPanel'.toLowerCase(), DropPanel); /* harmony default export */ var js_DropPanel = (DropPanel); // CONCATENATED MODULE: ./node_modules/absol-acomp/js/DropPanelStack.js var DropPanelStack_ = ACore["a" /* default */]._; var DropPanelStack_$ = ACore["a" /* default */].$; function DropPannelStack() { var res = DropPanelStack_({ class: 'absol-drop-pannel-stack' }); res.$attachHook = DropPanelStack_('attachhook').addTo(res).on('error', function () { Dom["a" /* default */].addToResizeSystem(this); this.updateSize = res.updateSize.bind(res); }); res.sync = new Promise(function (rs) { res.$attachHook.once('error', rs); }); return res; } DropPannelStack.prototype.updateSize = function () { }; DropPannelStack.prototype.getFreeHeight = function () { var childNodes = this.childNodes; var sumHeight = 0; var bound = this.getBoundingClientRect(); var childBound; for (var i = 0; i < childNodes.length; ++i) { var child = childNodes[i]; if (child.containsClass && child.containsClass('absol-drop-panel')) { childBound = child.getBoundingClientRect(); sumHeight += childBound.height; } } return bound.height - sumHeight; }; DropPannelStack.prototype.addChild = function (child) { var self = this; if (child.containsClass('absol-drop-panel')) { //remove last event listener off other parent if (child.__drop_panel_toggle_listener__) { child.off('toggle', child.__drop_panel_toggle_listener__); } child.__drop_panel_toggle_listener__ = function (event) { event.preventDefault(); self.sync = self.sync.then(function () { if (event.isShowed) { setTimeout(function () { child.removeStyle('max-height'); }, 200); child.toggle(); } else { var headBound = child.$head.getBoundingClientRect(); var vailableHeight = self.getFreeHeight(); if (vailableHeight > 3) { child.addStyle('max-height', self.getFreeHeight() + headBound.height + 'px'); child.toggle(); } } return new Promise(function (rs) { setTimeout(rs, 200); }); }) }; child.on('toggle', child.__drop_panel_toggle_listener__); this.super(child); } else { throw new Error('Child element must be a DropPanel'); } }; ACore["a" /* default */].install('droppanelstack', DropPannelStack); /* harmony default export */ var DropPanelStack = (DropPannelStack); // EXTERNAL MODULE: ./node_modules/absol-acomp/css/draggablestack.css var draggablestack = __webpack_require__(195); // CONCATENATED MODULE: ./node_modules/absol-acomp/js/DraggableVStack.js var DraggableVStack_ = ACore["a" /* default */]._; var DraggableVStack_$ = ACore["a" /* default */].$; function DraggableVStack() { var res = DraggableVStack_({ extendEvent: 'change', class: ['absol-draggable-stack', 'absol-draggable-vstack'] }); res.eventHandler = OOP["a" /* default */].bindFunctions(res, DraggableVStack.eventHandler); res.$cloneContainer = DraggableVStack_('.absol-draggable-stack-clone-container'); res.$destLine = DraggableVStack_('.absol-draggable-stack-dest-line'); res.on('mousedown', res.eventHandler.mouseDown); return res; } DraggableVStack.eventHandler = {}; DraggableVStack.eventHandler.mouseDown = function (event) { var dragzone = this._findDragzone(event.target); var self = this; if (dragzone) { //save mouse position, use it for other event this._mouseClientX = event.clientX; this._mouseClientY = event.clientY; var bound = this.getBoundingClientRect(); var element = this._findDirectChild(event.target); element.classList.add('dragging'); this.$draggingElt = element; this._dragginEltIndex = 0; this._childrentInfo = Array.prototype.map.call(this.childNodes, function (child, index) { var childBound = child.getBoundingClientRect(); if (child == element) self._dragginEltIndex = index; return { index: index, elt: child, bound: childBound, top: childBound.top - bound.top } }); this.$cloneContainer.addTo(this); this.$destLine.addTo(this); var containerBound = element.getBoundingClientRect(); this._initBound = bound; this._currentBound = bound; this._initTop = containerBound.top - bound.top; this._crTop = this._initTop; this._initHeight = containerBound.height; this._pressX = event.clientX - containerBound.left; this._pressY = event.clientY - containerBound.top; this.$cloneContainer.addStyle({ top: this._initTop + 'px', height: this._initHeight + 'px' }).addChild(element.cloneNode(true)); this.$destLine.addStyle('top', this._initTop + 'px'); DraggableVStack_$(document.body).on('mousemove', this.eventHandler.mouseMove); DraggableVStack_$(document.body).on('mouseleave', this.eventHandler.mouseFinish); DraggableVStack_$(document.body).on('mouseup', this.eventHandler.mouseFinish); this.$scrollTrackElements = []; var trackElt = this.parentElement; while (trackElt) { if (trackElt.addEventListener) trackElt.addEventListener('scroll', this.eventHandler.scroll, false); else trackElt.attachEvent('onscroll', this.eventHandler.scroll, false); this.$scrollTrackElements.push(trackElt); trackElt = trackElt.parentElement; } if (document.addEventListener) { document.addEventListener('scroll', this.eventHandler.scroll, false); } else { document.attachEvent('onscroll', this.eventHandler.scroll, false); } this.$scrollTrackElements.push(document); this._updateDragginPosition(); } }; DraggableVStack.eventHandler.mouseMove = function (event) { event.preventDefault(); //save mouse position this._mouseClientX = event.clientX; this._mouseClientY = event.clientY; this._updateDragginPosition(); }; DraggableVStack.eventHandler.scroll = function (event) { this._updateDragginPosition(); }; DraggableVStack.eventHandler.mouseFinish = function (event) { var self = this; DraggableVStack_$(document.body).off('mouseleave', this.eventHandler.mouseFinish); DraggableVStack_$(document.body).off('mouseup', this.eventHandler.mouseFinish); DraggableVStack_$(document.body).off('mousemove', this.eventHandler.mouseMove); this.$scrollTrackElements.forEach(function (e) { if (e.removeEventListener) e.removeEventListener('scroll', self.eventHandler.scroll, false); else e.dettachEvent('onscroll', self.eventHandler.scroll, false); }); if ((this._dragginEltIndex == this._childrentInfo.length - 1 && !this._destRecord) || (this._destRecord && (this._destRecord.index == this._dragginEltIndex || this._destRecord.index == this._dragginEltIndex + 1))) { //nothing to change, view animation this.$cloneContainer.addClass('home-going'); setTimeout(function () { self.$cloneContainer.addStyle({ top: self._initTop + 'px' }); }, 0); setTimeout(function () { self.$cloneContainer.clearChild().removeClass('home-going').remove(); self.$destLine.removeStyle({ top: '' }).remove(); self.$draggingElt.classList.remove('dragging'); self.$draggingElt = undefined; }, 200); } else { this.$draggingElt.remove(); this.$destLine.removeStyle({ top: '' }).remove(); this.$cloneContainer.clearChild().remove(); this.$draggingElt.classList.remove('dragging'); if (this._destRecord) { this.addChildBefore(this.$draggingElt, this._destRecord.elt); this.emit('change', { type: 'change', target: this, action: "BEFORE", at: this._destRecord.elt, sourceIndex: this._dragginEltIndex, destIndex: this._destIndex, elt: this.$draggingElt }, this); } else { this.addChild(this.$draggingElt); this.emit('change', { type: 'change', target: this, action: "END", elt: this.$draggingElt, sourceIndex: this._dragginEltIndex }, this); } } }; DraggableVStack.prototype._updateDragginPosition = function () { //update cloneContainer var bound = this.getBoundingClientRect(); //style top of cloneContainer this._crTop = this._mouseClientY - bound.top - this._pressY; this.$cloneContainer.addStyle({ top: this._crTop + 'px' }); //update destLine var centerY = this._crTop + this._initHeight / 2; var nearestRecord; var nearestDistance = Math.abs(centerY - bound.height);//end of stack var cDist; var nearestIndex = this._childrentInfo.length; for (var i = 0; i < this._childrentInfo.length; ++i) { cDist = Math.abs(centerY - this._childrentInfo[i].top); if (cDist < nearestDistance) { nearestRecord = this._childrentInfo[i]; nearestDistance = cDist; nearestIndex = i; } } if (nearestRecord) { this.$destLine.addStyle('top', nearestRecord.top + 'px'); } else { this.$destLine.addStyle('top', bound.height + 'px'); } if (nearestIndex == this._dragginEltIndex || nearestIndex == this._dragginEltIndex + 1) { this.$destLine.addStyle('visibility', 'hidden'); } else { this.$destLine.removeStyle('visibility', 'hidden'); } this._destRecord = nearestRecord; this._destIndex = nearestIndex; // setTimeout(this._autoScrollParentIfNeed.bind(this, 10), 33); }; DraggableVStack.prototype._autoScrollParentIfNeed = function (delta) { //todo: choose which element should be scroll if (!(delta > 0)) delta = 10000; var bound = this.getBoundingClientRect(); var cloneBound = this.$cloneContainer.getBoundingClientRect(); var outBound = Dom["a" /* default */].traceOutBoundingClientRect(this.$cloneContainer); if (outBound.bottom >= cloneBound.bottom && outBound.top <= cloneBound.top) return; var scrollables = []; var current = this; while (current) { var oy = window.getComputedStyle(current); oy = oy['overflow-y'] || oy['overflowY']; if (oy == 'auto' || oy == 'scroll') { scrollables.push(current); } current = current.parentElement; } scrollables.push(document.body.parentElement); }; DraggableVStack.prototype._findDragzone = function (elt) { var result = null; while (elt && elt != this) { if (elt.classList && elt.classList.contains('drag-zone')) { result = elt; break; } elt = elt.parentNode; } if (result) { elt = result; while (elt && elt != this) { if (elt.classList && (elt.classList.contains('absol-draggable-stack')) ) { result = null; break; } elt = elt.parentNode; } } return result; }; DraggableVStack.prototype._findDirectChild = function (elt) { while (elt && elt != this) { if (elt.parentNode == this) return elt; elt = elt.parentNode; } return undefined; }; ACore["a" /* default */].install('DraggableVStack'.toLowerCase(), DraggableVStack); /* harmony default export */ var js_DraggableVStack = (DraggableVStack); // CONCATENATED MODULE: ./node_modules/absol-acomp/js/DraggableHStack.js var DraggableHStack_ = ACore["a" /* default */]._; var DraggableHStack_$ = ACore["a" /* default */].$; function DraggableHStack() { var res = DraggableHStack_({ extendEvent: 'change', class: ['absol-draggable-stack', 'absol-draggable-hstack'] }); res.eventHandler = OOP["a" /* default */].bindFunctions(res, DraggableHStack.eventHandler); res.$cloneContainer = DraggableHStack_('.absol-draggable-stack-clone-container'); res.$destLine = DraggableHStack_('.absol-draggable-stack-dest-line'); res.on('mousedown', res.eventHandler.mouseDown); return res; } DraggableHStack.eventHandler = {}; DraggableHStack.eventHandler.mouseDown = function (event) { var self = this; var dragzone = this._findDragzone(event.target); if (dragzone) { this._mouseClientX = event.clientX; this._mouseClientY = event.clientY; var bound = this.getBoundingClientRect(); var element = this._findDirectChild(event.target); element.classList.add('dragging'); this.$draggingElt = element; this._dragginEltIndex = 0; this._childrentInfo = Array.prototype.map.call(this.childNodes, function (child, index) { var childBound = child.getBoundingClientRect(); if (child == element) self._dragginEltIndex = index; return { index: index, elt: child, bound: childBound, left: childBound.left - bound.left, } }); this.$cloneContainer.addTo(this); this.$destLine.addTo(this); var containerBound = element.getBoundingClientRect(); this._initBound = bound; this._currentBound = bound; this._initTop = containerBound.top - bound.top; this._initLeft = containerBound.left - bound.left; this._crLeft = this._initLeft; this._initWidth = containerBound.width; this._pressX = event.clientX - containerBound.left; this._pressY = event.clientY - containerBound.top; this.$cloneContainer.addStyle({ top: this._initTop + 'px', left: this._initLeft + 'px', width: this._initWidth + 'px' }).addChild(DraggableHStack_$(element.cloneNode(true)).addStyle({'width': '100%', 'box-sizing':'border-box'})); this.$destLine.addStyle('left', this._initLeft + 'px'); DraggableHStack_$(document.body).on('mousemove', this.eventHandler.mouseMove); DraggableHStack_$(document.body).on('mouseleave', this.eventHandler.mouseFinish); DraggableHStack_$(document.body).on('mouseup', this.eventHandler.mouseFinish); this.$scrollTrackElements = []; var trackElt = this.parentElement; while (trackElt) { if (trackElt.addEventListener) trackElt.addEventListener('scroll', this.eventHandler.scroll, false); else trackElt.attachEvent('onscroll', this.eventHandler.scroll, false); this.$scrollTrackElements.push(trackElt); trackElt = trackElt.parentElement; } if (document.addEventListener) { document.addEventListener('scroll', this.eventHandler.scroll, false); } else { document.attachEvent('onscroll', this.eventHandler.scroll, false); } this.$scrollTrackElements.push(document); this._updateDragginPosition(); } }; DraggableHStack.eventHandler.mouseMove = function (event) { event.preventDefault(); //save mouse position this._mouseClientX = event.clientX; this._mouseClientY = event.clientY; this._updateDragginPosition(); }; DraggableHStack.eventHandler.mouseFinish = function (event) { var self = this; DraggableHStack_$(document.body).off('mouseleave', this.eventHandler.mouseFinish); DraggableHStack_$(document.body).off('mouseup', this.eventHandler.mouseFinish); DraggableHStack_$(document.body).off('mousemove', this.eventHandler.mouseMove); this.$scrollTrackElements.forEach(function (e) { if (e.removeEventListener) e.removeEventListener('scroll', self.eventHandler.scroll, false); else e.dettachEvent('onscroll', self.eventHandler.scroll, false); }); if ((this._dragginEltIndex == this._childrentInfo.length - 1 && !this._destRecord) || (this._destRecord && (this._destRecord.index == this._dragginEltIndex || this._destRecord.index == this._dragginEltIndex + 1))) { //nothing to change, view animation this.$cloneContainer.addClass('home-going'); setTimeout(function () { self.$cloneContainer.addStyle({ left: self._initLeft + 'px' }); }, 0); setTimeout(function () { self.$cloneContainer.clearChild().removeClass('home-going').remove(); self.$destLine.removeStyle({ left: '' }).remove(); self.$draggingElt.classList.remove('dragging'); self.$draggingElt = undefined; }, 200); } else { this.$draggingElt.remove(); this.$destLine.removeStyle({ top: '' }).remove(); this.$cloneContainer.clearChild().remove(); this.$draggingElt.classList.remove('dragging'); if (this._destRecord) { this.addChildBefore(this.$draggingElt, this._destRecord.elt); this.emit('change', { type: 'change', target: this, action: "BEFORE", at: this._destRecord.elt, sourceIndex: this._dragginEltIndex, destIndex: this._destIndex, elt: this.$draggingElt }, this); } else { this.addChild(this.$draggingElt); this.emit('change', { type: 'change', target: this, action: "END", elt: this.$draggingElt, sourceIndex: this._dragginEltIndex }, this); } } }; DraggableHStack.prototype._findDragzone = js_DraggableVStack.prototype._findDragzone; DraggableHStack.prototype._findDirectChild = js_DraggableVStack.prototype._findDirectChild; DraggableHStack.eventHandler.scroll = function (event) { this._updateDragginPosition(); }; DraggableHStack.prototype._updateDragginPosition = function () { //update cloneContainer var bound = this.getBoundingClientRect(); //style top of cloneContainer this._crLeft = this._mouseClientX - bound.left - this._pressX; this.$cloneContainer.addStyle({ left: this._crLeft + 'px' }); //update destLine var centerX = this._crLeft + this._initWidth / 2; var nearestRecord; var nearestDistance = Math.abs(centerX - bound.width);//end of stack var cDist; var nearestIndex = this._childrentInfo.length; for (var i = 0; i < this._childrentInfo.length; ++i) { cDist = Math.abs(centerX - this._childrentInfo[i].left); if (cDist < nearestDistance) { nearestRecord = this._childrentInfo[i]; nearestDistance = cDist; nearestIndex = i; } } if (nearestRecord) { this.$destLine.addStyle('left', nearestRecord.left + 'px'); } else { var lastRecord = this._childrentInfo[this._childrentInfo.length - 1]; this.$destLine.addStyle('left', lastRecord.left + lastRecord.bound.width + 'px'); } if (nearestIndex == this._dragginEltIndex || nearestIndex == this._dragginEltIndex + 1) { this.$destLine.addStyle('visibility', 'hidden'); } else { this.$destLine.removeStyle('visibility', 'hidden'); } this._destRecord = nearestRecord; this._destIndex = nearestIndex; // setTimeout(this._autoScrollParentIfNeed.bind(this, 10), 33); }; ACore["a" /* default */].install('DraggableHStack'.toLowerCase(), DraggableHStack); /* harmony default export */ var js_DraggableHStack = (DraggableHStack); // EXTERNAL MODULE: ./node_modules/absol-acomp/css/chromecalendar.css var chromecalendar = __webpack_require__(197); // CONCATENATED MODULE: ./node_modules/absol/src/Time/datetime.js 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('/'); }; /** * * @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"]; //more https://www.myonlinetraininghub.com/excel-date-and-time-formatting var formatTokenRegex = /([a-zA-Z]|[^\s\-$-/:-?{-~!"^_`\[\]])+/g;//more /** * * @param {Date} date * @param {String} format * @returns {String} */ function formartDateString(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; } }); }; /** * @param {Date} date * @return {Date} */ function prevDate(date) { return new Date(date.getTime() - 86400000); }; /** * @param {Date} date * @return {Date} */ function nextDate(date) { return new Date(date.getTime() + 86400000); }; /** * @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 * @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 datetime_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); }; 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); } } // CONCATENATED MODULE: ./node_modules/absol-acomp/js/ChromeCalendar.js var ChromeCalendar_ = ACore["a" /* default */]._; var ChromeCalendar_$ = ACore["a" /* default */].$; function ChromeCalendar() { var res = ChromeCalendar_({ class: 'absol-chrome-calendar', extendEvent: 'pick', child: [ { class: 'absol-chrome-calendar-header', child: [ { class: 'absol-chrome-calendar-title', child: [ { tag: 'span', class: 'title-time', child: { text: 'Septemper, 2019' } }, { tag: 'span', child: { text: '\u25bc' } } ] }, { class: 'absol-chrome-calendar-header-buttons', child: [ { tag: 'button', class: 'prev-btn', child: 'span.mdi.mdi-menu-left', attr: { title: 'Previous Month' } }, { tag: 'button', class: 'today-btn', child: 'span.mdi.mdi-circle-medium', attr: { title: 'Today' } }, { tag: 'button', class: 'next-btn', child: 'span.mdi.mdi-menu-right', attr: { title: 'Next Month' } } ] } ] }, { class: 'absol-chrome-calendar-instance', child: [ { class: 'absol-chrome-calendar-dayofweek', child: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'].map(function (text) { return { child: { text: text } } }) }, { class: 'absol-chrome-calendar-month', child: Array(6).fill(0).map(function (u, i) { return { class: 'absol-chrome-calendar-week-in-mounth', child: Array(7).fill(0).map(function (v, j) { return { child: { text: i * 7 + j + '' } } }) } }) }, { tag: 'vscroller', class: 'absol-chrome-calendar-years', child: { child: Array(200).fill(0).map(function (u, i) { return { class: 'absol-chrome-calendar-year', child: [ { class: 'absol-chrome-calendar-year-head', child: { text: i + 1890 + '' }, } ], props: { __year__: i + 1890 }, on: { click: function () { res.expandYear(this.__year__); } } }; }) } } ] } ] }); res.$title = ChromeCalendar_$('.absol-chrome-calendar-title', res) .on('click', function () { res.viewYear(); }); res.$titleTime = ChromeCalendar_$('.absol-chrome-calendar-title > .title-time', res); res.$instance = ChromeCalendar_$('.absol-chrome-calendar-instance', res); res.$month = ChromeCalendar_$('.absol-chrome-calendar-month', res); res._minLimitDate = new Date(1890, 0, 1, 0, 0, 0, 0, 0); res._maxLimitDate = new Date(2090, 0, 1, 0, 0, 0, 0, 0); res._selectedDates = [beginOfDay(new Date())]; res._viewDate = new Date(); res.$prevBtn = ChromeCalendar_$('.absol-chrome-calendar-header-buttons > button.prev-btn', res) .on('click', function () { res.viewPrevMonth(); }); res.$todayBtn = ChromeCalendar_$('.absol-chrome-calendar-header-buttons > button.today-btn', res) .on('click', function () { res.viewToday(); res.pickDate(new Date()); }); res.$nextBtn = ChromeCalendar_$('.absol-chrome-calendar-header-buttons > button.next-btn', res) .on('click', function () { res.viewNexMounth(); }); res.$yearScroller = ChromeCalendar_$('vscroller.absol-chrome-calendar-years', res); res.$yearItems = []; ChromeCalendar_$('.absol-chrome-calendar-year', res.$yearScroller, function (e) { res.$yearItems.push(e); }) res.$attachHook = ChromeCalendar_('attachhook').addTo(res).on('error', function () { // res.updateSize(); res.$yearScroller.requestUpdateSize(); res.expandYear(res._viewDate.getFullYear()); }); res.sync = new Promise(function (rs) { res.$attachHook.on('error', rs); }); return res; } /** * @param {Date} date * @returns {Boolean} */ ChromeCalendar.prototype._isSelectedDate = function (date) { for (var i = 0; i < this._selectedDates.length; ++i) { if (compareDate(date, this._selectedDates[i]) == 0) return true; } return false; }; /** * @param {Date} date * @returns {Boolean} */ ChromeCalendar.prototype._isSelectedMonth = function (date) { for (var i = 0; i < this._selectedDates.length; ++i) { if (compareMonth(date, this._selectedDates[i]) == 0) return true; } return false; }; ChromeCalendar.prototype.pickDate = function (date, event) { this._selectedDates = [date]; this._updateMonth(this.$month); if (this.$lastOpenYearItem) this.$lastOpenYearItem.$months.updateActiveMonth(); this.emit('pick', { type: 'pick', value: date, isTrusted: event && event.isTrusted, originEvent: event, selectedDates: this.selectedDates }); }; /** * @param {Element} monthElt * @param {Date} date */ ChromeCalendar.prototype._fillMonth = function (monthElt, date) { var self = this; if (monthElt.$cells === undefined) {//for faster, attach event to element monthElt.$cells = []; ChromeCalendar_$('.absol-chrome-calendar-week-in-mounth > div', this.$month, function (elt) { monthElt.$cells.push(elt); elt.on('click', function (event) { self.pickDate(this.__date__, event); if (elt.containsClass('absol-chrome-calendar-not-in-month')) { if (this.__date__.getDate() < 15) { self.viewNexMounth(); } else { self.viewPrevMonth(); } } }); }); } var currentDate = beginOfWeek(datetime_beginOfMonth(date)); var d; var cell; for (var i = 0; i < monthElt.$cells.length; ++i) { var cell = monthElt.$cells[i]; d = currentDate.getDate(); cell.innerHTML = '' + d; cell.__date__ = beginOfDay(currentDate); currentDate = nextDate(currentDate); } }; ChromeCalendar.prototype._updateMonth = function (monthElt) { if (!monthElt.$cells) return; // days weren't filled var now = new Date(); var viewM = this._viewDate.getMonth(); var m; var cell; var currentDate; for (var i = 0; i < monthElt.$cells.length; ++i) { cell = monthElt.$cells[i]; currentDate = cell.__date__; m = currentDate.getMonth(); if (m != viewM) cell.addClass('absol-chrome-calendar-not-in-month'); else cell.removeClass('absol-chrome-calendar-not-in-month'); if (compareDate(currentDate, now) == 0) cell.addClass('absol-chrome-calendar-today'); else cell.removeClass('absol-chrome-calendar-today'); if (this._isSelectedDate(currentDate)) cell.addClass('absol-chrome-calendar-selected'); else cell.removeClass('absol-chrome-calendar-selected'); if (compareDate(this._minLimitDate, currentDate) > 0 || compareDate(currentDate, this._maxLimitDate) > 0) { cell.addClass('absol-chrome-calendar-date-disabled'); } else { cell.removeClass('absol-chrome-calendar-date-disabled'); } } }; ChromeCalendar.prototype.viewNexMounth = function () { var self = this; this.sync = this.sync.then(function () { return new Promise(function (rs) { var oldBound = self.$month.getBoundingClientRect(); var oldMonth = self.$month.cloneNode(true); var instanceBound = self.$instance.getBoundingClientRect(); if (self.$lastAnimationCtn) { self.$lastAnimationCtn.removeClass('new').addClass('old'); } var oldMonthCnt = ChromeCalendar_({ class: ['absol-chrome-calendar-month-animation-container', 'old'], style: { top: oldBound.top - instanceBound.top + 'px', height: oldBound.height + 'px', width: oldBound.width + 'px' }, child: oldMonth }).addTo(self.$instance); self._viewDate = nextMonth(self._viewDate); self.viewMonth(); var newMonth = self.$month.cloneNode(true); var overlap = 0; var j = 41; while (j >= 0 && self.$month.$cells[j].containsClass('absol-chrome-calendar-not-in-month')) { overlap += oldBound.height / 6; j -= 7; } var newMonthCtn = ChromeCalendar_({ class: ['absol-chrome-calendar-month-animation-container', 'new'], style: { top: oldBound.top + oldBound.height - instanceBound.top - overlap + 'px', height: oldBound.height + 'px', width: oldBound.width + 'px' }, child: newMonth }).addTo(self.$instance); self.$lastAnimationCtn = newMonthCtn; setTimeout(function () { oldMonthCnt.addStyle('top', oldBound.top - oldBound.height + overlap - instanceBound.top + 'px'); newMonthCtn.addStyle('top', oldBound.top - instanceBound.top + 'px'); }, 20); setTimeout(function () { self.$lastAnimationCtn = undefined; oldMonthCnt.remove(); newMonthCtn.remove(); }, 220); setTimeout(rs, 22); }); }); return this.sync; }; ChromeCalendar.prototype.viewPrevMonth = function () { var self = this; this.sync = this.sync.then(function () { return new Promise(function (rs) { var oldBound = self.$month.getBoundingClientRect(); var oldMonth = self.$month.cloneNode(true); var instanceBound = self.$instance.getBoundingClientRect(); if (self.$lastAnimationCtn) { self.$lastAnimationCtn.removeClass('new').addClass('old'); } var oldMonthCnt = ChromeCalendar_({ class: ['absol-chrome-calendar-month-animation-container', 'old'], style: { top: oldBound.top - instanceBound.top + 'px', height: oldBound.height + 'px', width: oldBound.width + 'px' }, child: oldMonth }).addTo(self.$instance); self._viewDate = prevMonth(self._viewDate); self.viewMonth(); var newMonth = self.$month.cloneNode(true); var overlap = 0; var j = 0; while (j < 42 && self.$month.$cells[j].containsClass('absol-chrome-calendar-not-in-month')) { overlap += oldBound.height / 6; j += 7; } var newMonthCtn = ChromeCalendar_({ class: ['absol-chrome-calendar-month-animation-container', 'new'], style: { top: oldBound.top - oldBound.height + overlap - instanceBound.top + 'px', height: oldBound.height + 'px', width: oldBound.width + 'px' }, child: newMonth }).addTo(self.$instance); self.$lastAnimationCtn = newMonthCtn; setTimeout(function () { oldMonthCnt.addStyle('top', oldBound.top + oldBound.height - overlap - instanceBound.top + 'px'); newMonthCtn.addStyle('top', oldBound.top - instanceBound.top + 'px'); }, 20); setTimeout(function () { self.$lastAnimationCtn = undefined; oldMonthCnt.remove(); newMonthCtn.remove(); }, 220); setTimeout(rs, 22); }) }); return this.sync; }; ChromeCalendar.prototype.viewToday = function () { this._viewDate = new Date(); this.viewMonth(); }; ChromeCalendar.prototype.viewMonth = function () { this._updateButtons(); this.removeClass('view-year').addClass('view-month'); this._fillMonth(this.$month, this._viewDate); this._updateMonth(this.$month); this.$titleTime.innerHTML = formartDateString(this._viewDate, 'mmmm, yyyy'); }; ChromeCalendar.prototype.viewYear = function () { this.removeClass('view-month') .addClass('view-year'); this.expandYear(this._viewDate.getFullYear()); this.$yearScroller.requestUpdateSize(); }; ChromeCalendar.prototype.expandYear = function (year) { var fontSize = this.getFontSize(); var self = this; var lastItemElt = this.$lastOpenYearItem; var itemElt = this.$yearItems[year - 1890]; var lastYear = 100000000; if (lastItemElt && lastItemElt.__year__ != year) { lastYear = lastItemElt.__year__; lastItemElt.addClass('start-closing'); setTimeout(function () { lastItemElt.removeClass('start-closing').addClass('closing'); }, 0); setTimeout(function () { lastItemElt.removeClass('closing'); lastItemElt.$months.remove(); lastItemElt.$months = undefined; }, 100); } if (lastItemElt != itemElt) { if (!itemElt.$months) { itemElt.$months = this._createMonths(year).addTo(itemElt); itemElt.addClass('start-opening'); setTimeout(function () { itemElt.removeClass('start-opening').addClass('opening'); }, 1); setTimeout(function () { itemElt.removeClass('opening'); }, 100); } } var dy = itemElt.getBoundingClientRect().top - self.$yearScroller.getBoundingClientRect().top - fontSize * 0.45; if (itemElt.__year__ > lastYear) { dy -= 6 * fontSize; } self.$yearScroller.scrollBy(dy, 100); this.$lastOpenYearItem = itemElt; itemElt.$months.updateActiveMonth(); }; ChromeCalendar.prototype._updateButtons = function () { var endOfPrevMonth = prevDate(datetime_beginOfMonth(this._viewDate)); if (compareDate(endOfPrevMonth, this._minLimitDate) < 0) { this.$prevBtn.addClass('absol-chrome-calendar-button-disabled'); } else { this.$prevBtn.removeClass('absol-chrome-calendar-button-disabled'); } var beginOfNextMonth = nextMonth(this._viewDate); if (compareDate(beginOfNextMonth, this._maxLimitDate) > 0) { this.$nextBtn.addClass('absol-chrome-calendar-button-disabled'); } else { this.$nextBtn.removeClass('absol-chrome-calendar-button-disabled'); } var now = new Date(); if (compareDate(now, this._maxLimitDate) > 0 || compareDate(now, this._minLimitDate) < 0) { this.$todayBtn.addClass('absol-chrome-calendar-button-disabled'); } else { this.$todayBtn.removeClass('absol-chrome-calendar-button-disabled'); } }; ChromeCalendar.prototype._createMonths = function (year) { var now = new Date(); var self = this; var res = ChromeCalendar_({ class: 'absol-chrome-calendar-year-mounths', child: Array(3).fill('').map(function (u, i) { return { class: 'absol-chrome-calendar-year-row-months', child: Array(4).fill(0).map(function (v, j) { var date = new Date(year, i * 4 + j, 1, 0, 0, 0, 0, 0); return { class: ['absol-chrome-calendar-year-month'] .concat((year == now.getFullYear() && now.getMonth() == i * 4 + j) ? ['absol-chrome-calendar-today'] : []) .concat(self._isSelectedMonth(date) ? ['absol-chrome-calendar-selected'] : []) , child: { text: monthNames[i * 4 + j].substr(0, 3) }, on: { click: function () { self._viewDate = date; self.viewMonth(); } }, props: { __date__: date } } }) } }) }); res.$monthList = []; ChromeCalendar_$('.absol-chrome-calendar-year-month', res, function (e) { res.$monthList.push(e); }); res.updateActiveMonth = function () { res.$monthList.forEach(function (e) { now = new Date(); if (compareMonth(e.__date__, now) == 0) { e.addClass('absol-chrome-calendar-today'); } else { e.removeClass('absol-chrome-calendar-today'); } if (self._isSelectedMonth(e.__date__)) { e.addClass('absol-chrome-calendar-selected'); } else { e.removeClass('absol-chrome-calendar-selected'); } var beginOfMonth = datetime_beginOfMonth(e.__date__); var endOfMonth = prevDate(nextMonth(e.__date__)); if (compareDate(self._minLimitDate, endOfMonth) > 0 || compareDate(beginOfMonth, self._maxLimitDate) > 0) { e.addClass('absol-chrome-calendar-date-disabled'); } else { e.removeClass('absol-chrome-calendar-date-disabled'); } }); } return res; }; ChromeCalendar.prototype.init = function (props) { props = props || {}; this.super(props); this.viewToday(); }; ChromeCalendar.property = {}; ChromeCalendar.property.selectedDates = { set: function (value) { value = value || []; if (value instanceof Date) value = [value]; this._selectedDates = value; this.sync = this.sync.then(function () { this._viewDate = this._selectedDates[0] || new Date();//default is today this.viewMonth(); }.bind(this)); }, get: function () { return this._selectedDates; } }; ChromeCalendar.property.minLimitDate = { set: function (value) { if (!value) value = new Date(1890, 0, 1, 0, 0, 0, 0, 0); if (typeof value == 'number') value = new Date(value); this._minLimitDate = value; //todo this._updateButtons(); this.sync = this.sync.then(function () { this._updateMonth(this.$month); if (this.$lastOpenYearItem) { this.$lastOpenYearItem.$months.updateActiveMonth(); } }.bind(this)); }, get: function () { return this._minLimitDate; } }; ChromeCalendar.property.maxLimitDate = { set: function (value) { if (!value) value = new Date(2090, 0, 1, 0, 0, 0, 0, 0); if (typeof value == 'number') value = new Date(value); this._maxLimitDate = value; this._updateButtons(); this.sync = this.sync.then(function () { this._updateMonth(this.$month); if (this.$lastOpenYearItem) { this.$lastOpenYearItem.$months.updateActiveMonth(); } }.bind(this)); }, get: function () { return this._minLimitDate; } }; ChromeCalendar.property.minDateLimit = ChromeCalendar.property.minLimitDate; ChromeCalendar.property.maxDateLimit = ChromeCalendar.property.maxLimitDate; ChromeCalendar.property.multiSelect = { set: function (value) { throw new Error('Not support yet!') var lastValue = this.multiSelect; value = !!value; if (lastValue != value) { if (value) { this.addClass('multi-select') } else { this.removeClass('multi-select'); } this._updateMonth(this.$month); } }, get: function () { return this.containsClass('multi-select'); } }; ACore["a" /* default */].install('chromecalendar', ChromeCalendar); ChromeCalendar._session = Math.random() * 10000000000 >> 0; ChromeCalendar._listener = undefined; ChromeCalendar.showWhenClick = function (element, calendarProps, anchor, calendarPickListener, darkTheme) { var res = { calendarProps: calendarProps, anchor: anchor, currentSession: undefined, element: element, calendarPickListener: calendarPickListener, darkTheme: darkTheme, setDateValue: function (value) { if (this.currentSession == ChromeCalendar._session) { ChromeCalendar.$calendar.selectedDates = [value]; } }, cancel: function () { } }; var clickHandler = function () { if (ChromeCalendar._session == res.currentSession) return; res.currentSession = ChromeCalendar.show(res.element, res.calendarProps, res.anchor, res.calendarPickListener, res.darkTheme); var finish = function (event) { if (event && event.target && EventEmitter["a" /* default */].hitElement(ChromeCalendar.$calendar, event)) return; document.body.removeEventListener('click', finish, false); ChromeCalendar.close(res.currentSession); ChromeCalendar.$calendar.off('pick', finish); res.currentSession = undefined; res.cancel = function () { }; }; setTimeout(function () { document.body.addEventListener('click', finish, false); ChromeCalendar.$calendar.on('pick', finish); res.cancel = finish; }, 10) }; res.remove = function () { element.removeEventListener('click', clickHandler, false); }; element.addEventListener('click', clickHandler, false); return res; }; ChromeCalendar.show = function (element, calendarProps, anchor, calendarPickListener, darkTheme) { ChromeCalendar._session = Math.random() * 10000000000 >> 0; function exec() { if (!ChromeCalendar.$ctn) { ChromeCalendar.$ctn = ChromeCalendar_('.absol-context-hinge-fixed-container'); ChromeCalendar.$follower = ChromeCalendar_('follower').addTo(ChromeCalendar.$ctn); ChromeCalendar.$calendar = ChromeCalendar_('chromecalendar') .on('pick', function (event) { if (typeof ChromeCalendar._listener == 'function') { ChromeCalendar._listener(event.value); } }).addTo(ChromeCalendar.$follower); } ChromeCalendar.$ctn.addTo(document.body); // only one value need if (calendarProps instanceof Date) calendarProps = { selectedDates: [calendarProps] }; if (calendarProps instanceof Array) calendarProps = { selectedDates: calendarProps }; Object.assign(ChromeCalendar.$calendar, calendarProps); if (darkTheme) ChromeCalendar.$ctn.addClass('dark'); else ChromeCalendar.$ctn.removeClass('dark'); ChromeCalendar.$follower.followTarget = element; ChromeCalendar.$follower.anchor = anchor; ChromeCalendar.$calendar.addStyle('visibility', 'hidden');//for prevent size change blink ChromeCalendar._listener = calendarPickListener; setTimeout(function () { ChromeCalendar.$follower.updatePosition(); ChromeCalendar.$calendar.removeStyle('visibility'); }, 2); } if (document.body) exec(); else Dom["a" /* default */].documentReady.then(exec); return ChromeCalendar._session; }; ChromeCalendar.close = function (session) { if (session !== true && session != ChromeCalendar._session) return; function exec() { ChromeCalendar.followTarget = undefined; ChromeCalendar._listener = undefined; ChromeCalendar.$ctn.remove(); } if (document.body) exec(); else Dom["a" /* default */].documentReady.then(exec); }; /* harmony default export */ var js_ChromeCalendar = (ChromeCalendar); // EXTERNAL MODULE: ./node_modules/absol-acomp/css/calendarinput.css var calendarinput = __webpack_require__(199); // CONCATENATED MODULE: ./node_modules/absol-acomp/js/CalendarInput.js var CalendarInput_ = ACore["a" /* default */]._; var CalendarInput_$ = ACore["a" /* default */].$; function CalendarInput() { var res = CalendarInput_({ extendEvent: ['change'], class: 'absol-calendar-input', child: 'input[type="text"][readonly="true"][value="dd/mm/yyyy"]' }); res.$input = CalendarInput_$('input', res); res._value = null; res._quickOption = js_ChromeCalendar.showWhenClick(res, { minLimitDate: res.minLimitDate || res.minDateLimit, maxLimitDate: res.maxLimitDate || res.maxDateLimit, selectedDates: [res._value] }, 'auto', function (value) { res._value = value; res.$input.value = res.formartDateString(value); res._quickOption.calendarProps.selectedDates = [value];//change new option res.emit('change', { target: res, value: value }, res); }); OOP["a" /* default */].drillProperty(res, res._quickOption.calendarProps, ['minLimitDate', 'maxLimitDate', 'minDateLimit', 'maxDateLimit']); return res; } CalendarInput.property = {}; CalendarInput.property.value = { set: function (value) { if (value === null || value === undefined) { this.$input.value = this.formartDateString(value); this._quickOption.calendarProps.selectedDates = []; this._value = value; } else { if (typeof value == 'number') value = new Date(value); this._value = value; this.$input.value = this.formartDateString(value); this._quickOption.calendarProps.selectedDates = [value]; } }, get: function () { return this._value; } }; CalendarInput.property.disabled = { set: function (value) { this.$input.disabled = !!value; if (value) { this.addClass('absol-disabled'); } else { this.removeClass('absol-disabled'); } }, get: function () { return this.$input.disabled; } }; CalendarInput.attribute = { disabled: { set: function (value) { this.$input.attr('disabled', value); if (this.$input.disabled) this.addClass('absol-disabled'); }, get: function () { return this.$input.attr('disabled'); }, remove: function () { this.$input.attr('disabled', undefined); this.removeClass('absol-disabled'); } } }; CalendarInput.property.dateToString = { set: function (value) { this._dateToString = value; this.$input.value = this.formartDateString(this.value); }, get: function () { return this._dateToString; } }; CalendarInput.prototype.formartDateString = function (date) { if (!date) { return { 'undefined': 'dd/mm/yyyy', 'function': '--/--/--', 'object': 'dd/mm/yyyy', 'string': typeof this.dateToString }[typeof this.dateToString] || '--/--/--'; } if (!this.dateToString) { return formartDateString(date); } else if (typeof this.dateToString == 'string') { return formartDateString(date, this.dateToString); } else if (typeof this.dateToString == 'function') { return this.dateToString(date); } }; ACore["a" /* default */].install('calendarinput', CalendarInput); // for older code ACore["a" /* default */].install('calendar-input', function (data) { return CalendarInput_({ tag: 'calendarinput', extendEvent: 'changed', props: data, on: { change: function (ev) { this.emit('changed', ev.value); } } }); }); /* harmony default export */ var js_CalendarInput = (CalendarInput); // EXTERNAL MODULE: ./node_modules/absol-acomp/css/onscreenwindow.css var onscreenwindow = __webpack_require__(201); // CONCATENATED MODULE: ./node_modules/absol-acomp/js/OnsScreenWindow.js var OnsScreenWindow_ = ACore["a" /* default */]._; var OnsScreenWindow_$ = ACore["a" /* default */].$; function OnScreenWindow() { var res = OnsScreenWindow_({ extendEvent: ['sizechange', 'drag', 'relocation'], class: 'absol-onscreen-window', child: { class: 'absol-onscreen-window-content', child: [ { class: 'absol-onscreen-window-head-bar', child: [ 'span.absol-onscreen-window-head-bar-icon.mdi.mdi-settings', { tag: 'span', class: 'absol-onscreen-window-head-bar-title', child: { text: '' } }, { class: "absol-onscreen-window-head-bar-buttons", child: [ { tag: 'button', class: 'absol-onscreen-window-head-bar-button-minimize', child: 'span.mdi.mdi-window-minimize' }, { tag: 'button', class: 'absol-onscreen-window-head-bar-button-dock', child: 'span.mdi.mdi-dock-window' }, { tag: 'button', class: 'absol-onscreen-window-head-bar-button-close', child: 'span.mdi.mdi-close' } ] } ] }, { class: 'absol-onscreen-window-body-container' }, '.absol-onscreen-window-resizer.absol-onscreen-window-resize-bottom', '.absol-onscreen-window-resizer.absol-onscreen-window-resize-top', '.absol-onscreen-window-resizer.absol-onscreen-window-resize-left', '.absol-onscreen-window-resizer.absol-onscreen-window-resize-right', '.absol-onscreen-window-resizer.absol-onscreen-window-resize-bottom-right', '.absol-onscreen-window-resizer.absol-onscreen-window-resize-bottom-left', '.absol-onscreen-window-resizer.absol-onscreen-window-resize-top-left', '.absol-onscreen-window-resizer.absol-onscreen-window-resize-top-right' ] } }); res.eventHandler = OOP["a" /* default */].bindFunctions(res, OnScreenWindow.eventHandler); res.$headerbar = js_Draggable(OnsScreenWindow_$('.absol-onscreen-window-head-bar', res)) .on('begindrag', res.eventHandler.beginDragHeaderbar); res.$bottomResizer = js_Draggable(OnsScreenWindow_$('.absol-onscreen-window-resizer.absol-onscreen-window-resize-bottom', res)) .on('begindrag', res.eventHandler.beginDragBottom); res.$rightResizer = js_Draggable(OnsScreenWindow_$('.absol-onscreen-window-resizer.absol-onscreen-window-resize-right', res)) .on('begindrag', res.eventHandler.beginDragRight); res.$topResizer = js_Draggable(OnsScreenWindow_$('.absol-onscreen-window-resizer.absol-onscreen-window-resize-top', res)) .on('begindrag', res.eventHandler.beginDragTop); res.$leftResizer = js_Draggable(OnsScreenWindow_$('.absol-onscreen-window-resizer.absol-onscreen-window-resize-left', res)) .on('begindrag', res.eventHandler.beginDragLeft); res.$bottomRightResizer = js_Draggable(OnsScreenWindow_$('.absol-onscreen-window-resizer.absol-onscreen-window-resize-bottom-right', res)) .on('begindrag', res.eventHandler.beginDragButtonRight); res.$bottomLeftResizer = js_Draggable(OnsScreenWindow_$('.absol-onscreen-window-resizer.absol-onscreen-window-resize-bottom-left', res)) .on('begindrag', res.eventHandler.beginDragBottomLeft); res.$topLeftResizer = js_Draggable(OnsScreenWindow_$('.absol-onscreen-window-resizer.absol-onscreen-window-resize-top-left', res)) .on('begindrag', res.eventHandler.beginDragTopLeft); res.$topRightResizer = js_Draggable(OnsScreenWindow_$('.absol-onscreen-window-resizer.absol-onscreen-window-resize-top-right', res)) .on('begindrag', res.eventHandler.beginDragTopRight); res.$headerButtonCtn = OnsScreenWindow_$('.absol-onscreen-window-head-bar-buttons', res.$headerbar); res.$windowIcon = OnsScreenWindow_$('span.absol-onscreen-window-head-bar-icon.mdi.mdi-settings', res); res.$windowTitle = OnsScreenWindow_$('.absol-onscreen-window-head-bar-title', res); res._windowIcon = 'span.absol-onscreen-window-head-bar-icon.mdi.mdi-settings'; res._windowTitle = ''; res.$bodyContainer = OnsScreenWindow_$('.absol-onscreen-window-body-container', res); res.$attachhook = OnsScreenWindow_('attachhook').addTo(res) .on('error', function () { this.updateSize = this.updateSize || res.relocation.bind(res); Dom["a" /* default */].addToResizeSystem(this); }); res.$minimizeBtn = OnsScreenWindow_$('button.absol-onscreen-window-head-bar-button-minimize', res); res.$closeBtn = OnsScreenWindow_$('button.absol-onscreen-window-head-bar-button-close', res); res.$dockBtn = OnsScreenWindow_$('button.absol-onscreen-window-head-bar-button-dock', res); return res; } OnScreenWindow.eventHandler = {}; OnScreenWindow.eventHandler.beginDragHeaderbar = function (event) { if (!EventEmitter["a" /* default */].hitElement(this.$headerButtonCtn, event)) { this.$headerbar.on('drag', this.eventHandler.dragHeaderbar); this.$headerbar.on('enddrag', this.eventHandler.endDragHeaderbar); var screenSize = Dom["a" /* default */].getScreenSize(); var bound = this.getBoundingClientRect(); this.__moveData__ = { bound: bound, modal: OnsScreenWindow_('.absol-onscreen-window-moving-modal').addTo(document.body), maxLeft: screenSize.width - bound.width - 1, maxY: screenSize.height - bound.height - 1, }; } }; OnScreenWindow.eventHandler.dragHeaderbar = function (event) { var dx = event.moveDX; var dy = event.moveDY; var newX = Math.max(0, Math.min(this.__moveData__.maxLeft, this.__moveData__.bound.left + dx)); var newY = Math.max(0, Math.min(this.__moveData__.maxY, this.__moveData__.bound.top + dy)); this.addStyle({ top: newY + 'px', left: newX + 'px' }); this.emit('drag', event, this); }; OnScreenWindow.eventHandler.endDragHeaderbar = function (event) { this.$headerbar.off('drag', this.eventHandler.dragHeaderbar); this.$headerbar.off('enddrag', this.eventHandler.endDragHeaderbar); this.__moveData__.modal.remove(); this.__moveData__ = undefined; }; OnScreenWindow.eventHandler.beginDragBottom = function (event) { if (event.target != this.$bottomResizer) return; this.$bottomResizer.on('drag', this.eventHandler.dragBottom); this.$bottomResizer.on('enddrag', this.eventHandler.endDragBottom); var screenSize = Dom["a" /* default */].getScreenSize(); var bound = this.getBoundingClientRect(); this.__moveData__ = { bound: bound, minHeight: this.getFontSize() * 1.4, maxHeight: screenSize.height - bound.top, modal: OnsScreenWindow_('.absol-onscreen-window-moving-modal.absol-onscreen-window-resize-bottom').addTo(document.body) }; }; OnScreenWindow.eventHandler.dragBottom = function (event) { var dy = event.moveDY; var newHeight = Math.max(this.__moveData__.minHeight, Math.min(this.__moveData__.maxHeight, this.__moveData__.bound.height + dy)); this.addStyle('height', newHeight + 'px'); }; OnScreenWindow.eventHandler.endDragBottom = function (event) { this.$bottomResizer.off('drag', this.eventHandler.dragBottom); this.$bottomResizer.off('enddrag', this.eventHandler.endDragBottom); this.__moveData__.modal.remove(); this.__moveData__ = undefined; }; OnScreenWindow.eventHandler.beginDragRight = function (event) { if (event.target != this.$rightResizer) return; this.$rightResizer.on('drag', this.eventHandler.dragRight); this.$rightResizer.on('enddrag', this.eventHandler.endDragRight); var screenSize = Dom["a" /* default */].getScreenSize(); var bound = this.getBoundingClientRect(); var minWidth = this.$windowTitle.getBoundingClientRect().right - bound.left + this.$headerButtonCtn.getBoundingClientRect().width; this.__moveData__ = { minWidth: minWidth, bound: bound, maxWidth: screenSize.width - bound.left, modal: OnsScreenWindow_('.absol-onscreen-window-moving-modal.absol-onscreen-window-resize-right').addTo(document.body) }; }; OnScreenWindow.eventHandler.dragRight = function (event) { var dx = event.moveDX; var newWidth = Math.max(this.__moveData__.minWidth, Math.min(this.__moveData__.maxWidth, this.__moveData__.bound.width + dx)); this.addStyle('width', newWidth + 'px'); }; OnScreenWindow.eventHandler.endDragRight = function (event) { this.$rightResizer.off('drag', this.eventHandler.dragRight); this.$rightResizer.off('enddrag', this.eventHandler.endDragRight); this.__moveData__.modal.remove(); this.__moveData__ = undefined; }; OnScreenWindow.eventHandler.beginDragTop = function (event) { if (event.target != this.$topResizer) return; this.$topResizer.on('drag', this.eventHandler.dragTop); this.$topResizer.on('enddrag', this.eventHandler.endDragTop); // var screenSize = Dom.getScreenSize(); var bound = this.getBoundingClientRect(); var fontSize = this.getFontSize(); this.__moveData__ = { fontSize: fontSize, bound: bound, maxTop: bound.bottom - 1.4 * fontSize, modal: OnsScreenWindow_('.absol-onscreen-window-moving-modal.absol-onscreen-window-resize-top').addTo(document.body) }; }; OnScreenWindow.eventHandler.dragTop = function (event) { var dy = event.moveDY; var newTop = Math.max(0, Math.min(this.__moveData__.maxTop, this.__moveData__.bound.top + dy)); var newHeight = this.__moveData__.bound.bottom - newTop; this.addStyle({ 'top': newTop + 'px', 'height': newHeight + 'px', }); this.emit('sizechange', event, this); }; OnScreenWindow.eventHandler.endDragTop = function (event) { this.$topResizer.off('drag', this.eventHandler.dragTop); this.$topResizer.off('enddrag', this.eventHandler.endDragTop); this.__moveData__.modal.remove(); this.__moveData__ = undefined; }; OnScreenWindow.eventHandler.beginDragLeft = function (event) { if (event.target != this.$leftResizer) return; this.$leftResizer.on('drag', this.eventHandler.dragLeft); this.$leftResizer.on('enddrag', this.eventHandler.endDragLeft); var bound = this.getBoundingClientRect(); var minWidth = this.$windowTitle.getBoundingClientRect().right - bound.left + this.$headerButtonCtn.getBoundingClientRect().width; this.__moveData__ = { maxLeft: bound.right - minWidth, bound: bound, modal: OnsScreenWindow_('.absol-onscreen-window-moving-modal.absol-onscreen-window-resize-left').addTo(document.body) }; }; OnScreenWindow.eventHandler.dragLeft = function (event) { var dx = event.moveDX; var newLeft = Math.max(0, Math.min(this.__moveData__.maxLeft, this.__moveData__.bound.left + dx)); var newWidth = this.__moveData__.bound.right - newLeft; this.addStyle({ width: newWidth + 'px', left: newLeft + 'px' }); this.emit('sizechange', event, this); }; OnScreenWindow.eventHandler.endDragLeft = function (event) { this.$rightResizer.off('drag', this.eventHandler.dragLeft); this.$rightResizer.off('enddrag', this.eventHandler.endDragLeft); this.__moveData__.modal.remove(); this.__moveData__ = undefined; }; //todo OnScreenWindow.eventHandler.beginDragButtonRight = function (event) { if (event.target != this.$bottomRightResizer) return; this.$bottomRightResizer.on('drag', this.eventHandler.dragButtonRight); this.$bottomRightResizer.on('enddrag', this.eventHandler.endDragButtonRight); var screenSize = Dom["a" /* default */].getScreenSize(); var bound = this.getBoundingClientRect(); var minWidth = this.$windowTitle.getBoundingClientRect().right - bound.left + this.$headerButtonCtn.getBoundingClientRect().width; this.__moveData__ = { minHeight: this.getFontSize() * 1.4, minWidth: minWidth, bound: bound, maxWidth: screenSize.width - bound.left, maxHeight: screenSize.height - bound.top, modal: OnsScreenWindow_('.absol-onscreen-window-moving-modal.absol-onscreen-window-resize-bottom-right').addTo(document.body) }; }; OnScreenWindow.eventHandler.dragButtonRight = function (event) { var dx = event.moveDX; var dy = event.moveDY; var newWidth = Math.max(this.__moveData__.minWidth, Math.min(this.__moveData__.maxWidth, this.__moveData__.bound.width + dx)); var newHeight = Math.max(this.__moveData__.minHeight, Math.min(this.__moveData__.maxHeight, this.__moveData__.bound.height + dy)); this.addStyle('width', newWidth + 'px'); this.addStyle('height', newHeight + 'px'); this.emit('sizechange', event, this); }; OnScreenWindow.eventHandler.endDragButtonRight = function (event) { this.$bottomRightResizer.off('drag', this.eventHandler.dragButtonRight); this.$bottomRightResizer.off('enddrag', this.eventHandler.endDragButtonRight); this.__moveData__.modal.remove(); this.__moveData__ = undefined; }; OnScreenWindow.eventHandler.beginDragBottomLeft = function (event) { if (event.target != this.$bottomLeftResizer) return; this.$bottomLeftResizer.on('drag', this.eventHandler.dragBottomLeft); this.$bottomLeftResizer.on('enddrag', this.eventHandler.endDragBottomLeft); var bound = this.getBoundingClientRect(); var minWidth = this.$windowTitle.getBoundingClientRect().right - bound.left + this.$headerButtonCtn.getBoundingClientRect().width; var screenSize = Dom["a" /* default */].getScreenSize(); this.__moveData__ = { maxLeft: bound.right - minWidth, bound: bound, minHeight: this.getFontSize() * 1.4, maxHeight: screenSize.height - bound.top, modal: OnsScreenWindow_('.absol-onscreen-window-moving-modal.absol-onscreen-window-resize-bottom-left').addTo(document.body) }; }; OnScreenWindow.eventHandler.dragBottomLeft = function (event) { var dx = event.moveDX; var dy = event.moveDY; var newLeft = Math.max(0, Math.min(this.__moveData__.maxLeft, this.__moveData__.bound.left + dx)); var newWidth = this.__moveData__.bound.right - newLeft; var newHeight = Math.max(this.__moveData__.minHeight, Math.min(this.__moveData__.maxHeight, this.__moveData__.bound.height + dy)); this.addStyle('height', newHeight + 'px'); this.addStyle({ width: newWidth + 'px', left: newLeft + 'px' }); this.emit('sizechange', event, this); }; OnScreenWindow.eventHandler.endDragBottomLeft = function (event) { this.$bottomLeftResizer.off('drag', this.eventHandler.dragLeft); this.$bottomLeftResizer.off('enddrag', this.eventHandler.endDragLeft); this.__moveData__.modal.remove(); this.__moveData__ = undefined; }; OnScreenWindow.eventHandler.beginDragTopLeft = function (event) { if (event.target != this.$topLeftResizer) return; this.$topLeftResizer.on('drag', this.eventHandler.dragTopLeft); this.$topLeftResizer.on('enddrag', this.eventHandler.endDragTopLeft); var bound = this.getBoundingClientRect(); var fontSize = this.getFontSize(); var minWidth = this.$windowTitle.getBoundingClientRect().right - bound.left + this.$headerButtonCtn.getBoundingClientRect().width; this.__moveData__ = { maxLeft: bound.right - minWidth, fontSize: fontSize, bound: bound, maxTop: bound.bottom - 1.4 * fontSize, modal: OnsScreenWindow_('.absol-onscreen-window-moving-modal.absol-onscreen-window-resize-top-left').addTo(document.body) }; }; OnScreenWindow.eventHandler.dragTopLeft = function (event) { var dy = event.moveDY; var dx = event.moveDX; var newTop = Math.max(0, Math.min(this.__moveData__.maxTop, this.__moveData__.bound.top + dy)); var newHeight = this.__moveData__.bound.bottom - newTop; var newLeft = Math.max(0, Math.min(this.__moveData__.maxLeft, this.__moveData__.bound.left + dx)); var newWidth = this.__moveData__.bound.right - newLeft; this.addStyle({ top: newTop + 'px', height: newHeight + 'px', width: newWidth + 'px', left: newLeft + 'px' }); this.emit('sizechange', event, this); }; OnScreenWindow.eventHandler.endDragTopLeft = function (event) { this.$topLeftResizer.off('drag', this.eventHandler.dragTopLeft); this.$topLeftResizer.off('enddrag', this.eventHandler.endDragTopLeft); this.__moveData__.modal.remove(); this.__moveData__ = undefined; }; OnScreenWindow.eventHandler.beginDragTopRight = function (event) { if (event.target != this.$topRightResizer) return; this.$topRightResizer.on('drag', this.eventHandler.dragTopRight); this.$topRightResizer.on('enddrag', this.eventHandler.endDragTopRight); var screenSize = Dom["a" /* default */].getScreenSize(); var bound = this.getBoundingClientRect(); var fontSize = this.getFontSize(); var minWidth = this.$windowTitle.getBoundingClientRect().right - bound.left + this.$headerButtonCtn.getBoundingClientRect().width; this.__moveData__ = { minWidth: minWidth, fontSize: fontSize, bound: bound, maxWidth: screenSize.width - bound.left, maxTop: bound.bottom - 1.4 * fontSize, modal: OnsScreenWindow_('.absol-onscreen-window-moving-modal.absol-onscreen-window-resize-top-right').addTo(document.body) }; }; OnScreenWindow.eventHandler.dragTopRight = function (event) { var dy = event.moveDY; var dx = event.moveDX; var newWidth = Math.max(this.__moveData__.minWidth, Math.min(this.__moveData__.maxWidth, this.__moveData__.bound.width + dx)); var newTop = Math.max(0, Math.min(this.__moveData__.maxTop, this.__moveData__.bound.top + dy)); var newHeight = this.__moveData__.bound.bottom - newTop; this.addStyle({ 'top': newTop + 'px', 'height': newHeight + 'px', width: newWidth + 'px' }); this.emit('sizechange', event, this); }; OnScreenWindow.eventHandler.endDragTopRight = function (event) { this.$topRightResizer.off('drag', this.eventHandler.dragTopRight); this.$topRightResizer.off('enddrag', this.eventHandler.endDragTopRight); this.__moveData__.modal.remove(); this.__moveData__ = undefined; }; ['addChild', 'addChildBefore', 'addChildAfter', 'clearChild', 'findChildBefore', 'findChildAfter'].forEach(function (key) { OnScreenWindow.prototype[key] = function () { return this.$bodyContainer[key].apply(this.$bodyContainer, arguments); }; }); OnScreenWindow.property = {}; OnScreenWindow.property.windowIcon = { set: function (value) { this._windowIcon = value; if (this.$windowIcon) { this.$windowIcon.remove(); this.$windowIcon = undefined; } if (value) { this.$windowIcon = OnsScreenWindow_(value).addClass('absol-onscreen-window-head-bar-icon'); this.$headerbar.addChildBefore(this.$windowIcon, this.$headerbar.childNodes[0]); } }, get: function () { return this._windowIcon; } }; OnScreenWindow.property.windowTitle = { set: function (value) { this._windowTitle = value; this.$windowTitle .clearChild() .addChild(OnsScreenWindow_({ text: '' + value })); }, get: function () { return this._windowTitle; } }; OnScreenWindow.prototype.relocation = function () { var bound = this.getBoundingClientRect(); var screenSize = Dom["a" /* default */].getScreenSize(); var isRelocated = false; if (bound.bottom >= screenSize.height) { this.addStyle('top', Math.max(0, screenSize.height - bound.height) + 'px'); isRelocated = true; } if (bound.right >= screenSize.width) { this.addStyle('left', Math.max(0, screenSize.width - bound.width) + 'px'); isRelocated = true; } if (isRelocated){ this.emit('relocation', {type:'relocation', target: this}, this) } }; ACore["a" /* default */].install('OnScreenWindow'.toLowerCase(), OnScreenWindow); // CONCATENATED MODULE: ./node_modules/absol-acomp/js/HRuler.js var HRuler_ = ACore["a" /* default */]._; var HRuler_$ = ACore["a" /* default */].$; function HRuler() { var self = this; this.$attachHook = HRuler_('attachhook').on('error', function () { this.updateSize = self.update.bind(self); Dom["a" /* default */].addToResizeSystem(this); this.updateSize(); }).addTo(self); this.$lines = []; this.$numbers = []; this._viewingNumberCount = 0; this._viewingLineCount = 0; this._spacing = 10; this._major = 10; this.$measureTarget = null; this._valueFloat = 'left'; } HRuler.render = function () { return HRuler_({ class: 'as-hruler' }); }; HRuler.prototype.measureElement = function (elt) { if (typeof elt == "string") elt = HRuler_$(elt); this.$measureTarget = elt; }; HRuler.prototype.update = function () { var fontSize = this.getFontSize(); var measureBound; var bound = this.getBoundingClientRect(); var contentBound = { left: bound.left + 1, right: bound.right - 1, top: bound.top + 1, bottom: bound.bottom - 1, width: bound.width - 2, height: bound.height - 2 }; if (this.$measureTarget) { measureBound = this.$measureTarget.getBoundingClientRect(); } else { measureBound = contentBound; } var startOfset = (measureBound[this._valueFloat] - contentBound[this._valueFloat]) * (this.inverse ? -1 : 1) % this._spacing; if (startOfset < 0) startOfset += this._spacing; var lineIndexOfset = Math.round(((contentBound[this._valueFloat] - measureBound[this._valueFloat]) * (this.inverse ? -1 : 1) + startOfset) / this._spacing); var lineCount = Math.floor((contentBound.width - startOfset) / this._spacing) + 1; while (this.$lines.length < lineCount) { this.$lines.push(HRuler_('.as-hruler-line')); } var i; var lineElt; for (i = 0; i < lineCount; ++i) { lineElt = this.$lines[i]; if ((i + lineIndexOfset) % this._major == 0) { lineElt.addClass('major'); } else { lineElt.removeClass('major'); } lineElt.addStyle(this._valueFloat, startOfset + this._spacing * i - 0.5 + 'px'); } while (this._viewingLineCount < lineCount) { this.$lines[this._viewingLineCount++].addTo(this); } while (this._viewingLineCount > lineCount) { this.$lines[--this._viewingLineCount].remove(); } var numberCount = Math.floor((lineCount + lineIndexOfset - 1) / this._major) - Math.ceil(lineIndexOfset / this._major) + 1; while (this.$numbers.length < numberCount) { this.$numbers.push(HRuler_('.as-hruler-major-number')); } var numberElt; var number; var majorStartOfset = startOfset; if (lineIndexOfset > 0) { majorStartOfset += (this._major - lineIndexOfset % this._spacing) * this._spacing; } else { majorStartOfset += (this._major - (this._spacing + lineIndexOfset % this._spacing)) * this._spacing; } for (i = 0; i < numberCount; ++i) { number = (Math.ceil(lineIndexOfset / this._major) + i) * this._spacing * this._major; numberElt = this.$numbers[i]; if (numberElt.__cacheNumber__ != number) { numberElt.__cacheNumber__ = number; numberElt.innerHTML = number + ''; } numberElt.addStyle(this._valueFloat, majorStartOfset + this._major * i * this._spacing - 0.7 * 2.5 * fontSize + 'px') } while (this._viewingNumberCount < numberCount) { this.$numbers[this._viewingNumberCount++].addTo(this); } while (this._viewingNumberCount > numberCount) { this.$numbers[--this._viewingNumberCount].remove(); } }; HRuler.property = {}; HRuler.property.major = { set: function (value) { if (value > 0) { this._major = value; this.update(); } }, get: function () { return this._major; } }; HRuler.property.spacing = { set: function (value) { if (value > 0) { this._spacing = value; this.update(); } }, get: function () { return this._spacing; } }; HRuler.property.inverse = { set: function (value) { this._valueFloat = value ? 'right' : 'left'; this.update(); }, get: function () { return this._valueFloat == 'right'; } }; ACore["a" /* default */].install('hruler', HRuler); /* harmony default export */ var js_HRuler = (HRuler); // EXTERNAL MODULE: ./node_modules/absol-acomp/css/hruler.css var hruler = __webpack_require__(203); // CONCATENATED MODULE: ./node_modules/absol-acomp/js/VRuler.js var VRuler_ = ACore["a" /* default */]._; var VRuler_$ = ACore["a" /* default */].$; function VRuler() { var self = this; this.$attachHook = VRuler_('attachhook').on('error', function () { this.updateSize = self.update.bind(self); Dom["a" /* default */].addToResizeSystem(this); this.updateSize(); }).addTo(this); this.$lines = []; this.$numbers = []; this.$measureTarget = undefined; this._viewingNumberCount = 0; this._viewingLineCount = 0; this._spacing = 10; this._major = 10; this._valueFloat = 'top'; } VRuler.render = function () { return VRuler_({ class: 'as-vruler' }); }; VRuler.prototype.measureElement = function (elt) { if (typeof elt == "string") elt = VRuler_$(elt); this.$measureTarget = elt; }; VRuler.prototype.update = function () { var fontSize = this.getFontSize(); var measureBound; var bound = this.getBoundingClientRect(); var contentBound = { left: bound.left + 1, right: bound.right - 1, top: bound.top + 1, bottom: bound.bottom - 1, width: bound.width - 2, height: bound.height - 2 }; if (this.$measureTarget) { measureBound = this.$measureTarget.getBoundingClientRect(); } else { measureBound = contentBound; } var startOfset = (measureBound[this._valueFloat] - contentBound[this._valueFloat]) * (this.inverse ? -1 : 1) % this._spacing; if (startOfset < 0) startOfset += this._spacing; var lineIndexOfset = Math.round(((contentBound[this._valueFloat] - measureBound[this._valueFloat]) * (this.inverse ? -1 : 1) + startOfset) / this._spacing); var lineCount = Math.floor((contentBound.height - startOfset) / this._spacing) + 1; while (this.$lines.length < lineCount) { this.$lines.push(VRuler_('.as-vruler-line')); } var i; var lineElt; for (i = 0; i < lineCount; ++i) { lineElt = this.$lines[i]; if ((i + lineIndexOfset) % this._major == 0) { lineElt.addClass('major'); } else { lineElt.removeClass('major'); } lineElt.addStyle(this._valueFloat, startOfset + this._spacing * i - 0.5 + 'px'); } while (this._viewingLineCount < lineCount) { this.$lines[this._viewingLineCount++].addTo(this); } while (this._viewingLineCount > lineCount) { this.$lines[--this._viewingLineCount].remove(); } var numberCount = Math.floor((lineCount + lineIndexOfset - 1) / this._major) - Math.ceil(lineIndexOfset / this._major) + 1; while (this.$numbers.length < numberCount) { this.$numbers.push(VRuler_('.as-vruler-major-number')); } var numberElt; var number; var majorStartOfset = startOfset; if (lineIndexOfset > 0) { majorStartOfset += (this._major - lineIndexOfset % this._spacing) * this._spacing; } else { majorStartOfset += (this._major - (this._spacing + lineIndexOfset % this._spacing)) * this._spacing; } for (i = 0; i < numberCount; ++i) { number = (Math.ceil(lineIndexOfset / this._major) + i) * this._spacing * this._major; numberElt = this.$numbers[i]; if (numberElt.__cacheNumber__ != number) { numberElt.__cacheNumber__ = number; numberElt.innerHTML = number + ''; } numberElt.addStyle(this._valueFloat, majorStartOfset + this._major * i * this._spacing - 0.7 * 0.5 * fontSize + 'px') } while (this._viewingNumberCount < numberCount) { this.$numbers[this._viewingNumberCount++].addTo(this); } while (this._viewingNumberCount > numberCount) { this.$numbers[--this._viewingNumberCount].remove(); } }; VRuler.property = {}; VRuler.property.major = { set: function (value) { if (value > 0) { this._major = value; this.update(); } }, get: function () { return this._major; } }; VRuler.property.spacing = { set: function (value) { if (value > 0) { this._spacing = value; this.update(); } }, get: function () { return this._spacing; } }; VRuler.property.inverse = { set: function (value) { this._valueFloat = value ? 'bottom' : 'top'; this.update(); }, get: function () { return this._valueFloat == 'bottom'; } }; ACore["a" /* default */].install('vruler', VRuler); /* harmony default export */ var js_VRuler = (VRuler); // EXTERNAL MODULE: ./node_modules/absol-acomp/css/vruler.css var vruler = __webpack_require__(205); // CONCATENATED MODULE: ./node_modules/absol-acomp/js/ResizeBox.js var ResizeBox_ = ACore["a" /* default */]._; var ResizeBox_$ = ACore["a" /* default */].$; function ResizeBox() { this.on('mousedown', this.eventHandler.mouseDownBody); this._mousedownEventData = undefined; this._mousemoveEventData = undefined; } ResizeBox.render = function () { return ResizeBox_({ class: 'as-resize-box', extendEvent: ['beginmove', 'endmove', 'moving', 'click'],//override click event child: { class: 'as-resize-box-body', child: [ '.as-resize-box-dot.left-top', '.as-resize-box-dot.top', '.as-resize-box-dot.right-top', '.as-resize-box-dot.right', '.as-resize-box-dot.right-bottom', '.as-resize-box-dot.bottom', '.as-resize-box-dot.left-bottom', '.as-resize-box-dot.left' ] } }); }; ResizeBox.eventHandler = {}; ResizeBox.eventHandler.mouseDownBody = function (event) { if (EventEmitter["a" /* default */].isMouseRight(event)) return; event.preventDefault(); this._optionNames = event.target.attr('class').match(/body|left|top|right|bottom/g); var option = this._optionNames.reduce(function (ac, key) { ac[key] = true; return ac; }, {}); this._mousedownEventData = { clientX: event.clientX, clientY: event.clientY, target: this, originEvent: event, prevented: false, preventDefault: function () { this.prevented = true; }, option: option, begin: false, type: 'beginmove' }; ResizeBox_$(document.body).on('mousemove', this.eventHandler.mouseMoveBody); ResizeBox_$(document.body) .on('mouseup', this.eventHandler.mouseFinishBody) .on('mouseleave', this.eventHandler.mouseFinishBody); }; ResizeBox.eventHandler.mouseMoveBody = function (event) { if (this._mousedownEventData.option.body && !this.canMove) return; if (this._mousedownEventData && !this._mousedownEventData.begin && !this._mousedownEventData.prevented) { this.emit('beginmove', this._mousedownEventData, this); if (this._mousedownEventData.prevented) { ResizeBox_$(document.body).off('mousemove', this.eventHandler.mouseMoveBody); } else { this._mousedownEventData.begin = true; ResizeBox_$(document.body) .addClass('as-resize-box-overiding') .addClass(this._optionNames.join('-')); } } if (this._mousedownEventData.begin) { event.preventDefault(); this._mousemoveEventData = { clientX: event.clientX, clientY: event.clientY, clientX0: this._mousedownEventData.clientX, clientY0: this._mousedownEventData.clientY, clientDX: event.clientX - this._mousedownEventData.clientX, clientDY: event.clientY - this._mousedownEventData.clientY, target: this, originEvent: event, option: this._mousedownEventData.option, type: 'moving' }; this.emit('moving', this._mousemoveEventData, this); } }; ResizeBox.eventHandler.mouseFinishBody = function (event) { ResizeBox_$(document.body).off('mousemove', this.eventHandler.mouseMoveBody) .off('mouseup', this.eventHandler.mouseFinishBody) .off('mouseleave', this.eventHandler.mouseFinishBody) .removeClass('as-resize-box-overiding') .removeClass(this._optionNames.join('-')); this._optionNames = undefined; if (this._mousedownEventData.begin) { this._mousefinishEventData = { clientX: event.clientX, clientY: event.clientY, clientX0: this._mousedownEventData.clientX, clientY0: this._mousedownEventData.clientY, clientDX: event.clientX - this._mousedownEventData.clientX, clientDY: event.clientY - this._mousedownEventData.clientY, target: this, originEvent: event, option: this._mousedownEventData.option, type: 'endmove' }; this.emit('endmove', this._mousefinishEventData, this); } else { if (EventEmitter["a" /* default */].hitElement(this, event)) this.emit('click', event, this); } }; ResizeBox.property = {}; ResizeBox.property.canMove = { set: function (value) { if (value) { this.addClass('as-can-move'); } else { this.removeClass('as-can-move'); } }, get: function () { return this.containsClass('as-can-move'); } }; ResizeBox.property.canResize = { set: function (value) { if (value) { this.addClass('as-can-resize'); } else { this.removeClass('as-can-resize'); } }, get: function () { return this.containsClass('as-can-resize'); } }; ResizeBox.property.canClick = { set: function (value) { if (value) { this.addClass('as-can-click'); } else { this.removeClass('as-can-click'); } }, get: function () { return this.containsClass('as-can-click'); } }; ACore["a" /* default */].install('resizebox', ResizeBox); /* harmony default export */ var js_ResizeBox = (ResizeBox); // EXTERNAL MODULE: ./node_modules/absol-acomp/css/resizebox.css var resizebox = __webpack_require__(207); // EXTERNAL MODULE: ./node_modules/absol-acomp/js/DebugTask.js var DebugTask = __webpack_require__(24); // EXTERNAL MODULE: ./node_modules/absol-acomp/css/debugtask.css var debugtask = __webpack_require__(209); // CONCATENATED MODULE: ./node_modules/absol-acomp/AComp.js // import './js/SelectTable2'; // import './css/selecttable2.css'; // import './js/TextArea2'; // import './css/textarea2.css'; // import './css/quickpath.css'; var AComp = { core: ACore["a" /* default */], $: ACore["a" /* default */].$, _: ACore["a" /* default */]._, creator: ACore["a" /* default */].creator, buildDom: ACore["a" /* default */].buildDom, runDebugTask: DebugTask["a" /* default */].start.bind(DebugTask["a" /* default */]), Draggable:js_Draggable }; window.runDebugTask = DebugTask["a" /* default */].start.bind(DebugTask["a" /* default */]); /* harmony default export */ var absol_acomp_AComp = (AComp); // CONCATENATED MODULE: ./js/core/FCore.js var Fcore = new Dom["a" /* default */](); Fcore.install(absol_acomp_AComp.core); /* harmony default export */ var FCore = (Fcore); // CONCATENATED MODULE: ./js/core/FViewable.js function FViewable() { this.style = {}; } /** * @returns {Array<String>} */ FViewable.prototype.getAcceptsStyleNames = function () { return []; }; FViewable.prototype.render = function () { throw new Error('Not Implement'); }; /** * @param {String} name * @returns {} */ FViewable.prototype.getStyleDescriptor = function (name) { var functionName = 'getStyle' + name.substr(0, 1).toUpperCase() + name.substr(1) + 'Descriptor'; return this[functionName] && this[functionName].call(this); }; /** * @returns {} */ FViewable.prototype.getStyleDescriptors = function () { var result = {}; var names = this.getAcceptsStyleNames(); var key; for (var i = 0; i < names.length; ++i) { key = names[i]; result[key] = this.getStyleDescriptor(key); } return result; }; /** * @param {String} name * @param {} value * @returns {} value which is set */ FViewable.prototype.setStyle = function (name, value) { var functionName = 'setStyle' + name.substr(0, 1).toUpperCase() + name.substr(1); var res = value; if (this[functionName]) { res = this[functionName].call(this, value); } if (res === undefined) { delete this.style[name]; } else { this.style[name] = res; } return res; }; /** * @param {String} name * @returns {} value which is set */ FViewable.prototype.getStyle = function (name) { return this.style[name]; }; /* harmony default export */ var core_FViewable = (FViewable); // CONCATENATED MODULE: ./js/anchors/RelativeAnchor.js var RelativeAnchor_ = FCore._; var RelativeAnchor_$ = FCore.$; /** * AnchorBox only has on child node */ function RelativeAnchor() { core_FViewable.call(this); this.style.hAlign = this.HALIGN_VALUE[0]; this.style.vAlign = this.VALIGN_VALUE[0]; this.style.left = 0; this.style.right = 0; this.style.top = 0; this.style.bottom = 0; this.childNode = null; //for quick binding render this.viewBinding = {}; this.onCreate(); this.view = this.render(); this.onCreated(); } Object.defineProperties(RelativeAnchor.prototype, Object.getOwnPropertyDescriptors(core_FViewable.prototype)); RelativeAnchor.prototype.construtor = RelativeAnchor; RelativeAnchor.prototype.onCreate = function () { /* NOOP */ }; RelativeAnchor.prototype.onCreated = function () { for (var key in this.viewBinding) { this[key] = RelativeAnchor_$(this.viewBinding[key], this.view); } }; RelativeAnchor.prototype.VALIGN_VALUE = ['top', 'bottom', 'center', 'fixed']; RelativeAnchor.prototype.HALIGN_VALUE = ['left', 'right', 'center', 'fixed']; RelativeAnchor.prototype.HALIGN_CLASS_NAMES = { left: 'as-halign-left', right: 'as-halign-right', center: 'as-halign-center', fixed: 'as-halign-fixed' }; RelativeAnchor.prototype.VALIGN_CLASS_NAMES = { top: 'as-valign-top', bottom: 'as-valign-bottom', center: 'as-valign-center', fixed: 'as-valign-fixed' }; RelativeAnchor.prototype.getAcceptsStyleNames = function () { return ['hAlign', 'vAlign', 'left', 'right', 'top', 'bottom']; }; RelativeAnchor.prototype.getStyleHAlignDescriptor = function () { return { type: 'enum', values: ['left', 'right', 'center', 'fixed'], disabled: false }; }; RelativeAnchor.prototype.getStyleVAlignDescriptor = function () { return { type: 'enum', values: ['top', 'bottom', 'center', 'fixed'], disabled: false }; }; RelativeAnchor.prototype.getStyleLeftDescriptor = function () { return { type: 'number', min: -Infinity, max: Infinity, disabled: this.style.hAlign == 'center' || this.style.hAlign == 'right', livePreview: true }; }; RelativeAnchor.prototype.getStyleRightDescriptor = function () { return { type: 'number', min: -Infinity, max: Infinity, disabled: this.style.hAlign == 'center' || this.style.hAlign == 'left', livePreview: true }; }; RelativeAnchor.prototype.getStyleTopDescriptor = function () { return { type: 'number', min: -Infinity, max: Infinity, disabled: this.style.vAlign == 'center' || this.style.vAlign == 'bottom', livePreview: true }; }; RelativeAnchor.prototype.getStyleBottomDescriptor = function () { return { type: 'number', min: -Infinity, max: Infinity, disabled: this.style.vAlign == 'center' || this.style.vAlign == 'top', livePreview: true }; }; RelativeAnchor.prototype.setStyleHAlign = function (value) { if (this.style.hAlign == value) return value; if (!this.HALIGN_VALUE.includes(value)) value = this.HALIGN_VALUE[0]; this.view.removeClass(this.HALIGN_CLASS_NAMES[this.style.hAlign]); this.style.hAlign = value; this.view.addClass(this.HALIGN_CLASS_NAMES[this.style.hAlign]); this.updateHAlignStyle(); return value; }; RelativeAnchor.prototype.setStyleVAlign = function (value) { if (this.style.vAlign == value) return value; if (!this.VALIGN_VALUE.includes(value)) value = this.VALIGN_VALUE[0]; this.view.removeClass(this.VALIGN_CLASS_NAMES[this.style.vAlign]); if (this.style.vAlign == 'center') { this.view.clearChild(); this.viewBinding.$containter = '.' + this.TOP_CLASS_NAME; this.$containter = this.view; if (this.childNode) { this.$containter.addChild(this.childNode.view); } } this.style.vAlign = value; this.view.addClass(this.VALIGN_CLASS_NAMES[this.style.vAlign]); if (this.style.vAlign == 'center') { this.view.clearChild(); this.view.addChild(RelativeAnchor_({ "class": 'as-center-table', child: '.as-center-cell' })); this.viewBinding.$containter = '.as-center-cell'; this.$containter = RelativeAnchor_$(this.viewBinding.$containter, this.view); if (this.childNode) { this.$containter.addChild(this.childNode.view); } } this.updateVAlignStyle(); return value; }; RelativeAnchor.prototype.setStyleLeft = function (value) { if (this.style.hAlign != 'center' && this.style.hAlign != 'right') { this.view.addStyle('left', value + 'px'); } else this.view.removeStyle('left'); return value; }; RelativeAnchor.prototype.setStyleRight = function (value) { if (this.style.hAlign != 'center' && this.style.hAlign != 'left') { this.view.addStyle('right', value + 'px'); } else this.view.removeStyle('right'); return value; }; RelativeAnchor.prototype.setStyleTop = function (value) { if (this.style.vAlign != 'center' && this.style.vAlign != 'bottom') { this.view.addStyle('top', value + 'px'); } else this.view.removeStyle('top'); return value; }; RelativeAnchor.prototype.setStyleBottom = function (value) { if (this.style.vAlign != 'center' && this.style.vAlign != 'top') { this.view.addStyle('bottom', value + 'px'); } else this.view.removeStyle('bottom'); return value; }; RelativeAnchor.prototype.TOP_CLASS_NAME = 'as-relative-anchor-box'; RelativeAnchor.prototype.render = function () { var layout = { "class": [this.TOP_CLASS_NAME, this.HALIGN_CLASS_NAMES[this.style.hAlign], this.VALIGN_CLASS_NAMES[this.style.vAlign]] }; this.viewBinding.$containter = '.' + this.TOP_CLASS_NAME; if (this.style.vAlign == 'center') { layout.child = { "class": 'as-center-table', child: 'as-center-cell' }; this.viewBinding.$containter = '.as-center-cell'; } return RelativeAnchor_(layout); }; /** * @param {BaseComponent} child */ RelativeAnchor.prototype.attachChild = function (child) { if (this.childNode) { this.childNode.view.remove(); this.childNode = null; this.childNode.anchor = null; } if (child.anchor) throw new Error("Detach anchorBox first"); this.childNode = child; child.anchor = this; this.$containter.addChild(child.view); child.onAnchorAttached(); }; RelativeAnchor.prototype.detachChild = function () { if (this.childNode) { this.childNode.view.remove(); this.childNode.onAnchorDetached(); this.childNode.anchor = null; this.childNode = null; } else throw new Error("Nothing to detach"); }; RelativeAnchor.prototype.HALIGN_ACCEPT_STYLE = { left: { left: true, right: false }, right: { left: false, right: true }, center: { left: false, right: false }, // component need set width fixed: { left: true, right: true } }; RelativeAnchor.prototype.VALIGN_ACCEPT_STYLE = { top: { top: true, bottom: false }, bottom: { top: false, bottom: true }, center: { top: false, bottom: false }, // component need set height fixed: { top: true, bottom: true } }; RelativeAnchor.prototype.updateVAlignStyle = function () { for (var key in this.VALIGN_ACCEPT_STYLE[this.style.vAlign]) { if (this.VALIGN_ACCEPT_STYLE[this.style.vAlign][key]) { this.view.addStyle(key, this.style[key] + 'px'); } else { this.view.removeStyle(key); } } }; RelativeAnchor.prototype.updateHAlignStyle = function () { for (var key in this.HALIGN_ACCEPT_STYLE[this.style.hAlign]) { if (this.HALIGN_ACCEPT_STYLE[this.style.hAlign][key]) { this.view.addStyle(key, this.style[key] + 'px'); } else { this.view.removeStyle(key); } } }; /* harmony default export */ var anchors_RelativeAnchor = (RelativeAnchor); // CONCATENATED MODULE: ./js/core/FNode.js function FNode() { /** * @type {FNode} */ this.parent = null; /** * @type {Array<FNode>} */ this.children = []; } FNode.prototype.onDetach = function () { /* NOOP */ }; FNode.prototype.onDetached = function () { /* NOOP */ }; FNode.prototype.onAttach = function () { /* NOOP */ }; FNode.prototype.onAttached = function () { /* NOOP */ }; /** * @param {FNode} child * @param {Number} index */ FNode.prototype.onRemoveChild = function (child, index) {}; /** * @param {FNode} child * @param {Number} index */ FNode.prototype.onAddChild = function (child, index) {}; /** * @return {FNode} */ FNode.prototype.remove = function () { if (this.parent) this.parent.removeChild(this); }; /** * @param {FNode} child * @return {FNode} */ FNode.prototype.addChild = function (child) { child.remove(); this.children.push(child); child.parent = this; //data ready this.onAttach(); this.onAddChild(child, -1); //negative index for appending child child.onAttached(); }; /** * @param {FNode} child * @return {FNode} */ FNode.prototype.removeChild = function (child) { var childIndex = this.children.indexOf(child); if (childIndex < 0) return false; this.children.splice(childIndex, 1); child.onDetach(this); this.onRemoveChild(child, childIndex); child.parent = undefined; child.onDetached(this); return true; }; /** * @param {FNode} child * @param {FNode} at * @return {FNode} */ FNode.prototype.addChildBefore = function (child, at) { child.remove(); var atIndex = this.children.indexOf(at); if (atIndex >= 0) { this.children.splice(atIndex, 0, child); child.parent = this; this.onAttach(); this.onAddChild(child, atIndex); child.onAttached(); return true; } return false; }; /** * @param {FNode} child * @param {FNode} at * @return {FNode} */ FNode.prototype.addChildAfter = function (child, at) { child.remove(); var atIndex = this.children.indexOf(at); if (atIndex >= 0) { this.children.splice(atIndex + 1, 0, child); child.parent = this; this.onAttach(); this.onAddChild(child, atIndex + 1); child.onAttached(); return true; } return false; }; /** * @param {FNode} child * @return {FNode} */ FNode.prototype.findChildBefore = function (child) { var index = this.children.indexOf(child); if (index > 0) return this.children[index - 1]; }; /** * @param {FNode} child * @return {FNode} */ FNode.prototype.findChildAfter = function (child) { var index = this.children.indexOf(child); if (index < this.children.length - 1) return this.children[index + 1]; }; /** * @param {FNode} child * @return {Number} */ FNode.prototype.indexOfChild = function (child) { return this.children.indexOf(child); }; /* harmony default export */ var core_FNode = (FNode); // CONCATENATED MODULE: ./js/core/FModel.js function FModel() { this.attributes = {}; } /** * @returns {Array<String>} */ FModel.prototype.getAcceptsAttributeNames = function () { return []; }; /** * @param {String} name * @returns {} */ FModel.prototype.getAttributeDescriptor = function (name) { var functionName = 'getAttribute' + name.substr(0, 1).toUpperCase() + name.substr(1) + 'Descriptor'; return this[functionName] && this[functionName].call(this); }; /** * @returns {} */ FModel.prototype.getAttributeDescriptors = function () { var result = {}; var names = this.getAcceptsAttributeNames(); var key; for (var i = 0; i < names.length; ++i) { key = names[i]; result[key] = this.getAttributeDescriptor(key); } return result; }; /** * @param {String} name * @param {} value * @returns {} value which is set */ FModel.prototype.setAttribute = function (name, value) { var functionName = 'setAttribute' + name.substr(0, 1).toUpperCase() + name.substr(1); var res = value; if (this[functionName]) { res = this[functionName].call(this, value); } if (res === undefined) { delete this.attributes[name]; } else { this.attributes[name] = res; } return res; }; /** * @param {String} name * @returns {} value which is set */ FModel.prototype.getAttribute = function (name) { return this.attributes[name]; }; /* harmony default export */ var core_FModel = (FModel); // CONCATENATED MODULE: ./node_modules/absol/src/AppPattern/PluginManager.js function PluginManager() { this.runnerChains = {}; } PluginManager.prototype.push = function (key, runner) { this.runnerChains[key] = this.runnerChains[key] || []; this.runnerChains[key].push(runner); }; PluginManager.prototype.pop = function (key) { this.runnerChains[key] = this.runnerChains[key] || []; return this.runnerChains[key].pop(); }; PluginManager.prototype.remove = function (key, runner) { var runnerChain = this.runnerChains[key]; if (runnerChain) { var index = runnerChain.indexOf(runner); if (index >= 0) { runnerChain.splice(index, 1); return true;} } return false; }; PluginManager.prototype.contains = function (key, runner) { var runnerChain = this.runnerChains[key]; if (runnerChain) { var index = runnerChain.indexOf(runner); if (index >= 0) return true; } return false; }; PluginManager.prototype.exec = function (_this, key) { var args = Array.prototype.slice.call(arguments, 2); var runnerChain = this.runnerChains[key]; if (runnerChain) for (var i = 0; i < runnerChain.length; ++i) { runnerChain[i].apply(_this, args); } }; /* harmony default export */ var AppPattern_PluginManager = (PluginManager); // CONCATENATED MODULE: ./js/core/PluginManager.js /* harmony default export */ var core_PluginManager = (new AppPattern_PluginManager()); // CONCATENATED MODULE: ./js/core/BaseComponent.js function BaseComponent() { EventEmitter["a" /* default */].call(this); this.events = {}; core_FViewable.call(this); core_FNode.call(this); core_FModel.call(this); this.anchorAcceptsStyleName = {}; this.onCreate(); this.view = this.render(); this.view.classList.add(this.BASE_COMPONENT_CLASS_NAME); this.onCreated(); } Object.defineProperties(BaseComponent.prototype, Object.getOwnPropertyDescriptors(EventEmitter["a" /* default */].prototype)); Object.defineProperties(BaseComponent.prototype, Object.getOwnPropertyDescriptors(core_FViewable.prototype)); Object.defineProperties(BaseComponent.prototype, Object.getOwnPropertyDescriptors(core_FNode.prototype)); Object.defineProperties(BaseComponent.prototype, Object.getOwnPropertyDescriptors(core_FModel.prototype)); BaseComponent.prototype.constructor = BaseComponent; BaseComponent.prototype.tag = "BaseComponent"; BaseComponent.prototype.menuIcon = "span.mdi.mdi-package-variant-closed"; BaseComponent.prototype.BASE_COMPONENT_CLASS_NAME = 'as-base-component'; BaseComponent.prototype.anchor = null; BaseComponent.prototype.SUPPORT_STYLE_NAMES = []; BaseComponent.prototype.onCreate = function () { this.constructor.count = this.constructor.count || 0; this.attributes.name = this.tag + "_" + this.constructor.count++; }; BaseComponent.prototype.onCreated = function () { this.updateAttributes(); }; BaseComponent.prototype.onAnchorAttached = function () { this.anchorAcceptsStyleName = this.anchor.getAcceptsStyleNames().reduce(function (ac, key) { ac[key] = true; return ac; }, {}); }; BaseComponent.prototype.onAnchorDetached = function () { this.anchorAcceptsStyleName = {}; }; BaseComponent.prototype.onAttached = function (parent) { this.updateStyle(); }; BaseComponent.prototype.updateStyle = function () { for (var key in this.style) { this.setStyle(key, this.style[key]); } }; BaseComponent.prototype.updateAttributes = function () { for (var key in this.attributes) { this.setAttribute(key, this.attributes[key]); //set init attribute } }; BaseComponent.prototype.getData = function () { var self = this; var data = { tag: this.tag }; var attributeKeys = Object.keys(this.attributes).filter(function (key) { return self.attributes[key] !== undefined || self.attributes[key] !== null; }); if (attributeKeys.length > 0) { data.attributes = attributeKeys.reduce(function (ac, key) { ac[key] = self.attributes[key]; return ac; }, {}); } var styleKeys = Object.keys(this.style).filter(function (key) { return self.style[key] !== undefined || self.style[key] !== null; }); if (styleKeys.length > 0) { data.style = styleKeys.reduce(function (ac, key) { ac[key] = self.style[key]; return ac; }, {}); } var eventsKeys = Object.keys(this.events).filter(function (key) { return self.events[key] !== undefined || self.events[key] !== null; }); if (eventsKeys.length > 0) { data.events = eventsKeys.reduce(function (ac, key) { ac[key] = self.events[key]; return ac; }, {}); } if (this.children.length > 0) { data.children = this.children.map(function (child) { return child.getData(); }); } return data; }; BaseComponent.prototype.fire = function (name) { EventEmitter["a" /* default */].prototype.fire.apply(this, arguments); if (this.events[name]) { core_PluginManager.exec(this, 'EXEC_SCRIPT', this.events[name], Array.prototype.slice.call(arguments, 1)); } return this; }; BaseComponent.prototype.setEvent = function (key, value) { if (value === undefined) { delete this.events[key]; } else this.events[key] = value; return value; }; BaseComponent.prototype.getAcceptsStyleNames = function () { if (this.anchor) return this.anchor.getAcceptsStyleNames(); return []; }; BaseComponent.prototype.getStyleDescriptor = function (name) { var res; res = core_FViewable.prototype.getStyleDescriptor.call(this, name); if (this.anchor) res = res || this.anchor.getStyleDescriptor(name); return res; }; BaseComponent.prototype.reMeasure = function () { if (this.parent && this.parent.reMeasure) this.parent.reMeasureChild(this); }; BaseComponent.prototype.measureMinSize = function () { return { width: 0, height: 0 }; }; BaseComponent.prototype.getAcceptsAttributeNames = function () { return ["type", "name"]; }; BaseComponent.prototype.getAcceptsEventNames = function () { return []; }; /** * @param {String} name * @returns {} */ core_FModel.prototype.getEventDescriptor = function (name) { var functionName = 'getEvent' + name.substr(0, 1).toUpperCase() + name.substr(1) + 'Descriptor'; return this[functionName] && this[functionName].call(this); }; BaseComponent.prototype.getAttributeTypeDescriptor = function () { return { type: 'const', value: this.tag }; }; BaseComponent.prototype.getAttributeNameDescriptor = function () { return { type: 'text', regex: /^[a-zA-Z\_0-9]$/ }; }; /* harmony default export */ var core_BaseComponent = (BaseComponent); // CONCATENATED MODULE: ./js/core/ScalableComponent.js var ScalableComponent_ = FCore._; function ScalableComponent() { core_BaseComponent.call(this); } Object.defineProperties(ScalableComponent.prototype, Object.getOwnPropertyDescriptors(core_BaseComponent.prototype)); ScalableComponent.prototype.constructor = ScalableComponent; ScalableComponent.prototype.tag = "ScalableComponent"; ScalableComponent.prototype.SUPPORT_STYLE_NAMES = ['width', 'height', 'top', 'left', 'right', 'top', 'bottom']; ScalableComponent.prototype.onCreate = function () { core_BaseComponent.prototype.onCreate.call(this); this.style.hAlign = 'left'; this.style.vAlign = 'top'; this.style.left = 0; this.style.right = 0; this.style.top = 0; this.style.bottom = 0; this.style.height = 30; this.style.width = 69; }; ScalableComponent.prototype.setStyleWidth = function (value) { if (this.style.hAlign != 'fixed') this.view.addStyle('width', value + 'px');else this.view.removeStyle('width'); return value; }; ScalableComponent.prototype.setStyleHeight = function (value) { if (this.style.vAlign != 'fixed') this.view.addStyle('height', value + 'px');else this.view.removeStyle('height'); return value; }; ScalableComponent.prototype.setStyleHAlign = function (value) { if (value != 'fixed') { this.view.addStyle('width', this.style.width + 'px'); } else { this.view.removeStyle('width'); } return value; }; ScalableComponent.prototype.setStyleVAlign = function (value) { if (value != 'fixed') { this.view.addStyle('height', this.style.height + 'px'); } else { this.view.removeStyle('height'); } return value; }; ScalableComponent.prototype.setStyle = function (key, value) { var res; if (this.anchorAcceptsStyleName[key]) { value = this.anchor.setStyle(key, value); // anchor first value = core_BaseComponent.prototype.setStyle.call(this, key, value); if (value === undefined) delete this.style[key];else this.style[key] = value; res = value; } else { res = core_BaseComponent.prototype.setStyle.call(this, key, value); } return res; }; ScalableComponent.prototype.getAcceptsStyleNames = function () { return core_BaseComponent.prototype.getAcceptsStyleNames.call(this).concat(['width', 'height']); }; ScalableComponent.prototype.getStyleWidthDescriptor = function () { return { disabled: this.style.hAlign == 'fixed', type: 'number', min: this.measureMinSize().width, max: Infinity, livePreview: true }; }; ScalableComponent.prototype.getStyleHeightDescriptor = function () { return { disabled: this.style.vAlign == 'fixed', type: 'number', min: this.measureMinSize().height, max: Infinity, livePreview: true }; }; /* harmony default export */ var core_ScalableComponent = (ScalableComponent); // EXTERNAL MODULE: ./css/component.css var component = __webpack_require__(22); // CONCATENATED MODULE: ./js/font/GoogleFont.js function queryURL(fontNames) { return 'https://fonts.googleapis.com/css?family=' + fontNames.join('_') + '&display=swap'; } var FONT_NAMES = ["Alegreya", "Alegreya+SC", "Alegreya+Sans", "Alegreya+Sans+SC", "Alfa+Slab+One", "Amatic+SC", "Andika", "Anton", "Archivo", "Archivo+Narrow", "Arima+Madurai", "Arimo", "Arsenal", "Asap", "Asap+Condensed", "Athiti", "Bahianita", "Bai+Jamjuree", "Baloo", "Baloo+Bhai", "Baloo+Bhaijaan", "Baloo+Bhaina", "Baloo+Chettan", "Baloo+Da", "Baloo+Paaji", "Baloo+Tamma", "Baloo+Tammudu", "Baloo+Thambi", "Bangers", "Barlow", "Barlow+Condensed", "Barlow+Semi+Condensed", "Barriecito", "Be+Vietnam", "Bevan", "Big+Shoulders+Display", "Big+Shoulders+Text", "Bungee", "Bungee+Hairline", "Bungee+Inline", "Bungee+Outline", "Bungee+Shade", "Cabin", "Cabin+Condensed", "Chakra+Petch", "Charm", "Charmonman", "Chonburi", "Coiny", "Comfortaa", "Cormorant", "Cormorant+Garamond", "Cormorant+Infant", "Cormorant+SC", "Cormorant+Unicase", "Cormorant+Upright", "Cousine", "Crimson+Pro", "Cuprum", "Dancing+Script", "Darker+Grotesque", "David+Libre", "Dosis", "EB+Garamond", "Encode+Sans", "Encode+Sans+Condensed", "Encode+Sans+Expanded", "Encode+Sans+Semi+Condensed", "Encode+Sans+Semi+Expanded", "Exo", "Exo+2", "Fahkwang", "Farsan", "Faustina", "Fira+Sans", "Fira+Sans+Condensed", "Fira+Sans+Extra+Condensed", "Francois+One", "Grenze", "Hepta+Slab", "IBM+Plex+Mono", "IBM+Plex+Sans", "IBM+Plex+Sans+Condensed", "IBM+Plex+Serif", "Inconsolata", "Itim", "Josefin+Sans", "Judson", "Jura", "K2D", "Kanit", "KoHo", "Kodchasan", "Krub", "Lalezar", "Lemonada", "Lexend+Deca", "Lexend+Exa", "Lexend+Giga", "Lexend+Mega", "Lexend+Peta", "Lexend+Tera", "Lexend+Zetta", "Literata", "Livvic", "Lobster", "Lora", "M+PLUS+1p", "M+PLUS+Rounded+1c", "Maitree", "Major+Mono+Display", "Mali", "Manuale", "Markazi+Text", "Maven+Pro", "Merriweather", "Metrophobic", "Mitr", "Montserrat", "Montserrat+Alternates", "Muli", "Niramit", "Noticia+Text", "Noto+Sans", "Noto+Sans+SC", "Noto+Serif", "Noto+Serif+SC", "Noto+Serif+TC", "Nunito", "Nunito+Sans", "Old+Standard+TT", "Open+Sans", "Open+Sans+Condensed:300", "Oswald", "Pacifico", "Pangolin", "Patrick+Hand", "Patrick+Hand+SC", "Pattaya", "Paytone+One", "Philosopher", "Play", "Playfair+Display", "Playfair+Display+SC", "Podkova", "Prata", "Pridi", "Prompt", "Quicksand", "Roboto", "Roboto+Condensed", "Roboto+Mono", "Roboto+Slab", "Rokkitt", "Rosario", "Saira", "Saira+Condensed", "Saira+Extra+Condensed", "Saira+Semi+Condensed", "Saira+Stencil+One", "Sarabun", "Sawarabi+Gothic", "Sedgwick+Ave", "Sedgwick+Ave+Display", "Sigmar+One", "Source+Code+Pro", "Source+Sans+Pro", "Space+Mono", "Spectral", "Spectral+SC", "Sriracha", "Srisakdi", "Taviraj", "Thasadith", "Tinos", "Trirong", "VT323", "Varela+Round", "Vollkorn", "Vollkorn+SC", "Yanone+Kaffeesatz", "Yeseva+One"]; var FONT_FACES = ["'Open Sans', sans-serif", "'Roboto', sans-serif", "'Big Shoulders Text', cursive", "'Montserrat', sans-serif", "'Oswald', sans-serif", "'Source Sans Pro', sans-serif", "'Roboto Condensed', sans-serif", "'Literata', serif", "'Roboto Mono', monospace", "'Roboto Slab', serif", "'Merriweather', serif", "'Noto Sans', sans-serif", "'Lora', serif", "'Muli', sans-serif", "'Open Sans Condensed', sans-serif", "'Playfair Display', serif", "'Nunito', sans-serif", "'Noto Serif', serif", "'Fira Sans', sans-serif", "'Inconsolata', monospace", "'Dosis', sans-serif", "'Nunito Sans', sans-serif", "'Arimo', sans-serif", "'Quicksand', sans-serif", "'Cabin', sans-serif", "'Josefin Sans', sans-serif", "'Varela Round', sans-serif", "'Anton', sans-serif", "'Lobster', cursive", "'Yanone Kaffeesatz', sans-serif", "'Source Code Pro', monospace", "'Baloo Bhai', cursive", "'Barlow', sans-serif", "'Dancing Script', cursive", "'Pacifico', cursive", "'Exo 2', sans-serif", "'Barlow Semi Condensed', sans-serif", "'EB Garamond', serif", "'Archivo Narrow', sans-serif", "'Asap', sans-serif", "'Comfortaa', cursive", "'Barlow Condensed', sans-serif", "'IBM Plex Sans', sans-serif", "'Maven Pro', sans-serif", "'Play', sans-serif", "'Exo', sans-serif", "'Amatic SC', cursive", "'Kanit', sans-serif", "'Fira Sans Condensed', sans-serif", "'Noto Sans SC', sans-serif", "'Vollkorn', serif", "'Prompt', sans-serif", "'Rokkitt', serif", "'Cuprum', sans-serif", "'Alegreya Sans', sans-serif", "'Francois One', sans-serif", "'Cormorant Garamond', serif", "'Alegreya', serif", "'Alfa Slab One', cursive", "'Noticia Text', serif", "'Saira Extra Condensed', sans-serif", "'Old Standard TT', serif", "'Tinos', serif", "'Fira Sans Extra Condensed', sans-serif", "'IBM Plex Serif', serif", "'Patrick Hand', cursive", "'M PLUS 1p', sans-serif", "'Prata', serif", "'Philosopher', sans-serif", "'Saira Semi Condensed', sans-serif", "'Archivo', sans-serif", "'Big Shoulders Display', cursive", "'Bangers', cursive", "'Playfair Display SC', serif", "'Cabin Condensed', sans-serif", "'Paytone One', sans-serif", "'Montserrat Alternates', sans-serif", "'Taviraj', serif", "'Spectral', serif", "'Lalezar', cursive", "'Asap Condensed', sans-serif", "'M PLUS Rounded 1c', sans-serif", "'Sigmar One', cursive", "'Saira', sans-serif", "'Pridi', serif", "'Mitr', sans-serif", "'Baloo', cursive", "'Cormorant', serif", "'Sarabun', sans-serif", "'Saira Condensed', sans-serif", "'Be Vietnam', sans-serif", "'Yeseva One', cursive", "'Lexend Peta', sans-serif", "'Alegreya Sans SC', sans-serif", "'IBM Plex Mono', monospace", "'Jura', sans-serif", "'Bevan', cursive", "'Lexend Exa', sans-serif", "'Sawarabi Gothic', sans-serif", "'Cousine', monospace", "'Markazi Text', serif", "'VT323', monospace", "'Baloo Bhaina', cursive", "'Space Mono', monospace", "'Encode Sans', sans-serif", "'Encode Sans Semi Expanded', sans-serif", "'Arima Madurai', cursive", "'Lexend Deca', sans-serif", "'Lexend Tera', sans-serif", "'Lexend Giga', sans-serif", "'Lexend Zetta', sans-serif", "'Lexend Mega', sans-serif", "'Arsenal', sans-serif", "'Itim', cursive", "'Noto Serif SC', serif", "'Pangolin', cursive", "'Lemonada', cursive", "'Encode Sans Condensed', sans-serif", "'Bai Jamjuree', sans-serif", "'Alegreya SC', serif", "'Noto Serif TC', serif", "'Judson', serif", "'Livvic', sans-serif", "'Krub', sans-serif", "'Trirong', serif", "'Niramit', sans-serif", "'Bungee Inline', cursive", "'Mali', cursive", "'Pattaya', sans-serif", "'Rosario', sans-serif", "'Bungee', cursive", "'Sriracha', cursive", "'Metrophobic', sans-serif", "'Faustina', serif", "'Darker Grotesque', sans-serif", "'Encode Sans Expanded', sans-serif", "'Chakra Petch', sans-serif", "'IBM Plex Sans Condensed', sans-serif", "'Maitree', serif", "'Baloo Bhaijaan', cursive", "'Cormorant Infant', serif", "'Saira Stencil One', cursive", "'Chonburi', cursive", "'Barriecito', cursive", "'Bahianita', cursive", "'Athiti', sans-serif", "'Sedgwick Ave', cursive", "'Patrick Hand SC', cursive", "'Srisakdi', cursive", "'Cormorant SC', serif", "'Andika', sans-serif", "'Podkova', serif", "'Bungee Shade', cursive", "'Baloo Da', cursive", "'Spectral SC', serif", "'Baloo Thambi', cursive", "'Baloo Chettan', cursive", "'Cormorant Upright', serif", "'Encode Sans Semi Condensed', sans-serif", "'Charm', cursive", "'Baloo Paaji', cursive", "'K2D', sans-serif", "'Farsan', cursive", "'David Libre', serif", "'Coiny', cursive", "'Baloo Tamma', cursive", "'Manuale', serif", "'Thasadith', sans-serif", "'Vollkorn SC', serif", "'Bungee Hairline', cursive", "'Kodchasan', sans-serif", "'Hepta Slab', serif", "'Cormorant Unicase', serif", "'Crimson Pro', serif", "'Grenze', serif", "'Charmonman', cursive", "'Baloo Tammudu', cursive", "'KoHo', sans-serif", "'Major Mono Display', monospace", "'Fahkwang', sans-serif", "'Bungee Outline', cursive", "'Sedgwick Ave Display', cursive"]; var FONT_ITEMS = FONT_FACES.map(function (fontFamily) { var fontName = fontFamily.match(/\'([^\']+)\'/)[1]; return { text: fontName, value: fontFamily, extendStyle: { fontFamily: fontFamily } }; }, {}); var FONT_FACES_BY_NAME = FONT_ITEMS.reduce(function (ac, cr) { ac[cr.text] = cr.value; return ac; }, {}); // CONCATENATED MODULE: ./js/components/Text.js var Text_ = FCore._; function Text() { core_ScalableComponent.call(this); } Object.defineProperties(Text.prototype, Object.getOwnPropertyDescriptors(core_ScalableComponent.prototype)); Text.prototype.constructor = Text; Text.prototype.tag = "Text"; Text.prototype.menuIcon = "span.mdi.mdi-format-color-text"; Text.prototype.onCreate = function () { core_ScalableComponent.prototype.onCreate.call(this); this.attributes.text = this.attributes.name; this.style.font = undefined; this.style.fontStyle = undefined; this.style.textSize = 0; }; Text.prototype.render = function () { return Text_('div.absol-bscroller'); }; Text.prototype.setAttributeText = function (value) { this.view.clearChild().addChild(Text_({ text: value })); return value; }; Text.prototype.setStyleFont = function (value) { if (value) this.view.addStyle('font-family', value);else this.view.removeStyle('font-family'); return value; }; Text.prototype.setStyleFontStyle = function (value) { var styleList = { Regular: { fontWeight: 'normal', fontStyle: 'normal' }, Bold: { fontWeight: 'bold', fontStyle: 'normal' }, 'Bold italic': { fontWeight: 'bold', fontStyle: 'italic' }, Italic: { fontWeight: 'normal', fontStyle: 'italic' } }; this.view.addStyle(styleList[value] || styleList.Regular); return value; }; Text.prototype.setStyleTextSize = function (value) { if (value > 0) this.view.addStyle('font-size', value + 'px');else this.view.removeStyle('font-size'); return value; }; Text.prototype.getAcceptsAttributeNames = function () { return core_ScalableComponent.prototype.getAcceptsAttributeNames.call(this).concat(['text']); }; Text.prototype.getAcceptsStyleNames = function () { return core_ScalableComponent.prototype.getAcceptsStyleNames.call(this).concat(['font', 'fontStyle', 'textSize']); }; Text.prototype.getAttributeTextDescriptor = function () { return { type: "text", "long": true }; }; Text.prototype.getStyleFontDescriptor = function () { return { type: "font" }; }; Text.prototype.getStyleFontStyleDescriptor = function () { return { type: "enum", values: ['Regular', 'Italic', 'Bold', 'Bold italic'] }; }; Text.prototype.getStyleTextSizeDescriptor = function () { return { type: "number", min: 0, max: 1000 }; }; /* harmony default export */ var components_Text = (Text); // CONCATENATED MODULE: ./js/components/TextInput.js var TextInput_ = FCore._; function TextInput() { core_ScalableComponent.call(this); } Object.defineProperties(TextInput.prototype, Object.getOwnPropertyDescriptors(core_ScalableComponent.prototype)); TextInput.prototype.constructor = TextInput; TextInput.prototype.tag = "TextInput"; TextInput.prototype.menuIcon = "span.mdi.mdi-textbox"; TextInput.prototype.SUPPORT_ATTRIBUTE_NAMES = ['value']; TextInput.prototype.SUPPORT_EVENT_NAMES = ['change']; TextInput.prototype.onCreated = function () { core_ScalableComponent.prototype.onCreated.call(this); var self = this; this.view.on('keyup', function () { var lastValue = self.attributes.value; if (this.value != lastValue) { self.attributes.value = this.value; self.emit('change', this.value, self); } }); }; TextInput.prototype.onCreate = function () { core_ScalableComponent.prototype.onCreate.call(this); this.setStyleTextAlign.textAlign = 'left'; this.attributes.value = ''; this.attributes.placeHolder = ''; }; TextInput.prototype.render = function () { return TextInput_('input[type="text"]'); }; TextInput.prototype.getAcceptsStyleNames = function () { return core_ScalableComponent.prototype.getAcceptsStyleNames.call(this).concat(['textAlign', 'font', 'fontStyle', 'textSize']); }; TextInput.prototype.setStyleFont = components_Text.prototype.setStyleFont; TextInput.prototype.getStyleFontDescriptor = components_Text.prototype.getStyleFontDescriptor; TextInput.prototype.setStyleFontStyle = components_Text.prototype.setStyleFontStyle; TextInput.prototype.getStyleFontStyleDescriptor = components_Text.prototype.getStyleFontStyleDescriptor; TextInput.prototype.setStyleTextSize = components_Text.prototype.setStyleTextSize; TextInput.prototype.getStyleTextSizeDescriptor = components_Text.prototype.getStyleTextSizeDescriptor; TextInput.prototype.getStyleTextAlignDescriptor = function () { return { type: "enum", values: ['left', 'center', 'right', 'unset'] }; }; TextInput.prototype.setStyleTextAlign = function (value) { if (['left', 'center', 'right'].indexOf(value) >= 0) { this.view.addStyle('text-align', value); } else { value = 'unset'; this.view.removeStyle('text-align', value); } return value; }; TextInput.prototype.setAttributeValue = function (value) { this.view.value = value; return value; }; TextInput.prototype.setAttributePlaceHolder = function (value) { this.view.attr('placeholder', value); return value; }; TextInput.prototype.getAcceptsAttributeNames = function () { return core_ScalableComponent.prototype.getAcceptsAttributeNames.call(this).concat(['value', 'placeHolder']); }; TextInput.prototype.getAttributeValueDescriptor = function () { return { type: "text" }; }; TextInput.prototype.getAttributePlaceHolderDescriptor = function () { return { type: "text" }; }; TextInput.prototype.getAcceptsEventNames = function () { return core_ScalableComponent.prototype.getAcceptsEventNames.call(this).concat(['change']); }; /* harmony default export */ var components_TextInput = (TextInput); // EXTERNAL MODULE: ./css/anchoreditor.css var anchoreditor = __webpack_require__(62); // CONCATENATED MODULE: ./js/dom/Icons.js var Icons_ = FCore._; FCore.install('mdi-align-horizontal-left', function () { return Icons_('<svg width="24px" height="24px" viewBox="0 0 24 24">\ <path fill="#000000" d = "M22 13V19H6V13H22M6 5V11H16V5H6M2 2V22H4V2H2" />\ </svg>'); }); FCore.install('mdi-align-horizontal-center', function () { return Icons_('<svg width="24px" height="24px" viewBox="0 0 24 24">\ <path fill="#000000" d="M20 19H13V22H11V19H4V13H11V11H7V5H11V2H13V5H17V11H13V13H20V19Z" />\ </svg>'); }); FCore.install('mdi-align-horizontal-right', function () { return Icons_('<svg width="24px" height="24px" viewBox="0 0 24 24">\ <path fill="#000000" d="M18 13V19H2V13H18M8 5V11H18V5H8M20 2V22H22V2H20Z" />\ </svg>'); }); FCore.install('mdi-align-vertical-bottom', function () { return Icons_('<svg width="24px" height="24px" viewBox="0 0 24 24">\ <path fill="#000000" d="M11 18H5V2H11V18M19 8H13V18H19V8M22 20H2V22H22V20Z" />\ </svg>'); }); FCore.install('mdi-align-vertical-center', function () { return Icons_('<svg width="24px" height="24px" viewBox="0 0 24 24">\ <path fill="#000000" d="M5 20V13H2V11H5V4H11V11H13V7H19V11H22V13H19V17H13V13H11V20H5Z" />\ </svg>'); }); FCore.install('mdi-align-vertical-top', function () { return Icons_('<svg width="24px" height="24px" viewBox="0 0 24 24">\ <path fill="#000000" d="M11 22H5V6H11V22M19 6H13V16H19V6M22 2H2V4H22V2Z" />\ </svg>'); }); // CONCATENATED MODULE: ./js/anchoreditors/RelativeAnchorEditor.js function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } var RelativeAnchorEditor_ = FCore._; var RelativeAnchorEditor_$ = FCore.$; /** * * @param {import('../editor/LayoutEditor').default} layoutEditor */ function RelativeAnchorEditor(layoutEditor) { EventEmitter["a" /* default */].call(this); var self = this; this.layoutEditor = layoutEditor; this.component = null; this.$modal = RelativeAnchorEditor_({ style: { zIndex: '10000000', left: '1px', right: '1px', top: '1px', bottom: '1px', position: 'fixed' } }); this.$resizeBox = RelativeAnchorEditor_('resizebox').on('mousedown', this.focus.bind(this)).on('beginmove', this.ev_beginMove.bind(this, true)).on('moving', this.ev_moving.bind(this, true)).on('endmove', this.ev_endMove.bind(this, true)).on('click', function (ev) { self.emit('click', ev, true); }); this.$resizeBox.defineEvent('contextmenu'); this.$resizeBox.on('contextmenu', this.ev_contextMenu.bind(this)); this.$topAlignLine = RelativeAnchorEditor_('vline'); this.$bottomAlignLine = RelativeAnchorEditor_('vline'); this.$leftAlignLine = RelativeAnchorEditor_('hline'); this.$rightAlignLine = RelativeAnchorEditor_('hline'); this.movingData = null; this.isFocus = false; } Object.defineProperties(RelativeAnchorEditor.prototype, Object.getOwnPropertyDescriptors(EventEmitter["a" /* default */].prototype)); RelativeAnchorEditor.prototype.constructor = RelativeAnchorEditor; RelativeAnchorEditor.prototype.ev_contextMenu = function (event) { var self = this; var items = []; if (this.layoutEditor.anchorEditors.length > 1) { items.push({ icon: RelativeAnchorEditor_('mdi-align-horizontal-left'), text: 'Align Left Edges', cmd: this.cmd_alignLeftDedge.bind(this) }); items.push({ icon: RelativeAnchorEditor_('mdi-align-horizontal-center'), text: 'Align Horizontal Center', cmd: this.cmd_alignHorizontalCenter.bind(this) }); items.push({ icon: RelativeAnchorEditor_('mdi-align-horizontal-right'), text: 'Align Right Edges', cmd: this.cmd_alignRightDedge.bind(this) }); items.push({ icon: RelativeAnchorEditor_('span.mdi.mdi-arrow-expand-horizontal'), text: 'Equalise Width', cmd: this.cmd_equaliseWidth.bind(this) }); items.push('================'); items.push({ icon: RelativeAnchorEditor_('mdi-align-vertical-top'), text: 'Align Top Edges', cmd: this.cmd_alignTopDedge.bind(this) }); items.push({ icon: RelativeAnchorEditor_('mdi-align-vertical-bottom'), text: 'Align Bottom Edges', cmd: this.cmd_alignBottomDedge.bind(this) }); items.push({ icon: RelativeAnchorEditor_('mdi-align-vertical-center'), text: 'Align Vertical Center', cmd: this.cmd_alignVerticalCenter.bind(this) }); items.push({ icon: RelativeAnchorEditor_('span.mdi.mdi-arrow-expand-vertical'), text: 'Equalise Height', cmd: this.cmd_equaliseHeight.bind(this) }); items.push('================'); } if (this.layoutEditor.anchorEditors.length > 2) { items.push({ icon: RelativeAnchorEditor_('span.mdi.mdi-distribute-horizontal-left'), text: 'Distribute Horizontal Left', cmd: this.cmd_distributeHorizontalLeft.bind(this) }); items.push({ icon: RelativeAnchorEditor_('span.mdi.mdi-distribute-horizontal-center'), text: 'Distribute Horizontal Center', cmd: this.cmd_distributeHorizontalCenter.bind(this) }); items.push({ icon: RelativeAnchorEditor_('span.mdi.mdi-distribute-horizontal-right'), text: 'Distribute Horizontal Right', cmd: this.cmd_distributeHorizontalRight.bind(this) }); items.push({ icon: RelativeAnchorEditor_('<svg width="24" height="24" version="1.1" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">\ <path d="m21 7v10h-5v5h-2v-20h2v5h5"/>\ <path d="m8 2h2v20h-2v-3h-5v-14h5z"/>\ </svg>'), text: 'Distribute Horizontal Distance', cmd: this.cmd_distributeHorizontalDistance.bind(this) }); items.push('================'); items.push({ icon: RelativeAnchorEditor_('span.mdi.mdi-distribute-vertical-top'), text: 'Distribute Vertical Top', cmd: this.cmd_distributeVerticalTop.bind(this) }); items.push({ icon: RelativeAnchorEditor_('span.mdi.mdi-distribute-vertical-center'), text: 'Distribute Vertical Center', cmd: this.cmd_distributeVerticalCenter.bind(this) }); items.push({ icon: RelativeAnchorEditor_('span.mdi.mdi-distribute-vertical-bottom'), text: 'Distribute Vertical Bottom', cmd: this.cmd_distributeVerticalBottom.bind(this) }); items.push({ icon: RelativeAnchorEditor_('<svg width="24" height="24" version="1.1" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">\ <path d="m7 3h10v5h5v2h-20v-2h5v-5"/>\ <path d="m2 16v-2h20v2h-3v5h-14v-5z"/>\ </svg>'), text: 'Distribute Verlical Distance', cmd: this.cmd_distributeVerticalDistance.bind(this) }); items.push('================'); } items.push({ icon: 'span.mdi.mdi-delete-variant[style="color:red"]', text: 'Delete', cmd: this.cmd_delete.bind(this) }); event.showContextMenu({ items: items }, function (event) { var cmd = event.menuItem.cmd; if (typeof cmd == 'function') { cmd(); self.layoutEditor.notifyDataChange(); } }); event.stopPropagation(); }; RelativeAnchorEditor.prototype.focus = function () { if (!this.component) return; if (this.isFocus) return; this.isFocus = true; this.$resizeBox.addClass('as-focus'); var editor; for (var i = 0; i < this.layoutEditor.anchorEditors.length; ++i) { editor = this.layoutEditor.anchorEditors[i]; if (editor == this) continue; editor.blur(); } this.emit('focus', { type: 'focus', target: this }, this); }; RelativeAnchorEditor.prototype.blur = function () { if (!this.isFocus) return; this.isFocus = false; this.$resizeBox.removeClass('as-focus'); this.emit('blur', { type: 'blur', target: this }, this); }; RelativeAnchorEditor.prototype.edit = function (component) { this.component = component; if (!this.component) this.blur(); this.update(); }; RelativeAnchorEditor.prototype.update = function () { if (this.component) { this.$resizeBox.addTo(this.layoutEditor.$forceground); var styleDescriptors = this.component.getStyleDescriptors(); this.$resizeBox.canMove = !!(styleDescriptors.top || styleDescriptors.bottom || styleDescriptors.left || styleDescriptors.right); this.$resizeBox.canResize = !!(styleDescriptors.width || styleDescriptors.height); if (!styleDescriptors.top || styleDescriptors.top.disabled) { this.$topAlignLine.remove(); } else { this.$topAlignLine.addTo(this.layoutEditor.$forceground); } if (!styleDescriptors.bottom || styleDescriptors.bottom.disabled) { this.$bottomAlignLine.remove(); } else { this.$bottomAlignLine.addTo(this.layoutEditor.$forceground); } if (!styleDescriptors.left || styleDescriptors.left.disabled) { this.$leftAlignLine.remove(); } else { this.$leftAlignLine.addTo(this.layoutEditor.$forceground); } if (!styleDescriptors.right || styleDescriptors.right.disabled) { this.$rightAlignLine.remove(); } else { this.$rightAlignLine.addTo(this.layoutEditor.$forceground); } this.updatePosition(); } else { this.$resizeBox.remove(); this.$leftAlignLine.remove(); this.$rightAlignLine.remove(); this.$topAlignLine.remove(); this.$bottomAlignLine.remove(); } }; RelativeAnchorEditor.prototype.updatePosition = function () { if (this.component) { var bound = this.layoutEditor.$forceground.getBoundingClientRect(); var compBound = this.component.view.getBoundingClientRect(); this.$resizeBox.addStyle({ left: compBound.left - bound.left + 'px', top: compBound.top - bound.top + 'px', width: compBound.width + 'px', height: compBound.height + 'px' }); if (this.$leftAlignLine.parentNode) this.$leftAlignLine.addStyle({ left: compBound.left - bound.left - this.component.style.left + 'px', width: this.component.style.left + 'px', top: compBound.top - bound.top + compBound.height / 2 + 'px' }); if (this.$rightAlignLine.parentNode) this.$rightAlignLine.addStyle({ left: compBound.right - bound.left + 'px', width: this.component.style.right + 'px', top: compBound.top - bound.top + compBound.height / 2 + 'px' }); if (this.$topAlignLine.parentNode) this.$topAlignLine.addStyle({ top: compBound.top - bound.top - this.component.style.top + 'px', height: this.component.style.top + 'px', left: compBound.left - bound.left + compBound.width / 2 + 'px' }); if (this.$bottomAlignLine.parentNode) this.$bottomAlignLine.addStyle({ top: compBound.bottom - bound.top + 'px', height: this.component.style.bottom + 'px', left: compBound.left - bound.left + compBound.width / 2 + 'px' }); } }; RelativeAnchorEditor.prototype.ev_beginMove = function (userAction, event) { var bound = this.layoutEditor.$forceground.getBoundingClientRect(); this.movingData = { x0: event.clientX - bound.left, y0: event.clientY - bound.top, dx: 0, dy: 0, option: event.option, styleDescriptors: this.component.getStyleDescriptors(), style0: Object.assign({}, this.component.style), comp: this.component, isChange: false }; if (userAction) this.emit('beginmove', _defineProperty({ type: 'beginmove', target: this, originEvent: event }, "target", this), this); }; RelativeAnchorEditor.prototype.ev_moving = function (userAction, event) { var movingData = this.movingData; var bound = this.layoutEditor.$forceground.getBoundingClientRect(); var x = event.clientX - bound.left; var y = event.clientY - bound.top; movingData.dx = x - movingData.x0; movingData.dy = y - movingData.y0; var positionIsChange = false; if (movingData.styleDescriptors.left && !movingData.styleDescriptors.left.disabled && (movingData.option.left || movingData.option.body)) { movingData.comp.setStyle('left', Math.max(0, movingData.style0.left + movingData.dx)); positionIsChange = true; } if (movingData.styleDescriptors.right && !movingData.styleDescriptors.right.disabled && (movingData.option.right || movingData.option.body)) { movingData.comp.setStyle('right', Math.max(0, movingData.style0.right - movingData.dx)); positionIsChange = true; } if (movingData.styleDescriptors.width && !movingData.styleDescriptors.width.disabled) { if (movingData.option.left) { if (!!movingData.styleDescriptors.left.disabled && !!movingData.styleDescriptors.right.disabled) { movingData.comp.setStyle('width', Math.max(movingData.comp.measureMinSize().width, movingData.style0.width - movingData.dx * 2)); } else { movingData.comp.setStyle('width', Math.max(movingData.style0.width - movingData.dx)); } positionIsChange = true; } if (movingData.option.right) { if (movingData.styleDescriptors.left && !!movingData.styleDescriptors.left.disabled && !!movingData.styleDescriptors.right.disabled) { movingData.comp.setStyle('width', Math.max(movingData.comp.measureMinSize().width, movingData.style0.width + movingData.dx * 2)); //center align } else { movingData.comp.setStyle('width', Math.max(movingData.comp.measureMinSize().width, movingData.style0.width + movingData.dx)); } positionIsChange = true; } } if (movingData.styleDescriptors.top && !movingData.styleDescriptors.top.disabled && (movingData.option.top || movingData.option.body)) { movingData.comp.setStyle('top', Math.max(0, movingData.style0.top + movingData.dy)); positionIsChange = true; } if (movingData.styleDescriptors.bottom && !movingData.styleDescriptors.bottom.disabled && (movingData.option.bottom || movingData.option.body)) { movingData.comp.setStyle('bottom', Math.max(0, movingData.style0.bottom - movingData.dy)); positionIsChange = true; } if (movingData.styleDescriptors.height && !movingData.styleDescriptors.height.disabled) { if (movingData.option.top) { if (movingData.styleDescriptors.top && !!movingData.styleDescriptors.top.disabled && !!movingData.styleDescriptors.bottom.disabled) { movingData.comp.setStyle('height', Math.max(movingData.comp.measureMinSize().height, movingData.style0.height - movingData.dy * 2)); } else { movingData.comp.setStyle('height', Math.max(movingData.comp.measureMinSize().height, movingData.style0.height - movingData.dy)); } positionIsChange = true; } if (movingData.option.bottom) { if (movingData.styleDescriptors.top && !!movingData.styleDescriptors.top.disabled && !!movingData.styleDescriptors.bottom.disabled) { movingData.comp.setStyle('height', Math.max(movingData.comp.measureMinSize().height, movingData.style0.height + movingData.dy * 2)); } else { movingData.comp.setStyle('height', Math.max(movingData.comp.measureMinSize().height, movingData.style0.height + movingData.dy)); } positionIsChange = true; } } this.updatePosition(); movingData.comp.reMeasure(); if (positionIsChange) { this.emit("reposition", { type: 'reposition', component: movingData.comp, movingData: movingData, originEvent: event }, this); movingData.isChange = true; } if (userAction) this.emit('moving', { taget: this, type: 'moving', originEvent: event, target: this }, this); }; RelativeAnchorEditor.prototype.ev_endMove = function (userAction, event) { if (this.movingData.isChange) { this.emit('change', { type: 'change', target: this, component: this.movingData.comp, originEvent: event }, this); } this.movingData = undefined; if (userAction) this.emit('endmove', { taget: this, type: 'moving', originEvent: event, target: this }, this); }; RelativeAnchorEditor.prototype.cmd_delete = function () { var editors = this.layoutEditor.anchorEditors; var components = editors.map(function (e) { return e.component; }); this.layoutEditor.removeComponent.apply(this.layoutEditor, components); }; RelativeAnchorEditor.prototype.cmd_alignLeftDedge = function () { var editors = this.layoutEditor.anchorEditors; var editor; this.component.reMeasure(); var leftValue = this.component.getStyle('left'); for (var i = 0; i < editors.length; ++i) { editor = editors[i]; if (editor == this) continue; editor.alignLeftDedge(leftValue); } this.layoutEditor.commitHistory('move', 'Align Left Dedge'); }; RelativeAnchorEditor.prototype.cmd_alignRightDedge = function () { var editors = this.layoutEditor.anchorEditors; var editor; this.component.reMeasure(); var rightValue = this.component.getStyle('right'); for (var i = 0; i < editors.length; ++i) { editor = editors[i]; if (editor == this) continue; editor.alignRightDedge(rightValue); } this.layoutEditor.commitHistory('move', 'Align Right Dedge'); }; RelativeAnchorEditor.prototype.cmd_alignHorizontalCenter = function () { var editors = this.layoutEditor.anchorEditors; var editor; this.component.reMeasure(); var centerValue = this.component.getStyle('right') - this.component.getStyle('left'); ; for (var i = 0; i < editors.length; ++i) { editor = editors[i]; if (editor == this) continue; editor.alignHorizontalCenter(centerValue); } this.layoutEditor.commitHistory('move', 'Align Horizontal Center'); }; RelativeAnchorEditor.prototype.cmd_equaliseWidth = function () { var editors = this.layoutEditor.anchorEditors; var editor; this.component.reMeasure(); var widthValue = this.component.getStyle('width'); for (var i = 0; i < editors.length; ++i) { var editor = editors[i]; if (editor == this) continue; editor.equaliseWidth(widthValue); } this.layoutEditor.commitHistory('move', 'Equalise Width'); }; RelativeAnchorEditor.prototype.alignLeftDedge = function (leftValue) { if (!this.component) return; this.component.reMeasure(); var currentHAlign = this.component.getStyle('hAlign'); switch (currentHAlign) { case 'left': case 'fixed': this.component.setStyle('left', leftValue); break; case 'right': this.component.setStyle('right', this.component.getStyle('right') + (leftValue - this.component.getStyle('left'))); break; case 'center': var center = this.component.getStyle('left') + this.component.getStyle('width') / 2; if (center - this.component.measureMinSize().width / 2 >= leftValue) { this.component.setStyle('width', (center - leftValue) * 2); } break; } this.updatePosition(); this.component.reMeasure(); }; RelativeAnchorEditor.prototype.alignRightDedge = function (rightValue) { if (!this.component) return; this.component.reMeasure(); var currentHAlign = this.component.getStyle('hAlign'); switch (currentHAlign) { case 'right': case 'fixed': this.component.setStyle('right', rightValue); break; case 'left': this.component.setStyle('left', this.component.getStyle('left') - (rightValue - this.component.getStyle('right'))); break; case 'center': var center = this.component.getStyle('right') - this.component.getStyle('width') / 2; if (center + this.component.measureMinSize().width / 2 <= rightValue) { this.component.setStyle('width', (rightValue - center) * 2); } break; } this.updatePosition(); this.component.reMeasure(); }; RelativeAnchorEditor.prototype.alignHorizontalCenter = function (centerValue) { // right - left if (!this.component) return; this.component.reMeasure(); var currentHAlign = this.component.getStyle('hAlign'); var cRight = this.component.getStyle('right'); var cLeft = this.component.getStyle('left'); var newLeft = (cRight + cLeft - centerValue) / 2; var newRight = (cRight + cLeft + centerValue) / 2; switch (currentHAlign) { case 'right': this.component.setStyle('right', newRight); break; case 'fixed': this.component.setStyle('left', newLeft); this.component.setStyle('right', newRight); break; case 'left': this.component.setStyle('left', newLeft); break; case 'center': //noway to align center break; } this.updatePosition(); this.component.reMeasure(); }; RelativeAnchorEditor.prototype.equaliseWidth = function (widthValue) { if (!this.component) return; this.component.reMeasure(); var currentHAlign = this.component.getStyle('hAlign'); var cRight = this.component.getStyle('right'); var cLeft = this.component.getStyle('left'); var cWidth = this.component.getStyle('width'); var dw = widthValue - cWidth; switch (currentHAlign) { case 'right': if (cLeft < dw) this.component.setStyle('right', cRight - (dw - cLeft)); this.component.setStyle('width', widthValue); break; case 'left': if (cRight < dw) this.component.setStyle('left', cLeft - (dw - cWidth)); this.component.setStyle('width', widthValue); break; case 'fixed': if (dw > cRight) { this.component.setStyle('right', 0); this.component.setStyle('left', cLeft - (dw - cWidth)); } else { this.component.setStyle('right', cRight - dw); } break; case 'center': this.component.setStyle('width', widthValue); break; } this.updatePosition(); this.component.reMeasure(); }; RelativeAnchorEditor.prototype.cmd_alignTopDedge = function () { var editors = this.layoutEditor.anchorEditors; var editor; this.component.reMeasure(); var topValue = this.component.getStyle('top'); for (var i = 0; i < editors.length; ++i) { editor = editors[i]; if (editor == this) continue; editor.alignTopDedge(topValue); } this.layoutEditor.commitHistory('move', 'Align Top Dedge'); }; RelativeAnchorEditor.prototype.cmd_alignBottomDedge = function () { var editors = this.layoutEditor.anchorEditors; var editor; this.component.reMeasure(); var bottomValue = this.component.getStyle('bottom'); for (var i = 0; i < editors.length; ++i) { editor = editors[i]; if (editor == this) continue; editor.alignBottomDedge(bottomValue); } this.layoutEditor.commitHistory('move', 'Align Bottom Dedge'); }; RelativeAnchorEditor.prototype.cmd_alignVerticalCenter = function () { var editors = this.layoutEditor.anchorEditors; var editor; this.component.reMeasure(); var centerValue = this.component.getStyle('bottom') - this.component.getStyle('top'); ; for (var i = 0; i < editors.length; ++i) { editor = editors[i]; if (editor == this) continue; editor.alignVerticalCenter(centerValue); } this.layoutEditor.commitHistory('move', 'Align Verlical Center'); }; RelativeAnchorEditor.prototype.cmd_equaliseHeight = function () { var editors = this.layoutEditor.anchorEditors; var editor; this.component.reMeasure(); var heightValue = this.component.getStyle('height'); for (var i = 0; i < editors.length; ++i) { editor = editors[i]; if (editor == this) continue; editor.equaliseHeight(heightValue); } this.layoutEditor.commitHistory('move', 'Equalise Height'); }; RelativeAnchorEditor.prototype.alignTopDedge = function (topValue) { if (!this.component) return; this.component.reMeasure(); var currentVAlign = this.component.getStyle('vAlign'); switch (currentVAlign) { case 'top': case 'fixed': this.component.setStyle('top', topValue); break; case 'bottom': this.component.setStyle('bottom', this.component.getStyle('bottom') + (topValue - this.component.getStyle('top'))); break; case 'center': var center = this.component.getStyle('top') + this.component.getStyle('height') / 2; if (center - this.component.measureMinSize().height / 2 >= topValue) { this.component.setStyle('height', (center - topValue) * 2); } break; } this.updatePosition(); this.component.reMeasure(); }; RelativeAnchorEditor.prototype.alignBottomDedge = function (bottomValue) { if (!this.component) return; this.component.reMeasure(); var currentVAlign = this.component.getStyle('vAlign'); switch (currentVAlign) { case 'bottom': case 'fixed': this.component.setStyle('bottom', bottomValue); break; case 'top': this.component.setStyle('top', this.component.getStyle('top') - (bottomValue - this.component.getStyle('bottom'))); break; case 'center': var center = this.component.getStyle('bottom') - this.component.getStyle('height') / 2; if (center + this.component.measureMinSize().height / 2 <= bottomValue) { this.component.setStyle('height', (bottomValue - center) * 2); } break; } this.updatePosition(); }; RelativeAnchorEditor.prototype.alignVerticalCenter = function (centerValue) { // bottom - top if (!this.component) return; this.component.reMeasure(); var currentVAlign = this.component.getStyle('vAlign'); var cBottom = this.component.getStyle('bottom'); var cTop = this.component.getStyle('top'); var newTop = (cBottom + cTop - centerValue) / 2; var newBottom = (cBottom + cTop + centerValue) / 2; switch (currentVAlign) { case 'bottom': this.component.setStyle('bottom', newBottom); break; case 'fixed': this.component.setStyle('top', newTop); this.component.setStyle('bottom', newBottom); break; case 'top': this.component.setStyle('top', newTop); break; case 'center': //noway to align center break; } this.updatePosition(); this.component.reMeasure(); }; RelativeAnchorEditor.prototype.equaliseHeight = function (heightValue) { if (!this.component) return; this.component.reMeasure(); var currentVAlign = this.component.getStyle('vAlign'); var cBottom = this.component.getStyle('bottom'); var cTop = this.component.getStyle('top'); var cHeight = this.component.getStyle('height'); var dh = heightValue - cHeight; switch (currentVAlign) { case 'bottom': if (cTop < dh) this.component.setStyle('bottom', cBottom - (dh - cTop)); this.component.setStyle('height', heightValue); break; case 'top': if (cBottom < dh) this.component.setStyle('top', cTop - (dh - cHeight)); this.component.setStyle('height', heightValue); break; case 'fixed': if (dh > cBottom) { this.component.setStyle('bottom', 0); this.component.setStyle('top', cTop - (dh - cHeight)); } else { this.component.setStyle('bottom', cBottom - dh); } break; case 'center': this.component.setStyle('height', heightValue); break; } this.updatePosition(); this.component.reMeasure(); }; RelativeAnchorEditor.prototype.cmd_distributeHorizontalLeft = function () { var editors = this.layoutEditor.anchorEditors; var editor; var i; for (i = 0; i < editors.length; ++i) { editor = editors[i]; editor.component.reMeasure(); } editors = editors.slice(); editors.sort(function (a, b) { return a.component.style.left - b.component.style.left; }); var minX = editors[0].component.style.left; var maxX = editors[editors.length - 1].component.style.left; if (minX == maxX) return; for (i = 1; i < editors.length - 1; ++i) { editor = editors[i]; editor.alignLeftDedge(minX + (maxX - minX) / (editors.length - 1) * i); editor.component.reMeasure(); } this.layoutEditor.commitHistory('move', 'Distribute Horizontal Left'); }; RelativeAnchorEditor.prototype.cmd_distributeHorizontalCenter = function () { var editors = this.layoutEditor.anchorEditors; var editor; var i; for (i = 0; i < editors.length; ++i) { editor = editors[i]; editor.component.reMeasure(); } editors = editors.slice(); editors.sort(function (a, b) { return a.component.style.left + a.component.style.width / 2 - (b.component.style.left + b.component.style.width / 2); }); var minX = editors[0].component.style.left + editors[0].component.style.width / 2; var maxX = editors[editors.length - 1].component.style.left + editors[editors.length - 1].component.style.width / 2; if (minX == maxX) return; for (i = 1; i < editors.length - 1; ++i) { editor = editors[i]; editor.alignLeftDedge(minX + (maxX - minX) / (editors.length - 1) * i - editor.component.style.width / 2); editor.component.reMeasure(); } this.layoutEditor.commitHistory('move', 'Distribute Horizontal Center'); }; RelativeAnchorEditor.prototype.cmd_distributeHorizontalRight = function () { var editors = this.layoutEditor.anchorEditors; var editor; var i; for (i = 0; i < editors.length; ++i) { editor = editors[i]; editor.component.reMeasure(); } editors = editors.slice(); editors.sort(function (a, b) { return a.component.style.right - b.component.style.right; }); var minX = editors[0].component.style.right; var maxX = editors[editors.length - 1].component.style.right; if (minX == maxX) return; for (i = 1; i < editors.length - 1; ++i) { editor = editors[i]; editor.alignRightDedge(minX + (maxX - minX) / (editors.length - 1) * i); editor.component.reMeasure(); } this.layoutEditor.commitHistory('move', 'Distribute Horizontal Right'); }; RelativeAnchorEditor.prototype.cmd_distributeHorizontalDistance = function () { var editors = this.layoutEditor.anchorEditors; var editor; var i; for (i = 0; i < editors.length; ++i) { editor = editors[i]; editor.component.reMeasure(); } editors = editors.slice(); editors.sort(function (a, b) { return a.component.style.left + a.component.style.width / 2 - (b.component.style.left + b.component.style.width / 2); }); var sumDistance = editors[editors.length - 1].component.style.left - (editors[0].component.style.left + editors[0].component.style.width); for (i = 1; i < editors.length - 1; ++i) { editor = editors[i]; sumDistance -= editor.component.style.width; } var distance = sumDistance / (editors.length - 1); var curentLeft = editors[0].component.style.left + editors[0].component.style.width + distance; for (i = 1; i < editors.length - 1; ++i) { editor = editors[i]; editor.alignHorizontalCenter(editor.component.style.right - 2 * curentLeft + editor.component.style.left); editor.component.reMeasure(); curentLeft += editor.component.style.width + distance; } this.layoutEditor.commitHistory('move', 'Distribute Horizontal Distance'); }; RelativeAnchorEditor.prototype.cmd_distributeVerticalTop = function () { var editors = this.layoutEditor.anchorEditors; var editor; var i; for (i = 0; i < editors.length; ++i) { editor = editors[i]; editor.component.reMeasure(); } editors = editors.slice(); editors.sort(function (a, b) { return a.component.style.top - b.component.style.top; }); var minX = editors[0].component.style.top; var maxX = editors[editors.length - 1].component.style.top; if (minX == maxX) return; for (i = 1; i < editors.length - 1; ++i) { editor = editors[i]; editor.alignTopDedge(minX + (maxX - minX) / (editors.length - 1) * i); editor.component.reMeasure(); } this.layoutEditor.commitHistory('move', 'Distribute Vertical Top'); }; RelativeAnchorEditor.prototype.cmd_distributeVerticalCenter = function () { var editors = this.layoutEditor.anchorEditors; var editor; var i; for (i = 0; i < editors.length; ++i) { editor = editors[i]; editor.component.reMeasure(); } editors = editors.slice(); editors.sort(function (a, b) { return a.component.style.top + a.component.style.height / 2 - (b.component.style.top + b.component.style.height / 2); }); var minX = editors[0].component.style.top + editors[0].component.style.height / 2; var maxX = editors[editors.length - 1].component.style.top + editors[editors.length - 1].component.style.height / 2; if (minX == maxX) return; for (i = 1; i < editors.length - 1; ++i) { editor = editors[i]; editor.alignTopDedge(minX + (maxX - minX) / (editors.length - 1) * i - editor.component.style.height / 2); editor.component.reMeasure(); } this.layoutEditor.commitHistory('move', 'Distribute Vertical Center'); }; RelativeAnchorEditor.prototype.cmd_distributeVerticalBottom = function () { var editors = this.layoutEditor.anchorEditors; var editor; var i; for (i = 0; i < editors.length; ++i) { editor = editors[i]; editor.component.reMeasure(); } editors = editors.slice(); editors.sort(function (a, b) { return a.component.style.bottom - b.component.style.bottom; }); var minX = editors[0].component.style.bottom; var maxX = editors[editors.length - 1].component.style.bottom; if (minX == maxX) return; for (i = 1; i < editors.length - 1; ++i) { editor = editors[i]; editor.alignBottomDedge(minX + (maxX - minX) / (editors.length - 1) * i); editor.component.reMeasure(); } this.layoutEditor.commitHistory('move', 'Distribute Vertical Bottom'); }; RelativeAnchorEditor.prototype.cmd_distributeVerticalDistance = function () { var editors = this.layoutEditor.anchorEditors; var editor; var i; for (i = 0; i < editors.length; ++i) { editor = editors[i]; editor.component.reMeasure(); } editors = editors.slice(); editors.sort(function (a, b) { return a.component.style.top + a.component.style.height / 2 - (b.component.style.top + b.component.style.height / 2); }); var sumDistance = editors[editors.length - 1].component.style.top - (editors[0].component.style.top + editors[0].component.style.height); for (i = 1; i < editors.length - 1; ++i) { editor = editors[i]; sumDistance -= editor.component.style.height; } var distance = sumDistance / (editors.length - 1); var curentTop = editors[0].component.style.top + editors[0].component.style.height + distance; for (i = 1; i < editors.length - 1; ++i) { editor = editors[i]; editor.alignVerticalCenter(editor.component.style.bottom - 2 * curentTop + editor.component.style.top); editor.component.reMeasure(); curentTop += editor.component.style.height + distance; } this.layoutEditor.commitHistory('move', 'Distribute Vertical Distance'); }; /* harmony default export */ var anchoreditors_RelativeAnchorEditor = (RelativeAnchorEditor); // CONCATENATED MODULE: ./js/layouts/RelativeLayout.js var RelativeLayout_ = FCore._; function RelativeLayout() { core_ScalableComponent.call(this); } Object.defineProperties(RelativeLayout.prototype, Object.getOwnPropertyDescriptors(core_ScalableComponent.prototype)); RelativeLayout.prototype.constructor = RelativeLayout; RelativeLayout.prototype.tag = 'RelativeLayout'; RelativeLayout.prototype.menuIcon = 'span.mdi.mdi-relative-scale'; RelativeLayout.prototype.TOP_CLASS_NAME = 'as-relative-layout'; RelativeLayout.prototype.SUPPORT_STYLE_NAMES = ['width', 'height']; //, 'left', 'right', 'top', 'bottom']; RelativeLayout.prototype.create = function () { core_ScalableComponent.prototype.create.call(this); this.style.vAlign = 'fixed'; this.style.hAlign = 'fixed'; }; RelativeLayout.prototype.getAnchorConstructor = function () { return anchors_RelativeAnchor; }; RelativeLayout.prototype.getAnchorEditorConstructor = function () { return anchoreditors_RelativeAnchorEditor; }; RelativeLayout.prototype.render = function () { return RelativeLayout_({ "class": this.TOP_CLASS_NAME }); }; RelativeLayout.prototype.onAddChild = function (child, index) { var anchor = new anchors_RelativeAnchor(); anchor.attachChild(child); if (index == -1 || !this.view.childNodes[index]) { this.view.addChild(anchor.view); } else { this.view.addChildBefore(anchor.view, this.view.childNodes[index]); } }; RelativeLayout.prototype.onRemoveChild = function (child, index) { var anchor = child.anchor; anchor.detachChild(); anchor.view.remove(); }; /** * @param {BaseComponent} component * @returns {BaseComponent} auto set disable style */ RelativeLayout.prototype.reMeasureChild = function (component) { switch (component.style.hAlign) { case "left": component.setStyle('right', this.style.width - component.style.left - component.style.width); break; case "right": component.setStyle('left', this.style.width - component.style.right - component.style.width); break; case "center": component.setStyle('right', (this.style.width - component.style.width) / 2); component.setStyle('left', (this.style.width - component.style.width) / 2); break; case "fixed": component.setStyle('width', this.style.width - component.style.right - component.style.left); break; } switch (component.style.vAlign) { case "top": component.setStyle('bottom', this.style.height - component.style.top - component.style.height); break; case "bottom": component.setStyle('top', this.style.height - component.style.bottom - component.style.height); break; case "center": component.setStyle('bottom', (this.style.height - component.style.height) / 2); component.setStyle('top', (this.style.height - component.style.height) / 2); break; case "fixed": component.setStyle('height', this.style.height - component.style.bottom - component.style.top); break; } }; /** * * @returns {{width:Number, height:Number}} */ RelativeLayout.prototype.measureMinSize = function () { var width = 0; var height = 0; var child; var cW; var cH; for (var i = 0; i < this.children.length; ++i) { child = this.children[i]; cW = 0; cH = 0; switch (child.style.hAlign) { case "left": cW = child.style.left + child.style.width; break; case "right": cW = child.style.right + child.style.width; break; case "center": cW = child.style.width; break; case "fixed": cW = child.measureMinSize().width + child.style.left + child.style.right; break; } switch (child.style.vAlign) { case "top": cH = child.style.top + child.style.height; break; case "bottom": cH = child.style.bottom + child.style.height; break; case "center": cH = child.style.height; break; case "fixed": cH = child.measureMinSize().height + child.style.top + child.style.bottom; break; } width = Math.max(cW, width); height = Math.max(cH, height); } return { width: width, height: height }; }; /** * @param {BaseComponent} child, * @param {Number} posX * @param {Number} posY */ RelativeLayout.prototype.addChildByPosition = function (child, posX, posY) { this.addChild(child); posX = Math.max(0, Math.min(this.style.width - child.style.width, posX)); posY = Math.max(0, Math.min(this.style.height - child.style.height, posY)); child.setStyle('left', posX); child.setStyle('top', posY); }; /* harmony default export */ var layouts_RelativeLayout = (RelativeLayout); // CONCATENATED MODULE: ./js/core/Assembler.js function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } function Assembler() { this.constructors = {}; } ; Assembler.prototype.build = function (data) { var construction = this.constructors[data.tag]; if (construction == undefined) throw new Error("undefined construction " + data.tag); var res = new construction(); var style = data.style; if (_typeof(style) == 'object') for (var styleName in style) { res.setStyle(styleName, style[styleName]); } var attributes = data.attributes; if (_typeof(attributes) == 'object') for (var attributeName in attributes) { res.setAttribute(attributeName, attributes[attributeName]); } var events = data.events; if (_typeof(events) == 'object') for (var eventName in events) { res.setEvent(eventName, events[eventName]); } var children = data.children; if (children && children.length > 0) { for (var i = 0; i < children.length; ++i) { var child = this.build(children[i]); res.addChild(child); } } return res; }; Assembler.prototype.addConstructor = function (arg0, arg1) { if (typeof arg0 == 'function') { var name = arg0.prototype.tag || arg0.name; this.constructors[name] = arg0; } else if (typeof arg0 == 'string') { this.constructors[arg0] = arg1; } else { throw new Error('Invalid params'); } }; Assembler.prototype.removeConstructor = function (arg0, arg1) { if (typeof arg0 == 'function') { var name = arg0.prototype.tag || arg0.name; this.constructors[name] = undefined; delete this.constructors[name]; } else if (typeof arg0 == 'string' && (this.constructors[arg0] == arg1 || arg1 == undefined)) { delete this.constructors[arg0]; } }; Assembler.prototype.addComponent = function (name, construction) { this.addConstructor(name, construction); }; Assembler.prototype.removeComponent = function (name, construction) { this.removeConstructor(name, construction); }; /* harmony default export */ var core_Assembler = (Assembler); // CONCATENATED MODULE: ./js/components/DateInput.js var DateInput_ = FCore._; function DateInput() { core_ScalableComponent.call(this); } Object.defineProperties(DateInput.prototype, Object.getOwnPropertyDescriptors(core_ScalableComponent.prototype)); DateInput.prototype.constructor = DateInput; DateInput.prototype.tag = "DateInput"; DateInput.prototype.menuIcon = "span.mdi.mdi-calendar-edit"; DateInput.prototype.SUPPORT_STYLE_NAMES = ['top', 'left', 'right', 'top', 'bottom', 'width', 'height']; DateInput.prototype.SUPPORT_ATTRIBUTE_NAMES = ['value']; DateInput.prototype.SUPPORT_EVENT_NAMES = ['change']; DateInput.prototype.render = function () { return DateInput_('calendarinput'); }; DateInput.prototype.onCreate = function () { core_ScalableComponent.prototype.onCreate.call(this); this.attributes.value = null; this.style.width = 100; this.style.height = 30; }; DateInput.prototype.onCreated = function () { core_ScalableComponent.prototype.onCreated.call(this); var self = this; this.view.on('change', function (event) { self.attributes.value = this.value; self.emit('change', { type: 'change', value: this.value }, self); }); }; DateInput.prototype.setAttributeValue = function (value) { if (value instanceof Date) this.view.value = value;else if (typeof value == 'string' || typeof value == "number") { this.attributes.value = new Date(value); this.view.value = this.attributes.value; } else { this.attributes.value = null; this.view.value = this.attributes.value; } return this.view.value; }; DateInput.prototype.getAcceptsAttributeNames = function () { return core_ScalableComponent.prototype.getAcceptsAttributeNames.call(this).concat(['value']); }; DateInput.prototype.getAttributeValueDescriptor = function () { return { type: 'date', nullable: true, defaultValue: beginOfDay(new Date()) }; }; DateInput.prototype.getAcceptsEventNames = function () { return core_ScalableComponent.prototype.getAcceptsEventNames.call(this).concat(['change']); }; DateInput.prototype.measureMinSize = function () { return { width: 75, height: 16 }; }; /* harmony default export */ var components_DateInput = (DateInput); // EXTERNAL MODULE: ./css/hline.css var hline = __webpack_require__(213); // CONCATENATED MODULE: ./js/dom/HLine.js var HLine_$ = FCore.$; var HLine_ = FCore._; function HLine() {} HLine.render = function () { return HLine_({ "class": 'as-hline', child: { "class": 'as-hline-body', child: ['.as-hline-dot.left', '.as-hline-dot.right'] } }); }; FCore.install('hline', HLine); /* harmony default export */ var dom_HLine = (HLine); // EXTERNAL MODULE: ./css/vline.css var vline = __webpack_require__(215); // CONCATENATED MODULE: ./js/dom/VLine.js var VLine_$ = FCore.$; var VLine_ = FCore._; function VLine() {} VLine.render = function () { return VLine_({ "class": 'as-vline', child: { "class": 'as-vline-body', child: ['.as-vline-dot.top', '.as-vline-dot.bottom'] } }); }; FCore.install('vline', VLine); /* harmony default export */ var dom_VLine = (VLine); // CONCATENATED MODULE: ./js/R.js /* harmony default export */ var R = ({ LAYOUT_EDITOR: 'LAYOUT_EDITOR', COMPONENT_PICKER: 'COMPONENT_PICKER', UNDO_HISTORY: 'UNDO_HISTORY', FORM_EDITOR: 'FORM_EDITOR' }); // CONCATENATED MODULE: ./js/editor/LayoutEditor.js function LayoutEditor_typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { LayoutEditor_typeof = function _typeof(obj) { return typeof obj; }; } else { LayoutEditor_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return LayoutEditor_typeof(obj); } var LayoutEditor_ = FCore._; var LayoutEditor_$ = FCore.$; function LayoutEditor() { AppPattern_Context.call(this); core_Assembler.call(this); EventEmitter["a" /* default */].call(this); this.addConstructor('RelativeLayout', layouts_RelativeLayout); this.rootLayout = null; this.snapshots = []; this.snapshotsIndex = 0; this._changeCommited = true; this.mode = 'design'; this._publicDataChange = true; /** * @type {Array<import('../anchoreditors/AnchorEditor')>} */ this.anchorEditors = []; } Object.defineProperties(LayoutEditor.prototype, Object.getOwnPropertyDescriptors(AppPattern_Context.prototype)); Object.defineProperties(LayoutEditor.prototype, Object.getOwnPropertyDescriptors(core_Assembler.prototype)); Object.defineProperties(LayoutEditor.prototype, Object.getOwnPropertyDescriptors(EventEmitter["a" /* default */].prototype)); LayoutEditor.prototype.constructor = LayoutEditor; LayoutEditor.prototype.MODE_VALUE = ['design', 'interact']; LayoutEditor.prototype.MODE_CLASS_NAMES = { design: 'mode-design', interact: 'mode-interact' }; LayoutEditor.prototype.onAttached = function () { /** * @type {import('./UndoHistory').default} */ this.mUndoHistory = this.getContext(R.UNDO_HISTORY); }; LayoutEditor.prototype.activePublicDataChange = function (flag) { this._publicDataChange = !!flag; }; /** * call whenever component is edited, event will not be fired if disable publicDataChange flag */ LayoutEditor.prototype.notifyDataChange = function () { if (this._publicDataChange) this.emit('change', { type: 'change', target: this }, this); }; LayoutEditor.prototype.getView = function () { if (this.$view) return this.$view; var self = this; this.$view = LayoutEditor_({ "class": ['as-layout-editor'].concat([this.MODE_CLASS_NAMES[this.mode]]), child: [{ "class": 'as-layout-editor-mode-button-container', child: { tag: 'button', attr: { title: { 'interact': 'Interact Mode', 'design': 'Design Mode' }[this.mode] }, child: ['span.mdi.mdi-pencil-box-multiple-outline', 'span.mdi.mdi-play-outline'] } }, { "class": 'as-layout-editor-vrule-container', child: 'vruler' }, { "class": 'as-layout-editor-hrule-container', child: 'hruler' }, { "class": 'as-layout-editor-background-container' }, { "class": ["as-layout-editor-space-container", 'absol-bscroller'], child: { "class": 'as-layout-editor-space', child: [{ "class": 'as-layout-editor-layout-container', on: { contextmenu: this.ev_contextMenuLayout.bind(this) } }, { "class": 'as-layout-editor-forceground-container', child: '.as-layout-editor-forceground', extendEvent: 'contextmenu' }] } }] }); var self = this; this.$attachHook = LayoutEditor_('attachhook').on('error', function () { this.updateSize = self.updateSize.bind(self); Dom["a" /* default */].addToResizeSystem(this); self.updateSize(); }).addTo(this.$view); this.$hruler = LayoutEditor_$('hruler', this.$view); this.$hruler.measureElement(LayoutEditor_$('.as-relative-layout', this.$view)); this.$spaceCtn = LayoutEditor_$('.as-layout-editor-space-container', this.$view).on('scroll', this.ev_layoutCtnScroll.bind(this)); this.$vruler = LayoutEditor_$('vruler', this.$view); this.$vruler.measureElement(LayoutEditor_$('.as-relative-layout', this.$view)); this.$layoutCtn = LayoutEditor_$('.as-layout-editor-layout-container', this.$view); this.$forceground = LayoutEditor_$('.as-layout-editor-forceground', this.$view).on('click', this.ev_clickForceground.bind(this)); this.$editorSpaceCtn = LayoutEditor_$('.as-layout-editor-space-container', this.$view).on('click', function (ev) { if (ev.target == this) { self.setActiveComponent(); } }); this.$modeBtn = LayoutEditor_$('.as-layout-editor-mode-button-container > button', this.$view).on('click', this.ev_clickModeBtn.bind(this)); return this.$view; }; LayoutEditor.prototype.ev_clickModeBtn = function (button, event) { var next = { 'interact': 'design', 'design': 'interact' }; var buttonTitle = { 'interact': 'Interact Mode', 'design': 'Design Mode' }; this.setMode(next[this.mode]); this.$modeBtn.attr('title', buttonTitle[this.mode]); }; LayoutEditor.prototype.ev_layoutCtnScroll = function () { this.updateRuler(); }; LayoutEditor.prototype.ev_clickForceground = function (event) { if (event.target != this.$forceground) return; var hitComponent; function visit(node) { var bound = node.view.getBoundingClientRect(); if (bound.left <= event.clientX && bound.right >= event.clientX && bound.top <= event.clientY && bound.bottom >= event.clientY) { hitComponent = node; } if (node.children) node.children.forEach(visit); } visit(this.rootLayout); if (hitComponent) { if (event.shiftKey) this.toggleActiveComponent(hitComponent);else this.setActiveComponent(hitComponent); } }; LayoutEditor.prototype.ev_contextMenuLayout = function (event) { var self = this; event.showContextMenu({ items: [{ text: 'Design Mode', icon: 'span.mdi.mdi-pencil-box-multiple-outline', cmd: 'design' }] }, function (menuEvent) { var cmd = menuEvent.menuItem.cmd; switch (cmd) { case 'design': self.setMode('design'); break; } }); }; LayoutEditor.prototype.updateRuler = function () { this.$vruler.update(); this.$hruler.update(); }; LayoutEditor.prototype.updateAnchor = function () { for (var i = 0; i < this.anchorEditors.length; ++i) { this.anchorEditors[i].update(); } }; LayoutEditor.prototype.updateAnchorPosition = function () { for (var i = 0; i < this.anchorEditors.length; ++i) { this.anchorEditors[i].updatePosition(); } }; LayoutEditor.prototype.updateSize = function () {//todo }; LayoutEditor.prototype._newAnchorEditor = function (component) { var self = this; var AnchorEditor = this.findNearestLayoutParent(component.parent || this.rootLayout).getAnchorEditorConstructor(); //craete new, repeat event to other active anchor editor var editor = new AnchorEditor(this).on('click', function (event) { if (this.component) if (self.anchorEditors.length > 1) self.toggleActiveComponent(this.component);else { self.setActiveComponent(this.component); } }) //todo: implement in AnchorEditor .on('beginmove', function (event) { var originEvent = event.originEvent; var other; for (var i = 0; i < self.anchorEditors.length; ++i) { other = self.anchorEditors[i]; if (other != this) { other.ev_beginMove(false, originEvent); } } }).on('beginmove', function (event) { var originEvent = event.originEvent; var other; for (var i = 0; i < self.anchorEditors.length; ++i) { other = self.anchorEditors[i]; if (other != this) { other.ev_beginMove(false, originEvent); } } }).on('moving', function (event) { var originEvent = event.originEvent; var other; for (var i = 0; i < self.anchorEditors.length; ++i) { other = self.anchorEditors[i]; if (other != this) { other.ev_moving(false, originEvent); } } self.notifyDataChange(); }).on('endmove', function (event) { var originEvent = event.originEvent; var other; for (var i = 0; i < self.anchorEditors.length; ++i) { other = self.anchorEditors[i]; if (other != this) { other.ev_endMove(false, originEvent); } } self.commitHistory('move', 'Move/Resize component'); }).on('focus', function (event) { console.log('focus'); self.emit('focuscomponent', { type: 'focuscomponent', component: this.component, originEvent: event, target: self }, self); }).on('change', function (event) { self.notifyDataChange(); }); editor.edit(component); return editor; }; /** * @argument {Array<import('../core/BaseComponent').default>} */ LayoutEditor.prototype.setActiveComponent = function () { //todo while (this.anchorEditors.length > 0) { var editor = this.anchorEditors.pop(); editor.edit(undefined); } while (this.anchorEditors.length < arguments.length) { var editor = this._newAnchorEditor(arguments[this.anchorEditors.length]); this.anchorEditors.push(editor); editor.focus(); } }; /** * @argument {Array<import('../core/BaseComponent').default>} */ LayoutEditor.prototype.toggleActiveComponent = function () { //todo var editor; for (var i = 0; i < arguments.length; ++i) { editor = this.findAnchorEditorByComponent(arguments[i]); if (editor) { editor.edit(undefined); } else { editor = this._newAnchorEditor(arguments[i]); this.anchorEditors.push(editor); editor.focus(); } } this.anchorEditors = this.anchorEditors.filter(function (e) { return !!e.component; }); if (this.anchorEditors.length > 0) { this.anchorEditors[this.anchorEditors.length - 1].focus(); } }; LayoutEditor.prototype.findAnchorEditorByComponent = function (comp) { for (var i = 0; i < this.anchorEditors.length; ++i) { if (this.anchorEditors[i].component == comp) return this.anchorEditors[i]; } return undefined; }; LayoutEditor.prototype.getActivatedComponents = function () { return this.anchorEditors.map(function (e) { return e.component; }).filter(function (e) { return !!e; }); }; LayoutEditor.prototype.applyData = function (data) { var self = this; function visit(node) { var constructor = self.constructors[node.tag]; if (!constructor) throw new Error(node.tag + ' constructor not found!'); var comp = new constructor(); var style = node.style; if (LayoutEditor_typeof(style) == 'object') for (var styleName in style) { comp.setStyle(styleName, style[styleName]); } var attributes = node.attributes; if (LayoutEditor_typeof(attributes) == 'object') for (var attributeName in attributes) { comp.setAttribute(attributeName, attributes[attributeName]); } var events = node.events; if (LayoutEditor_typeof(events) == 'object') for (var eventName in events) { comp.setEvent(eventName, events[eventName]); } if (node.children && node.children.length > 0) { node.children.forEach(function (cNode) { var childComp = visit(cNode); comp.addChild(childComp); childComp.reMeasure(); }); } return comp; } if (this.rootLayout) { this.rootLayout.onDetached(this); this.rootLayout.view.remove(); } this.rootLayout = visit(data); this.$layoutCtn.addChild(this.rootLayout.view); this.rootLayout.onAttached(this); this.$vruler.measureElement(this.rootLayout.view); this.$hruler.measureElement(this.rootLayout.view); this.emit('change', { type: 'change', target: this, data: data }, this); }; LayoutEditor.prototype.setData = function (data) { this.applyData(data); this.commitHistory('set-data', "Set data"); }; LayoutEditor.prototype.editLayout = function (component) {}; LayoutEditor.prototype.autoExpandRootLayout = function () { if (this.rootLayout) { var minSize = this.rootLayout.measureMinSize(); var isChange = false; if (minSize.width > this.rootLayout.style.width) { this.rootLayout.setStyle('width', minSize.width); isChange = true; } if (minSize.height > this.rootLayout.style.height) { this.rootLayout.setStyle('height', minSize.height); isChange = true; } if (isChange) { this.emit('layoutexpand', { type: 'layoutexpand', target: this, layout: this.rootLayout }, this); this.notifyDataChange(); } } }; LayoutEditor.prototype.getData = function () { if (this.rootLayout) return this.rootLayout.getData(); return null; }; LayoutEditor.prototype.setMode = function (mode) { if (this.MODE_VALUE.indexOf(mode) < 0 || this.mode == mode) return; if (this.$view) { this.$view.removeClass(this.MODE_CLASS_NAMES[this.mode]).addClass(this.MODE_CLASS_NAMES[mode]); } var lastMode = this.mode; this.mode = mode; this.emit('changemode', { type: 'changemode', mode: mode, lastMode: lastMode }, this); }; LayoutEditor.prototype.findNearestLayoutParent = function (comp) { while (comp) { if (comp.addChildByPosition) { break; } comp = comp.parent; } return comp; }; /** * @returns {import('../core/BaseComponent') } */ LayoutEditor.prototype.addNewComponent = function (tag, posX, posY) { var layout; if (this.anchorEditors.length > 0) { layout = this.findNearestLayoutParent(this.anchorEditors[this.anchorEditors.length - 1].component); } layout = layout || this.rootLayout; var rootBound = this.rootLayout.view.getBoundingClientRect(); var layoutBound = layout.view.getBoundingClientRect(); var newComponent = this.build({ tag: tag }); layout.addChildByPosition(newComponent, posX - (layoutBound.left - rootBound.left), posY - (layoutBound.top - rootBound.top)); newComponent.reMeasure(); this.emit('addcomponent', { type: 'addcomponent', component: newComponent, target: this }, this); this.setActiveComponent(newComponent); this.notifyDataChange(); setTimeout(this.updateAnchorPosition.bind(this), 1); this.commitHistory('add', "Add " + newComponent.getAttribute('name') + '[' + tag + ']'); }; LayoutEditor.prototype.clearRootLayout = function () { this._activatedComponent = undefined; this.rootLayout.clearChild(); this.updateAnchor(); this.emit('clearallcomponent', { target: this }, this); this.notifyDataChange(); this.commitHistory('remove', 'Remove all components'); }; LayoutEditor.prototype.removeComponent = function () { var removedComponents = []; var comp; for (var i = 0; i < arguments.length; ++i) { comp = arguments[i]; comp.remove(); removedComponents.push(comp); var anchorEditor = this.findAnchorEditorByComponent(comp); if (anchorEditor) { this.toggleActiveComponent(comp); } this.emit('removecomponent', { type: 'removecomponent', target: this, component: comp }, this); } this.notifyDataChange(); if (removedComponents.length > 0) { this.commitHistory('remove', 'Remove ' + removedComponents.map(function (c) { return c.getAttribute('name'); }).join(', ')); } }; LayoutEditor.prototype.moveUpComponent = function (comp) { var parent = comp.parent; if (!parent) return; var prevChild = parent.findChildBefore(comp); if (!prevChild) return; comp.remove(); parent.addChildBefore(comp, prevChild); this.emit('moveupcomponent', { type: 'moveupcomponent', target: this, component: comp }, this); this.notifyDataChange(); this.commitHistory('move-order', 'Move ' + comp.getAttribute('name') + ' up'); }; LayoutEditor.prototype.moveDownComponent = function (comp) { var parent = comp.parent; if (!parent) return; var nextChild = parent.findChildAfter(comp); if (!nextChild) return; nextChild.remove(); parent.addChildBefore(nextChild, comp); this.emit('movedowncomponent', { type: 'movedowncomponent', target: this, component: comp }, this); this.notifyDataChange(); this.commitHistory('move-order', 'Move ' + comp.getAttribute('name') + ' down'); }; LayoutEditor.prototype.moveToBottomComponent = function (comp) { var parent = comp.parent; if (!parent) return; var lastChild = parent.children[parent.children - 1]; if (lastChild == comp) return; comp.remove(); parent.addChild(comp); this.emit('movetobottomcomponent', { type: 'movetobottomcomponent', target: this, component: comp }, this); this.notifyDataChange(); this.commitHistory('move-order', 'Move ' + comp.getAttribute('name') + ' to bottom'); }; LayoutEditor.prototype.moveToTopComponent = function (comp) { var parent = comp.parent; if (!parent) return; var firstChild = parent.children[0]; if (firstChild == comp) return; comp.remove(); parent.addChildBefore(comp, firstChild); this.emit('movetotopcomponent', { type: 'movetotopcomponent', target: this, component: comp }, this); this.notifyDataChange(); this.commitHistory('move-order', 'Move ' + comp.getAttribute('name') + ' to top'); }; LayoutEditor.prototype.commitHistory = function (type, description) { if (!this.mUndoHistory) return; this.mUndoHistory.commit(type, this.getData(), description, new Date()); }; /* harmony default export */ var editor_LayoutEditor = (LayoutEditor); // EXTERNAL MODULE: ./css/formeditor.css var formeditor = __webpack_require__(217); // CONCATENATED MODULE: ./js/components/NumberInput.js var components_NumberInput_ = FCore._; function NumberInput_NumberInput() { core_ScalableComponent.call(this); } Object.defineProperties(NumberInput_NumberInput.prototype, Object.getOwnPropertyDescriptors(core_ScalableComponent.prototype)); NumberInput_NumberInput.prototype.constructor = NumberInput_NumberInput; NumberInput_NumberInput.prototype.tag = "NumberInput"; NumberInput_NumberInput.prototype.menuIcon = 'span.mdi.mdi-numeric-2-box-outline'; NumberInput_NumberInput.prototype.SUPPORT_ATTRIBUTE_NAMES = ['value']; NumberInput_NumberInput.prototype.SUPPORT_EVENT_NAMES = ['change']; NumberInput_NumberInput.prototype.onCreate = function () { core_ScalableComponent.prototype.onCreate.call(this); }; NumberInput_NumberInput.prototype.onCreated = function () { core_ScalableComponent.prototype.onCreated.call(this); var self = this; this.view.on('change', function (event) { self.attributes.value = event.value; if (self.events.change) console.log("TODO: exec", self.events.change); }); this.view._debug = true; //load default value from view this.attributes.min = this.view.min; this.attributes.max = this.view.max; this.attributes.value = this.view.value; this.attributes.decimalSeparator = this.view.decimalSeparator; this.attributes.thousandsSeparator = this.view.thousandsSeparator; this.attributes.floatFixed = this.view.floatFixed; }; NumberInput_NumberInput.prototype.render = function () { return components_NumberInput_('numberinput'); }; NumberInput_NumberInput.prototype.setAttributeValue = function (value) { this.view.value = value; this.attributes.min = this.view.min == -Infinity ? null : this.view.min; this.attributes.max = this.view.max == Infinity ? null : this.view.max; return this.view.value; }; NumberInput_NumberInput.prototype.setAttributeDecimalSerapator = function (value) { this.view.decimalSerapator = value; return this.view.decimalSerapator; }; NumberInput_NumberInput.prototype.setAttributeFloatFixed = function (value) { this.view.floatFixed = value; return this.view.floatFixed; }; NumberInput_NumberInput.prototype.setAttributeMax = function (value) { if (value === null) this.view.max = Infinity;else this.view.max = value; this.attributes.min = this.view.min == -Infinity ? null : this.view.min; this.attributes.value = this.view.value; return value; }; NumberInput_NumberInput.prototype.setAttributeMin = function (value) { if (value === null) this.view.min = -Infinity;else this.view.min = value; this.attributes.max = this.view.max == Infinity ? null : this.view.max; this.attributes.value = this.view.value; return value; }; NumberInput_NumberInput.prototype.getAcceptsAttributeNames = function () { return core_ScalableComponent.prototype.getAcceptsAttributeNames.call(this).concat(["value", "floatFixed", 'min', 'max']); }; NumberInput_NumberInput.prototype.getAttributeValueDescriptor = function () { return { type: "number", max: this.attributes.max, min: this.attributes.min }; }; NumberInput_NumberInput.prototype.getAttributeFloatFixedDescriptor = function () { return { type: "number", max: 100, min: -1 }; }; NumberInput_NumberInput.prototype.getAttributeMinDescriptor = function () { return { type: "number", nullable: true, defaultValue: -9999 }; }; NumberInput_NumberInput.prototype.getAttributeMaxDescriptor = function () { return { type: "number", nullable: true, defaultValue: 9999 }; }; NumberInput_NumberInput.prototype.getAcceptsEventNames = function () { return core_ScalableComponent.prototype.getAcceptsEventNames.call(this).concat(['change']); }; /* harmony default export */ var components_NumberInput = (NumberInput_NumberInput); // CONCATENATED MODULE: ./js/core/ContentScalelessComponent.js var ContentScalelessComponent_ = FCore._; var ContentScalelessComponent_$ = FCore.$; function ContentScalelessComponent() { core_ScalableComponent.call(this); } Object.defineProperties(ContentScalelessComponent.prototype, Object.getOwnPropertyDescriptors(core_ScalableComponent.prototype)); ContentScalelessComponent.prototype.constructor = ContentScalelessComponent; ContentScalelessComponent.prototype.tag = "ContentScalelessComponent"; ContentScalelessComponent.prototype.onCreated = function () { this.$cell = ContentScalelessComponent_$('.as-component-content-scaleless-cell', this.view); this.$content = this.$cell.childNodes[0]; core_ScalableComponent.prototype.onCreated.call(this); }; ContentScalelessComponent.prototype.render = function () { return ContentScalelessComponent_({ "class": 'as-component-content-scaleless', child: { "class": 'as-component-content-scaleless-cell', child: this.renderContent() } }); }; ContentScalelessComponent.prototype.renderContent = function () { throw new Error('Not Implement!'); }; ContentScalelessComponent.prototype.setStyleTextHAlign = function (value) { this.view.addStyle('text-align', value); return value; }; ContentScalelessComponent.prototype.setStyleTextVAlign = function (value) { if (value == 'center') value = 'middle'; this.$cell.addStyle('vertical-align', value); return value; }; ContentScalelessComponent.prototype.measureMinSize = function () { var bound = this.$content.getBoundingClientRect(); return { width: bound.width, height: bound.height }; }; /* harmony default export */ var core_ContentScalelessComponent = (ContentScalelessComponent); // CONCATENATED MODULE: ./js/components/Label.js var Label_ = FCore._; var Label_$ = FCore.$; function Label() { core_ContentScalelessComponent.call(this); } Object.defineProperties(Label.prototype, Object.getOwnPropertyDescriptors(core_ContentScalelessComponent.prototype)); Label.prototype.constructor = Label; Label.prototype.tag = "Label"; Label.prototype.menuIcon = 'span.mdi.mdi-label-outline'; Label.prototype.SUPPORT_ATTRIBUTE_NAMES = ['value']; Label.prototype.SUPPORT_EVENT_NAMES = ['change']; Label.prototype.onCreate = function () { core_ContentScalelessComponent.prototype.onCreate.call(this); this.attributes.text = this.attributes.name; }; Label.prototype.renderContent = function () { return Label_('label'); }; Label.prototype.setAttributeText = function (value) { this.$content.clearChild().addChild(Label_({ text: value })); return value; }; Label.prototype.getAcceptsAttributeNames = function () { return core_ContentScalelessComponent.prototype.getAcceptsAttributeNames.call(this).concat(["text"]); }; Label.prototype.getAttributeTextDescriptor = function () { return { type: "text" }; }; /* harmony default export */ var components_Label = (Label); // CONCATENATED MODULE: ./js/components/TextArea.js var TextArea_ = FCore._; function TextArea() { components_TextInput.call(this); } Object.defineProperties(TextArea.prototype, Object.getOwnPropertyDescriptors(components_TextInput.prototype)); TextArea.prototype.constructor = TextArea; TextArea.prototype.tag = "TextArea"; TextArea.prototype.menuIcon = "span.mdi.mdi-textarea"; TextArea.prototype.render = function () { return TextArea_('textarea.absol-bscroller'); }; TextArea.prototype.getAttributeValueDescriptor = function () { return { type: "text", "long": true }; }; /* harmony default export */ var components_TextArea = (TextArea); // CONCATENATED MODULE: ./js/components/Checkbox.js var Checkbox_ = FCore._; var Checkbox_$ = FCore.$; function Checkbox_CheckBox() { core_ContentScalelessComponent.call(this); } Object.defineProperties(Checkbox_CheckBox.prototype, Object.getOwnPropertyDescriptors(core_ContentScalelessComponent.prototype)); Checkbox_CheckBox.prototype.constructor = Checkbox_CheckBox; Checkbox_CheckBox.prototype.tag = "CheckBox"; Checkbox_CheckBox.prototype.menuIcon = "span.mdi.mdi-check-box-outline"; Checkbox_CheckBox.prototype.onCreate = function () { core_ContentScalelessComponent.prototype.onCreate.call(this); this.style.width = 18; this.style.height = 18; this.style.vAlign = 'top'; this.style.hAlign = 'left'; this.style.textHAlign = 'center'; this.style.textVAlign = 'center'; this.attributes.checked = false; }; Checkbox_CheckBox.prototype.renderContent = function () { return Checkbox_('checkboxbutton'); }; Checkbox_CheckBox.prototype.onCreated = function () { core_ContentScalelessComponent.prototype.onCreated.call(this); var self = this; this.view.on('change', function () { self.attributes.checked = this.checked; if (self.events.change) console.log("TODO: exec", self.events.change); }); }; Checkbox_CheckBox.prototype.setAttributeChecked = function (value) { this.$content.checked = !!value; return this.$content.checked; }; Checkbox_CheckBox.prototype.setStyleWidth = function (value) { value = value >= 18 ? value : 18; return core_ContentScalelessComponent.prototype.setStyleWidth.call(this, value); }; Checkbox_CheckBox.prototype.setStyleHeight = function (value) { value = value >= 18 ? value : 18; return core_ContentScalelessComponent.prototype.setStyleHeight.call(this, value); }; Checkbox_CheckBox.prototype.getAttributeCheckedDescriptor = function () { return { type: "bool" }; }; Checkbox_CheckBox.prototype.getAcceptsAttributeNames = function () { return core_ContentScalelessComponent.prototype.getAcceptsAttributeNames.call(this).concat(["checked"]); }; Checkbox_CheckBox.prototype.getAcceptsEventNames = function () { return core_ContentScalelessComponent.prototype.getAcceptsEventNames.call(this).concat(['change']); }; Checkbox_CheckBox.prototype.measureMinSize = function () { return { width: 18, height: 18 }; }; /* harmony default export */ var Checkbox = (Checkbox_CheckBox); // CONCATENATED MODULE: ./js/components/Radio.js var components_Radio_ = FCore._; var components_Radio_$ = FCore.$; function components_Radio_Radio() { core_ContentScalelessComponent.call(this); } Object.defineProperties(components_Radio_Radio.prototype, Object.getOwnPropertyDescriptors(core_ContentScalelessComponent.prototype)); components_Radio_Radio.prototype.constructor = components_Radio_Radio; components_Radio_Radio.prototype.tag = "Radio"; components_Radio_Radio.prototype.menuIcon = "span.mdi.mdi-radiobox-marked"; components_Radio_Radio.prototype.onCreate = function () { core_ContentScalelessComponent.prototype.onCreate.call(this); this.style.width = 18; this.style.height = 18; this.style.vAlign = 'top'; this.style.hAlign = 'left'; this.style.textHAlign = 'center'; this.style.textVAlign = 'center'; this.attributes.checked = false; this.attributes.value = ''; }; components_Radio_Radio.prototype.onCreated = function () { core_ContentScalelessComponent.prototype.onCreated.call(this); var self = this; this.$content.on('change', function () { self.attributes.checked = this.checked; if (self.events.change) console.log("TODO: exec", self.events.change); }); }; components_Radio_Radio.prototype.renderContent = function () { return components_Radio_('radiobutton'); }; components_Radio_Radio.prototype.setAttributeChecked = function (value) { this.$content.checked = !!value; return this.$content.checked; }; components_Radio_Radio.prototype.setStyleWidth = function (value) { value = value >= 18 ? value : 18; return core_ContentScalelessComponent.prototype.setStyleWidth.call(this, value); }; components_Radio_Radio.prototype.setStyleHeight = function (value) { value = value >= 18 ? value : 18; return core_ContentScalelessComponent.prototype.setStyleHeight.call(this, value); }; components_Radio_Radio.prototype.setAttributeGroupName = function (value) { this.$content.attr('name', value); return value; }; components_Radio_Radio.prototype.getAttributeGroupNameDescriptor = function () { return { type: "text", regex: /[a-zA-Z0-9\_\-]+/ }; }; components_Radio_Radio.prototype.setAttributValue = function (value) { this.$content.attr('value', value + ''); return value; }; components_Radio_Radio.prototype.getAttributeValueDescriptor = function () { return { type: "text" }; }; components_Radio_Radio.prototype.getAttributeCheckedDescriptor = function () { return { type: "bool" }; }; components_Radio_Radio.prototype.getAcceptsAttributeNames = function () { return core_ContentScalelessComponent.prototype.getAcceptsAttributeNames.call(this).concat(["groupName", "checked", 'value']); }; components_Radio_Radio.prototype.getAcceptsEventNames = function () { return core_ContentScalelessComponent.prototype.getAcceptsEventNames.call(this).concat(['change']); }; components_Radio_Radio.prototype.measureMinSize = function () { return { width: 18, height: 18 }; }; /* harmony default export */ var components_Radio = (components_Radio_Radio); // CONCATENATED MODULE: ./js/components/ComboBox.js var ComboBox_ = FCore._; function ComboBox() { core_ScalableComponent.call(this); } Object.defineProperties(ComboBox.prototype, Object.getOwnPropertyDescriptors(core_ScalableComponent.prototype)); ComboBox.prototype.constructor = ComboBox; ComboBox.prototype.tag = "ComboBox"; ComboBox.prototype.menuIcon = 'span.mdi.mdi-arrow-down-drop-circle-outline'; ComboBox.prototype.onCreate = function () { core_ScalableComponent.prototype.onCreate.call(this); this.attributes.list = [{ text: '0', value: '0' }, { text: '1', value: '1' }, { text: '2', value: '2' }, { text: '3', value: '3' }]; this.attributes.value = '0'; Object.defineProperty(this.attributes, 'text', { get: function get() { if (this.list) { for (var i = 0; i < this.list.length; ++i) { if (this.list[i].value == this.value) return this.list[i].text; } return ''; } else { return ""; } }, set: function set(value) {//do nothing } }); }; ComboBox.prototype.onCreated = function () { core_ScalableComponent.prototype.onCreated.call(this); var self = this; this.view.on('minwidthchange', function (event) { if (!(self.style.width > event.value)) { self.setStyle('width', event.value); } }).on('change', function () { self.attributes.value = this.value; self.emit("change", { type: 'change', value: this.value }, self); }); this.attributes.value = this.view.value; }; ComboBox.prototype.render = function () { return ComboBox_('selectmenu'); }; ComboBox.prototype.setAttributeList = function (value) { this.view.items = value; return this.view.items; }; ComboBox.prototype.setAttributeValue = function (value) { this.view.value = value; return this.view.value; }; ComboBox.prototype.setAttributeText = function (value) { return value; }; ComboBox.prototype.getAcceptsAttributeNames = function () { return core_ScalableComponent.prototype.getAcceptsAttributeNames.call(this).concat(["list", 'value', 'text']); }; ComboBox.prototype.getAttributeListDescriptor = function () { return { type: 'list' }; }; ComboBox.prototype.getAttributeValueDescriptor = function () { return { type: 'text' }; }; ComboBox.prototype.getAttributeTextDescriptor = function () { return { type: 'const', value: this.getAttribute('text') }; }; ComboBox.prototype.getAcceptsEventNames = function () { return core_ScalableComponent.prototype.getAcceptsEventNames.call(this).concat(['change']); }; ComboBox.prototype.measureMinSize = function () { var minWidthStyle = parseFloat(this.view.getComputedStyleValue('min-width').replace('px')); return { width: Math.max(minWidthStyle, 24), height: 25 }; }; /* harmony default export */ var components_ComboBox = (ComboBox); // CONCATENATED MODULE: ./js/components/SelectBox.js var components_SelectBox_ = FCore._; function SelectBox_SelectBox() { core_ScalableComponent.call(this); } Object.defineProperties(SelectBox_SelectBox.prototype, Object.getOwnPropertyDescriptors(core_ScalableComponent.prototype)); SelectBox_SelectBox.prototype.constructor = SelectBox_SelectBox; SelectBox_SelectBox.prototype.tag = "SelectBox"; SelectBox_SelectBox.prototype.menuIcon = 'span.mdi.mdi-file-table-box-outline'; SelectBox_SelectBox.prototype.onCreated = function () { core_ScalableComponent.prototype.onCreated.call(this); var self = this; this.view.on('minwidthchange', function (event) { if (!(self.style.width > event.value)) { self.setStyle('width', event.value); } }); this.view.on('change', function (event) { self.attributes.values = event.values; self.emit('change', event.values, self); }); }; SelectBox_SelectBox.prototype.render = function () { return components_SelectBox_('selectbox'); }; SelectBox_SelectBox.prototype.setAttributeList = function (value) { this.view.items = value; return this.view.items; }; SelectBox_SelectBox.prototype.setAttributeValue = function (value) { this.view.values = value; }; SelectBox_SelectBox.prototype.getAcceptsEventNames = function () { return core_ScalableComponent.prototype.getAcceptsEventNames.call(this).concat(['change']); }; /* harmony default export */ var components_SelectBox = (SelectBox_SelectBox); // EXTERNAL MODULE: ./css/componentpicker.css var componentpicker = __webpack_require__(219); // CONCATENATED MODULE: ./js/components/Image.js var Image_ = FCore._; function Image() { core_ScalableComponent.call(this); this.naturalWidth = 0; this.naturalHeight = 0; this.loadedSync = Promise.resolve([0, 0]); } Object.defineProperties(Image.prototype, Object.getOwnPropertyDescriptors(core_ScalableComponent.prototype)); Image.prototype.constructor = Image; Image.prototype.tag = "Image"; Image.prototype.menuIcon = "span.mdi.mdi-image-outline"; Image.prototype.onCreate = function () { core_ScalableComponent.prototype.onCreate.call(this); this.attributes.src = ''; }; Image.prototype.render = function () { return Image_('img'); }; Image.prototype.setAttributeSrc = function (value) { var self = this; this.view.src = value; this.loadedSync = Dom["a" /* default */].waitImageLoaded(this.view).then(function () { self.naturalWidth = self.view.naturalWidth || 0; self.naturalHeight = self.view.naturalHeight || 0; return [self.naturalWidth, self.naturalHeight]; }); return value; }; Image.prototype.getAcceptsAttributeNames = function () { return core_ScalableComponent.prototype.getAcceptsAttributeNames.call(this).concat(['src', 'naturalSize']); }; Image.prototype.getAttributeSrcDescriptor = function () { return { type: "text", "long": true }; }; Image.prototype.getAttributeNaturalSizeDescriptor = function () { return { type: 'const', value: this.loadedSync.then(function (wh) { return wh.join(' x '); }) }; }; // Image.prototype.getAttributeRealSizeDescriptor = function () { // return { // type: 'const', // value: this.naturalWidth + ' x ' + this.naturalHeight // } // }; /* harmony default export */ var components_Image = (Image); // CONCATENATED MODULE: ./js/components/Button.js var Button_ = FCore._; function Button() { core_ScalableComponent.call(this); } Object.defineProperties(Button.prototype, Object.getOwnPropertyDescriptors(core_ScalableComponent.prototype)); Button.prototype.constructor = Button; Button.prototype.tag = "Button"; Button.prototype.menuIcon = "span.mdi.mdi-alpha-b-box"; Button.prototype.onCreate = function () { core_ScalableComponent.prototype.onCreate.call(this); this.attributes.text = this.attributes.name; }; Button.prototype.onCreated = function () { core_ScalableComponent.prototype.onCreated.call(this); var self = this; this.view.on('click', function (event) { if (self.events.click) { console.log('TODO: exec', self.events.click); } }); }; Button.prototype.render = function () { return Button_('button'); }; Button.prototype.setAttributeText = function (value) { this.view.clearChild().addChild(Button_({ text: value })); return value; }; Button.prototype.getAcceptsAttributeNames = function () { return core_ScalableComponent.prototype.getAcceptsAttributeNames.call(this).concat(['text']); }; Button.prototype.getAttributeTextDescriptor = function () { return { type: "text" }; }; /* harmony default export */ var components_Button = (Button); // CONCATENATED MODULE: ./js/components/Table.js var Table_ = FCore._; var Table_$ = FCore.$; function Table() { core_ScalableComponent.call(this); } Object.defineProperties(Table.prototype, Object.getOwnPropertyDescriptors(core_ScalableComponent.prototype)); Table.prototype.constructor = Table; Table.prototype.tag = "Table"; Table.prototype.menuIcon = "span.mdi.mdi-table-large"; Table.prototype.onCreate = function () { core_ScalableComponent.prototype.onCreate.call(this); this.attributes.header = this.attributes.header || [randomPhrase(10), randomPhrase(10), randomPhrase(10)]; this.attributes.body = this.attributes.body || [[randomPhrase(10), randomPhrase(10), randomPhrase(10)], [randomPhrase(10), randomPhrase(10), randomPhrase(10)], [randomPhrase(10), randomPhrase(10), randomPhrase(10)]]; this.style.height = 100; this.style.width = 300; }; // Table.prototype.onCreated = function () { // ScalableComponent.prototype.onCreate.call(this); // } Table.prototype.render = function () { this.$table = Table_({ tag: 'table', "class": 'as-inner-table', child: ['thead', 'tbody'] }); return Table_({ tag: 'tablescroller', child: this.$table, props: { fixedCol: 0 } }); }; Table.prototype.setStyle = function () { var res = core_ScalableComponent.prototype.setStyle.apply(this, arguments); return res; }; Table.prototype.getAcceptsAttributeNames = function () { return core_ScalableComponent.prototype.getAcceptsAttributeNames.call(this).concat(['header', 'body', 'fixedCol']); }; Table.prototype.getAttributeHeaderDescriptor = function () { return { type: "array" }; }; Table.prototype.getAttributeBodyDescriptor = function () { return { type: "array2d" }; }; Table.prototype.getAttributeFixedColDescriptor = function () { return { type: "number", min: 0, max: Infinity }; }; Table.prototype.setAttributeHeader = function (header) { if (!(header.length > 0)) { header = ["Data Error"]; } var headerElt = Table_$('thead', this.$table).clearChild(); headerElt.clearChild(); var rowElt = Table_('tr'); var cellElt; for (var i = 0; i < header.length; ++i) { cellElt = Table_({ tag: 'th', child: { text: header[i] + '' } }); rowElt.addChild(cellElt); } headerElt.addChild(rowElt); this.view._updateContent(); return header; }; Table.prototype.setAttributeBody = function (body) { if (!(body.length > 0)) { body = [["Data Error"]]; } var bodyElt = Table_$('tbody', this.$table).clearChild(); var rowElt; // var cellElt; var row, cell; for (var i = 0; i < body.length; ++i) { row = body[i]; rowElt = Table_('tr').addTo(bodyElt); for (var j = 0; j < row.length; ++j) { cell = row[j]; Table_({ tag: 'td', child: { text: cell + '' } }).addTo(rowElt); } } this.view._updateContent(); return body; }; Table.prototype.setAttributeFixedCol = function (value) { if (value >= 0) {} else { value = 0; } this.view.fixedCol = value; return value; }; /* harmony default export */ var components_Table = (Table); // CONCATENATED MODULE: ./js/anchors/LinearAnchor.js var LinearAnchor_ = FCore._; var LinearAnchor_$ = FCore.$; /** * AnchorBox only has on child node */ function LinearAnchor() { core_FViewable.call(this); this.style.left = 0; this.style.right = 0; this.style.top = 0; this.style.bottom = 0; this.childNode = null; //for quick binding render this.viewBinding = {}; this.onCreate(); this.view = this.render(); this.onCreated(); } Object.defineProperties(LinearAnchor.prototype, Object.getOwnPropertyDescriptors(core_FViewable.prototype)); LinearAnchor.prototype.construtor = LinearAnchor; LinearAnchor.prototype.TOP_CLASS_NAME = 'as-linear-anchor-box'; LinearAnchor.prototype.onCreate = function () { /* NOOP */ }; LinearAnchor.prototype.onCreated = function () { for (var key in this.viewBinding) { this[key] = LinearAnchor_$(this.viewBinding[key], this.view); } }; LinearAnchor.prototype.getAcceptsStyleNames = function () { return ['left', 'right', 'top', 'bottom']; }; LinearAnchor.prototype.getStyleLeftDescriptor = function () { return { type: 'number', min: -Infinity, max: Infinity, disabled: this.style.hAlign == 'center' || this.style.hAlign == 'right', livePreview: true }; }; LinearAnchor.prototype.getStyleRightDescriptor = function () { return { type: 'number', min: -Infinity, max: Infinity, disabled: this.style.hAlign == 'center' || this.style.hAlign == 'left', livePreview: true }; }; LinearAnchor.prototype.getStyleTopDescriptor = function () { return { type: 'number', min: -Infinity, max: Infinity, disabled: this.style.vAlign == 'center' || this.style.vAlign == 'bottom', livePreview: true }; }; LinearAnchor.prototype.getStyleBottomDescriptor = function () { return { type: 'number', min: -Infinity, max: Infinity, disabled: this.style.vAlign == 'center' || this.style.vAlign == 'top', livePreview: true }; }; LinearAnchor.prototype.setStyleLeft = function (value) { this.view.addStyle('margin-left', value + 'px'); return value; }; LinearAnchor.prototype.setStyleRight = function (value) { this.view.addStyle('margin-right', value + 'px'); return value; }; LinearAnchor.prototype.setStyleTop = function (value) { this.view.addStyle('margin-top', value + 'px'); return value; }; LinearAnchor.prototype.setStyleBottom = function (value) { this.view.addStyle('margin-bottom', value + 'px'); return value; }; LinearAnchor.prototype.render = function () { var layout = { "class": [this.TOP_CLASS_NAME] }; return LinearAnchor_(layout); }; /** * @param {BaseComponent} child */ LinearAnchor.prototype.attachChild = function (child) { if (this.childNode) { this.childNode.view.remove(); this.childNode = null; this.childNode.anchor = null; } if (child.anchor) throw new Error("Detach anchorBox first"); this.childNode = child; child.anchor = this; this.view.addChild(child.view); child.onAnchorAttached(); }; LinearAnchor.prototype.detachChild = function () { if (this.childNode) { this.childNode.view.remove(); this.childNode.onAnchorDetached(); this.childNode.anchor = null; this.childNode = null; } else throw new Error("Nothing to detach"); }; /* harmony default export */ var anchors_LinearAnchor = (LinearAnchor); // CONCATENATED MODULE: ./js/anchoreditors/LinearAnchorEditor.js function LinearAnchorEditor_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } var LinearAnchorEditor_ = FCore._; var LinearAnchorEditor_$ = FCore.$; /** * * @param {import('../editor/LayoutEditor').default} layoutEditor */ function LinearAnchorEditor(layoutEditor) { EventEmitter["a" /* default */].call(this); var self = this; this.layoutEditor = layoutEditor; this.component = null; this.$modal = LinearAnchorEditor_({ style: { zIndex: '10000000', left: '1px', right: '1px', top: '1px', bottom: '1px', position: 'fixed' } }); this.$marginBox = LinearAnchorEditor_('resizebox').on('click', this.focusMarginBox.bind(this)).on('beginmove', this.ev_beginMove.bind(this, true)).on('moving', this.ev_movingMargin.bind(this, true)).on('endmove', this.ev_endMove.bind(this, true)); this.$resizeBox = LinearAnchorEditor_('resizebox').on('mousedown', this.focus.bind(this)).on('beginmove', this.ev_beginMove.bind(this, true)).on('moving', this.ev_moving.bind(this, true)).on('endmove', this.ev_endMove.bind(this, true)).on('click', this.focus.bind(this)); this.$resizeBox.defineEvent('contextmenu'); this.$resizeBox.on('contextmenu', this.ev_contextMenu.bind(this)); this.movingData = null; this.isFocus = false; } Object.defineProperties(LinearAnchorEditor.prototype, Object.getOwnPropertyDescriptors(EventEmitter["a" /* default */].prototype)); LinearAnchorEditor.prototype.constructor = LinearAnchorEditor; LinearAnchorEditor.prototype.ev_contextMenu = function (event) { var self = this; var items = []; if (this.layoutEditor.anchorEditors.length > 1) { items.push({ icon: LinearAnchorEditor_('mdi-align-horizontal-left'), text: 'Align Left Edges', cmd: this.cmd_alignLeftDedge.bind(this) }); items.push({ icon: LinearAnchorEditor_('mdi-align-horizontal-center'), text: 'Align Horizontal Center', cmd: this.cmd_alignHorizontalCenter.bind(this) }); items.push({ icon: LinearAnchorEditor_('mdi-align-horizontal-right'), text: 'Align Right Edges', cmd: this.cmd_alignRightDedge.bind(this) }); items.push({ icon: LinearAnchorEditor_('span.mdi.mdi-arrow-expand-horizontal'), text: 'Equalise Width', cmd: this.cmd_equaliseWidth.bind(this) }); items.push('================'); items.push({ icon: LinearAnchorEditor_('mdi-align-vertical-top'), text: 'Align Top Edges', cmd: this.cmd_alignTopDedge.bind(this) }); items.push({ icon: LinearAnchorEditor_('mdi-align-vertical-bottom'), text: 'Align Bottom Edges', cmd: this.cmd_alignBottomDedge.bind(this) }); items.push({ icon: LinearAnchorEditor_('mdi-align-vertical-center'), text: 'Align Vertical Center', cmd: this.cmd_alignVerticalCenter.bind(this) }); items.push({ icon: LinearAnchorEditor_('span.mdi.mdi-arrow-expand-vertical'), text: 'Equalise Height', cmd: this.cmd_equaliseHeight.bind(this) }); items.push('================'); } if (this.layoutEditor.anchorEditors.length > 2) { items.push({ icon: LinearAnchorEditor_('span.mdi.mdi-distribute-horizontal-left'), text: 'Distribute Horizontal Left', cmd: this.cmd_distributeHorizontalLeft.bind(this) }); items.push({ icon: LinearAnchorEditor_('span.mdi.mdi-distribute-horizontal-center'), text: 'Distribute Horizontal Center', cmd: this.cmd_distributeHorizontalCenter.bind(this) }); items.push({ icon: LinearAnchorEditor_('span.mdi.mdi-distribute-horizontal-right'), text: 'Distribute Horizontal Right', cmd: this.cmd_distributeHorizontalRight.bind(this) }); items.push({ icon: LinearAnchorEditor_('<svg width="24" height="24" version="1.1" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">\ <path d="m21 7v10h-5v5h-2v-20h2v5h5"/>\ <path d="m8 2h2v20h-2v-3h-5v-14h5z"/>\ </svg>'), text: 'Distribute Horizontal Distance', cmd: this.cmd_distributeHorizontalDistance.bind(this) }); items.push('================'); items.push({ icon: LinearAnchorEditor_('span.mdi.mdi-distribute-vertical-top'), text: 'Distribute Vertical Top', cmd: this.cmd_distributeVerticalTop.bind(this) }); items.push({ icon: LinearAnchorEditor_('span.mdi.mdi-distribute-vertical-center'), text: 'Distribute Vertical Center', cmd: this.cmd_distributeVerticalCenter.bind(this) }); items.push({ icon: LinearAnchorEditor_('span.mdi.mdi-distribute-vertical-bottom'), text: 'Distribute Vertical Bottom', cmd: this.cmd_distributeVerticalBottom.bind(this) }); items.push({ icon: LinearAnchorEditor_('<svg width="24" height="24" version="1.1" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">\ <path d="m7 3h10v5h5v2h-20v-2h5v-5"/>\ <path d="m2 16v-2h20v2h-3v5h-14v-5z"/>\ </svg>'), text: 'Distribute Verlical Distance', cmd: this.cmd_distributeVerticalDistance.bind(this) }); items.push('================'); } items.push({ icon: 'span.mdi.mdi-delete-variant[style="color:red"]', text: 'Delete', cmd: this.cmd_delete.bind(this) }); event.showContextMenu({ items: items }, function (event) { var cmd = event.menuItem.cmd; if (typeof cmd == 'function') { cmd(); self.layoutEditor.notifyDataChange(); } }); event.stopPropagation(); }; LinearAnchorEditor.prototype.focusMarginBox = function () { if (!this.component) return; if (this.isFocus) { this.$resizeBox.removeClass('as-focus'); this.$marginBox.addClass('as-focus'); } else { this.$marginBox.addClass('as-focus'); this.isFocus = true; var editor; for (var i = 0; i < this.layoutEditor.anchorEditors.length; ++i) { editor = this.layoutEditor.anchorEditors[i]; if (editor == this) continue; editor.blur(); } this.emit('focus', { type: 'focus', target: this }, this); } }; LinearAnchorEditor.prototype.focus = function () { if (!this.component) return; this.$resizeBox.addClass('as-focus'); this.$marginBox.removeClass('as-focus'); if (this.isFocus) return; this.isFocus = true; var editor; for (var i = 0; i < this.layoutEditor.anchorEditors.length; ++i) { editor = this.layoutEditor.anchorEditors[i]; if (editor == this) continue; editor.blur(); } this.emit('focus', { type: 'focus', target: this }, this); }; LinearAnchorEditor.prototype.blur = function () { if (!this.isFocus) return; this.isFocus = false; this.$resizeBox.removeClass('as-focus'); this.emit('blur', { type: 'blur', target: this }, this); }; LinearAnchorEditor.prototype.edit = function (component) { this.component = component; if (!this.component) this.blur(); this.update(); }; LinearAnchorEditor.prototype.update = function () { if (this.component) { var styleDescriptors = this.component.getStyleDescriptors(); if (styleDescriptors.top || styleDescriptors.bottom || styleDescriptors.left || styleDescriptors.right) { this.$marginBox.addTo(this.layoutEditor.$forceground); } else { this.$marginBox.selfRemove(); } this.$resizeBox.addTo(this.layoutEditor.$forceground); this.$resizeBox.canMove = !!(styleDescriptors.top || styleDescriptors.bottom || styleDescriptors.left || styleDescriptors.right); this.$resizeBox.canResize = !!(styleDescriptors.width || styleDescriptors.height); this.$marginBox.canClick = !!(styleDescriptors.top || styleDescriptors.bottom || styleDescriptors.left || styleDescriptors.right); this.$marginBox.canResize = true; this.updatePosition(); } else { this.$resizeBox.remove(); this.$marginBox.remove(); } }; LinearAnchorEditor.prototype.updatePosition = function () { if (this.component) { this.component.reMeasure(); var bound = this.layoutEditor.$forceground.getBoundingClientRect(); var compBound = this.component.view.getBoundingClientRect(); this.$resizeBox.addStyle({ left: compBound.left - bound.left + 'px', top: compBound.top - bound.top + 'px', width: compBound.width + 'px', height: compBound.height + 'px' }); this.$marginBox.addStyle({ left: compBound.left - bound.left - this.component.style.left + 'px', top: compBound.top - bound.top - this.component.style.top + 'px', width: compBound.width + this.component.style.left + this.component.style.right + 'px', height: compBound.height + this.component.style.top + this.component.style.bottom + 'px' }); } }; LinearAnchorEditor.prototype.ev_beginMove = function (userAction, event) { var bound = this.layoutEditor.$forceground.getBoundingClientRect(); this.movingData = { x0: event.clientX - bound.left, y0: event.clientY - bound.top, dx: 0, dy: 0, option: event.option, styleDescriptors: this.component.getStyleDescriptors(), style0: Object.assign({}, this.component.style), comp: this.component, isChange: false }; if (userAction) { this.emit('beginmove', LinearAnchorEditor_defineProperty({ type: 'beginmove', target: this, originEvent: event }, "target", this), this); this.$modal.addTo(document.body); } }; LinearAnchorEditor.prototype.ev_moving = function (userAction, event) { var movingData = this.movingData; var bound = this.layoutEditor.$forceground.getBoundingClientRect(); var x = event.clientX - bound.left; var y = event.clientY - bound.top; movingData.dx = x - movingData.x0; movingData.dy = y - movingData.y0; var positionIsChange = false; if (movingData.styleDescriptors.left && !movingData.styleDescriptors.left.disabled && (movingData.option.left || movingData.option.body)) { movingData.comp.setStyle('left', Math.max(0, movingData.style0.left + movingData.dx)); positionIsChange = true; } if (movingData.styleDescriptors.right && !movingData.styleDescriptors.right.disabled && (movingData.option.right || movingData.option.body)) { movingData.comp.setStyle('right', Math.max(0, movingData.style0.right - movingData.dx)); positionIsChange = true; } if (movingData.styleDescriptors.width && !movingData.styleDescriptors.width.disabled) { if (movingData.option.left) { if (!!movingData.styleDescriptors.left.disabled && !!movingData.styleDescriptors.right.disabled) { movingData.comp.setStyle('width', Math.max(movingData.comp.measureMinSize().width, movingData.style0.width - movingData.dx * 2)); } else { movingData.comp.setStyle('width', Math.max(movingData.style0.width - movingData.dx)); } positionIsChange = true; } if (movingData.option.right) { if (movingData.styleDescriptors.left && !!movingData.styleDescriptors.left.disabled && !!movingData.styleDescriptors.right.disabled) { movingData.comp.setStyle('width', Math.max(movingData.comp.measureMinSize().width, movingData.style0.width + movingData.dx * 2)); //center align } else { movingData.comp.setStyle('width', Math.max(movingData.comp.measureMinSize().width, movingData.style0.width + movingData.dx)); } positionIsChange = true; } } if (movingData.styleDescriptors.top && !movingData.styleDescriptors.top.disabled && (movingData.option.top || movingData.option.body)) { movingData.comp.setStyle('top', Math.max(0, movingData.style0.top + movingData.dy)); positionIsChange = true; } if (movingData.styleDescriptors.bottom && !movingData.styleDescriptors.bottom.disabled && (movingData.option.bottom || movingData.option.body)) { movingData.comp.setStyle('bottom', Math.max(0, movingData.style0.bottom - movingData.dy)); positionIsChange = true; } if (movingData.styleDescriptors.height && !movingData.styleDescriptors.height.disabled) { if (movingData.option.top) { if (movingData.styleDescriptors.top && !!movingData.styleDescriptors.top.disabled && !!movingData.styleDescriptors.bottom.disabled) { movingData.comp.setStyle('height', Math.max(movingData.comp.measureMinSize().height, movingData.style0.height - movingData.dy * 2)); } else { movingData.comp.setStyle('height', Math.max(movingData.comp.measureMinSize().height, movingData.style0.height - movingData.dy)); } positionIsChange = true; } if (movingData.option.bottom) { if (movingData.styleDescriptors.top && !!movingData.styleDescriptors.top.disabled && !!movingData.styleDescriptors.bottom.disabled) { movingData.comp.setStyle('height', Math.max(movingData.comp.measureMinSize().height, movingData.style0.height + movingData.dy * 2)); } else { movingData.comp.setStyle('height', Math.max(movingData.comp.measureMinSize().height, movingData.style0.height + movingData.dy)); } positionIsChange = true; } } movingData.comp.reMeasure(); this.updatePosition(); if (positionIsChange) { this.emit("reposition", { type: 'reposition', component: movingData.comp, movingData: movingData, originEvent: event }, this); movingData.isChange = true; } if (userAction) this.emit('moving', { taget: this, type: 'moving', originEvent: event, target: this }, this); }; LinearAnchorEditor.prototype.ev_movingMargin = function (userAction, event) { var movingData = this.movingData; var bound = this.layoutEditor.$forceground.getBoundingClientRect(); var x = event.clientX - bound.left; var y = event.clientY - bound.top; movingData.dx = x - movingData.x0; movingData.dy = y - movingData.y0; var positionIsChange = false; if (movingData.styleDescriptors.bottom && event.option.bottom) { movingData.comp.setStyle('bottom', Math.max(0, movingData.style0.bottom + movingData.dy)); } if (movingData.styleDescriptors.right && event.option.right) { movingData.comp.setStyle('right', Math.max(0, movingData.style0.right + movingData.dx)); } this.updatePosition(); movingData.comp.reMeasure(); if (positionIsChange) { this.emit("reposition", { type: 'reposition', component: movingData.comp, movingData: movingData, originEvent: event }, this); movingData.isChange = true; } if (userAction) this.emit('moving', { taget: this, type: 'moving', originEvent: event, target: this }, this); }; LinearAnchorEditor.prototype.ev_endMove = function (userAction, event) { if (this.movingData.isChange) { this.emit('change', { type: 'change', target: this, component: this.movingData.comp, originEvent: event }, this); } this.movingData = undefined; if (userAction) { this.emit('endmove', { taget: this, type: 'moving', originEvent: event, target: this }, this); setTimeout(this.$modal.selfRemove.bind(this.$modal), 100); } }; LinearAnchorEditor.prototype.cmd_delete = function () { var editors = this.layoutEditor.anchorEditors; var components = editors.map(function (e) { return e.component; }); this.layoutEditor.removeComponent.apply(this.layoutEditor, components); }; LinearAnchorEditor.prototype.cmd_alignLeftDedge = function () { var editors = this.layoutEditor.anchorEditors; var editor; this.component.reMeasure(); var leftValue = this.component.getStyle('left'); for (var i = 0; i < editors.length; ++i) { editor = editors[i]; if (editor == this) continue; editor.alignLeftDedge(leftValue); } this.layoutEditor.commitHistory('move', 'Align Left Dedge'); }; LinearAnchorEditor.prototype.cmd_alignRightDedge = function () { var editors = this.layoutEditor.anchorEditors; var editor; this.component.reMeasure(); var rightValue = this.component.getStyle('right'); for (var i = 0; i < editors.length; ++i) { editor = editors[i]; if (editor == this) continue; editor.alignRightDedge(rightValue); } this.layoutEditor.commitHistory('move', 'Align Right Dedge'); }; LinearAnchorEditor.prototype.cmd_alignHorizontalCenter = function () { var editors = this.layoutEditor.anchorEditors; var editor; this.component.reMeasure(); var centerValue = this.component.getStyle('right') - this.component.getStyle('left'); ; for (var i = 0; i < editors.length; ++i) { editor = editors[i]; if (editor == this) continue; editor.alignHorizontalCenter(centerValue); } this.layoutEditor.commitHistory('move', 'Align Horizontal Center'); }; LinearAnchorEditor.prototype.cmd_equaliseWidth = function () { var editors = this.layoutEditor.anchorEditors; var editor; this.component.reMeasure(); var widthValue = this.component.getStyle('width'); for (var i = 0; i < editors.length; ++i) { var editor = editors[i]; if (editor == this) continue; editor.equaliseWidth(widthValue); } this.layoutEditor.commitHistory('move', 'Equalise Width'); }; LinearAnchorEditor.prototype.alignLeftDedge = function (leftValue) { if (!this.component) return; this.component.reMeasure(); var currentHAlign = this.component.getStyle('hAlign'); switch (currentHAlign) { case 'left': case 'fixed': this.component.setStyle('left', leftValue); break; case 'right': this.component.setStyle('right', this.component.getStyle('right') + (leftValue - this.component.getStyle('left'))); break; case 'center': var center = this.component.getStyle('left') + this.component.getStyle('width') / 2; if (center - this.component.measureMinSize().width / 2 >= leftValue) { this.component.setStyle('width', (center - leftValue) * 2); } break; } this.updatePosition(); this.component.reMeasure(); }; LinearAnchorEditor.prototype.alignRightDedge = function (rightValue) { if (!this.component) return; this.component.reMeasure(); var currentHAlign = this.component.getStyle('hAlign'); switch (currentHAlign) { case 'right': case 'fixed': this.component.setStyle('right', rightValue); break; case 'left': this.component.setStyle('left', this.component.getStyle('left') - (rightValue - this.component.getStyle('right'))); break; case 'center': var center = this.component.getStyle('right') - this.component.getStyle('width') / 2; if (center + this.component.measureMinSize().width / 2 <= rightValue) { this.component.setStyle('width', (rightValue - center) * 2); } break; } this.updatePosition(); this.component.reMeasure(); }; LinearAnchorEditor.prototype.alignHorizontalCenter = function (centerValue) { // right - left if (!this.component) return; this.component.reMeasure(); var currentHAlign = this.component.getStyle('hAlign'); var cRight = this.component.getStyle('right'); var cLeft = this.component.getStyle('left'); var newLeft = (cRight + cLeft - centerValue) / 2; var newRight = (cRight + cLeft + centerValue) / 2; switch (currentHAlign) { case 'right': this.component.setStyle('right', newRight); break; case 'fixed': this.component.setStyle('left', newLeft); this.component.setStyle('right', newRight); break; case 'left': this.component.setStyle('left', newLeft); break; case 'center': //noway to align center break; } this.updatePosition(); this.component.reMeasure(); }; LinearAnchorEditor.prototype.equaliseWidth = function (widthValue) { if (!this.component) return; this.component.reMeasure(); var currentHAlign = this.component.getStyle('hAlign'); var cRight = this.component.getStyle('right'); var cLeft = this.component.getStyle('left'); var cWidth = this.component.getStyle('width'); var dw = widthValue - cWidth; switch (currentHAlign) { case 'right': if (cLeft < dw) this.component.setStyle('right', cRight - (dw - cLeft)); this.component.setStyle('width', widthValue); break; case 'left': if (cRight < dw) this.component.setStyle('left', cLeft - (dw - cWidth)); this.component.setStyle('width', widthValue); break; case 'fixed': if (dw > cRight) { this.component.setStyle('right', 0); this.component.setStyle('left', cLeft - (dw - cWidth)); } else { this.component.setStyle('right', cRight - dw); } break; case 'center': this.component.setStyle('width', widthValue); break; } this.updatePosition(); this.component.reMeasure(); }; LinearAnchorEditor.prototype.cmd_alignTopDedge = function () { var editors = this.layoutEditor.anchorEditors; var editor; this.component.reMeasure(); var topValue = this.component.getStyle('top'); for (var i = 0; i < editors.length; ++i) { editor = editors[i]; if (editor == this) continue; editor.alignTopDedge(topValue); } this.layoutEditor.commitHistory('move', 'Align Top Dedge'); }; LinearAnchorEditor.prototype.cmd_alignBottomDedge = function () { var editors = this.layoutEditor.anchorEditors; var editor; this.component.reMeasure(); var bottomValue = this.component.getStyle('bottom'); for (var i = 0; i < editors.length; ++i) { editor = editors[i]; if (editor == this) continue; editor.alignBottomDedge(bottomValue); } this.layoutEditor.commitHistory('move', 'Align Bottom Dedge'); }; LinearAnchorEditor.prototype.cmd_alignVerticalCenter = function () { var editors = this.layoutEditor.anchorEditors; var editor; this.component.reMeasure(); var centerValue = this.component.getStyle('bottom') - this.component.getStyle('top'); ; for (var i = 0; i < editors.length; ++i) { editor = editors[i]; if (editor == this) continue; editor.alignVerticalCenter(centerValue); } this.layoutEditor.commitHistory('move', 'Align Verlical Center'); }; LinearAnchorEditor.prototype.cmd_equaliseHeight = function () { var editors = this.layoutEditor.anchorEditors; var editor; this.component.reMeasure(); var heightValue = this.component.getStyle('height'); for (var i = 0; i < editors.length; ++i) { editor = editors[i]; if (editor == this) continue; editor.equaliseHeight(heightValue); } this.layoutEditor.commitHistory('move', 'Equalise Height'); }; LinearAnchorEditor.prototype.alignTopDedge = function (topValue) { if (!this.component) return; this.component.reMeasure(); var currentVAlign = this.component.getStyle('vAlign'); switch (currentVAlign) { case 'top': case 'fixed': this.component.setStyle('top', topValue); break; case 'bottom': this.component.setStyle('bottom', this.component.getStyle('bottom') + (topValue - this.component.getStyle('top'))); break; case 'center': var center = this.component.getStyle('top') + this.component.getStyle('height') / 2; if (center - this.component.measureMinSize().height / 2 >= topValue) { this.component.setStyle('height', (center - topValue) * 2); } break; } this.updatePosition(); this.component.reMeasure(); }; LinearAnchorEditor.prototype.alignBottomDedge = function (bottomValue) { if (!this.component) return; this.component.reMeasure(); var currentVAlign = this.component.getStyle('vAlign'); switch (currentVAlign) { case 'bottom': case 'fixed': this.component.setStyle('bottom', bottomValue); break; case 'top': this.component.setStyle('top', this.component.getStyle('top') - (bottomValue - this.component.getStyle('bottom'))); break; case 'center': var center = this.component.getStyle('bottom') - this.component.getStyle('height') / 2; if (center + this.component.measureMinSize().height / 2 <= bottomValue) { this.component.setStyle('height', (bottomValue - center) * 2); } break; } this.updatePosition(); }; LinearAnchorEditor.prototype.alignVerticalCenter = function (centerValue) { // bottom - top if (!this.component) return; this.component.reMeasure(); var currentVAlign = this.component.getStyle('vAlign'); var cBottom = this.component.getStyle('bottom'); var cTop = this.component.getStyle('top'); var newTop = (cBottom + cTop - centerValue) / 2; var newBottom = (cBottom + cTop + centerValue) / 2; switch (currentVAlign) { case 'bottom': this.component.setStyle('bottom', newBottom); break; case 'fixed': this.component.setStyle('top', newTop); this.component.setStyle('bottom', newBottom); break; case 'top': this.component.setStyle('top', newTop); break; case 'center': //noway to align center break; } this.updatePosition(); this.component.reMeasure(); }; LinearAnchorEditor.prototype.equaliseHeight = function (heightValue) { if (!this.component) return; this.component.reMeasure(); var currentVAlign = this.component.getStyle('vAlign'); var cBottom = this.component.getStyle('bottom'); var cTop = this.component.getStyle('top'); var cHeight = this.component.getStyle('height'); var dh = heightValue - cHeight; switch (currentVAlign) { case 'bottom': if (cTop < dh) this.component.setStyle('bottom', cBottom - (dh - cTop)); this.component.setStyle('height', heightValue); break; case 'top': if (cBottom < dh) this.component.setStyle('top', cTop - (dh - cHeight)); this.component.setStyle('height', heightValue); break; case 'fixed': if (dh > cBottom) { this.component.setStyle('bottom', 0); this.component.setStyle('top', cTop - (dh - cHeight)); } else { this.component.setStyle('bottom', cBottom - dh); } break; case 'center': this.component.setStyle('height', heightValue); break; } this.updatePosition(); this.component.reMeasure(); }; LinearAnchorEditor.prototype.cmd_distributeHorizontalLeft = function () { var editors = this.layoutEditor.anchorEditors; var editor; var i; for (i = 0; i < editors.length; ++i) { editor = editors[i]; editor.component.reMeasure(); } editors = editors.slice(); editors.sort(function (a, b) { return a.component.style.left - b.component.style.left; }); var minX = editors[0].component.style.left; var maxX = editors[editors.length - 1].component.style.left; if (minX == maxX) return; for (i = 1; i < editors.length - 1; ++i) { editor = editors[i]; editor.alignLeftDedge(minX + (maxX - minX) / (editors.length - 1) * i); editor.component.reMeasure(); } this.layoutEditor.commitHistory('move', 'Distribute Horizontal Left'); }; LinearAnchorEditor.prototype.cmd_distributeHorizontalCenter = function () { var editors = this.layoutEditor.anchorEditors; var editor; var i; for (i = 0; i < editors.length; ++i) { editor = editors[i]; editor.component.reMeasure(); } editors = editors.slice(); editors.sort(function (a, b) { return a.component.style.left + a.component.style.width / 2 - (b.component.style.left + b.component.style.width / 2); }); var minX = editors[0].component.style.left + editors[0].component.style.width / 2; var maxX = editors[editors.length - 1].component.style.left + editors[editors.length - 1].component.style.width / 2; if (minX == maxX) return; for (i = 1; i < editors.length - 1; ++i) { editor = editors[i]; editor.alignLeftDedge(minX + (maxX - minX) / (editors.length - 1) * i - editor.component.style.width / 2); editor.component.reMeasure(); } this.layoutEditor.commitHistory('move', 'Distribute Horizontal Center'); }; LinearAnchorEditor.prototype.cmd_distributeHorizontalRight = function () { var editors = this.layoutEditor.anchorEditors; var editor; var i; for (i = 0; i < editors.length; ++i) { editor = editors[i]; editor.component.reMeasure(); } editors = editors.slice(); editors.sort(function (a, b) { return a.component.style.right - b.component.style.right; }); var minX = editors[0].component.style.right; var maxX = editors[editors.length - 1].component.style.right; if (minX == maxX) return; for (i = 1; i < editors.length - 1; ++i) { editor = editors[i]; editor.alignRightDedge(minX + (maxX - minX) / (editors.length - 1) * i); editor.component.reMeasure(); } this.layoutEditor.commitHistory('move', 'Distribute Horizontal Right'); }; LinearAnchorEditor.prototype.cmd_distributeHorizontalDistance = function () { var editors = this.layoutEditor.anchorEditors; var editor; var i; for (i = 0; i < editors.length; ++i) { editor = editors[i]; editor.component.reMeasure(); } editors = editors.slice(); editors.sort(function (a, b) { return a.component.style.left + a.component.style.width / 2 - (b.component.style.left + b.component.style.width / 2); }); var sumDistance = editors[editors.length - 1].component.style.left - (editors[0].component.style.left + editors[0].component.style.width); for (i = 1; i < editors.length - 1; ++i) { editor = editors[i]; sumDistance -= editor.component.style.width; } var distance = sumDistance / (editors.length - 1); var curentLeft = editors[0].component.style.left + editors[0].component.style.width + distance; for (i = 1; i < editors.length - 1; ++i) { editor = editors[i]; editor.alignHorizontalCenter(editor.component.style.right - 2 * curentLeft + editor.component.style.left); editor.component.reMeasure(); curentLeft += editor.component.style.width + distance; } this.layoutEditor.commitHistory('move', 'Distribute Horizontal Distance'); }; LinearAnchorEditor.prototype.cmd_distributeVerticalTop = function () { var editors = this.layoutEditor.anchorEditors; var editor; var i; for (i = 0; i < editors.length; ++i) { editor = editors[i]; editor.component.reMeasure(); } editors = editors.slice(); editors.sort(function (a, b) { return a.component.style.top - b.component.style.top; }); var minX = editors[0].component.style.top; var maxX = editors[editors.length - 1].component.style.top; if (minX == maxX) return; for (i = 1; i < editors.length - 1; ++i) { editor = editors[i]; editor.alignTopDedge(minX + (maxX - minX) / (editors.length - 1) * i); editor.component.reMeasure(); } this.layoutEditor.commitHistory('move', 'Distribute Vertical Top'); }; LinearAnchorEditor.prototype.cmd_distributeVerticalCenter = function () { var editors = this.layoutEditor.anchorEditors; var editor; var i; for (i = 0; i < editors.length; ++i) { editor = editors[i]; editor.component.reMeasure(); } editors = editors.slice(); editors.sort(function (a, b) { return a.component.style.top + a.component.style.height / 2 - (b.component.style.top + b.component.style.height / 2); }); var minX = editors[0].component.style.top + editors[0].component.style.height / 2; var maxX = editors[editors.length - 1].component.style.top + editors[editors.length - 1].component.style.height / 2; if (minX == maxX) return; for (i = 1; i < editors.length - 1; ++i) { editor = editors[i]; editor.alignTopDedge(minX + (maxX - minX) / (editors.length - 1) * i - editor.component.style.height / 2); editor.component.reMeasure(); } this.layoutEditor.commitHistory('move', 'Distribute Vertical Center'); }; LinearAnchorEditor.prototype.cmd_distributeVerticalBottom = function () { var editors = this.layoutEditor.anchorEditors; var editor; var i; for (i = 0; i < editors.length; ++i) { editor = editors[i]; editor.component.reMeasure(); } editors = editors.slice(); editors.sort(function (a, b) { return a.component.style.bottom - b.component.style.bottom; }); var minX = editors[0].component.style.bottom; var maxX = editors[editors.length - 1].component.style.bottom; if (minX == maxX) return; for (i = 1; i < editors.length - 1; ++i) { editor = editors[i]; editor.alignBottomDedge(minX + (maxX - minX) / (editors.length - 1) * i); editor.component.reMeasure(); } this.layoutEditor.commitHistory('move', 'Distribute Vertical Bottom'); }; LinearAnchorEditor.prototype.cmd_distributeVerticalDistance = function () { var editors = this.layoutEditor.anchorEditors; var editor; var i; for (i = 0; i < editors.length; ++i) { editor = editors[i]; editor.component.reMeasure(); } editors = editors.slice(); editors.sort(function (a, b) { return a.component.style.top + a.component.style.height / 2 - (b.component.style.top + b.component.style.height / 2); }); var sumDistance = editors[editors.length - 1].component.style.top - (editors[0].component.style.top + editors[0].component.style.height); for (i = 1; i < editors.length - 1; ++i) { editor = editors[i]; sumDistance -= editor.component.style.height; } var distance = sumDistance / (editors.length - 1); var curentTop = editors[0].component.style.top + editors[0].component.style.height + distance; for (i = 1; i < editors.length - 1; ++i) { editor = editors[i]; editor.alignVerticalCenter(editor.component.style.bottom - 2 * curentTop + editor.component.style.top); editor.component.reMeasure(); curentTop += editor.component.style.height + distance; } this.layoutEditor.commitHistory('move', 'Distribute Vertical Distance'); }; /* harmony default export */ var anchoreditors_LinearAnchorEditor = (LinearAnchorEditor); // CONCATENATED MODULE: ./js/layouts/LinearLayout.js var LinearLayout_ = FCore._; function LinearLayout() { core_ScalableComponent.call(this); } Object.defineProperties(LinearLayout.prototype, Object.getOwnPropertyDescriptors(core_ScalableComponent.prototype)); LinearLayout.prototype.constructor = LinearLayout; LinearLayout.prototype.tag = 'LinearLayout'; LinearLayout.prototype.menuIcon = 'span.mdi.mdi-post-outline'; LinearLayout.prototype.TOP_CLASS_NAME = 'as-linear-layout'; LinearLayout.prototype.SUPPORT_STYLE_NAMES = ['width', 'height']; //, 'left', 'right', 'top', 'bottom']; LinearLayout.prototype.create = function () { core_ScalableComponent.prototype.create.call(this); this.style.vAlign = 'fixed'; this.style.hAlign = 'fixed'; }; LinearLayout.prototype.getAnchorConstructor = function () { return anchors_LinearAnchor; }; LinearLayout.prototype.getAnchorEditorConstructor = function () { return anchoreditors_LinearAnchorEditor; }; LinearLayout.prototype.render = function () { return LinearLayout_({ "class": this.TOP_CLASS_NAME }); }; LinearLayout.prototype.onAddChild = function (child, index) { var anchor = new anchors_LinearAnchor(); anchor.attachChild(child); if (index == -1 || !this.view.childNodes[index]) { this.view.addChild(anchor.view); } else { this.view.addChildBefore(anchor.view, this.view.childNodes[index]); } }; LinearLayout.prototype.onRemoveChild = function (child, index) { var anchor = child.anchor; anchor.detachChild(); anchor.view.remove(); }; /** * @param {BaseComponent} component * @returns {BaseComponent} auto set disable style */ LinearLayout.prototype.reMeasureChild = function (component) {}; /** * * @returns {{width:Number, height:Number}} */ LinearLayout.prototype.measureMinSize = function () { //todo var width = 0; var height = 0; var child; var cW; var cH; for (var i = 0; i < this.children.length; ++i) { child = this.children[i]; var minSize = child.measureMinSize(); cW = child.style.left + minSize.width + child.style.right; cH = child.style.top + minSize.height + child.style.bottom; width = Math.min(cW, width); height += cH; } return { width: width, height: height }; }; LinearLayout.prototype.addChildByPosition = function (child, posX, posY) { var at = undefined; var y = 0; for (var i = 0; i < this.children.length; ++i) { at = this.children[i]; y += at.style.height + at.style.top + at.style.bottom; if (y >= posY) { break; } } if (y < posY) { at = undefined; } if (at) { this.addChildBefore(child, at); } else { this.addChild(child); } }; /* harmony default export */ var layouts_LinearLayout = (LinearLayout); // CONCATENATED MODULE: ./js/editor/ComponentPicker.js var ComponentPicker_ = FCore._; var ComponentPicker_$ = FCore.$; function ComponentPicker() { AppPattern_Context.call(this); EventEmitter["a" /* default */].call(this); this.$view = null; this.mLayoutEditor = null; } Object.defineProperties(ComponentPicker.prototype, Object.getOwnPropertyDescriptors(AppPattern_Context.prototype)); Object.defineProperties(ComponentPicker.prototype, Object.getOwnPropertyDescriptors(EventEmitter["a" /* default */].prototype)); ComponentPicker.prototype.constructor = ComponentPicker; ComponentPicker.prototype.onStart = function () { /** * @type {import('./LayoutEditor').default} */ this.mLayoutEditor = this.getContext(R.LAYOUT_EDITOR); }; ComponentPicker.prototype.getView = function () { if (this.$view) return this.$view; if (this.$view) return this.$compExpTree; var self = this; function toggleGroup() { this.status = { open: 'close', close: 'open' }[this.status]; } this.$view = ComponentPicker_({ "class": 'as-compopnent-picker', child: [{ tag: 'exptree', props: { name: 'all', status: 'open' }, on: { press: toggleGroup }, child: [{ tag: 'exptree', props: { name: 'layouts', status: 'open' }, on: { press: toggleGroup }, child: [{ tag: 'exptree', props: { name: "RelativeLayout", icon: layouts_RelativeLayout.prototype.menuIcon, componentConstructor: layouts_RelativeLayout } }, { tag: 'exptree', props: { name: "LinearLayout", icon: layouts_LinearLayout.prototype.menuIcon, componentConstructor: layouts_LinearLayout } }] }, { tag: 'exptree', props: { name: 'inputs', status: 'open' }, on: { press: toggleGroup }, child: [{ tag: 'exptree', props: { name: "DateInput", icon: components_DateInput.prototype.menuIcon, componentConstructor: components_DateInput } }, { tag: 'exptree', props: { name: "TextInput", icon: components_TextInput.prototype.menuIcon, componentConstructor: components_TextInput } }, { tag: 'exptree', props: { name: "TextArea", icon: components_TextArea.prototype.menuIcon, componentConstructor: components_TextArea } }, { tag: 'exptree', props: { name: "NumberInput", icon: components_NumberInput.prototype.menuIcon, componentConstructor: components_NumberInput } }, { tag: 'exptree', props: { name: "ComboBox", icon: components_ComboBox.prototype.menuIcon, componentConstructor: components_ComboBox } }, // { // tag: 'exptree', // props: { // name: "SelectBox", // icon: SelectBox.prototype.menuIcon, // componentConstructor: SelectBox // }, // on: { // press: function () { // // this.addComponent({ tag: 'SelectBox', attributes: { value: [0], list: [{ text: 'Item 0', value: 0 }, { text: 'Item 1', value: 1 }] } }); // }.bind(this) // } // }, { tag: 'exptree', props: { name: "Radio", icon: components_Radio.prototype.menuIcon, componentConstructor: components_Radio } }, { tag: 'exptree', props: { name: "CheckBox", icon: Checkbox.prototype.menuIcon, componentConstructor: Checkbox } }] }, { tag: 'exptree', props: { name: "static", status: 'open' }, on: { press: toggleGroup }, child: [{ tag: 'exptree', props: { name: "Label", icon: components_Label.prototype.menuIcon, componentConstructor: components_Label } }, { tag: 'exptree', props: { name: "Text", icon: components_Text.prototype.menuIcon, componentConstructor: components_Text } }, { tag: 'exptree', props: { name: "Image", icon: components_Image.prototype.menuIcon, componentConstructor: components_Image } }, { tag: 'exptree', props: { name: "Table", icon: components_Table.prototype.menuIcon, componentConstructor: components_Table } }] }, { tag: 'exptree', props: { name: "trigger", status: 'open' }, on: { press: toggleGroup }, child: [{ tag: 'exptree', props: { name: "Button", icon: components_Button.prototype.menuIcon, componentConstructor: components_Button } }] }] }] }); ComponentPicker_$('exptree', this.$view, function (elt) { if (elt.componentConstructor) { js_Draggable(elt.$node).on('begindrag', self.ev_constructorBeginDrag.bind(self, elt)).on('enddrag', self.ev_constructorEndDrag.bind(self, elt)).on('drag', self.ev_constructorDrag.bind(self, elt)); } }); return this.$view; }; ComponentPicker.prototype.ev_constructorBeginDrag = function (treeNode, event) { this.$modal = this.$modal || ComponentPicker_('.as-compopnent-picker-forceground'); this.$higne = this.$higne || ComponentPicker_('.as-compopnent-picker-higne').addTo(this.$modal); this.$addBoxCtn = this.$addBoxCtn || ComponentPicker_('.as-compopnent-picker-add-box-container').addTo(this.$higne); this.$addBox = this.$addBox || ComponentPicker_({ "class": 'as-compopnent-picker-add-box', child: { "class": 'as-compopnent-picker-add-box-plus', child: 'span.mdi.mdi-plus' } }).addTo(this.$addBoxCtn); if (this.$addBoxIcon) this.$addBoxIcon.remove(); this.$addBoxIcon = ComponentPicker_(treeNode.componentConstructor.prototype.menuIcon).addTo(this.$addBox); this.$modal.addTo(document.body); if (this.mLayoutEditor.rootLayout) { this._dragRect = this.mLayoutEditor.rootLayout.view.getBoundingClientRect(); } else { this._dragRect = undefined; } }; ComponentPicker.prototype.ev_constructorEndDrag = function (treeNode, event) { if (!this.$modal) return; //quick fix, must fix in Draggable this.$modal.remove(); var x = event.clientX; var y = event.clientY; var rect = this._dragRect; if (rect && rect.top <= y && rect.bottom >= y && rect.left <= x && rect.right >= x) { this.mLayoutEditor.addNewComponent(treeNode.componentConstructor.prototype.tag, x - rect.left, y - rect.top); } }; ComponentPicker.prototype.ev_constructorDrag = function (treeNode, event) { this.$addBoxCtn.addStyle({ left: event.clientX + 'px', top: event.clientY + 'px' }); var x = event.clientX; var y = event.clientY; var rect = this._dragRect; if (rect && rect.top <= y && rect.bottom >= y && rect.left <= x && rect.right >= x) { this.$addBox.addClass('as-can-drop'); } else { this.$addBox.removeClass('as-can-drop'); } }; /* harmony default export */ var editor_ComponentPicker = (ComponentPicker); // EXTERNAL MODULE: ./css/propertyeditor.css var propertyeditor = __webpack_require__(221); // EXTERNAL MODULE: ./css/listeditor.css var listeditor = __webpack_require__(223); // CONCATENATED MODULE: ./js/editor/ListEditor.js var ListEditor_ = FCore._; var ListEditor_$ = FCore.$; function ListEditor() { AppPattern_Context.call(this); EventEmitter["a" /* default */].call(this); this._data = []; this._lashHashValue = -1.1; } Object.defineProperties(ListEditor.prototype, Object.getOwnPropertyDescriptors(AppPattern_Context.prototype)); Object.defineProperties(ListEditor.prototype, Object.getOwnPropertyDescriptors(EventEmitter["a" /* default */].prototype)); ListEditor.prototype.constructor = ListEditor; ListEditor.prototype.getView = function () { if (this.$view) return this.$view; var self = this; this.$view = ListEditor_({ tag: 'table', "class": 'as-list-editor', child: [{ tag: 'thead', child: [{ tag: 'tr', child: [{ tag: 'td', child: { text: 'Text' } }, { tag: 'td', child: { text: 'Value' } }, { tag: 'td' }] }] }, { tag: 'tbody', child: [{ tag: 'tr', "class": 'as-list-editor-add-row', child: { tag: 'td', attr: { colspan: '3' }, child: ['span.mdi.mdi-plus', { tag: 'span', child: { text: 'Add new item' } }] } }] }] }); this.$body = ListEditor_$('tbody', this.$view); this.$addRow = ListEditor_$('.as-list-editor-add-row', this.$view).on('click', function () { self.appendRowElement(); }); this.updateData(); return this.$view; }; ListEditor.prototype.updateData = function () { if (!this.$view) return; if (this._lashHashValue == this.getDataHash()) return; this.$body.clearChild(); var self = this; this.$items = this._data.map(function (item) { return self.makeNewRow(item).addTo(self.$body); }); this.$body.addChild(this.$addRow); this.checkEmpty(); this.checkDuplicate(); }; ListEditor.prototype.makeNewRow = function (data) { var self = this; var itemRow = ListEditor_({ tag: 'tr', "class": 'as-list-editor-row', child: [{ tag: 'td', "class": ['as-list-editor-cell'], child: [{ tag: 'span', "class": 'as-list-editor-text', attr: { contenteditable: 'true' }, child: { text: data.text } }] }, { tag: 'td', "class": ['as-list-editor-cell'], child: { tag: 'span', "class": 'as-list-editor-value', attr: { contenteditable: 'true' }, child: { text: '' + data.value } } }, { tag: 'td', child: { tag: 'button', "class": 'as-list-editor-quick-menu-trigger', child: { tag: 'span', "class": ['mdi', 'mdi-dots-vertical'] } } }] }); itemRow.__data__ = data; itemRow.$textInput = ListEditor_$('.as-list-editor-text', itemRow).on('keydown', function (event) { if (event.key == 'Enter') { event.preventDefault(); this.blur(); } }).on('blur', function () { var newText = itemRow.$textInput.innerText.trim(); if (data.text != newText) { data.text = newText; if (self.checkEmpty() && self.checkDuplicate()) { self.notifyChange(); } } }); contenteditableTextOnly(itemRow.$textInput, function (text) { return text.replace(/[\r\n]/g, ''); }); if ((data.text + '').trim() == '') { itemRow.$textInput.parentNode.addClass('empty-cell'); } itemRow.$valueInput = ListEditor_$('.as-list-editor-value', itemRow).on('keydown', function (event) { if (event.key == 'Enter') { event.preventDefault(); this.blur(); } }).on('blur', function () { var newValue = itemRow.$valueInput.innerText.trim(); if (data.value != newValue) { data.value = newValue; if (self.checkEmpty() && self.checkDuplicate()) { self.notifyChange(); } } }); contenteditableTextOnly(itemRow.$valueInput, function (text) { return text.replace(/[\r\n]/g, ''); }); if ((data.value + '').trim() == '') { itemRow.$valueInput.parentNode.addClass('empty-cell'); } itemRow.$menuTrigger = ListEditor_$('.as-list-editor-quick-menu-trigger', itemRow); itemRow.quickMenuData = js_QuickMenu.toggleWhenClick(itemRow.$menuTrigger, { getMenuProps: function getMenuProps() { return { extendStyle: { 'font-size': '12px' }, items: [{ icon: '.mdi.mdi-table-row-plus-before', text: 'Insert Row Before', cmd: 'insert-before' }, { icon: '.mdi.mdi-table-row-plus-after', text: 'Insert Row After', cmd: 'insert-after' }, { icon: '.mdi.mdi-table-row-remove', text: 'Remove', cmd: 'remove' }] }; }, onSelect: function onSelect(itemElt) { switch (itemElt.cmd) { case 'remove': self.removeRowByElt(itemRow); break; case 'insert-before': self.insertRowBeforeElt(itemRow); break; case 'insert-after': self.insertRowAfterElt(itemRow); break; } } }); return itemRow; }; /** * @returns {Boolean} */ ListEditor.prototype.checkDuplicate = function () { var res = true; var textDict = {}; var valueDict = {}; var rows = Array.apply(null, this.$body.childNodes); var row; for (var i = 0; i < rows.length; ++i) { row = rows[i]; if (row.__data__ && (row.__data__.text + '').trim() != '') { if (textDict[row.__data__.text]) { row.$textInput.parentNode.addClass('duplicate-cell'); } else { textDict[row.__data__.text] = true; row.$textInput.parentNode.removeClass('duplicate-cell'); } } if (row.__data__ && (row.__data__.value + '').trim() != '') { if (valueDict[row.__data__.value]) { row.$valueInput.parentNode.addClass('duplicate-cell'); res = false; } else { valueDict[row.__data__.value] = true; row.$valueInput.parentNode.removeClass('duplicate-cell'); } } } ; return res; }; /** * @returns {Boolean} */ ListEditor.prototype.checkEmpty = function () { var res = true; var rows = Array.apply(null, this.$body.childNodes); var row; for (var i = 0; i < rows.length; ++i) { row = rows[i]; if (row.__data__) { if (!row.__data__.text || row.__data__.text.trim() == '') { res = false; row.$textInput.parentNode.addClass('empty-cell'); } else { row.$textInput.parentNode.removeClass('empty-cell'); } if (!row.__data__.value || row.__data__.value.trim() == '') { res = false; row.$valueInput.parentNode.addClass('empty-cell'); } else { row.$valueInput.parentNode.removeClass('empty-cell'); } } } ; return res; }; ListEditor.prototype.removeRowByElt = function (rowElement) { rowElement.remove(); this._data = this._data.filter(function (item) { return rowElement.__data__ != item; }); if (this.checkEmpty() && this.checkDuplicate()) { this.notifyChange(); } }; ListEditor.prototype.removeRowByData = function (rowData) { this._data = this._data.filter(function (item) { return rowData != item; }); if (this.$view) ListEditor_$('.as-list-editor-row', this.$view, function (elt) { if (elt.__data__ == rowData) elt.remove(); return true; }); if (this.checkEmpty() && this.checkDuplicate()) { this.notifyChange(); } }; ListEditor.prototype.insertRowBeforeElt = function (elt) { var itemData = { text: '', value: '' }; var res = this.makeNewRow(itemData); this.$body.addChildBefore(res, elt); var index = this._data.indexOf(elt.__data__); this._data.splice(index, 0, itemData); return res; }; ListEditor.prototype.insertRowAfterElt = function (elt) { var itemData = { text: '', value: '' }; var res = this.makeNewRow(itemData); this.$body.addChildAfter(res, elt); var index = this._data.indexOf(elt.__data__); this._data.splice(index + 1, 0, itemData); return res; }; ListEditor.prototype.appendRowElement = function () { var itemData = { text: '', value: '' }; var res = this.makeNewRow(itemData); this.$body.addChildBefore(res, this.$addRow); this._data.push(itemData); if (this.checkEmpty() && this.checkDuplicate()) { this.notifyChange(); } return res; }; ListEditor.prototype.setData = function (items) { items = items || []; this._data = items; this.updateData(); }; ListEditor.prototype.getData = function () { return this._data; //todo }; /** * @returns {Number} */ ListEditor.prototype.getDataHash = function () { return this.data2Hash(this._data || []); }; ListEditor.prototype.data2Hash = function (data) { return data.reduce(function (hash, item, idx) { var c; var s = idx + ':' + item.text + ':' + item.value; for (var i = 0; i < s.length; ++i) { c = s.charCodeAt(i); hash = (hash << 5) - hash + c; hash |= 0; } return hash; }, 0); }; ListEditor.prototype.notifyChange = function () { var currentHash = this.getDataHash(); if (this._lashHashValue != currentHash) { this._lashHashValue = currentHash; this.emit('change', { target: this, hash: currentHash }, this); } }; /* harmony default export */ var editor_ListEditor = (ListEditor); // CONCATENATED MODULE: ./js/font/MaterialDesignIcons.js var linkElts = document.getElementsByTagName('link'); var linkElt; for (var MaterialDesignIcons_i = 0; MaterialDesignIcons_i < linkElts.length; ++MaterialDesignIcons_i) { linkElt = linkElts[MaterialDesignIcons_i]; if (linkElt.href && linkElt.href.indexOf('materialdesignicons') >= 0) break; } if (!linkElt || !linkElt.href || linkElt.href.indexOf('materialdesignicons') < 0) { linkElt = FCore._('<link rel="stylesheet" href="//cdn.materialdesignicons.com/4.5.95/css/materialdesignicons.min.css">').addTo(document.head); } var loadFontPromise = Network_XHR.getRequest(linkElt.href, 'text').then(function (text) { var regex = /\.mdi-([^:]+)::before/g; var iconNames = []; var iconNameMatch; do { iconNameMatch = regex.exec(text); if (iconNameMatch) iconNames.push(iconNameMatch[1]); } while (iconNameMatch); return { iconNames: iconNames }; }); function getMaterialDesignIconNames() { return loadFontPromise.then(function (data) { return data.iconNames; }); } ; function getMaterialDesignLinkElt() { return linkElt; } // EXTERNAL MODULE: ./css/fonticonpicker.css var fonticonpicker = __webpack_require__(225); // CONCATENATED MODULE: ./js/font/GoogleMaterialIcons.js var GOOGLE_MATERIAL_ICON_NAMES = ["backup", "3d_rotation", "accessibility", "accessibility_new", "accessible", "accessible_forward", "account_balance", "account_balance_wallet", "account_box", "account_circle", "add_shopping_cart", "alarm", "alarm_add", "alarm_off", "alarm_on", "all_inbox", "all_out", "android", "announcement", "arrow_right_alt", "aspect_ratio", "assessment", "assignment", "assignment_ind", "assignment_late", "assignment_return", "assignment_returned", "assignment_turned_in", "autorenew", "backup", "book", "bookmark", "bookmark_border", "bookmarks", "bug_report", "build", "cached", "calendar_today", "calendar_view_day", "camera_enhance", "cancel_schedule_send", "card_giftcard", "card_membership", "card_travel", "change_history", "check_circle", "check_circle_outline", "chrome_reader_mode", "class", "code", "commute", "compare_arrows", "contact_support", "contactless", "copyright", "credit_card", "dashboard", "date_range", "delete", "delete_forever", "delete_outline", "description", "dns", "done", "done_all", "done_outline", "donut_large", "donut_small", "drag_indicator", "eco", "eject", "euro_symbol", "event", "event_seat", "exit_to_app", "explore", "explore_off", "extension", "face", "favorite", "favorite_border", "feedback", "find_in_page", "find_replace", "fingerprint", "flight_land", "flight_takeoff", "flip_to_back", "flip_to_front", "g_translate", "gavel", "get_app", "gif", "grade", "group_work", "help", "help_outline", "highlight_off", "history", "home", "horizontal_split", "hourglass_empty", "hourglass_full", "http", "https", "important_devices", "info", "input", "invert_colors", "label", "label_important", "label_off", "language", "launch", "line_style", "line_weight", "list", "lock", "lock_open", "loyalty", "markunread_mailbox", "maximize", "minimize", "motorcycle", "note_add", "offline_bolt", "offline_pin", "opacity", "open_in_browser", "open_in_new", "open_with", "pageview", "pan_tool", "payment", "perm_camera_mic", "perm_contact_calendar", "perm_data_setting", "perm_device_information", "perm_identity", "perm_media", "perm_phone_msg", "perm_scan_wifi", "pets", "picture_in_picture", "picture_in_picture_alt", "play_for_work", "polymer", "power_settings_new", "pregnant_woman", "print", "query_builder", "question_answer", "receipt", "record_voice_over", "redeem", "remove_shopping_cart", "reorder", "report_problem", "restore", "restore_from_trash", "restore_page", "room", "rounded_corner", "rowing", "schedule", "search", "settings_applications", "settings_backup_restore", "settings_bluetooth", "settings_brightness", "settings_cell", "settings_ethernet", "settings_input_antenna", "settings_input_component", "settings_input_composite", "settings_input_hdmi", "settings_input_svideo", "settings_overscan", "settings_phone", "settings_power", "settings_remote", "settings_voice", "shop", "shop_two", "shopping_basket", "shopping_cart", "speaker_notes", "speaker_notes_off", "spellcheck", "stars", "store", "subject", "supervised_user_circle", "supervisor_account", "swap_horiz", "swap_horizontal_circle", "swap_vert", "swap_vertical_circle", "sync_alt", "system_update_alt", "tab", "tab_unselected", "text_rotate_up", "text_rotate_vertical", "text_rotation_angledown", "text_rotation_angleup", "text_rotation_down", "text_rotation_none", "theaters", "thumb_down", "thumb_up", "thumbs_up_down", "timeline", "toc", "today", "toll", "touch_app", "track_changes", "translate", "trending_down", "trending_flat", "trending_up", "turned_in", "turned_in_not", "update", "verified_user", "vertical_split", "view_agenda", "view_array", "view_carousel", "view_column", "view_day", "view_headline", "view_list", "view_module", "view_quilt", "view_stream", "view_week", "visibility", "visibility_off", "voice_over_off", "watch_later", "work", "work_off", "work_outline", "youtube_searched_for", "zoom_in", "zoom_out", "add_alert", "error", "error_outline", "notification_important", "warning", "4k", "add_to_queue", "airplay", "album", "art_track", "av_timer", "branding_watermark", "call_to_action", "closed_caption", "control_camera", "equalizer", "explicit", "fast_forward", "fast_rewind", "featured_play_list", "featured_video", "fiber_dvr", "fiber_manual_record", "fiber_new", "fiber_pin", "fiber_smart_record", "forward_10", "forward_30", "forward_5", "games", "hd", "hearing", "high_quality", "library_add", "library_books", "library_music", "loop", "mic", "mic_none", "mic_off", "missed_video_call", "movie", "music_video", "new_releases", "not_interested", "note", "pause", "pause_circle_filled", "pause_circle_outline", "play_arrow", "play_circle_filled", "play_circle_outline", "playlist_add", "playlist_add_check", "playlist_play", "queue", "queue_music", "queue_play_next", "radio", "recent_actors", "remove_from_queue", "repeat", "repeat_one", "replay", "replay_10", "replay_30", "replay_5", "shuffle", "skip_next", "skip_previous", "slow_motion_video", "snooze", "sort_by_alpha", "speed", "stop", "subscriptions", "subtitles", "surround_sound", "video_call", "video_label", "video_library", "videocam", "videocam_off", "volume_down", "volume_mute", "volume_off", "volume_up", "web", "web_asset", "business", "call", "call_end", "call_made", "call_merge", "call_missed", "call_missed_outgoing", "call_received", "call_split", "cancel_presentation", "chat", "chat_bubble", "chat_bubble_outline", "clear_all", "comment", "contact_mail", "contact_phone", "contacts", "desktop_access_disabled", "dialer_sip", "dialpad", "domain_disabled", "duo", "email", "forum", "import_contacts", "import_export", "invert_colors_off", "list_alt", "live_help", "mail_outline", "message", "mobile_screen_share", "no_sim", "pause_presentation", "person_add_disabled", "phone", "phone_disabled", "phone_enabled", "phonelink_erase", "phonelink_lock", "phonelink_ring", "phonelink_setup", "portable_wifi_off", "present_to_all", "print_disabled", "ring_volume", "rss_feed", "screen_share", "sentiment_satisfied_alt", "speaker_phone", "stay_current_landscape", "stay_current_portrait", "stay_primary_landscape", "stay_primary_portrait", "stop_screen_share", "swap_calls", "textsms", "unsubscribe", "voicemail", "vpn_key", "add", "add_box", "add_circle", "add_circle_outline", "amp_stories", "archive", "backspace", "ballot", "block", "clear", "create", "delete_sweep", "drafts", "dynamic_feed", "file_copy", "filter_list", "flag", "font_download", "forward", "gesture", "how_to_reg", "how_to_vote", "inbox", "link", "link_off", "low_priority", "mail", "markunread", "move_to_inbox", "next_week", "outlined_flag", "policy", "redo", "remove", "remove_circle", "remove_circle_outline", "reply", "reply_all", "report", "report_off", "save", "save_alt", "select_all", "send", "sort", "square_foot", "text_format", "unarchive", "undo", "waves", "where_to_vote", "access_alarm", "access_alarms", "access_time", "add_alarm", "add_to_home_screen", "airplanemode_active", "airplanemode_inactive", "battery_alert", "battery_charging_full", "battery_full", "battery_std", "battery_unknown", "bluetooth", "bluetooth_connected", "bluetooth_disabled", "bluetooth_searching", "brightness_auto", "brightness_high", "brightness_low", "brightness_medium", "data_usage", "developer_mode", "devices", "dvr", "gps_fixed", "gps_not_fixed", "gps_off", "graphic_eq", "location_disabled", "location_searching", "mobile_friendly", "mobile_off", "nfc", "screen_lock_landscape", "screen_lock_portrait", "screen_lock_rotation", "screen_rotation", "sd_storage", "settings_system_daydream", "signal_cellular_4_bar", "signal_cellular_alt", "signal_cellular_connected_no_internet_4_bar", "signal_cellular_no_sim", "signal_cellular_null", "signal_cellular_off", "signal_wifi_4_bar", "signal_wifi_4_bar_lock", "signal_wifi_off", "storage", "usb", "wallpaper", "widgets", "wifi_lock", "wifi_tethering", "add_comment", "attach_file", "attach_money", "bar_chart", "border_all", "border_bottom", "border_clear", "border_horizontal", "border_inner", "border_left", "border_outer", "border_right", "border_style", "border_top", "border_vertical", "bubble_chart", "drag_handle", "format_align_center", "format_align_justify", "format_align_left", "format_align_right", "format_bold", "format_clear", "format_color_reset", "format_indent_decrease", "format_indent_increase", "format_italic", "format_line_spacing", "format_list_bulleted", "format_list_numbered", "format_list_numbered_rtl", "format_paint", "format_quote", "format_shapes", "format_size", "format_strikethrough", "format_textdirection_l_to_r", "format_textdirection_r_to_l", "format_underlined", "functions", "height", "highlight", "insert_chart", "insert_chart_outlined", "insert_comment", "insert_drive_file", "insert_emoticon", "insert_invitation", "insert_link", "insert_photo", "linear_scale", "merge_type", "mode_comment", "monetization_on", "money_off", "multiline_chart", "notes", "pie_chart", "post_add", "publish", "scatter_plot", "score", "short_text", "show_chart", "space_bar", "strikethrough_s", "table_chart", "text_fields", "title", "vertical_align_bottom", "vertical_align_center", "vertical_align_top", "wrap_text", "attachment", "cloud", "cloud_circle", "cloud_done", "cloud_download", "cloud_off", "cloud_queue", "cloud_upload", "create_new_folder", "folder", "folder_open", "folder_shared", "cast", "cast_connected", "computer", "desktop_mac", "desktop_windows", "developer_board", "device_hub", "device_unknown", "devices_other", "dock", "gamepad", "headset", "headset_mic", "keyboard", "keyboard_arrow_down", "keyboard_arrow_left", "keyboard_arrow_right", "keyboard_arrow_up", "keyboard_backspace", "keyboard_capslock", "keyboard_hide", "keyboard_return", "keyboard_tab", "keyboard_voice", "laptop", "laptop_chromebook", "laptop_mac", "laptop_windows", "memory", "mouse", "phone_android", "phone_iphone", "phonelink", "phonelink_off", "power_input", "router", "scanner", "security", "sim_card", "smartphone", "speaker", "speaker_group", "tablet", "tablet_android", "tablet_mac", "toys", "tv", "videogame_asset", "watch", "add_a_photo", "add_photo_alternate", "add_to_photos", "adjust", "assistant", "assistant_photo", "audiotrack", "blur_circular", "blur_linear", "blur_off", "blur_on", "brightness_1", "brightness_2", "brightness_3", "brightness_4", "brightness_5", "brightness_6", "brightness_7", "broken_image", "brush", "burst_mode", "camera", "camera_alt", "camera_front", "camera_rear", "camera_roll", "center_focus_strong", "center_focus_weak", "collections", "collections_bookmark", "color_lens", "colorize", "compare", "control_point", "control_point_duplicate", "crop", "crop_16_9", "crop_3_2", "crop_5_4", "crop_7_5", "crop_din", "crop_free", "crop_landscape", "crop_original", "crop_portrait", "crop_rotate", "crop_square", "dehaze", "details", "edit", "euro", "exposure", "exposure_neg_1", "exposure_neg_2", "exposure_plus_1", "exposure_plus_2", "exposure_zero", "filter", "filter_1", "filter_2", "filter_3", "filter_4", "filter_5", "filter_6", "filter_7", "filter_8", "filter_9", "filter_9_plus", "filter_b_and_w", "filter_center_focus", "filter_drama", "filter_frames", "filter_hdr", "filter_none", "filter_tilt_shift", "filter_vintage", "flare", "flash_auto", "flash_off", "flash_on", "flip", "flip_camera_android", "flip_camera_ios", "gradient", "grain", "grid_off", "grid_on", "hdr_off", "hdr_on", "hdr_strong", "hdr_weak", "healing", "image", "image_aspect_ratio", "image_search", "iso", "landscape", "leak_add", "leak_remove", "lens", "linked_camera", "looks", "looks_3", "looks_4", "looks_5", "looks_6", "looks_one", "looks_two", "loupe", "monochrome_photos", "movie_creation", "movie_filter", "music_note", "music_off", "nature", "nature_people", "navigate_before", "navigate_next", "palette", "panorama", "panorama_fish_eye", "panorama_horizontal", "panorama_vertical", "panorama_wide_angle", "photo", "photo_album", "photo_camera", "photo_filter", "photo_library", "photo_size_select_actual", "photo_size_select_large", "photo_size_select_small", "picture_as_pdf", "portrait", "remove_red_eye", "rotate_90_degrees_ccw", "rotate_left", "rotate_right", "shutter_speed", "slideshow", "straighten", "style", "switch_camera", "switch_video", "tag_faces", "texture", "timelapse", "timer", "timer_10", "timer_3", "timer_off", "tonality", "transform", "tune", "view_comfy", "view_compact", "vignette", "wb_auto", "wb_cloudy", "wb_incandescent", "wb_iridescent", "wb_sunny", "360", "atm", "beenhere", "category", "compass_calibration", "departure_board", "directions", "directions_bike", "directions_boat", "directions_bus", "directions_car", "directions_railway", "directions_run", "directions_subway", "directions_transit", "directions_walk", "edit_attributes", "ev_station", "fastfood", "flight", "hotel", "layers", "layers_clear", "local_activity", "local_airport", "local_atm", "local_bar", "local_cafe", "local_car_wash", "local_convenience_store", "local_dining", "local_drink", "local_florist", "local_gas_station", "local_grocery_store", "local_hospital", "local_hotel", "local_laundry_service", "local_library", "local_mall", "local_movies", "local_offer", "local_parking", "local_pharmacy", "local_phone", "local_pizza", "local_play", "local_post_office", "local_printshop", "local_see", "local_shipping", "local_taxi", "map", "menu_book", "money", "museum", "my_location", "navigation", "near_me", "person_pin", "rate_review", "restaurant", "restaurant_menu", "satellite", "store_mall_directory", "streetview", "subway", "terrain", "traffic", "train", "tram", "transfer_within_a_station", "transit_enterexit", "trip_origin", "zoom_out_map", "apps", "arrow_back", "arrow_back_ios", "arrow_downward", "arrow_drop_down", "arrow_drop_down_circle", "arrow_drop_up", "arrow_forward", "arrow_forward_ios", "arrow_left", "arrow_right", "arrow_upward", "cancel", "check", "chevron_left", "chevron_right", "close", "double_arrow", "expand_less", "expand_more", "first_page", "fullscreen", "fullscreen_exit", "home_work", "last_page", "menu", "menu_open", "more_horiz", "more_vert", "refresh", "subdirectory_arrow_left", "subdirectory_arrow_right", "unfold_less", "unfold_more", "account_tree", "adb", "airline_seat_flat", "airline_seat_flat_angled", "airline_seat_individual_suite", "airline_seat_legroom_extra", "airline_seat_legroom_normal", "airline_seat_legroom_reduced", "airline_seat_recline_extra", "airline_seat_recline_normal", "bluetooth_audio", "confirmation_number", "disc_full", "drive_eta", "enhanced_encryption", "event_available", "event_busy", "event_note", "folder_special", "live_tv", "mms", "more", "network_check", "network_locked", "no_encryption", "ondemand_video", "personal_video", "phone_bluetooth_speaker", "phone_callback", "phone_forwarded", "phone_in_talk", "phone_locked", "phone_missed", "phone_paused", "power", "power_off", "priority_high", "sd_card", "sms", "sms_failed", "sync", "sync_disabled", "sync_problem", "system_update", "tap_and_play", "time_to_leave", "tv_off", "vibration", "voice_chat", "vpn_lock", "wc", "wifi", "wifi_off", "ac_unit", "airport_shuttle", "all_inclusive", "apartment", "bathtub", "beach_access", "business_center", "casino", "child_care", "child_friendly", "fitness_center", "free_breakfast", "golf_course", "hot_tub", "house", "kitchen", "meeting_room", "no_meeting_room", "pool", "room_service", "rv_hookup", "smoke_free", "smoking_rooms", "spa", "storefront", "cake", "deck", "emoji_emotions", "emoji_events", "emoji_flags", "emoji_food_beverage", "emoji_nature", "emoji_objects", "emoji_people", "emoji_symbols", "emoji_transportation", "fireplace", "group", "group_add", "king_bed", "location_city", "mood", "mood_bad", "nights_stay", "notifications", "notifications_active", "notifications_none", "notifications_off", "notifications_paused", "outdoor_grill", "pages", "party_mode", "people", "people_alt", "people_outline", "person", "person_add", "person_outline", "plus_one", "poll", "public", "school", "sentiment_dissatisfied", "sentiment_satisfied", "sentiment_very_dissatisfied", "sentiment_very_satisfied", "share", "single_bed", "sports", "sports_baseball", "sports_basketball", "sports_cricket", "sports_esports", "sports_football", "sports_golf", "sports_handball", "sports_hockey", "sports_kabaddi", "sports_mma", "sports_motorsports", "sports_rugby", "sports_soccer", "sports_tennis", "sports_volleyball", "thumb_down_alt", "thumb_up_alt", "whatshot", "check_box", "check_box_outline_blank", "indeterminate_check_box", "radio_button_checked", "radio_button_unchecked", "star", "star_border", "star_half", "toggle_off", "toggle_on"]; // CONCATENATED MODULE: ./js/font/FontIconPicker.js var FontIconPicker_ = FCore._; var FontIconPicker_$ = FCore.$; function FontIconPicker() { AppPattern_Context.call(this); EventEmitter["a" /* default */].call(this); this._fontIndex = 0; this._viewingFontIndex = -1; } Object.defineProperties(FontIconPicker.prototype, Object.getOwnPropertyDescriptors(AppPattern_Context.prototype)); Object.defineProperties(FontIconPicker.prototype, Object.getOwnPropertyDescriptors(EventEmitter["a" /* default */].prototype)); FontIconPicker.prototype.constructor = FontIconPicker; FontIconPicker.prototype.getView = function () { if (this.$view) return this.$view; var self = this; this.$view = FontIconPicker_({ "class": 'as-font-icon-picker', child: ['searchtextinput', { tag: 'selectmenu', "class": 'as-font-icon-picker-select-font', props: { items: [{ text: 'Material Design Icons', value: 0 }, { text: 'Google Material Icons', value: 1 }] }, value: this._fontIndex, on: { change: this.updateContent.bind(this) } }, // { // class: 'as-font-icon-picker-option', // child: [ // { // tag: 'checkbox', // props: { // text: 'Outline', // checked: true // } // } // ] // }, { tag: 'bscroller', "class": ['as-font-icon-picker-content', 'as-font-icon-picker-material-design-icons'] }, { tag: 'bscroller', "class": ['as-font-icon-picker-content', 'as-font-icon-picker-google-material-icons'] }] }); this.$searchInput = FontIconPicker_$('searchtextinput', this.$view).on('stoptyping', this.search.bind(this)); this.$selectFont = FontIconPicker_$('.as-font-icon-picker-select-font', this.$view); this.$option = FontIconPicker_$('.as-font-icon-picker-option', this.$view); this.$materialDesignContent = FontIconPicker_$('.as-font-icon-picker-content.as-font-icon-picker-material-design-icons', this.$view); this.$googleMaterialContent = FontIconPicker_$('.as-font-icon-picker-content.as-font-icon-picker-google-material-icons', this.$view); this.$mdiButtons = []; this.$googleMaterialIconButtons = []; this.$view.on('click', this.ev_clickContent.bind(this)); getMaterialDesignIconNames().then(function (result) { for (var i = 0; i < result.length; ++i) { self.$mdiButtons.push(FontIconPicker_({ tag: 'button', "class": 'as-font-icon-picker-icon', child: 'span.mdi.mdi-' + result[i], attr: { title: result[i] }, props: { __keywods__: result[i].split(/[\-\_\s]+/), __data__: 'span.mdi.mdi-' + result[i] } }).addTo(self.$materialDesignContent)); } }); GOOGLE_MATERIAL_ICON_NAMES.forEach(function (name) { self.$googleMaterialIconButtons.push(FontIconPicker_({ tag: 'button', "class": 'as-font-icon-picker-icon', attr: { title: name }, props: { __keywods__: name.split(/[\-\_\s]+/), __data__: '<i class="material-icons">' + name + '</i>' }, child: { tag: 'i', "class": 'material-icons', child: { text: name } } }).addTo(self.$googleMaterialContent)); }); this.updateContent(); return this.$view; }; FontIconPicker.prototype.ev_clickContent = function (event) { var target = event.target; while (target != this.$view && target) { if (target.containsClass('as-font-icon-picker-icon')) break; target = target.parentNode; } if (target && target.containsClass('as-font-icon-picker-icon')) { console.log(target.__data__); } }; FontIconPicker.prototype.updateContent = function () { this._fontIndex = this.$selectFont.value; if (this._fontIndex == 0) this.showMaterialDesignIcons();else if (this._fontIndex == 1) this.showGoogleMaterialIcons(); var keyword = this.$searchInput.value.trim().split(/[\-\_\s]+/).filter(function (w) { return !!w; }); }; FontIconPicker.prototype.showMaterialDesignIcons = function () { this._fontIndex = 0; if (!this.$view) return; if (this._viewingFontIndex == 0) return; this._viewingFontIndex = 0; this.$materialDesignContent.removeStyle('display'); this.$googleMaterialContent.addStyle('display', 'none'); this.search(); }; FontIconPicker.prototype.showGoogleMaterialIcons = function () { this._fontIndex = 1; if (!this.$view) return; if (this._viewingFontIndex == 1) return; this._viewingFontIndex = 1; this.$materialDesignContent.addStyle('display', 'none'); this.$googleMaterialContent.removeStyle('display'); this.search(); }; FontIconPicker.prototype.search = function () { var keyword = this.$searchInput.value.trim().split(/[\-\_\s]+/).filter(function (w) { return !!w; }); var viewList = this._fontIndex == 0 ? this.$mdiButtons : this.$googleMaterialIconButtons; var contentElt = this._fontIndex == 0 ? this.$materialDesignContent : this.$googleMaterialContent; if (keyword.length > 0) { var list = viewList.map(function (button) { return { elt: button, value: wordsMatch(keyword, button.__keywods__) }; }); list.sort(function (a, b) { return b.value - a.value; }); var minValue = list[0].value; var maxValue = list[list.length - 1].value; var midValue = (minValue * 2 + maxValue) / 3; list = list.filter(function (item) { return item.value > midValue; }); viewList = list.map(function (item) { return item.elt; }); } contentElt.clearChild(); viewList.forEach(function (elt) { elt.addTo(contentElt); }); }; Dom["a" /* default */].documentReady.then(function () { var test = new FontIconPicker(); test.getView().addTo(document.body); }); /* harmony default export */ var font_FontIconPicker = (FontIconPicker); // CONCATENATED MODULE: ./js/editor/PropertyEditor.js function PropertyEditor_typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { PropertyEditor_typeof = function _typeof(obj) { return typeof obj; }; } else { PropertyEditor_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return PropertyEditor_typeof(obj); } // FontIconPicker getMaterialDesignIconNames(); var PropertyEditor_ = FCore._; var PropertyEditor_$ = FCore.$; function PropertyEditor() { AppPattern_Context.call(this); EventEmitter["a" /* default */].call(this); this.$view = null; /** * @type {import('../core/BaseComponent').default} */ this.object = null; this.propertyNames = []; this.$needUpdate = []; // all element which had .as-need-update } Object.defineProperties(PropertyEditor.prototype, Object.getOwnPropertyDescriptors(AppPattern_Context.prototype)); Object.defineProperties(PropertyEditor.prototype, Object.getOwnPropertyDescriptors(EventEmitter["a" /* default */].prototype)); PropertyEditor.prototype.constructor = PropertyEditor; PropertyEditor.prototype.onStart = function () {}; PropertyEditor.prototype.edit = function (object) { this.object = object; this.loadAttributes(); }; PropertyEditor.prototype.setProperty = function (name, value) { return this.object[name] = value; }; PropertyEditor.prototype.getProperty = function (name) { return this.object[name]; }; PropertyEditor.prototype.getPropertyDescriptor = function (name) { return { type: PropertyEditor_typeof(this.object) }; }; PropertyEditor.prototype.getPropertyNames = function () { return Object.keys(this.object); }; PropertyEditor.prototype.loadAttributes = function () { var self = this; self.$body.clearChild(); this.propertyNames = []; this.$rows = []; this.$needUpdate = []; if (!this.object) return; this.propertyNames = this.getPropertyNames(); this.propertyNames.forEach(function (name) { var descriptor = self.getPropertyDescriptor(name); var functionName = 'create' + Object(stringFormat["camelCaseToPascalCase"])(descriptor.type) + 'InputRow'; if (!self[functionName]) { // throw new Error('Not support type' + descriptor.type + '!') functionName = 'createNotSupportInputRow'; } ; var rowElt = self[functionName](name, descriptor); rowElt.addTo(self.$body); self.$rows.push(rowElt); }); PropertyEditor_$('.as-need-update', this.$body, function (elt) { self.$needUpdate.push(elt); }); }; PropertyEditor.prototype.notifyChangeToProperties = function (name, from) { var e; for (var i = 0; i < this.$needUpdate.length; ++i) { e = this.$needUpdate[i]; if (e.notifyChange) e.notifyChange(name, from); } }; PropertyEditor.prototype.createEnumInputRow = function (name, descriptor) { var self = this; var res = PropertyEditor_({ tag: 'tr', child: [{ tag: 'td', child: { text: name } }, { tag: 'td', child: { tag: 'selectmenu', "class": 'as-need-update', props: { items: descriptor.values.map(function (value) { return { text: value + "", value: value }; }), notifyChange: function notifyChange() { var value = self.getProperty(name); if (value != this.value) { this.value = value; } }, value: this.getProperty(name) }, on: { change: function change() { self.setProperty(name, this.value); self.notifyChange(name, this); self.notifyStopChange(name); } } } }] }); return res; }; PropertyEditor.prototype.createFontInputRow = function (name, descriptor) { var self = this; var res = PropertyEditor_({ tag: 'tr', child: [{ tag: 'td', child: { text: name } }, { tag: 'td', child: { tag: 'selectmenu', "class": 'as-need-update', props: { items: [{ text: 'None', value: undefined }].concat(FONT_ITEMS), notifyChange: function notifyChange() { var value = self.getProperty(name); if (value != this.value) { this.value = value; } }, value: this.getProperty(name) }, on: { change: function change() { self.setProperty(name, this.value); self.notifyChange(name, this); self.notifyStopChange(name); } } } }] }); return res; }; PropertyEditor.prototype.createConstInputRow = function (name, descriptor) { var self = this; var res = PropertyEditor_({ tag: 'tr', child: [{ tag: 'td', child: { text: name } }, { tag: 'td', attr: { colspan: '3' }, child: { tag: 'strong', "class": 'as-need-update', props: { notifyChange: function notifyChange() { var descriptor = self.getPropertyDescriptor(name); if (PropertyEditor_typeof(descriptor.value) == 'object' && descriptor.value.then) { descriptor.value.then(function (value) { res.$text.clearChild().addChild(PropertyEditor_({ text: value + '' })); }); } else { res.$text.clearChild().addChild(PropertyEditor_({ text: descriptor.value + '' })); } } } } }] }); res.$text = PropertyEditor_$('strong', res); if (PropertyEditor_typeof(descriptor.value) == 'object' && descriptor.value.then) { descriptor.value.then(function (value) { res.$text.clearChild().addChild(PropertyEditor_({ text: value + '' })); }); } else { res.$text.clearChild().addChild(PropertyEditor_({ text: descriptor.value + '' })); } return res; }; PropertyEditor.prototype.createTextInputRow = function (name, descriptor) { var self = this; var res = PropertyEditor_({ tag: 'tr', child: [{ tag: 'td', child: { text: name } }, { tag: 'td', attr: { colspan: '3' }, child: { tag: descriptor["long"] ? 'textarea' : 'input', "class": 'as-need-update', attr: { type: 'text' }, props: { value: this.getProperty(name), notifyChange: function notifyChange() { var value = self.getProperty(name); if (value != this.value) { this.value = value; } } }, on: { keyup: function keyup() { self.setProperty(name, this.value); self.notifyChange(name, this); }, change: function change() { self.notifyStopChange(name); } } } }] }); return res; }; PropertyEditor.prototype.createBoolInputRow = function (name, descriptor) { var self = this; var res = PropertyEditor_({ tag: 'tr', child: [{ tag: 'td', child: { text: name } }, { tag: 'td', attr: { colspan: '3' }, child: { tag: 'checkboxbutton', "class": 'as-need-update', props: { checked: this.getProperty(name), notifyChange: function notifyChange() { var value = self.getProperty(name); if (value != this.checked) { this.checked = value; } } }, on: { change: function change() { self.setProperty(name, this.checked); self.notifyChange(name, this); self.notifyStopChange(name); } } } }] }); return res; }; PropertyEditor.prototype.createDateInputRow = function (name, descriptor) { var self = this; var res = PropertyEditor_({ tag: 'tr', child: [{ tag: 'td', child: { text: name } }, { tag: 'td', attr: descriptor.nullable ? { colspan: '2' } : { colspan: '3' }, child: { tag: 'calendarinput', "class": 'as-need-update', props: { disabled: descriptor.disabled, value: self.getProperty(name), notifyChange: function notifyChange() { var value = self.getProperty(name); if (!value) this.value = null;else this.value = value; this.disabled = self.getPropertyDescriptor(name).disabled; } }, on: { change: function change() { self.setProperty(name, this.value); self.notifyChange(name, this); self.notifyStopChange(name); } } } }].concat(descriptor.nullable ? [{ tag: 'td', child: [{ text: 'NULL ' }, { tag: 'checkboxbutton', "class": 'as-need-update', props: { checked: !self.getProperty(name), notifyChange: function notifyChange() { this.checked = !self.getProperty(name); } }, on: { change: function change() { if (this.checked) { self.setProperty(name, null); } else { self.setProperty(name, beginOfDay(new Date())); } self.notifyChange(name, this); self.notifyStopChange(name); } } }] }] : []) }); return res; }; PropertyEditor.prototype.createNumberInputRow = function (name, descriptor) { var self = this; var res = PropertyEditor_({ tag: 'tr', child: [{ tag: 'td', child: { text: name } }, { tag: 'td', attr: descriptor.nullable ? { colspan: '2' } : { colspan: '3' }, child: { tag: 'numberinput', "class": 'as-need-update', props: { min: typeof descriptor.min == 'number' ? descriptor.min : -Infinity, max: typeof descriptor.max == 'number' ? descriptor.max : Infinity, value: self.getProperty(name), disabled: descriptor.disabled, notifyChange: function notifyChange() { var value = self.getProperty(name); if (value === null) this.value = descriptor.defaultValue;else this.value = value; this.disabled = self.getPropertyDescriptor(name).disabled; } }, on: { change: function change(event) { if (event.by == 'keyup') return; if (!descriptor.livePreview && event.by == 'long_press_button') return; self.setProperty(name, this.value); self.notifyChange(name, this); if (event.by != 'long_press_button') self.notifyStopChange(name); } } } }].concat(descriptor.nullable ? [{ tag: 'td', child: [{ text: 'NULL ' }, { tag: 'checkboxbutton', "class": 'as-need-update', props: { checked: self.getProperty(name) === null, notifyChange: function notifyChange() { this.checked = self.getProperty(name) === null; } }, on: { change: function change() { if (this.checked) { self.setProperty(name, null); } else { self.setProperty(name, descriptor.defaultValue); } self.notifyChange(name, this); } } }] }] : []) }); return res; }; PropertyEditor.prototype.createListInputRow = function (name, descriptor) { var self = this; var listEditor = new editor_ListEditor(); var res = PropertyEditor_({ tag: 'tr', child: [{ tag: 'td', child: { text: name } }, { tag: 'td', attr: { colspan: '3' }, child: listEditor.getView() }] }); listEditor.on('change', function () { self.setProperty(name, this.getData()); self.notifyStopChange(name); }); listEditor.start(); listEditor.setData(this.getProperty(name)); return res; }; PropertyEditor.prototype.createNotSupportInputRow = function (name, descriptor) { var res = PropertyEditor_({ tag: 'tr', child: [{ tag: 'td', child: { text: name } }, { tag: 'td', attr: { colspan: '3' }, child: [{ text: 'Not support ' }, { tag: 'strong', child: { text: descriptor.type } }] }] }); return res; }; PropertyEditor.prototype.getView = function () { if (this.$view) return this.$view; this.$view = PropertyEditor_({ tag: 'table', "class": 'as-property-editor', child: [{ tag: 'thead', child: [{ tag: 'tr', child: [{ tag: 'td', child: { text: "key" } }, { tag: 'td', attr: { colspan: '3' }, child: { text: 'value' } }] }] }, { tag: 'tbody' }] }); this.$body = PropertyEditor_$('tbody', this.$view); return this.$view; }; PropertyEditor.prototype.notifyChange = function (name, from) { this.notifyChangeToProperties(name, from); this.emit('change', { type: 'change', target: this, from: from, name: name, object: this.object }, this); }; PropertyEditor.prototype.notifyStopChange = function (name) { this.emit('stopchange', { type: 'stopchange', name: name, object: this.object }, this); }; /* harmony default export */ var editor_PropertyEditor = (PropertyEditor); // CONCATENATED MODULE: ./js/editor/AttributeEditor.js function AttributeEditor() { editor_PropertyEditor.call(this); } Object.defineProperties(AttributeEditor.prototype, Object.getOwnPropertyDescriptors(editor_PropertyEditor.prototype)); AttributeEditor.prototype.constructor = AttributeEditor; AttributeEditor.prototype.setProperty = function (name, value) { return this.object.setAttribute(name, value); }; AttributeEditor.prototype.getProperty = function (name) { return this.object.getAttribute(name); }; AttributeEditor.prototype.getPropertyDescriptor = function (name) { return this.object.getAttributeDescriptor(name); }; AttributeEditor.prototype.getPropertyNames = function () { return this.object.getAcceptsAttributeNames(); }; /* harmony default export */ var editor_AttributeEditor = (AttributeEditor); // CONCATENATED MODULE: ./js/editor/StyleEditor.js function StyleEditor() { editor_PropertyEditor.call(this); } Object.defineProperties(StyleEditor.prototype, Object.getOwnPropertyDescriptors(editor_PropertyEditor.prototype)); StyleEditor.prototype.constructor = StyleEditor; StyleEditor.prototype.setProperty = function (name, value) { return this.object.setStyle(name, value); }; StyleEditor.prototype.getProperty = function (name) { return this.object.getStyle(name); }; StyleEditor.prototype.getPropertyDescriptor = function (name) { return this.object.getStyleDescriptor(name); }; StyleEditor.prototype.getPropertyNames = function () { return this.object.getAcceptsStyleNames(); }; /* harmony default export */ var editor_StyleEditor = (StyleEditor); // CONCATENATED MODULE: ./js/editor/AllPropertyEditor.js function AllPropertyEditor() { editor_PropertyEditor.call(this); this.propertyGroup = {}; } Object.defineProperties(AllPropertyEditor.prototype, Object.getOwnPropertyDescriptors(editor_PropertyEditor.prototype)); AllPropertyEditor.prototype.constructor = AllPropertyEditor; AllPropertyEditor.prototype.setProperty = function (name, value) { if (this.propertyGroup.attributes[name]) return this.object.setAttribute(this.propertyGroup.attributes[name], value); if (this.propertyGroup.style[name]) return this.object.setStyle(this.propertyGroup.style[name], value); throw new Error('not found ' + name); }; AllPropertyEditor.prototype.getProperty = function (name) { if (this.propertyGroup.attributes[name]) return this.object.getAttribute(this.propertyGroup.attributes[name]); if (this.propertyGroup.style[name]) return this.object.getStyle(this.propertyGroup.style[name]); throw new Error('not found ' + name); }; AllPropertyEditor.prototype.getPropertyDescriptor = function (name) { if (this.propertyGroup.attributes[name]) return this.object.getAttributeDescriptor(this.propertyGroup.attributes[name]); if (this.propertyGroup.style[name]) return this.object.getStyleDescriptor(this.propertyGroup.style[name]); throw new Error('not found ' + name); }; AllPropertyEditor.prototype.getPropertyNames = function () { var attributes = this.object.getAcceptsAttributeNames(); var style = this.object.getAcceptsStyleNames(); this.propertyGroup.attributes = attributes.reduce(function (ac, cr) { ac[cr] = cr; return ac; }, {}); this.propertyGroup.style = style.reduce(function (ac, cr) { ac[cr] = cr; return ac; }, {}); var key; for (key in this.propertyGroup.attributes) { if (this.propertyGroup.style[key]) { delete this.propertyGroup.attributes[key]; delete this.propertyGroup.style[key]; this.propertyGroup.attributes[key + '(attribute)'] = key; this.propertyGroup.style[key + '(style)'] = key; } } return Object.keys(this.propertyGroup.attributes).concat(Object.keys(this.propertyGroup.style)).sort(); }; /* harmony default export */ var editor_AllPropertyEditor = (AllPropertyEditor); // EXTERNAL MODULE: ./css/componentoutline.css var componentoutline = __webpack_require__(227); // CONCATENATED MODULE: ./js/editor/ComponentOutline.js var ComponentOutline_ = FCore._; var ComponentOutline_$ = FCore.$; function ComponentOutline() { AppPattern_Context.call(this); EventEmitter["a" /* default */].call(this); this.$view = null; /** * @type {import('./LayoutEditor').default} */ this.mLayoutEditor = null; this.activeComponents = []; this.$expNodes = []; this.$focusNode = undefined; this._lastPressTime = 0; } Object.defineProperties(ComponentOutline.prototype, Object.getOwnPropertyDescriptors(AppPattern_Context.prototype)); Object.defineProperties(ComponentOutline.prototype, Object.getOwnPropertyDescriptors(EventEmitter["a" /* default */].prototype)); ComponentOutline.prototype.constructor = ComponentOutline; ComponentOutline.prototype.onStart = function () { this.mLayoutEditor = this.getContext(R.LAYOUT_EDITOR); }; ComponentOutline.prototype.ev_contextNode = function (comp, event) { var self = this; var items = [{ icon: 'span.mdi.mdi-delete-variant', text: 'Delete', cmd: 'delete', extendStyle: { color: 'red' } }]; var anchorEditor = this.mLayoutEditor.findAnchorEditorByComponent(comp); if (anchorEditor) { anchorEditor.focus(); } else { this.mLayoutEditor.setActiveComponent(comp); } if (this.mLayoutEditor.anchorEditors.length == 1) { items = [{ icon: 'span.mdi.mdi-arrow-collapse-up', text: 'Move To Top', cmd: 'move-to-top' }, { icon: 'span.mdi.mdi-arrow-up', text: 'Move Up', cmd: 'move-up' }, { icon: 'span.mdi.mdi-arrow-down', text: 'Move Down', cmd: 'move-down' }, { icon: 'span.mdi.mdi-arrow-collapse-down', text: 'Move To Bottom', cmd: 'move-to-bottom' }, '================='].concat(items); } event.stopPropagation(); event.showContextMenu({ items: items }, function (event) { switch (event.menuItem.cmd) { case "delete": if (comp.parent) { self.mLayoutEditor.removeComponent(comp); } break; case 'move-to-top': self.moveToTop(comp); break; case 'move-up': self.moveUp(comp); break; case 'move-down': self.moveDown(comp); break; case 'move-to-bottom': self.moveToBottom(comp); break; } }); }; ComponentOutline.prototype.moveToTop = function (comp) { this.mLayoutEditor.moveToTopComponent(comp); }; ComponentOutline.prototype.moveUp = function (comp) { this.mLayoutEditor.moveUpComponent(comp); this.updateComponetTree(); }; ComponentOutline.prototype.moveDown = function (comp) { this.mLayoutEditor.moveDownComponent(comp); this.updateComponetTree(); }; ComponentOutline.prototype.moveToBottom = function (comp) { this.mLayoutEditor.moveToBottomComponent(comp); this.updateComponetTree(); }; ComponentOutline.prototype.updateComponetTree = function () { var self = this; this.$expNodes = []; if (this.$exptree) { this.$exptree.remove(); this.$exptree = undefined; } function onPressNode(comp, event) { if (event.shiftKey) self.mLayoutEditor.toggleActiveComponent(comp);else self.mLayoutEditor.setActiveComponent(comp); } function visit(expTree, comp) { if (comp.children) { comp.children.forEach(function (childComp) { var childElt = ComponentOutline_({ tag: 'exptree', props: { icon: childComp.menuIcon, name: childComp.getAttribute('name'), __comp__: childComp } }); childElt.getNode().defineEvent(['contextmenu']); childElt.getNode().on({ click: onPressNode.bind(null, childComp), contextmenu: self.ev_contextNode.bind(self, childComp) }); expTree.addChild(childElt); self.$expNodes.push(childElt); visit(childElt, childComp); }); } } if (this.mLayoutEditor.rootLayout) { this.$exptree = ComponentOutline_({ tag: 'exptree', props: { status: 'open', icon: this.mLayoutEditor.rootLayout.menuIcon, name: this.mLayoutEditor.rootLayout.getAttribute('name'), __comp__: this.mLayoutEditor.rootLayout, __isRoot__: true }, on: { press: onPressNode } }); this.$expNodes.push(this.$exptree); visit(this.$exptree, this.mLayoutEditor.rootLayout); if (this.$view) { this.$view.addChild(this.$exptree); } } this.updateComponentStatus(); }; ComponentOutline.prototype.updateComponentStatus = function () { this.$focusNode = undefined; var nodeElt; var editor; for (var i = 0; i < this.$expNodes.length; ++i) { nodeElt = this.$expNodes[i]; editor = undefined; for (var j = 0; j < this.mLayoutEditor.anchorEditors.length; ++j) { if (this.mLayoutEditor.anchorEditors[j].component == nodeElt.__comp__) { editor = this.mLayoutEditor.anchorEditors[j]; } if (editor) { nodeElt.addClass('as-component-outline-node-selected'); if (editor.isFocus) { nodeElt.addClass('as-component-outline-node-focus'); this.$focusNode = nodeElt; } else { nodeElt.removeClass('as-component-outline-node-focus'); } } else { nodeElt.removeClass('as-component-outline-node-selected'); nodeElt.removeClass('as-component-outline-node-focus'); } } } // console.log(this.mLayoutEditor.getActivatedComponents()); }; ComponentOutline.prototype.getView = function () { if (this.$view) return this.$view; this.$view = ComponentOutline_({ "class": 'as-component-outline', attr: { tabindex: '1' }, on: { keydown: this.ev_keydown.bind(this) } }); if (this.$exptree) this.$view.addChild(this.$exptree); return this.$view; }; ComponentOutline.prototype.ev_keydown = function (event) { var now = new Date().getTime(); if (now - this._lastPressTime < 50) return; this._lastPressTime = now; switch (event.key) { case 'Down': case 'ArrowDown': if (this.$focusNode) this.selectNext(this.$focusNode.__comp__); break; case 'Up': case 'ArrowUp': if (this.$focusNode) this.selectPrev(this.$focusNode.__comp__); break; } }; ComponentOutline.prototype.selectNext = function (component) { var prev = undefined; var self = this; ComponentOutline_$('exptree', this.$view, function (node) { if (node.__comp__ == component) { prev = node; } else if (prev) { self.mLayoutEditor.setActiveComponent(node.__comp__); node.$node.focus(); return true; } }); }; ComponentOutline.prototype.selectPrev = function (component) { var prev = undefined; var self = this; ComponentOutline_$('exptree', this.$view, function (node) { if (node.__comp__ == component) { if (prev) { self.mLayoutEditor.setActiveComponent(prev.__comp__); prev.$node.focus(); return true; } } prev = node; }); }; /* harmony default export */ var editor_ComponentOutline = (ComponentOutline); // EXTERNAL MODULE: ./css/undohistory.css var undohistory = __webpack_require__(229); // CONCATENATED MODULE: ./js/editor/UndoHistory.js var UndoHistory_ = FCore._; var UndoHistory_$ = FCore.$; function UndoHistory() { EventEmitter["a" /* default */].call(this); AppPattern_Context.call(this); this._lastPosition = undefined; this.items = []; this.lastItemIndex = this.items.length - 1; } Object.defineProperties(UndoHistory.prototype, Object.getOwnPropertyDescriptors(AppPattern_Context.prototype)); Object.defineProperties(UndoHistory.prototype, Object.getOwnPropertyDescriptors(EventEmitter["a" /* default */].prototype)); UndoHistory.prototype.constructor = UndoHistory; UndoHistory.prototype.ev_clickDockBtn = function () { this.$view.removeClass('as-minimize'); if (this._lastPosition) { var bound = this.$view.getBoundingClientRect(); } }; UndoHistory.prototype.ev_clickMinimizeBtn = function () { this.$view.addClass('as-minimize'); }; UndoHistory.prototype.ev_relocation = function () {}; UndoHistory.prototype.getView = function () { if (this.$view) return this.$view; this.$view = UndoHistory_({ tag: 'onscreenwindow', "class": ['as-undo-history', 'as-minimize-x'], props: { windowTitle: 'Undo Manager', windowIcon: 'span.mdi.mdi-cogs' }, child: [{ "class": 'as-undo-history-active-buttons', child: [{ tag: 'button', "class": 'as-undo-history-active-undo', attr: { title: 'Undo' }, props: { disabled: true }, child: 'span.mdi.mdi-undo' }, { tag: 'button', "class": 'as-undo-history-active-redo', attr: { title: 'Redo' }, props: { disabled: true }, child: 'span.mdi.mdi-redo' }, { "class": 'as-undo-history-active-buttons-right-container', child: { tag: 'button', attr: { title: 'Clear' }, "class": 'as-undo-history-active-clear', child: 'span.mdi.mdi-delete' } }] }, { tag: 'bscroller', "class": ['as-undo-history-item-list'], child: this.items.map(function (item) { return item.getView(); }) }] }); this.$view.$dockBtn.on('click', this.ev_clickDockBtn.bind(this)); this.$view.$minimizeBtn.on('click', this.ev_clickMinimizeBtn.bind(this)); this.$view.on('relocation', this.ev_relocation.bind(this)); this.$list = UndoHistory_$('.as-undo-history-item-list', this.$view); this.$undoBtn = UndoHistory_$('button.as-undo-history-active-undo', this.$view).on('click', this.undo.bind(this)); this.$redoBtn = UndoHistory_$('button.as-undo-history-active-redo', this.$view).on('click', this.redo.bind(this)); this.$clear = UndoHistory_$('button.as-undo-history-active-clear', this.$view).on('click', this.clear.bind(this)); return this.$view; }; UndoHistory.prototype.onResume = function () { var view = this.getView(); view.addTo(document.body); var bound = view.getBoundingClientRect(); var layoutEditor = this.getContext(R.LAYOUT_EDITOR); if (layoutEditor) { var layoutBound = layoutEditor.getView().getBoundingClientRect(); view.addStyle('left', layoutBound.right - bound.width + 'px'); view.addStyle('top', layoutBound.top + 'px'); } }; UndoHistory.prototype.onPause = function () { this.getView().remove(); }; UndoHistory.prototype.checkout = function (item, viewOnly) { var cItem; var found = false; for (var i = this.items.length - 1; i >= 0; --i) { cItem = this.items[i]; if (cItem == item) { cItem.setActive(true); found = true; this.lastItemIndex = i; } else { cItem.setActive(false); } cItem.setDisabled(!found); } this.$list.scrollInto(item.getView()); this.$undoBtn.disabled = this.lastItemIndex <= 0; this.$redoBtn.disabled = this.lastItemIndex >= this.items.length - 1; if (!viewOnly) this.emit('checkout', { type: 'checkout', target: this, item: item }, this); }; UndoHistory.prototype.undo = function () { if (this.lastItemIndex > 0) { this.checkout(this.items[this.lastItemIndex - 1]); } }; UndoHistory.prototype.redo = function () { if (this.lastItemIndex < this.items.length - 1) { this.checkout(this.items[this.lastItemIndex + 1]); } }; /** * @param {String} type * @param {*} data * @param {String} description * @param {Date} timestamp */ UndoHistory.prototype.commit = function (type, data, description, timestamp) { var item; while (this.items.length > this.lastItemIndex + 1) { item = this.items.pop(); item.getView().remove(); } var res = new UndoHistoryItem(this, type, data, description, timestamp); this.items.push(res); this.$list.addChild(res.getView()); this.checkout(res, true); return res; }; UndoHistory.prototype.clear = function () { if (this.items.length < 2) return; var lastItem = this.items.pop(); var lastData = lastItem.data; lastItem.getView().remove(); while (this.items.length > 0) { lastItem = this.items.pop(); lastItem.getView().remove(); } this.commit('clear', lastData, 'Clear History'); }; UndoHistory.prototype.renew = function () { while (this.items.length > 0) { lastItem = this.items.pop(); lastItem.getView().remove(); } }; /** * @param {UndoHistory}parent * @param {String} type * @param {*} data * @param {String} description * @param {Date} timestamp */ function UndoHistoryItem(parent, type, data, description, timestamp) { this.parent = parent; this.type = type || 'edit'; this.data = data; this.description = description || 'Change'; this.timestamp = timestamp || new Date(); this._active = false; this._disabled = false; } UndoHistoryItem.prototype.typeIcon = { move: 'span.mdi.mdi-move-resize', remove: 'span.mdi.mdi-delete-variant[style="color: rgb(255,59,59)"]', 'edit-attribute': 'span.mdi.mdi-circle-edit-outline', edit: 'span.mdi.mdi-circle-edit-outline', add: 'span.mdi.mdi-pen-plus', 'set-data': 'span.mdi.mdi-open-in-app', 'move-resize': 'span.mdi.mdi-move-resize', 'move-order': 'span.mdi.mdi-arrow-up-down-bold', 'clear': 'span.mdi.mdi-check-outline' }; UndoHistoryItem.prototype.setActive = function (bool) { this._active = !!bool; if (this.$view) { if (bool) { this.$view.addClass('as-undo-history-item-active'); } else { this.$view.removeClass('as-undo-history-item-active'); } } }; UndoHistoryItem.prototype.setDisabled = function (bool) { this._disabled = !!bool; if (this.$view) { if (bool) { this.$view.addClass('as-undo-history-item-disabled'); } else { this.$view.removeClass('as-undo-history-item-disabled'); } } }; UndoHistoryItem.prototype.getActive = function () { return this._active; }; UndoHistoryItem.prototype.getView = function () { if (this.$view) return this.$view; this.$view = UndoHistory_({ "class": ['as-undo-history-item'].concat(this._active ? ['as-undo-history-item-active'] : []).concat(this._disabled ? ['as-undo-history-item-disabled'] : []), attr: { title: this.timestamp.toLocaleTimeString() }, child: [{ "class": 'as-undo-history-item-icon-container', child: this.typeIcon[this.type] }, { text: this.description }], on: { click: this.ev_click.bind(this) } }); return this.$view; }; UndoHistoryItem.prototype.ev_click = function (event) { this.parent.checkout(this); }; /* harmony default export */ var editor_UndoHistory = (UndoHistory); // EXTERNAL MODULE: ./css/fontformatpicker.css var fontformatpicker = __webpack_require__(231); // CONCATENATED MODULE: ./js/font/FontFormatPicker.js var FontFormatPicker_ = FCore._; var FontFormatPicker_$ = FCore.$; /** * @typedef {import('absol/src/AppPattern/Context').default} FontFormatPicker */ function FontFormatPicker() { AppPattern_Context.call(this); this.fontFamilyItems = FONT_FACES.map(function (fontFamily) { var fontName = fontFamily.match(/\'([^\']+)\'/)[1]; return { text: fontName, value: fontFamily, extendStyle: { fontFamily: fontFamily } }; }, {}); this.styleItems = [{ text: 'Regular', value: 'Regular' }, { text: 'Italic', value: 'Italic' }, { text: 'Bold', value: 'Bold' }, { text: 'Bold italic', value: 'BoldItalic' }]; this.fontFamilies = this.fontFamilyItems.reduce(function (ac, cr) { ac[cr.text] = cr.value; return ac; }, {}); } Object.defineProperties(FontFormatPicker.prototype, Object.getOwnPropertyDescriptors(AppPattern_Context.prototype)); FontFormatPicker.prototype.constructor = AppPattern_Context; FontFormatPicker.prototype.getView = function () { if (this.$view) return this.$view; this.$view = FontFormatPicker_({ tag: 'onscreenwindow', "class": 'as-form-format-picker', props: { windowTitle: 'Font', windowIcon: 'span.mdi.mdi-alpha-f-box-outline' }, child: [{ child: [{ "class": ['as-form-format-picker-input-box', 'as-form-format-picker-input-box-select-font'], child: [{ "class": 'as-form-format-picker-input-box-name', child: { text: 'Font' } }, { tag: 'selectmenu', "class": 'as-form-format-picker-select-font', props: { items: this.fontFamilyItems } }] }, { "class": ['as-form-format-picker-input-box', 'as-form-format-picker-input-box-select-style'], child: [{ "class": 'as-form-format-picker-input-box-name', child: { text: 'Style' } }, { tag: 'selectmenu', "class": 'as-form-format-picker-select-font', props: { items: this.styleItems } }] }] }] }); return this.$view; }; FontFormatPicker.prototype.onResume = function () { this.getView().addTo(document.body); }; FontFormatPicker.prototype.onPause = function () { this.getView().remove(); }; // Dom.documentReady.then(function () { // /** // * @type {FontFormatPicker} // */ // var test = new FontFormatPicker(); // test.start(); // }); /* harmony default export */ var font_FontFormatPicker = (FontFormatPicker); // CONCATENATED MODULE: ./js/editor/FormEditor.js var FormEditor_ = FCore._; var FormEditor_$ = FCore.$; function FormEditor() { AppPattern_Context.call(this); EventEmitter["a" /* default */].call(this); this.ctxMng = new AppPattern_ContextManager(); var self = this; this.style = { leftSizeWidth: 16, //em leftSizeMinWidth: 10, rightSizeWidth: 23, //em rightSizeMinWidth: 15 }; this.mLayoutEditor = new editor_LayoutEditor(); this.mLayoutEditor.addComponent(components_DateInput); this.mLayoutEditor.addComponent(components_TextInput); this.mLayoutEditor.addComponent(components_TextArea); this.mLayoutEditor.addComponent(layouts_RelativeLayout); this.mLayoutEditor.addComponent(components_NumberInput); this.mLayoutEditor.addComponent(components_Label); this.mLayoutEditor.addComponent(Checkbox); this.mLayoutEditor.addComponent(components_Radio); this.mLayoutEditor.addComponent(components_ComboBox); // this.mLayoutEditor.addComponent(SelectBox); this.mLayoutEditor.addComponent(components_Text); this.mLayoutEditor.addComponent(components_Image); this.mLayoutEditor.addComponent(components_Button); this.mLayoutEditor.addComponent(components_Table); this.mLayoutEditor.addComponent(layouts_LinearLayout); this.mUndoHistory = new editor_UndoHistory(); this.mComponentPicker = new editor_ComponentPicker(); this.mAttributeEditor = new editor_AttributeEditor(); this.mComponentOutline = new editor_ComponentOutline(); this.mAttributeEditor.on('change', function (event) { self.emit('change', Object.assign({ formEditor: self }, event), self); }).on('stopchange', function (event) { self.commitHistory('edit', event.object.getAttribute('name') + '.' + event.name + ''); }); ; this.mStyleEditor = new editor_StyleEditor().on('change', this.ev_styleEditorChange.bind(this)).on('stopchange', function (event) { self.commitHistory('edit', event.object.getAttribute('name') + '.' + event.name + ''); }); this.mAllPropertyEditor = new editor_AllPropertyEditor().on('stopchange', function (event) { self.commitHistory('edit', event.object.getAttribute('name') + '.' + event.name + ''); }); ; this.mAllPropertyEditor.on('change', function (event) { self.mLayoutEditor.autoExpandRootLayout(); if (self._focusElement) self._focusElement.reMeasure(); if (event.name == 'vAlign' || event.name == 'hAlign') self.mLayoutEditor.updateAnchor();else self.mLayoutEditor.updateAnchorPosition(); self.mStyleEditor.notifyChange(); self.mAttributeEditor.notifyChange(); self.emit('change', Object.assign({ formEditor: this }, event), self); Dom["a" /* default */].updateResizeSystem(); }).on('stopchange', function (event) { self.commitHistory('edit', event.object.getAttribute('name') + '.' + event.name + ''); }); this.mLayoutEditor.on('change', this.notifyAllChange.bind(this)).on('focuscomponent', this.ev_focusElement.bind(this)).on('removecomponent', this.ev_removeComponent.bind(this)).on('addcomponent', this.ev_addComponent.bind(this)); this.mUndoHistory.on('checkout', function (event) { self.mLayoutEditor.applyData(event.item.data); self.mComponentOutline.updateComponetTree(); }); this.mLayoutEditor.on('movecomponent', this.notifyStyleChange.bind(this)); this.ctxMng.set(R.LAYOUT_EDITOR, this.mLayoutEditor); this.ctxMng.set(R.COMPONENT_PICKER, this.mComponentPicker); this.ctxMng.set(R.UNDO_HISTORY, this.mUndoHistory); this.mLayoutEditor.attach(this); this.mComponentPicker.attach(this); this.mComponentOutline.attach(this); this.mUndoHistory.attach(this); } Object.defineProperties(FormEditor.prototype, Object.getOwnPropertyDescriptors(AppPattern_Context.prototype)); Object.defineProperties(FormEditor.prototype, Object.getOwnPropertyDescriptors(EventEmitter["a" /* default */].prototype)); FormEditor.prototype.constructor = FormEditor; FormEditor.prototype.onStart = function () { this.mLayoutEditor.start(); this.mComponentPicker.start(); this.mAttributeEditor.start(); this.mAllPropertyEditor.start(); this.mComponentOutline.start(); this.mUndoHistory.start(); }; FormEditor.prototype.onStop = function () { this.mLayoutEditor.stop(); this.mComponentPicker.stop(); this.mAttributeEditor.stop(); this.mAllPropertyEditor.stop(); this.mComponentOutline.stop(); this.mUndoHistory.stop(); }; FormEditor.prototype.onPause = function () { this.mLayoutEditor.pause(); this.mComponentPicker.pause(); this.mAttributeEditor.pause(); this.mAllPropertyEditor.pause(); this.mComponentOutline.pause(); this.mUndoHistory.pause(); }; FormEditor.prototype.onResume = function () { this.mLayoutEditor.resume(); this.mComponentPicker.resume(); this.mAttributeEditor.resume(); this.mAllPropertyEditor.resume(); this.mComponentOutline.resume(); this.mUndoHistory.resume(); }; FormEditor.prototype.getContextManager = function () { return this.ctxMng; }; FormEditor.prototype.getView = function () { if (this.$view) return this.$view; var self = this; this.$view = FormEditor_({ "class": 'as-form-editor', attr: { tabindex: '1' }, child: [{ "class": 'as-form-editor-left-site-container', child: { tag: 'tabview', "class": ['xp-tiny', 'as-form-editor-left-site'], child: [{ tag: 'tabframe', "class": ['absol-bscroller', 'as-form-property-tab'], attr: { name: 'Form', id: 'tab-form' } }, { tag: 'tabframe', "class": ['absol-bscroller', 'as-form-property-tab'], attr: { name: 'Component', id: 'tab-component' }, child: this.mComponentPicker.getView() }, { tag: 'tabframe', "class": ['absol-bscroller', 'as-form-property-tab'], attr: { name: 'Outline', id: 'tab-outline' }, child: this.mComponentOutline.getView() }] } }, { "class": 'as-form-editor-editor-space-container' }, { "class": 'as-form-editor-right-site-container', child: { tag: 'tabview', "class": ['xp-tiny', 'as-form-editor-right-site'], child: [{ tag: 'tabframe', "class": ['absol-bscroller', 'as-form-property-tab'], attr: { name: 'Attributes', id: 'tab-attributes-new' }, child: this.mAttributeEditor.getView() }, { tag: 'tabframe', "class": ['absol-bscroller', 'as-form-property-tab'], attr: { name: 'Style', id: 'tab-style' }, child: this.mStyleEditor.getView() }, { tag: 'tabframe', "class": ['absol-bscroller', 'as-form-property-tab'], attr: { name: 'Event', id: 'tab-event' } }, { tag: 'tabframe', "class": ['absol-bscroller', 'as-form-property-tab'], attr: { name: 'All', id: 'tab-all' }, child: this.mAllPropertyEditor.getView() }] } }, '.as-form-editor-resizer.vertical.left-site', '.as-form-editor-resizer.vertical.right-site'], on: { keydown: this.ev_keydown.bind(this) } }); this.$attachhook = FormEditor_('attachook').addTo(this.$view).on('error', function () { Dom["a" /* default */].addToResizeSystem(this); this.updateSize = this.updateSize || self.ev_resize.bind(this); }); this.$leftSiteCtn = FormEditor_$('.as-form-editor-left-site-container', this.$view); this.$rightSiteCtn = FormEditor_$('.as-form-editor-right-site-container', this.$view); this.$editorSpaceCtn = FormEditor_$('.as-form-editor-editor-space-container', this.$view); this.$editorSpaceCtn.addChild(this.mLayoutEditor.getView()); this.$leftSiteResizer = js_Draggable(FormEditor_$('.as-form-editor-resizer.vertical.left-site', this.$view)).on('predrag', this.ev_preDragLeftResizer.bind(this)).on('enddrag', this.ev_endDragLeftResizer.bind(this)).on('drag', this.ev_dragLeftResizer.bind(this)); this.$rightSiteResizer = js_Draggable(FormEditor_$('.as-form-editor-resizer.vertical.right-site', this.$view)).on('predrag', this.ev_preDragRightResizer.bind(this)).on('enddrag', this.ev_endDragRightResizer.bind(this)).on('drag', this.ev_dragRightResizer.bind(this)); this.$leftTabView = FormEditor_$('tabview', this.$leftSiteCtn); this.$leftTabView.activeTab('tab-component'); this.$rightTabView = FormEditor_$('tabview', this.$rightSiteCtn); this.$rightTabView.activeTab('tab-style'); this.$styleTabFrame = FormEditor_$('tabframe#tab-style', this.$rightTabView); this.$attributesTabFrame = FormEditor_$('tabframe#tab-attributes', this.$rightTabView); this.$contextCaptor = FormEditor_('contextcaptor').addTo(this.$view).attachTo(this.$view); return this.$view; }; FormEditor.prototype.ev_focusElement = function (event) { this._focusElement = event.component; this.mStyleEditor.edit(event.component); this.mAttributeEditor.edit(event.component); this.mAllPropertyEditor.edit(event.component); this.mComponentOutline.updateComponentStatus(); }; FormEditor.prototype.ev_removeComponent = function (event) { if (this._focusElement == event.component) { this._focusElement = undefined; this.mStyleEditor.edit(undefined); this.mAttributeEditor.edit(undefined); this.mAllPropertyEditor.edit(undefined); } this.mComponentOutline.updateComponetTree(); }; FormEditor.prototype.ev_addComponent = function () { this.mComponentOutline.updateComponetTree(); }; FormEditor.prototype.ev_styleEditorChange = function (event) { this.mLayoutEditor.autoExpandRootLayout(); if (this._focusElement) this._focusElement.reMeasure(); Dom["a" /* default */].updateResizeSystem(); if (event.name == 'vAlign' || event.name == 'hAlign') this.mLayoutEditor.updateAnchor();else this.mLayoutEditor.updateAnchorPosition(); this.emit('change', Object.assign({ formEditor: this }, event), this); }; FormEditor.prototype.setComponentProperty = function (name, value) { return this.component.setAttribute(name, value); }; FormEditor.prototype.getComponentProperty = function (name) { return this.component.getAttribute(name); }; FormEditor.prototype.ev_resize = function () {}; FormEditor.prototype.ev_preDragLeftResizer = function (event) { this.$leftSiteResizer.addStyle({ width: '100px', left: 'calc(' + this.style.leftSizeWidth + 'em - 50px)' }); this._dragLeftMovingDate = { width: this.style.leftSizeWidth, fontSize: this.$view.getFontSize(), bound: this.$view.getBoundingClientRect() }; }; FormEditor.prototype.ev_endDragLeftResizer = function (event) { this.$leftSiteResizer.addStyle({ left: 'calc(' + this.style.leftSizeWidth + 'em - 0.2em)' }).removeStyle('width'); this._dragLeftMovingDate = undefined; delete this._dragLeftMovingDate; }; FormEditor.prototype.ev_dragLeftResizer = function (event) { var dxEm = event.moveDXem; var newWidth = this._dragLeftMovingDate.width + dxEm; this.$leftSiteResizer.addStyle({ width: '100px', left: 'calc(' + newWidth + 'em - 50px)' }); this.style.leftSizeWidth = Math.max(this.style.leftSizeMinWidth, Math.min(this._dragLeftMovingDate.bound.width / 3 / this._dragLeftMovingDate.fontSize, newWidth)); this.$leftSiteCtn.addStyle('width', this.style.leftSizeWidth + 'em'); this.$editorSpaceCtn.addStyle('left', this.style.leftSizeWidth + 0.2 + 'em'); window.dispatchEvent(new Event('resize')); }; FormEditor.prototype.ev_preDragRightResizer = function (event) { this.$rightSiteResizer.addStyle({ width: '100px', right: 'calc(' + this.style.rightSizeWidth + 'em - 50px)' }); this._dragRightMovingDate = { width: this.style.rightSizeWidth, fontSize: this.$view.getFontSize(), bound: this.$view.getBoundingClientRect() }; }; FormEditor.prototype.ev_endDragRightResizer = function (event) { this.$rightSiteResizer.addStyle({ right: 'calc(' + this.style.rightSizeWidth + 'em - 0.2em)' }).removeStyle('width'); this._dragRightMovingDate = undefined; delete this._dragRightMovingDate; }; FormEditor.prototype.ev_dragRightResizer = function (event) { var dxEm = event.moveDXem; var newWidth = this._dragRightMovingDate.width - dxEm; this.$rightSiteResizer.addStyle({ width: '100px', right: 'calc(' + newWidth + 'em - 50px)' }); this.style.rightSizeWidth = Math.max(this.style.rightSizeMinWidth, Math.min(this._dragRightMovingDate.bound.width / 3 / this._dragRightMovingDate.fontSize, newWidth)); this.$rightSiteCtn.addStyle('width', this.style.rightSizeWidth + 'em'); this.$editorSpaceCtn.addStyle('right', this.style.rightSizeWidth + 0.2 + 'em'); window.dispatchEvent(new Event('resize')); }; FormEditor.prototype.ev_keydown = function (event) { this._lastKeydownTime = this._lastKeydownTime || 0; var now = new Date().getTime(); if (now - this._lastKeydownTime > 100) { if (event.ctrlKey && event.key == 'z') { this._lastKeydownTime = now; this.mUndoHistory.undo(); } else if (event.ctrlKey && event.key == 'y') { this._lastKeydownTime = now; this.mUndoHistory.redo(); } } }; FormEditor.prototype.ev_layoutEditorChange = function () {}; FormEditor.prototype.setData = function (data) { this.mLayoutEditor.setData(data); this.mComponentOutline.updateComponetTree(); }; FormEditor.prototype.getData = function () { return this.mLayoutEditor.getData(); }; FormEditor.prototype.commitHistory = function (type, description) { this.mUndoHistory.commit(type, this.getData(), description, new Date()); }; FormEditor.prototype.addComponent = function (data) { if (this.mLayoutEditor.rootLayout) { var newComponent = this.mLayoutEditor.build(data); this.mLayoutEditor.rootLayout.addChild(newComponent); this.mLayoutEditor.activeComponent(newComponent); this.commitHistory('add', 'Add' + newComponent.tag); } }; FormEditor.prototype.notifyAllChange = function () { this.mStyleEditor.notifyChange(); this.mAttributeEditor.notifyChange(); this.mAllPropertyEditor.notifyChange(); this.emit('change', Object.assign({}, { formEditor: this }), this); }; FormEditor.prototype.notifyStyleChange = function () { this.mStyleEditor.notifyChange(); this.emit('change', Object.assign({}, { formEditor: this }), this); }; FormEditor.prototype.notifyAttributeChange = function () { this.emit('change', Object.assign({}, { formEditor: this }), this); }; /* harmony default export */ var editor_FormEditor = (FormEditor); // EXTERNAL MODULE: ./css/layoutsizeeditor.css var layoutsizeeditor = __webpack_require__(233); // CONCATENATED MODULE: ./js/propertyeditors/LayoutSizeEditor.js var LayoutSizeEditor_ = FCore._; var LayoutSizeEditor_$ = FCore.$; function LayoutSizeEditor() { AppPattern_Context.call(this); EventEmitter["a" /* default */].call(this); } Object.defineProperties(LayoutSizeEditor.prototype, Object.getOwnPropertyDescriptors(AppPattern_Context.prototype)); Object.defineProperties(LayoutSizeEditor.prototype, Object.getOwnPropertyDescriptors(EventEmitter["a" /* default */].prototype)); LayoutSizeEditor.prototype.constructor = LayoutSizeEditor; LayoutSizeEditor.prototype.getView = function () { if (this.$view) return this.$view; this.$view = LayoutSizeEditor_({ "class": 'as-layout-size-editor', tag: 'sizebox', props: { boxTitle: 'Position' }, child: { tag: 'sizebox', props: { boxTitle: 'marrgin' } } }); ; return this.$view; }; function SizeBox() { this.$left = LayoutSizeEditor_({ tag: 'spaninput', elt: LayoutSizeEditor_$('.as-size-box-editor-position-left>span.absol-span-input', this), props: { type: 'number' } }); this.$right = LayoutSizeEditor_({ tag: 'spaninput', elt: LayoutSizeEditor_$('.as-size-box-editor-position-right>span.absol-span-input', this), props: { type: 'number' } }); this.$top = LayoutSizeEditor_({ tag: 'spaninput', elt: LayoutSizeEditor_$('.as-size-box-editor-position-top span.absol-span-input', this), props: { type: 'number' } }); this.$bottom = LayoutSizeEditor_({ tag: 'spaninput', elt: LayoutSizeEditor_$('.as-size-box-editor-position-bottom span.absol-span-input', this), props: { type: 'number' } }); this.$center = LayoutSizeEditor_$('.as-size-box-editor-position-center', this); this.$title = LayoutSizeEditor_$('.as-size-box-editor-title', this); } SizeBox.prototype.addChild = function (elt) { this.$center.addChild(elt); return this; }; SizeBox.property = {}; SizeBox.property.boxTitle = { set: function set(value) { this.$title.innerHTML = value + ''; }, get: function get() { return this.$title.innerHTML; } }; SizeBox.render = function () { return LayoutSizeEditor_('<div class="as-size-box-editor">\ <div class="as-size-box-editor-position-top">\ <div><div class="as-size-box-editor-title">Title text</div></div>\ <div><span class="absol-span-input" contenteditable="true"></span></div>\ <div></div>\ </div>\ <div class="as-size-box-editor-position-mid">\ <div class="as-size-box-editor-position-left">\ <span class="absol-span-input" contenteditable="true"></span>\ </div>\ <div class="as-size-box-editor-position-center">\ </div>\ <div class="as-size-box-editor-position-right">\ <span class="absol-span-input" contenteditable="true"></span>\ </div>\ </div>\ <div class="as-size-box-editor-position-bottom">\ <div></div>\ <div><span class="absol-span-input" contenteditable="true"></span></div>\ <div></div>\ </div>\ </div>'); }; FCore.install('sizebox', SizeBox); /* harmony default export */ var propertyeditors_LayoutSizeEditor = (LayoutSizeEditor); // CONCATENATED MODULE: ./index.js /* harmony default export */ var index_0 = ({ AllPropertyEditor: editor_AllPropertyEditor, AttributeEditor: editor_AttributeEditor, AnchorEditor: anchoreditors_RelativeAnchorEditor, ComponentOutline: editor_ComponentOutline, ComponentPicker: editor_ComponentPicker, ListEditor: editor_ListEditor, PropertyEditor: editor_PropertyEditor, StyleEditor: editor_StyleEditor, LayoutSizeEditor: propertyeditors_LayoutSizeEditor, PluginManager: core_PluginManager, FViewable: core_FViewable, FNode: core_FNode, FModel: core_FModel, FormEditor: editor_FormEditor, LayoutEditor: editor_LayoutEditor, ScalableComponent: core_ScalableComponent, ContentScalelessComponent: core_ContentScalelessComponent, RelativeAnchor: anchors_RelativeAnchor, BaseComponent: core_BaseComponent, RelativeLayout: layouts_RelativeLayout, TextInput: components_TextInput, DateInput: components_DateInput, Button: components_Button, CheckBox: Checkbox, ComboBox: components_ComboBox, Image: components_Image, Label: components_Label, NumberInput: components_NumberInput, Radio: components_Radio, Table: components_Table, Text: components_Text, TextArea: components_TextArea, Assembler: core_Assembler, core: FCore }); // CONCATENATED MODULE: ./dev.js window.absol = window.absol || {}; window.absol.form = index_0; window.absol._ = window.absol._ || FCore._; window.absol.$ = window.absol.$ || FCore.$; window.absol.Dom = window.absol.Dom || Dom["a" /* default */]; window.absol.Svg = window.absol.Svg || Svg["a" /* default */]; /***/ }) /******/ ]);