VaKeR CYBER ARMY
Logo of a company Server : Apache/2.4.41 (Ubuntu)
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/gadevoir/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /var/www/html/gadevoir/gadevoir-app.js
/******/ (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 = 94);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* unused harmony export _ */
/* unused harmony export $ */
/* 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 */ "b"]({ creator: Object.assign({}, absol_src_HTML5_Dom__WEBPACK_IMPORTED_MODULE_0__[/* default */ "b"].ShareInstance.creator) });
var _ = ACore._;
var $ = ACore.$;

/* harmony default export */ __webpack_exports__["a"] = (ACore);

/***/ }),
/* 1 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";

// EXPORTS
__webpack_require__.d(__webpack_exports__, "e", function() { return /* binding */ isDomNode; });
__webpack_require__.d(__webpack_exports__, "f", function() { return /* binding */ traceOutBoundingClientRect; });
__webpack_require__.d(__webpack_exports__, "d", function() { return /* binding */ getScreenSize; });
__webpack_require__.d(__webpack_exports__, "g", function() { return /* binding */ waitImageLoaded; });
__webpack_require__.d(__webpack_exports__, "c", function() { return /* binding */ depthClone; });
__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ copyStyleRule; });

// UNUSED EXPORTS: FeatureClass, activeFullScreen, deactiveFullScreen, isFullScreen, fontFaceIsLoaded, waitIFrameLoaded, imageToCanvas, getScrollSize, depthCloneWithStyle, getConstructDescriptor

// CONCATENATED MODULE: ./node_modules/absol/src/HTML5/JSPath.js
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;
};

var identRegex = /[a-zA-Z0-9\-_]+/;
var stringRegex = /"(([^"\\]*|(\\.))*)"/;
var classRegex = new RegExp('\\.' + identRegex.source);
var idRegex = new RegExp('#' + identRegex.source);
var booleanRegex = /true|false/;
var valueRegex = new RegExp(stringRegex.source + '|' + booleanRegex.source);
var attributeRegex = new RegExp('\\[\\s*(' + identRegex.source + ')\\s*(=\\s*(' + valueRegex.source + '))\\]');
var queryRegex = new RegExp([
    '(',
    identRegex.source, '|',
    attributeRegex.source, '|',
    classRegex.source, '|',
    idRegex.source,
    ')+'
].join(''));


JSPath.__tagRegex = new RegExp(queryRegex.source + '|\\>', 'g');
JSPath.__tagNameRegex = new RegExp('^' + identRegex.source, 'i');
JSPath.__classRegex = new RegExp(classRegex.source, 'g');
JSPath.__idRegex = new RegExp(idRegex.source, 'i');

JSPath.__attrRegex = new RegExp(attributeRegex.source, 'g');


JSPath.parseQuery = function (s) {
    var tag = {};

    s = s.replace(JSPath.__attrRegex, function (full, name, assign, jsonTextValue) {
        tag.attributes = tag.attributes || {};
        if (assign) {
            tag.attributes[name] = JSON.parse(jsonTextValue);
        }
        else
            tag.attributes[name] = true;
        return '';
    });

    var classList = s.match(this.__classRegex);
    var idList = s.match(this.__idRegex);
    var tagList = s.match(this.__tagNameRegex);
    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)
        });
    }
    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 */ var HTML5_JSPath = (JSPath);
// 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;
}
// EXTERNAL MODULE: ./node_modules/absol/src/HTML5/ElementNS.js
var ElementNS = __webpack_require__(27);

// EXTERNAL MODULE: ./node_modules/absol/src/HTML5/AElement.js
var AElement = __webpack_require__(6);

// EXTERNAL MODULE: ./node_modules/absol/src/HTML5/ResizeSystem.js
var ResizeSystem = __webpack_require__(12);

// 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/HTML5/Dom.js








/***
 * @typedef {{"accept-charset":string, "http-equiv": string, accept : string, accesskey : string, action : string, align : string, allow : string, alt : string, async : string, autocapitalize : string, autocomplete : string, autofocus : string, autoplay : string, background : string, bgcolor : string, border : string, buffered : string, capture : string, challenge : string, charset : string, checked : string, cite : string, class : string, code : string, codebase : string, color : string, cols : string, colspan : string, content : string, contenteditable : string, contextmenu : string, controls : string, coords : string, crossorigin : string, csp : string, data : string, "data-*" : string, datetime : string, decoding : string, default : string, defer : string, dir : string, dirname : string, disabled : string, download : string, draggable : string, dropzone : string, enctype : string, enterkeyhint : string, for : string,     form : string, formaction : string, formenctype : string, formmethod : string, formnovalidate : string, formtarget : string, headers : string, height : string, hidden : string, high : string, href : string, hreflang : string, icon : string, id : string, importance : string, integrity : string, intrinsicsize : string, inputmode : string, ismap : string, itemprop : string, keytype : string, kind : string, label : string, lang : string, language : string, loading : string, list : string, loop : string, low : string, manifest : string, max : string, maxlength : string, minlength : string, media : string, method : string, min : string, multiple : string, muted : string, name : string, novalidate : string, open : string, optimum : string, pattern : string, ping : string, placeholder : string, poster : string, preload : string, radiogroup : string, readonly : string, referrerpolicy : string, rel : string, required : string, reversed : string, rows : string, rowspan : string, sandbox : string, scope : string, scoped : string, selected : string, shape : string, size : string, sizes : string, slot : string, span : string, spellcheck : string, src : string, srcdoc : string, srclang : string, srcset : string, start : string, step : string, style : string, summary : string, tabindex : string, target : string, title : string, translate : string, type : string, usemap : string, value : string, width : string, wrap : string, }} AElementAttributeDescriptor
 */

/**
 * @typedef {{"arabic-form":string,"baseline-shift": string, "accent-height": string,  "alignment-baseline": string,  "cap-height": string,  "clip-path": string,  "clip-rule": string,  "color-dinterpolation": string,  "color-interpolation-filters": string,  "color-profile": string,  "color-rendering": string,  "dominant-baseline": string,  "enable-background": string,  "fill-opacity": string,  "fill-rule": string,  "flood-color": string,  "flood-opacity": string,  "font-family": string,  "font-size": string,  "font-size-adjust": string,  "font-stretch": string,  "font-style": string,  "font-variant": string,  "font-weight": string,  "glyph-name": string,  "glyph-orientation-horizontal": string,  "glyph-orientation-vertical": string,  "horiz-adv-x": string,  "horiz-origin-x": string,  "image-rendering": string,  "letter-spacing": string,  "lighting-color": string,  "marker-end": string,  "marker-mid": string,  "marker-start": string,  "overline-position": string,  "overline-thickness": string,  "panose-1": string,  "paint-order": string,  "pointer-events": string,  "rendering-intent": string,  "shape-rendering": string,  "stop-color": string,  "stop-opacity": string,  "strikethrough-position": string,  "strikethrough-thickness": string,  "stroke-dasharray": string,  "stroke-dashoffset": string,  "stroke-linecap": string,  "stroke-linejoin": string,  "stroke-miterlimit": string,  "stroke-opacity": string,  "stroke-width": string,  "text-anchor": string,  "text-decoration": string,  "text-rendering": string,  "transform-origin": string,  "underline-position": string,  "underline-thickness": string,  "unicode-bidi": string,  "unicode-range": string,  "units-per-em": string,  "v-alphabetic": string,  "v-hanging": string,  "v-ideographic": string,  "v-mathematical": string,  "vector-effect": string,  "vert-adv-y": string,  "vert-origin-x": string,  "vert-origin-y": string,  "word-spacing": string,  "writing-mode": string,  "x-height": string,  "xlink:actuate": string,  "xlink:arcrole": string,  "xlink:href": string,  "xlink:role": string,  "xlink:show": string,  "xlink:title": string,  "xlink:type": string,  "xml:base": string,  "xml:lang": string,  "xml:space": string, accumulate:string, additive:string, allowReorder:string, alphabetic:string, amplitude:string, ascent:string, attributeName:string, attributeType:string, autoReverse:string, azimuth:string, baseFrequency:string, baseProfile:string, bbox:string, begin:string, bias:string, by:string, calcMode:string, class:string, clip:string, clipPathUnits:string, color:string, contentScriptType:string, contentStyleType:string, cursor:string, cx:string, cy:string, d:string, decelerate:string, descent:string, diffuseConstant:string, direction:string, display:string, divisor:string, dur:string, dx:string, dy:string, edgeMode:string, elevation:string, end:string, exponent:string, externalResourcesRequired:string, fill:NamedColor|Color|string, filter:string, filterRes:string, filterUnits:string, format:string, from:string, fr:string, fx:string, fy:string, g1:string, g2:string, glyphRef:string, gradientTransform:string, gradientUnits:string, hanging:string, height:string, href:string, hreflang:string, id:string, ideographic:string, in:string, in2:string, intercept:string, k:string, k1:string, k2:string, k3:string, k4:string, kernelMatrix:string, kernelUnitLength:string, kerning:string, keyPoints:string, keySplines:string, keyTimes:string, lang:string, lengthAdjust:string, limitingConeAngle:string, local:string, markerHeight:string, markerUnits:string, markerWidth:string, mask:string, maskContentUnits:string, maskUnits:string, mathematical:string, max:string, media:string, method:string, min:string, mode:string, name:string, numOctaves:string, offset:string, opacity:string, operator:string, order:string, orient:string, orientation:string, origin:string, overflow:string, path:string, pathLength:string, patternContentUnits:string, patternTransform:string, patternUnits:string, ping:string, points:string, pointsAtX:string, pointsAtY:string, pointsAtZ:string, preserveAlpha:string, preserveAspectRatio:string, primitiveUnits:string, r:string, radius:string, referrerPolicy:string, refX:string, refY:string, rel:string, repeatCount:string, repeatDur:string, requiredExtensions:string, requiredFeatures:string, restart:string, result:string, rotate:string, rx:string, ry:string, scale:string, seed:string, slope:string, spacing:string, specularConstant:string, specularExponent:string, speed:string, spreadMethod:string, startOffset:string, stdDeviation:string, stemh:string, stemv:string, stitchTiles:string, string:string, stroke:string, style:string, surfaceScale:string, systemLanguage:string, tabindex:string, tableValues:string, target:string, targetX:string, targetY:string, textLength:string, to:string, transform:string, type:string, u1:string, u2:string, unicode:string, values:string, version:string, viewBox:string, viewTarget:string, visibility:string, width:string, widths:string, x:string, x1:string, x2:string, xChannelSelector:string, y:string, y1:string, y2:string, yChannelSelector:string, z:string, zoomAndPan:string, }}  AElementNSAttributeDescriptor
 */

/***
 * @typedef {{abort:event:function((UiEvent|Event)):void,afterprint:event:function(Event):void,animationend:event:function(AnimationEvent):void,animationiteration:event:function(AnimationEvent):void,animationstart:event:function(AnimationEvent):void,beforeprint:event:function(Event):void,beforeunload:event:function((UiEvent|Event)):void,blur:event:function(FocusEvent):void,canplay:event:function(Event):void,canplaythrough:event:function(Event):void,change:event:function(Event):void,click:event:function(MouseEvent):void,contextmenu:event:function(MouseEvent):void,copy:event:function(ClipboardEvent):void,cut:event:function(ClipboardEvent):void,dblclick:event:function(MouseEvent):void,drag:event:function(DragEvent):void,dragend:event:function(DragEvent):void,dragenter:event:function(DragEvent):void,dragleave:event:function(DragEvent):void,dragover:event:function(DragEvent):void,dragstart:event:function(DragEvent):void,drop:event:function(DragEvent):void,durationchange:event:function(Event):void,ended:event:function(Event):void,error:event:function((ProgressEvent|UiEvent|Event)):void,focus:event:function(FocusEvent):void,focusin:event:function(FocusEvent):void,focusout:event:function(FocusEvent):void,fullscreenchange:event:function(Event):void,fullscreenerror:event:function(Event):void,hashchange:event:function(HashChangeEvent):void,input:event:function((InputEvent|Event)):void,invalid:event:function(Event):void,keydown:event:function(KeyboardEvent):void,keypress:event:function(KeyboardEvent):void,keyup:event:function(KeyboardEvent):void,load:event:function((UiEvent|Event)):void,loadeddata:event:function(Event):void,loadedmetadata:event:function(Event):void,loadstart:event:function(ProgressEvent):void,message:event:function(Event):void,mousedown:event:function(MouseEvent):void,mouseenter:event:function(MouseEvent):void,mouseleave:event:function(MouseEvent):void,mousemove:event:function(MouseEvent):void,mouseover:event:function(MouseEvent):void,mouseout:event:function(MouseEvent):void,mouseup:event:function(MouseEvent):void,mousewheel:event:function(WheelEvent):void,offline:event:function(Event):void,online:event:function(Event):void,open:event:function(Event):void,pagehide:event:function(PageTransitionEvent):void,pageshow:event:function(PageTransitionEvent):void,paste:event:function(ClipboardEvent):void,pause:event:function(Event):void,play:event:function(Event):void,playing:event:function(Event):void,popstate:event:function(PopStateEvent):void,progress:event:function(Event):void,ratechange:event:function(Event):void,resize:event:function((UiEvent|Event)):void,reset:event:function(Event):void,scroll:event:function((UiEvent|Event)):void,search:event:function(Event):void,seeked:event:function(Event):void,seeking:event:function(Event):void,select:event:function((UiEvent|Event)):void,show:event:function(Event):void,stalled:event:function(Event):void,storage:event:function(StorageEvent):void,submit:event:function(Event):void,suspend:event:function(Event):void,timeupdate:event:function(Event):void,toggle:event:function(Event):void,touchcancel:event:function(TouchEvent):void,touchend:event:function(TouchEvent):void,touchmove:event:function(TouchEvent):void,touchstart:event:function(TouchEvent):void,transitionend:event:function(TransitionEvent):void,unload:event:function((UiEvent|Event)):void,volumechange:event:function(Event):void,waiting:event:function(Event):void,wheel:event:function(WheelEvent):void}} AElementEventDescriptor
 */


/***
 * @typedef AbsolConstructDescriptor
 * @property {string | function |null} tag
 * @property {CSSStyleDeclaration} style
 * @property {Array | string} extendEvent
 * @property {Array | string} class
 * @property {AElementAttributeDescriptor|AElementNSAttributeDescriptor} attr
 * @property {string|AElement | AElementNS | AbsolConstructDescriptor | string[] |AElement[] | AElementNS[] | AbsolConstructDescriptor[]} child
 * @property {string} text to create a TextNode, not Element
 * @property {AElement} elt
 * @property {AElementEventDescriptor|{}} on
 * @property {Object} props
 *
 */


/****
 *
 * @returns {AElement}
 */
var attachhookCreator = function () {
    var res = Dom.ShareInstance._({
        tag: 'img',
        class: 'absol-attachhook',
        extendEvent: ['attached'],
        style: {
            display: 'none'
        },
        attr: {
            src: ''
        },
        on: {
            error: function (event) {
                if (!this._attached && this.isDescendantOf(document.body)) {
                    this._attached = true;
                    this.emit('attached', event, this);
                }
            }
        }
    });
    res._attached = false;
    Object.defineProperty(res, 'attached', {
        get: function () {
            return this._attached;
        }
    });
    res.resetState = function () {
        this._attached = false;
        this.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(AElement["a" /* default */].prototype);
    Object.defineProperties(element, prototypes);
    AElement["a" /* default */].call(element);
    return element;
};

/***
 *
 * @param {*=} option
 * @constructor
 */
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['$ '.trim()] = this.$.bind(this);
    this['_ '.trim()] = this._.bind(this);
    this['$' + '$'] = this.$$.bind(this);
    this.buildDom = this._;
}


Dom.prototype.fromCode = function (code) {
    code = code.trim().replace(/>\s+</gm, '><');
    var temTag = 'div';
    if (code.startsWith('<td') || (code.startsWith('<th') && !code.startsWith('<thead'))) temTag = 'tr';
    else if (code.startsWith('<tr')) temTag = 'tbody';
    else if (code.startsWith('<thead') || code.startsWith('<tbody')) temTag = 'table';
    var tempDiv = document.createElement(temTag);
    tempDiv.innerHTML = code;
    var element = tempDiv.childNodes[0];
    var prototypes = Object.getOwnPropertyDescriptors(AElement["a" /* default */].prototype);
    Object.defineProperties(element, prototypes);
    AElement["a" /* default */].call(element);
    return element;
};


/**
 * DFS
 * @param {string | AElement} query
 * @param {AElement} root
 * @param {function} onFound - return true to stop find
 * @returns {AElement | AElementNS}
 */


Dom.prototype.$ = 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;
};

/***
 *
 * @type {function(string, AElement, Function): AElement}
 */
Dom.prototype.selectAttacth = Dom.prototype.$;


/**
 * DFS
 * @param {string} query
 * @param {AElement} root
 * @param {function} onFound - return true to stop find
 */
Dom.prototype.select = function (query, root, onFound) {
    root = root || document.documentElement;
    var matcher = HTML5_JSPath.compileJSPath(query);
    return matcher.findFirst(root, onFound);
};


var FeatureClass = {
    AElementNS: {
        constructor: ElementNS["a" /* default */],
        prototypeKeys: Object.keys(ElementNS["a" /* default */].prototype)
    },
    AElement: {
        constructor: AElement["a" /* default */],
        prototypeKeys: Object.keys(AElement["a" /* default */].prototype)
    }
};
/**
 *
 * @param {AElement | AElementNS } element
 */
Dom.prototype.attach = function (element) {
    if (element.attr) return;
    var feature = (element.getBBox && element.tagName !== 'svg') ? FeatureClass.AElementNS : FeatureClass.AElement;
    var elementConstructor = feature.constructor;
    var proto = elementConstructor.prototype;
    var prototypeKeys = feature.prototypeKeys;
    var n = prototypeKeys.length;
    var key;
    for (var i = 0; i < n; ++i) {
        key = prototypeKeys[i];
        element[key] = proto[key];
    }
    Object.assign(element, elementConstructor.prototype)
    elementConstructor.call(element);
};


Dom.prototype.makeNewElement = function (tagName) {
    return document.createElement(tagName);
};

Dom.prototype.makeNewTextNode = function (data) {
    return document.createTextNode(data);
};


/**
 *
 * @param {AbsolConstructDescriptor | string | {} } option
 * @returns {AElementNS| AElement | Text}
 */
Dom.prototype._ = function (option, isInherited) {
    var res;
    var creator;
    if (Dom.isDomNode(option)) {
        res = option;
        option = {};
        /** fix reinit component */
        isInherited = true;
    }
    else {
        if (option.charAt) {
            option = option.trim();
            if (option[0] == '<') {
                res = this.fromCode(option);
                option = {};
            }
            else {
                var queryObj = HTML5_JSPath.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 (option.text || option.text === '') {//is textNode
        return this.makeNewTextNode(option.text);
    }

    option.tag = option.tag || this.defaultTag;
    creator = option.tag.prototype ? option.tag : this.creator[option.tag];
    if (option.tag.prototype) option.tag = option.tag.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] = creator;
        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 = res.eventHandler || {};
                var eventHandler = OOP["a" /* default */].bindFunctions(res, creator.eventHandler || creator.prototype.eventHandler);
                for (var eventHandlerKey in eventHandler) {
                    if (res.eventHandler[eventHandlerKey]) {
                        throw new Error("Same name of eventHandler[" + eventHandlerKey + "]");
                    }
                    else {
                        res.eventHandler[eventHandlerKey] = eventHandler[eventHandlerKey];
                    }
                }
            }
            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);
    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._(option.child[i], false, true));
        }
    }
    return res;
};

/***
 *
 * @type {function(Object, boolean): AElement}
 */
Dom.prototype.create = Dom.prototype._;


/***
 *
 * @param query
 * @param root
 * @returns {Array<AElement|AElementNS>}
 */
Dom.prototype.$$ = function (query, root) {
    var thisD = this;
    var res = [];
    this.selectAttacth(query, root, function (elt) {
        thisD.attach(elt);
        res.push(elt);
    });
    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 = arg0.tag || getFunctionName(arg0) || arg0.name;
            if (name) {
                this.creator[name.toLowerCase()] = arg0;
            }
            else {
                console.error('No ident name of creator function', arg0);
            }
        }
        else if (arg0 instanceof Array) {
            arg0.forEach(function (func) {
                var name = func.tag || getFunctionName(func) || func.name;
                if (name) {
                    _this.creator[name.toLowerCase()] = func;
                }
            });
        }
        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 {
            console.error('Unknown data', arg0);
        }
    }
    else if (arguments.length == 2) {
        if (arg0 instanceof Array) {
            if (arg1.creator) arg1 = arg1.creator;
            arg0.forEach(function (key) {
                var func = arg1[key];
                if (typeof (func) == 'function')
                    if (_this.creator[key] != func)
                        _this.creator[key] = func;
            });
        }
        else if (arg0 instanceof RegExp) {
            if (arg1.creator) arg1 = arg1.creator;
            Object.keys(arg1).forEach(function (key) {
                if (key.match(arg0)) {
                    var func = arg1[key];
                    if (typeof (func) == 'function')
                        if (_this.creator[key] != func)
                            _this.creator[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 {String | null} tagName
 */
Dom.prototype.require = function (tagName) {
    return this.creator[tagName] || null;
};


/**
 *
 * @param {*} o
 * @returns {Boolean}
 */
function isDomNode(o) {
    return (
        typeof Node === "object" ? o instanceof Node :
            o && typeof o === "object" && typeof o.nodeType === "number" && typeof o.nodeName === "string"
    );
}

Dom.isDomNode = isDomNode;

/**
 * @param {AElement|Node|HTMLElement} element
 */
function activeFullScreen(element) {
    if (element.requestFullscreen) {
        element.requestFullscreen();
    }
    else if (element.mozRequestFullScreen) {
        element.mozRequestFullScreen();
    }
    else if (element.webkitRequestFullscreen) {
        element.webkitRequestFullscreen(AElement["a" /* default */].ALLOW_KEYBOARD_INPUT);
    }
    else if (element.msRequestFullscreen) {
        element.msRequestFullscreen();
    }
}

Dom.activeFullScreen = activeFullScreen;


function deactiveFullScreen() {
    if (document.exitFullscreen) {
        document.exitFullscreen();
    }
    else if (document.mozCancelFullScreen) {
        document.mozCancelFullScreen();
    }
    else if (document.webkitExitFullscreen) {
        document.webkitExitFullscreen();
    }
    else if (document.msExitFullscreen) {
        document.msExitFullscreen();
    }
}

Dom.deactiveFullScreen = deactiveFullScreen;

function isFullScreen() {
    var fullScreenElement = document.fullscreenElement ||
        document.webkitFullscreenElement ||
        document.mozFullScreenElement ||
        document.msFullscreenElement;
    return !!fullScreenElement;
}

Dom.isFullScreen = isFullScreen;

/**
 * @param {AElement|Node|HTMLElement} current
 * @returns {ClientRect}
 */
function traceOutBoundingClientRect(current) {
    var screenSize = Dom.getScreenSize();
    var left = 0;
    var right = screenSize.width;
    var top = 0;
    var bottom = screenSize.height;
    while (current) {
        var ox = AElement["a" /* default */].prototype.getComputedStyleValue.call(current, 'overflow-x') !== "visible";
        var oy = AElement["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.traceOutBoundingClientRect = traceOutBoundingClientRect;

/***
 *
 * @param {string} fontFace
 * @param {number} timeout
 * @returns {Promise<boolean>}
 */
function fontFaceIsLoaded(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);
                    });
            }

            check(timeout);
        });
    });
}

Dom.fontFaceIsLoaded = fontFaceIsLoaded;

/***
 *
 * @returns {{width: number, WIDTH: number, HEIGHT: number, height: number}}
 */
function getScreenSize() {
    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.getScreenSize = getScreenSize;

/***
 *
 * @param {HTMLImageElement} img
 * @param {number=} timeout
 * @returns {Promise<void>}
 */
function waitImageLoaded(img, timeout) {
    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, timeout || 5000);
    });
    // No other way of checking: assume it’s ok.
}

Dom.waitImageLoaded = waitImageLoaded;


/***
 *
 * @param {HTMLIFrameElement| Worker} iframe
 * @returns {Promise}
 */
function waitIFrameLoaded(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.waitIFrameLoaded = waitIFrameLoaded;

/***
 *
 * @param {Image} element
 * @returns {Promise<HTMLCanvasElement>}
 */
function imageToCanvas(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("AElement must be image");
    }
}

Dom.imageToCanvas = imageToCanvas;


Dom.ShareInstance = new Dom();


Dom.scrollWidthPromise;

Dom.documentReady = new Promise(function (resolve) {
    if (document.body) {
        resolve();
    }
    else {
        window.addEventListener("load", resolve);
    }
});

function getScrollSize() {
    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.getScrollSize = getScrollSize;


/***
 *
 * @param {(AElement|AElementNS|Node)} originElt
 * @param {function(originElt: (AElement|AElementNS|Node), originElt: (AElement|AElementNS|Node)):void } afterCloneCb
 * @return {AElement|AElementNS|Node}
 */
function depthClone(originElt, afterCloneCb) {
    /***
     *
     * @type {AElement|AElementNS|Node}
     */
    var newElt = originElt.cloneNode();//no deep
    if (originElt.childNodes) {
        /***
         *
         * @type {(AElement|AElementNS)[]}
         */
        var children = Array.prototype.map.call(originElt.childNodes, function (child) {
            return depthClone(child, afterCloneCb)
        });
        for (var i = 0; i < children.length; ++i) {
            newElt.appendChild(children[i]);
        }
    }

    return (afterCloneCb && afterCloneCb(originElt, newElt)) || newElt;
}


/***
 *
 * @param originElt
 * @returns {AElement|HTMLElement|Node}
 */
function depthCloneWithStyle(originElt, afterCloneCb) {
    return depthClone(originElt, function (originElt, newElt) {
        if (!originElt.getAttribute && !originElt.getAttributeNS) return;
        copyStyleRule(originElt, newElt);
        afterCloneCb && afterCloneCb(originElt, newElt);
    });
}

Dom.depthClone = depthClone;
Dom.depthCloneWithStyle = depthCloneWithStyle;

/***
 *
 * @param  {AElement|HTMLElement|Node}sourceElt
 * @param  {AElement|HTMLElement|Node} destElt
 * @returns  {AElement|HTMLElement|Node}
 */
function copyStyleRule(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 = AElement["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] = AElement["a" /* default */].prototype.getComputedStyleValue.call(sourceElt, key);
    }
    return destElt;
}

Dom.copyStyleRule = copyStyleRule;

/***
 * get absol construct descriptor for HTML element only
 * @param {AElement | Text} elt
 * @returns {AbsolConstructDescriptor}
 */
function getConstructDescriptor(elt) {
    var obj = {};
    obj.tag = elt.tagName.toLowerCase();
    var classAttr = elt.getAttribute('class');
    var classList;
    if (classAttr)
        classList = parseClassAttr(classAttr);
    if (classList && classList.length > 0)
        obj.class = classList;
    var styleAttr = elt.getAttribute('style');
    var style;
    if (styleAttr)
        style = parseStyleAttr(styleAttr);


    var attributes = elt.attributes;
    var attNode;
    var attrName;
    var attrValue;
    var attr = {};
    var on = {};
    var props = {};
    var eventMatch, eventName;
    var propMatch, propName;
    for (var i = 0; i < attributes.length; ++i) {
        attNode = attributes[i];
        attrName = attNode.nodeName;
        attrValue = attNode.nodeValue;
        if (attrName == 'style' || attrName == 'class') continue;
        eventMatch = attrName.match(/^on(.+)/)
        if (eventMatch) {
            eventName = eventMatch[1];
            on[eventName] = new Function('event', 'sender', attrValue);
            continue;
        }
        propMatch = attrName.match(/^prop-(.+)/);
        if (propMatch) {
            propName = propMatch[1];
            props[propName] = attrValue;
            continue;
        }
        attr[attrName] = attrValue;
    }
    var key;
    for (key in style) {
        //style is not empty
        obj.style = style;
        break;
    }
    for (key in attr) {
        obj.attr = attr;
        break;
    }
    for (key in on) {
        obj.on = on;
        break;
    }
    for (key in props) {
        obj.props = props;
        break;
    }

    return obj;
}

Dom.getConstructDescriptor = getConstructDescriptor;

Dom.addToResizeSystem = function (element) {
    ResizeSystem["a" /* default */].add(element);
};

Dom.updateResizeSystem = function () {
    ResizeSystem["a" /* default */].update();
}

Dom.updateSizeUp = function (fromElt) {
    ResizeSystem["a" /* default */].updateUp(fromElt);
};


/* harmony default export */ var HTML5_Dom = __webpack_exports__["b"] = (Dom);

/***/ }),
/* 2 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* unused harmony export eventProperties */
/* unused harmony export touchProperties */
/* unused harmony export isMouseRight */
/* unused harmony export isMouseLeft */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return hitElement; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return copyEvent; });
/* unused harmony export copyTouch */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return findChangedTouchByIdent; });
/* unused harmony export findTouchByIdent */
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 () {
                        event.callback.apply(this, arguments);
                        this.off(event.eventName, event.wrappedCallback, event.cap);
                    };
                }
                else {
                    event.wrappedCallback = event.callback;
                }

                if (!this.isSupportedEvent(arg0)) {
                    if (this.addEventListener) {
                        this.addEventListener(arg0, event.wrappedCallback, !!arg2);
                    }
                    else {
                        this.attachEvent('on' + arg0, arg1, !!arg2);
                    }
                }

                eventArr.push(event);
                this._azar_extendEvents[arg2 ? 'prioritize' : 'nonprioritize'][arg0] = eventArr;
            }
            else {
                console.warn("dupplicate event");
            }

        }
        return this;
    }
};


EventEmitter.prototype.on = function (arg0, arg1, arg2) {
    this.eventEmittorOnWithTime(false, arg0, arg1, arg2);
    return this;
};


EventEmitter.prototype.once = function (arg0, arg1, arg2) {
    this.eventEmittorOnWithTime(true, arg0, arg1, arg2);
    return this;
};

EventEmitter.prototype.off = function (arg0, arg1, arg2) {
    if (typeof arg0 == 'object') {
        for (var key in arg0) {
            this.off(key, arg0[key]);
        }
        return this;
    }
    else {
        if (typeof arg1 == 'object') {
            return this.off(arg0, arg1.callback, arg1.cap);
        }
        else {
            var eventArr = this._azar_extendEvents[arg2 ? 'prioritize' : 'nonprioritize'][arg0] || [];
            var newEventArray = [];
            for (var i = 0; i < eventArr.length; ++i) {
                var event = eventArr[i];
                if (event.wrappedCallback == arg1) {
                    //Dont add to newEventArray
                    if (this.isSupportedEvent(arg0)) {
                    }
                    else {
                        if (this.removeEventListener) {
                            this.removeEventListener(event.eventName, event.wrappedCallback, !!event.cap);
                        }
                        else {
                            this.detachEvent('on' + event.eventName, event.wrappedCallback, !!event.cap);
                        }
                    }
                }
                else {
                    newEventArray.push(event);
                }
            }
            this._azar_extendEvents[arg2 ? 'prioritize' : 'nonprioritize'][arg0] = newEventArray;
            return this;
        }
    }

};

var eventProperties = ["altKey", "bubbles", "button", "buttons", "cancelBubble", "cancelable", "clientX", "clientY", "composed",
    "ctrlKey", "currentTarget", "defaultPrevented", "deltaMode", "deltaX", "deltaY", "deltaZ", "detail", "eventPhase",
    "explicitOriginalTarget", "isTrusted", "layerX", "layerY", "metaKey", "movementX", "movementY", "mozInputSource",
    "mozPressure", "offsetX", "offsetY", "originalTarget", "pageX", "pageY", "rangeOffset", "rangeParent", "region",
    "relatedTarget", "returnValue", "screenX", "screenY", "shiftKey", "srcElement", "target", "timeStamp", "type",
    "deltaMode", "deltaX", "deltaY", "deltaZ", 'preventDefault'];

var touchProperties = ['clientX', 'clientY', 'force', 'identifier', 'pageX', 'pageY', 'rotationAngle', 'screenX',
    'screenY', 'target'];

function isMouseRight(event) {
    var isRightMB = false;
    if ("which" in event)  // Gecko (Firefox), WebKit (Safari/Chrome) & Opera
        isRightMB = event.which == 3;
    else if ("button" in event)  // IE, Opera
        isRightMB = event.button == 2;
    return isRightMB;
}

function isMouseLeft() {
    var isLeftMB = false;
    if ("which" in event)  // Gecko (Firefox), WebKit (Safari/Chrome) & Opera
        isLeftMB = event.which == 1;
    else if ("button" in event)  // IE, Opera
        isLeftMB = event.button == 1;
    return isLeftMB;
}

function hitElement(element, event) {
    var current = event.target;
    while (current) {
        if (current == element) return true;
        current = current.parentElement;
    }
    return false;
}

function copyEvent(event, props) {
    var result = {};
    var key, value;
    //copy native property
    for (var i = 0; i < eventProperties.length; ++i) {
        key = eventProperties[i];
        value = event[key];
        if (value !== undefined) {
            if (typeof value == "function") {
                result[key] = event[key].bind(event);
            }
            else {
                result[key] = event[key];
            }
        }
    }
    Object.assign(result, event);
    if (props)
        Object.assign(result, props)
    if (event.changedTouches){
        result.changedTouches = Array.prototype.map.call(event.changedTouches, function (touch){
            return copyTouch(touch);
        });
    }
    if (event.touches){
        result.touches = Array.prototype.map.call(event.touches, function (touch){
            return copyTouch(touch);
        });
    }
    return result;
}

function copyTouch(touch, props) {
    var result = {};
    var key, value;
    //copy native property
    for (var i = 0; i < touchProperties.length; ++i) {
        key = touchProperties[i];
        value = touch[key];
        if (value !== undefined) {
            if (typeof value == "function") {
                result[key] = touch[key].bind(touch);
            }
            else {
                result[key] = touch[key];
            }
        }
    }
    Object.assign(result, touch);
    if (props)
        Object.assign(result, props);
    return result;
}

/***
 *
 * @param {TouchEvent} event
 * @return {Touch | null}
 */
function findChangedTouchByIdent(event, identifier) {
    if (event.changedTouches) {
        for (var i = 0; i < event.changedTouches.length; ++i) {
            if (event.changedTouches[i].identifier === identifier) {
                return event.changedTouches[i];
            }
        }
    }
    return null;
}


/***
 *
 * @param event
 * @param identifier
 * @return {Touch|null}
 */
function findTouchByIdent(event, identifier) {
    if (event.touches) {
        for (var i = 0; i < event.touches.length; ++i) {
            if (event.touches[i].identifier === identifier) {
                return event.touches[i];
            }
        }
    }
    return null;
}


EventEmitter.isMouseRight = isMouseRight;

EventEmitter.isMouseLeft = isMouseLeft;

EventEmitter.hitElement = hitElement;

EventEmitter.copyEvent = copyEvent;

EventEmitter.eventProperties = eventProperties;


/* harmony default export */ __webpack_exports__["b"] = (EventEmitter);

/***/ }),
/* 3 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
var OOP = {};

/**
 * @param {Object} object
 * @param {String} key
 * @param {Function} method
 */
OOP.overrideMethod = function (object, key, method) {
    if (object[key] === undefined) object[key] = method;
    else {
        var _superMethod = object[key];
        object[key] = (function (_superMethod, method) {
            return function () {
                var _super = this.super;
                this.super = _superMethod;
                var result = method.apply(this, arguments);
                this.super = _super;
                return result;
            };

        })(_superMethod, method);
    }
};


OOP.extends = function (object, prototype) {
    // do not use setter, getter
    for (var key in prototype) {
        if (key !== 'constructor' && key !== '__proto__') {
            if ((typeof prototype[key] == 'function')) {
                OOP.overrideMethod(object, key, prototype[key]);
            }
            else if (prototype[key] !== undefined && prototype[key] !== null) {
                object[key] = prototype[key];//just copy
            }
        }
    }
};

OOP.inherit = function (child, parent) {
    // do not use setter, getter

    Object.keys(parent).forEach(function (key) {
        if (key !== 'constructor' && (typeof parent[key] == 'function')) {
            var superMethod = parent[key];
            var currentMethod = child[key];
            if (!currentMethod) child[key] = superMethod;
            else {
                child[key] = function () {
                    var _super = this.super;
                    this.super = superMethod;
                    var result = currentMethod.apply(this, arguments);
                    this.super = _super;
                    return result;
                };
            }
        }
    });
};


OOP.drillProperty = function (topObject, botObject, keyTop, keyBot) {
    if (typeof (keyTop) == 'string') {
        keyBot = keyBot || keyTop;
        Object.defineProperty(topObject, keyTop, {
            set: function (value) {
                botObject[keyBot] = value;
            },
            get: function () {
                return botObject[keyBot];
            }
        });
    }
    else {
        if (keyTop instanceof Array) {
            for (var i = 0; i < keyTop.length; ++i) {
                OOP.drillProperty(topObject, botObject, keyTop[i], keyTop[i]);
            }
        }
        else {
            for (var key in keyTop) {
                OOP.drillProperty(topObject, botObject, key, keyTop[key]);
            }
        }
    }
};

OOP.bindFunctions = function (_this, handlers) {
    var res = {};
    for (var key in handlers) {
        res[key] = handlers[key].bind(_this);
    }
    return res;
};


OOP.inheritCreator = function (parent, child) {
    var i;
    if (child.property) {
        if (parent.property) {
            for (i in parent.property) {
                if (!child.property[i]) child.property[i] = parent.property[i];
            }
        }
    }
    for (i in parent.prototype) {
        if (!child.prototype[i]) {
            child.prototype[i] = parent.prototype[i];
        }
        else {
            child.prototype[i] = (function (superFunction, childFunction) {
                return function () {
                    var _super = this.super;
                    this.super = superFunction;
                    var result = childFunction.apply(this, arguments);
                    this.super = _super;
                    return result;
                };
            })(parent.prototype[i], child.prototype[i]);
        }
    }
};

/***
 *
 * @param {Function} constructor
 */
OOP.mixClass = function (constructor) {
    var descriptors = {};
    for (var i = 1; i < arguments.length; ++i) {
        Object.assign(descriptors, Object.getOwnPropertyDescriptors(arguments[i].prototype));
    }

    Object.defineProperties(constructor.prototype, descriptors);
    constructor.prototype.constructor = constructor;
};

/* harmony default export */ __webpack_exports__["a"] = (OOP);

/***/ }),
/* 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__(97);

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__(7);
/* harmony import */ var _AElementNS__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(32);
/* harmony import */ var _OOP__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(3);






/***
 * @augments Node
 * @augments ChildNode
 * @augments ParentNode
 * @augments Element
 * @augments HTMLElement
 * @augments EventEmitter
 * @augments ElementCSSInlineStyle
 * @constructor
 */
function AElement() {
    _EventEmitter__WEBPACK_IMPORTED_MODULE_0__[/* default */ "b"].call(this);
    this._azar_extendAttributes = this._azar_extendAttributes || {};
    this._azar_extendTags = {};
    this.eventHandler = {};
}

_OOP__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"].mixClass(AElement, _EventEmitter__WEBPACK_IMPORTED_MODULE_0__[/* default */ "b"]);

AElement.prototype.init = function (props) {
    Object.assign(this, props || {});
};


AElement.prototype.eventHandler = {};

/***
 * run super-class method
 */
AElement.prototype.super = function () {/* nope */
};

/**
 * @typedef {Object} AttributeDefiner
 * @property {Function} set
 * @property {Function} get
 * @property {Function} remove
 *
 * @param {String} key
 * @param {AttributeDefiner} def
 */
AElement.prototype.defineAttribute = function (key, def) {
    this._azar_extendAttributes[key] = def;
};


AElement.prototype.defineAttributes = function (defs) {
    for (var key in defs) {
        this.defineAttribute(key, defs[key]);
    }
};

AElement.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;
};

/***
 * add style
 * @param {CSSStyleDeclaration|string|{}} arg0
 * @param {string} arg1
 * @returns {AElement}
 */
/**
 * add style
 * @param {CSSStyleDeclaration|string|{}} arg0
 * @returns {AElement}
 */
AElement.prototype.addStyle = function (arg0, arg1) {
    if (typeof arg0 == 'string')
        if (arg0.indexOf('-') >= 0) {
            this.style.setProperty(arg0, arg1);
        }
        else {
            this.style[arg0] = arg1;
        }
    else {
        for (var key in arg0)
            this.addStyle(key, arg0[key]);
    }
    return this;
};

/***
 *
 * @param {string|string[]|CSSStyleDeclaration} arg0
 * @returns {AElement}
 */
AElement.prototype.removeStyle = function (arg0) {
    var key;
    if (arg0.charAt) {
        if (arg0.indexOf('-') >= 0) {
            this.style.removeProperty(arg0);
        }
        else {
            this.style[arg0] = null;
            delete this.style[arg0];
        }
    }
    else {
        if (arg0.map && arg0.forEach) {
            for (var i = 0; i < arg0.length; ++i)
                this.removeStyle(arg0[i]);
        }
        else {
            for (key in arg0)
                this.removeStyle(key);
        }
    }
    return this;
};

AElement.prototype.addChild = function (child) {
    if (child.indexOf && child.map && child.forEach) {
        for (var i = 0; i < child.length; ++i)
            this.appendChild(child[i]);
    }
    else
        this.appendChild(child);
    return this;
};


AElement.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;
};


AElement.prototype.selfRemove = function () {
    if (this.parentElement)
        this.parentElement.removeChild(this);
    return this;
};


AElement.prototype.selfReplace = function (newNode) {
    if (this.parentElement)
        this.parentElement.replaceChild(newNode, this);
    return this;
};

AElement.prototype.clearChild = function () {
    while (this.firstChild) {
        this.removeChild(this.firstChild);
    }
    return this;
};

/**
 *
 * @param {string|Array} className
 * @returns {Boolean}
 */
AElement.prototype.containsClass = function (className) {
    if (className.forEach && className.map) {
        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|Array} className
 * @returns {AElement}
 */
AElement.prototype.addClass = function (className) {
    if (className && className.forEach && className.map) {
        for (var i = 0; i < className.length; ++i)
            this.classList.add(className[i]);
    }
    else
        this.classList.add(className);
    return this;
};

/**
 *
 * @param {string|Array} className
 * @returns {AElement}
 */
AElement.prototype.removeClass = function (className) {
    if (className && className.forEach && className.map) {
        for (var i = 0; i < className.length; ++i)
            this.classList.remove(className[i]);
    }
    else
        this.classList.remove(className);
    return this;
};


AElement.prototype.getComputedStyleValue = function (key) {
    return window.getComputedStyle(this).getPropertyValue(key);

};

AElement.prototype.getFontSize = function () {
    return parseFloat(this.getComputedStyleValue('font-size').replace('px', ''));
};


AElement.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;
};

AElement.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;
};

AElement.prototype.addChildBefore = function (newItem, bf) {
    this.insertBefore(newItem, bf);
    return this;
};

AElement.prototype.addChildAfter = function (newItem, at) {
    var bf = this.findChildAfter(at);
    if (bf) return this.addChildBefore(newItem, bf);
    return this.addChild(newItem);
};

/**
 * @returns {DOMRect}
 */
AElement.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;
};

/***
 *
 * @param parent
 * @returns {boolean}
 */
AElement.prototype.isDescendantOf = function (parent) {
    var child = this;
    while (child) {
        if (child === parent) return true;
        child = child.parentNode;
    }
    return false;
};


/*************************** **********************/
AElement.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;
};


/***
 * @returns {Promise}
 */
AElement.prototype.afterAttached = function () {
    if (this.isDescendantOf(document.body)) return Promise.resolve();
    var attachHookElt = this.$attachhook || this.querySelector('.absol-attachhook');
    if (!attachHookElt) {
        attachHookElt = document.createElement('img');
        attachHookElt.src = '';
        attachHookElt.classList.add('absol-attachhook');
        Object.assign(attachHookElt, _AElementNS__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"].prototype);
        AElement.call(attachHookElt);
        attachHookElt.defineEvent('attached');
        this.$attachhook = attachHookElt;
        this.$attachhook.on('error', function (event) {
            if (this.isDescendantOf(document.body)) this.emit('attached', event, this);
        })
        this.appendChild(attachHookElt);
    }
    return new Promise(function (rs) {
        attachHookElt.once('attached', rs);
    });
};


/***
 * WARNING: this function may be unsafe
 */
AElement.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 = AElement.prototype.on;
    if (_Detector_BrowserDetector__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"].isSafari && !_Detector_BrowserDetector__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"].isMobile) {
        AElement.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) {
        AElement.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 < AElement.eventProperties.length; ++i) {
                            var key = AElement.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;
        };
    }

}());

AElement.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"] = (AElement);

/***/ }),
/* 7 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* WEBPACK VAR INJECTION */(function(global) {/* harmony import */ var _BrowserRules__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(88);
/* 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;
    this.hasTouch = 'ontouchstart' in window ||
        window.DocumentTouch && document instanceof window.DocumentTouch ||
        navigator.maxTouchPoints > 0 ||
        window.navigator.msMaxTouchPoints > 0;
    this.isTouchDevice = this.isMobile && this.hasTouch;
    this.supportPassiveEvent = (function () {
        var supportsPassiveOption = false;
        try {
            var opts = Object.defineProperty({}, 'passive', {
                get: function () {
                    supportsPassiveOption = true;
                }
            });
            window.addEventListener('test', null, opts);
            window.removeEventListener('test', null, opts);
        } catch (e) { }
        return supportsPassiveOption;
    })();
}



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__(13)))

/***/ }),
/* 8 */
/***/ (function(module, exports, __webpack_require__) {

/* WEBPACK VAR INJECTION */(function(process) {/* eslint-env browser */

/**
 * This is the web browser implementation of `debug()`.
 */

exports.formatArgs = formatArgs;
exports.save = save;
exports.load = load;
exports.useColors = useColors;
exports.storage = localstorage();
exports.destroy = (() => {
	let warned = false;

	return () => {
		if (!warned) {
			warned = true;
			console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
		}
	};
})();

/**
 * Colors.
 */

exports.colors = [
	'#0000CC',
	'#0000FF',
	'#0033CC',
	'#0033FF',
	'#0066CC',
	'#0066FF',
	'#0099CC',
	'#0099FF',
	'#00CC00',
	'#00CC33',
	'#00CC66',
	'#00CC99',
	'#00CCCC',
	'#00CCFF',
	'#3300CC',
	'#3300FF',
	'#3333CC',
	'#3333FF',
	'#3366CC',
	'#3366FF',
	'#3399CC',
	'#3399FF',
	'#33CC00',
	'#33CC33',
	'#33CC66',
	'#33CC99',
	'#33CCCC',
	'#33CCFF',
	'#6600CC',
	'#6600FF',
	'#6633CC',
	'#6633FF',
	'#66CC00',
	'#66CC33',
	'#9900CC',
	'#9900FF',
	'#9933CC',
	'#9933FF',
	'#99CC00',
	'#99CC33',
	'#CC0000',
	'#CC0033',
	'#CC0066',
	'#CC0099',
	'#CC00CC',
	'#CC00FF',
	'#CC3300',
	'#CC3333',
	'#CC3366',
	'#CC3399',
	'#CC33CC',
	'#CC33FF',
	'#CC6600',
	'#CC6633',
	'#CC9900',
	'#CC9933',
	'#CCCC00',
	'#CCCC33',
	'#FF0000',
	'#FF0033',
	'#FF0066',
	'#FF0099',
	'#FF00CC',
	'#FF00FF',
	'#FF3300',
	'#FF3333',
	'#FF3366',
	'#FF3399',
	'#FF33CC',
	'#FF33FF',
	'#FF6600',
	'#FF6633',
	'#FF9900',
	'#FF9933',
	'#FFCC00',
	'#FFCC33'
];

/**
 * Currently only WebKit-based Web Inspectors, Firefox >= v31,
 * and the Firebug extension (any Firefox version) are known
 * to support "%c" CSS customizations.
 *
 * TODO: add a `localStorage` variable to explicitly enable/disable colors
 */

// eslint-disable-next-line complexity
function useColors() {
	// NB: In an Electron preload script, document will be defined but not fully
	// initialized. Since we know we're in Chrome, we'll just detect this case
	// explicitly
	if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {
		return true;
	}

	// Internet Explorer and Edge do not support colors.
	if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
		return false;
	}

	// Is webkit? http://stackoverflow.com/a/16459606/376773
	// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
	return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||
		// Is firebug? http://stackoverflow.com/a/398120/376773
		(typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||
		// Is firefox >= v31?
		// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
		(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||
		// Double check webkit in userAgent just in case we are in a worker
		(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
}

/**
 * Colorize log arguments if enabled.
 *
 * @api public
 */

function formatArgs(args) {
	args[0] = (this.useColors ? '%c' : '') +
		this.namespace +
		(this.useColors ? ' %c' : ' ') +
		args[0] +
		(this.useColors ? '%c ' : ' ') +
		'+' + module.exports.humanize(this.diff);

	if (!this.useColors) {
		return;
	}

	const c = 'color: ' + this.color;
	args.splice(1, 0, c, 'color: inherit');

	// The final "%c" is somewhat tricky, because there could be other
	// arguments passed either before or after the %c, so we need to
	// figure out the correct index to insert the CSS into
	let index = 0;
	let lastC = 0;
	args[0].replace(/%[a-zA-Z%]/g, match => {
		if (match === '%%') {
			return;
		}
		index++;
		if (match === '%c') {
			// We only are interested in the *last* %c
			// (the user may have provided their own)
			lastC = index;
		}
	});

	args.splice(lastC, 0, c);
}

/**
 * Invokes `console.debug()` when available.
 * No-op when `console.debug` is not a "function".
 * If `console.debug` is not available, falls back
 * to `console.log`.
 *
 * @api public
 */
exports.log = console.debug || console.log || (() => {});

/**
 * Save `namespaces`.
 *
 * @param {String} namespaces
 * @api private
 */
function save(namespaces) {
	try {
		if (namespaces) {
			exports.storage.setItem('debug', namespaces);
		} else {
			exports.storage.removeItem('debug');
		}
	} catch (error) {
		// Swallow
		// XXX (@Qix-) should we be logging these?
	}
}

/**
 * Load `namespaces`.
 *
 * @return {String} returns the previously persisted debug modes
 * @api private
 */
function load() {
	let r;
	try {
		r = exports.storage.getItem('debug');
	} catch (error) {
		// Swallow
		// XXX (@Qix-) should we be logging these?
	}

	// If debug isn't set in LS, and we're in Electron, try to load $DEBUG
	if (!r && typeof process !== 'undefined' && 'env' in process) {
		r = process.env.DEBUG;
	}

	return r;
}

/**
 * Localstorage attempts to return the localstorage.
 *
 * This is necessary because safari throws
 * when a user disables cookies/localstorage
 * and you attempt to access it.
 *
 * @return {LocalStorage}
 * @api private
 */

function localstorage() {
	try {
		// TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context
		// The Browser also has localStorage in the global context.
		return localStorage;
	} catch (error) {
		// Swallow
		// XXX (@Qix-) should we be logging these?
	}
}

module.exports = __webpack_require__(289)(exports);

const {formatters} = module.exports;

/**
 * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
 */

formatters.j = function (v) {
	try {
		return JSON.stringify(v);
	} catch (error) {
		return '[UnexpectedJSONParseError]: ' + error.message;
	}
};

/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(15)))

/***/ }),
/* 9 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
const debug_1 = __webpack_require__(8);
const APP_NAME = 'mediasoup-client';
class Logger {
    constructor(prefix) {
        if (prefix) {
            this._debug = debug_1.default(`${APP_NAME}:${prefix}`);
            this._warn = debug_1.default(`${APP_NAME}:WARN:${prefix}`);
            this._error = debug_1.default(`${APP_NAME}:ERROR:${prefix}`);
        }
        else {
            this._debug = debug_1.default(APP_NAME);
            this._warn = debug_1.default(`${APP_NAME}:WARN`);
            this._error = debug_1.default(`${APP_NAME}:ERROR`);
        }
        /* eslint-disable no-console */
        this._debug.log = console.info.bind(console);
        this._warn.log = console.warn.bind(console);
        this._error.log = console.error.bind(console);
        /* eslint-enable no-console */
    }
    get debug() {
        return this._debug;
    }
    get warn() {
        return this._warn;
    }
    get error() {
        return this._error;
    }
}
exports.Logger = Logger;


/***/ }),
/* 10 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
/**
 * Clones the given data.
 */
function clone(data, defaultValue) {
    if (typeof data === 'undefined')
        return defaultValue;
    return JSON.parse(JSON.stringify(data));
}
exports.clone = clone;
/**
 * Generates a random positive integer.
 */
function generateRandomNumber() {
    return Math.round(Math.random() * 10000000);
}
exports.generateRandomNumber = generateRandomNumber;


/***/ }),
/* 11 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
/* WEBPACK VAR INJECTION */(function(global) {/*!
 * The buffer module from node.js, for the browser.
 *
 * @author   Feross Aboukhadijeh <http://feross.org>
 * @license  MIT
 */
/* eslint-disable no-proto */



var base64 = __webpack_require__(300)
var ieee754 = __webpack_require__(301)
var isArray = __webpack_require__(63)

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__(13)))

/***/ }),
/* 12 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var _AElement__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6);
/* harmony import */ var _AElementNS__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(32);



/**
 *
 * @constructor
 */
function ResizeSystem() {
    this.elts = [];
    this.cache = [];
    this.cacheOf = null;
    this.lastResizeTime = 0;
    window.addEventListener('resize', this.update.bind(this));
    this['goDown'+'AndCache'] = this.goDownAndCache.bind(this);
    this['notify'+'ToElt'] = this.notifyToElt.bind(this);
}

/***
 *
 * @param {AElement | AElementNS} elt
 */
ResizeSystem.prototype.goDownAndCache = function (elt){
    if (this.notifyToElt(elt))
        this.cache.push(elt);
    if (elt.childNodes) {
        Array.prototype.forEach.call(elt.childNodes, this.goDownAndCache);
    }
};

ResizeSystem.prototype.notifyToElt = function (elt){
    if (typeof elt.requestUpdateSize == 'function') {
        elt.requestUpdateSize();
        return true;
    }
    else if (typeof elt.updateSize == 'function') {
        elt.updateSize();
        return true;
    }
    else if (typeof elt.onresize == 'function') {
        elt.onresize();
        return true;
    }
};


ResizeSystem.prototype.update = function () {
    var now = new Date().getTime();
    if (now - 100 > this.lastResizeTime) {
        this.removeTrash();
        this.cache = undefined;
    }
    this.lastResizeTime = now;
    if (this.cacheOf !== null){
        this.cache = undefined;
        this.cacheOf = null;
    }


    if (this.cache === undefined) {
        this.cache = [];
        this.elts.forEach(this.goDownAndCache);
    }
    else {
        this.cache.forEach(this.notifyToElt);
    }
}

ResizeSystem.prototype.removeTrash = function () {
    this.elts = this.elts.filter(function (element) {
        return _AElement__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"].prototype.isDescendantOf.call(element, document.body);
    });
};

/***
 *
 * @param  {AElement| AElementNS | Node} fromElt
 * @returns {boolean}
 */
ResizeSystem.prototype.updateUp = function (fromElt) {
    while (fromElt) {
        if (typeof fromElt.requestUpdateSize == 'function') {
            fromElt.requestUpdateSize();
            return true;
        }
        else if (typeof fromElt.updateSize == 'function') {
            fromElt.updateSize();
            return true;
        }
        else if (typeof fromElt.onresize == 'function') {
            fromElt.onresize();
            return true;
        }
        fromElt = fromElt.parentElement;
    }
};

/***
 *
 * @param  {AElement| AElementNS | Node} fromElt
 * @returns {boolean}
 */
ResizeSystem.prototype.updateDown = function (fromElt) {
    var now = new Date().getTime();
    if (now - 100 > this.lastResizeTime) {
        this.cache = undefined;
    }
    this.lastResizeTime = now;
    if (this.cacheOf !== fromElt){
        this.cache = undefined;
        this.cacheOf = fromElt;
    }
    if (this.cache === undefined) {
        this.cache = [];
        this.goDownAndCache(fromElt);
    }
    else {
        this.cache.forEach(this.notifyToElt);
    }
};

/***
 *
 * @param {AElement| AElementNS | Node} elt
 * @return {boolean}
 */
ResizeSystem.prototype.add = function (elt) {
    for (var i = 0; i < this.elts.length; ++i)
        if (_AElement__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"].prototype.isDescendantOf.call(elt, this.elts[i])) {
            return false;
        }
    this.elts = this.elts.filter(function (e) {
        return !_AElement__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"].prototype.isDescendantOf.call(e, elt);
    });
    this.elts.push(elt);
    return true;
};

/* harmony default export */ __webpack_exports__["a"] = (new ResizeSystem());

/***/ }),
/* 13 */
/***/ (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;


/***/ }),
/* 14 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
const h264 = __webpack_require__(306);
const utils = __webpack_require__(10);
const RTP_PROBATOR_MID = 'probator';
const RTP_PROBATOR_SSRC = 1234;
const RTP_PROBATOR_CODEC_PAYLOAD_TYPE = 127;
/**
 * Validates RtpCapabilities. It may modify given data by adding missing
 * fields with default values.
 * It throws if invalid.
 */
function validateRtpCapabilities(caps) {
    if (typeof caps !== 'object')
        throw new TypeError('caps is not an object');
    // codecs is optional. If unset, fill with an empty array.
    if (caps.codecs && !Array.isArray(caps.codecs))
        throw new TypeError('caps.codecs is not an array');
    else if (!caps.codecs)
        caps.codecs = [];
    for (const codec of caps.codecs) {
        validateRtpCodecCapability(codec);
    }
    // headerExtensions is optional. If unset, fill with an empty array.
    if (caps.headerExtensions && !Array.isArray(caps.headerExtensions))
        throw new TypeError('caps.headerExtensions is not an array');
    else if (!caps.headerExtensions)
        caps.headerExtensions = [];
    for (const ext of caps.headerExtensions) {
        validateRtpHeaderExtension(ext);
    }
}
exports.validateRtpCapabilities = validateRtpCapabilities;
/**
 * Validates RtpCodecCapability. It may modify given data by adding missing
 * fields with default values.
 * It throws if invalid.
 */
function validateRtpCodecCapability(codec) {
    const MimeTypeRegex = new RegExp('^(audio|video)/(.+)', 'i');
    if (typeof codec !== 'object')
        throw new TypeError('codec is not an object');
    // mimeType is mandatory.
    if (!codec.mimeType || typeof codec.mimeType !== 'string')
        throw new TypeError('missing codec.mimeType');
    const mimeTypeMatch = MimeTypeRegex.exec(codec.mimeType);
    if (!mimeTypeMatch)
        throw new TypeError('invalid codec.mimeType');
    // Just override kind with media component of mimeType.
    codec.kind = mimeTypeMatch[1].toLowerCase();
    // preferredPayloadType is optional.
    if (codec.preferredPayloadType && typeof codec.preferredPayloadType !== 'number')
        throw new TypeError('invalid codec.preferredPayloadType');
    // clockRate is mandatory.
    if (typeof codec.clockRate !== 'number')
        throw new TypeError('missing codec.clockRate');
    // channels is optional. If unset, set it to 1 (just if audio).
    if (codec.kind === 'audio') {
        if (typeof codec.channels !== 'number')
            codec.channels = 1;
    }
    else {
        delete codec.channels;
    }
    // parameters is optional. If unset, set it to an empty object.
    if (!codec.parameters || typeof codec.parameters !== 'object')
        codec.parameters = {};
    for (const key of Object.keys(codec.parameters)) {
        let value = codec.parameters[key];
        if (value === undefined) {
            codec.parameters[key] = '';
            value = '';
        }
        if (typeof value !== 'string' && typeof value !== 'number') {
            throw new TypeError(`invalid codec parameter [key:${key}s, value:${value}]`);
        }
        // Specific parameters validation.
        if (key === 'apt') {
            if (typeof value !== 'number')
                throw new TypeError('invalid codec apt parameter');
        }
    }
    // rtcpFeedback is optional. If unset, set it to an empty array.
    if (!codec.rtcpFeedback || !Array.isArray(codec.rtcpFeedback))
        codec.rtcpFeedback = [];
    for (const fb of codec.rtcpFeedback) {
        validateRtcpFeedback(fb);
    }
}
exports.validateRtpCodecCapability = validateRtpCodecCapability;
/**
 * Validates RtcpFeedback. It may modify given data by adding missing
 * fields with default values.
 * It throws if invalid.
 */
function validateRtcpFeedback(fb) {
    if (typeof fb !== 'object')
        throw new TypeError('fb is not an object');
    // type is mandatory.
    if (!fb.type || typeof fb.type !== 'string')
        throw new TypeError('missing fb.type');
    // parameter is optional. If unset set it to an empty string.
    if (!fb.parameter || typeof fb.parameter !== 'string')
        fb.parameter = '';
}
exports.validateRtcpFeedback = validateRtcpFeedback;
/**
 * Validates RtpHeaderExtension. It may modify given data by adding missing
 * fields with default values.
 * It throws if invalid.
 */
function validateRtpHeaderExtension(ext) {
    if (typeof ext !== 'object')
        throw new TypeError('ext is not an object');
    // kind is optional. If unset set it to an empty string.
    if (!ext.kind || typeof ext.kind !== 'string')
        ext.kind = '';
    if (ext.kind !== '' && ext.kind !== 'audio' && ext.kind !== 'video')
        throw new TypeError('invalid ext.kind');
    // uri is mandatory.
    if (!ext.uri || typeof ext.uri !== 'string')
        throw new TypeError('missing ext.uri');
    // preferredId is mandatory.
    if (typeof ext.preferredId !== 'number')
        throw new TypeError('missing ext.preferredId');
    // preferredEncrypt is optional. If unset set it to false.
    if (ext.preferredEncrypt && typeof ext.preferredEncrypt !== 'boolean')
        throw new TypeError('invalid ext.preferredEncrypt');
    else if (!ext.preferredEncrypt)
        ext.preferredEncrypt = false;
    // direction is optional. If unset set it to sendrecv.
    if (ext.direction && typeof ext.direction !== 'string')
        throw new TypeError('invalid ext.direction');
    else if (!ext.direction)
        ext.direction = 'sendrecv';
}
exports.validateRtpHeaderExtension = validateRtpHeaderExtension;
/**
 * Validates RtpParameters. It may modify given data by adding missing
 * fields with default values.
 * It throws if invalid.
 */
function validateRtpParameters(params) {
    if (typeof params !== 'object')
        throw new TypeError('params is not an object');
    // mid is optional.
    if (params.mid && typeof params.mid !== 'string')
        throw new TypeError('params.mid is not a string');
    // codecs is mandatory.
    if (!Array.isArray(params.codecs))
        throw new TypeError('missing params.codecs');
    for (const codec of params.codecs) {
        validateRtpCodecParameters(codec);
    }
    // headerExtensions is optional. If unset, fill with an empty array.
    if (params.headerExtensions && !Array.isArray(params.headerExtensions))
        throw new TypeError('params.headerExtensions is not an array');
    else if (!params.headerExtensions)
        params.headerExtensions = [];
    for (const ext of params.headerExtensions) {
        validateRtpHeaderExtensionParameters(ext);
    }
    // encodings is optional. If unset, fill with an empty array.
    if (params.encodings && !Array.isArray(params.encodings))
        throw new TypeError('params.encodings is not an array');
    else if (!params.encodings)
        params.encodings = [];
    for (const encoding of params.encodings) {
        validateRtpEncodingParameters(encoding);
    }
    // rtcp is optional. If unset, fill with an empty object.
    if (params.rtcp && typeof params.rtcp !== 'object')
        throw new TypeError('params.rtcp is not an object');
    else if (!params.rtcp)
        params.rtcp = {};
    validateRtcpParameters(params.rtcp);
}
exports.validateRtpParameters = validateRtpParameters;
/**
 * Validates RtpCodecParameters. It may modify given data by adding missing
 * fields with default values.
 * It throws if invalid.
 */
function validateRtpCodecParameters(codec) {
    const MimeTypeRegex = new RegExp('^(audio|video)/(.+)', 'i');
    if (typeof codec !== 'object')
        throw new TypeError('codec is not an object');
    // mimeType is mandatory.
    if (!codec.mimeType || typeof codec.mimeType !== 'string')
        throw new TypeError('missing codec.mimeType');
    const mimeTypeMatch = MimeTypeRegex.exec(codec.mimeType);
    if (!mimeTypeMatch)
        throw new TypeError('invalid codec.mimeType');
    // payloadType is mandatory.
    if (typeof codec.payloadType !== 'number')
        throw new TypeError('missing codec.payloadType');
    // clockRate is mandatory.
    if (typeof codec.clockRate !== 'number')
        throw new TypeError('missing codec.clockRate');
    const kind = mimeTypeMatch[1].toLowerCase();
    // channels is optional. If unset, set it to 1 (just if audio).
    if (kind === 'audio') {
        if (typeof codec.channels !== 'number')
            codec.channels = 1;
    }
    else {
        delete codec.channels;
    }
    // parameters is optional. If unset, set it to an empty object.
    if (!codec.parameters || typeof codec.parameters !== 'object')
        codec.parameters = {};
    for (const key of Object.keys(codec.parameters)) {
        let value = codec.parameters[key];
        if (value === undefined) {
            codec.parameters[key] = '';
            value = '';
        }
        if (typeof value !== 'string' && typeof value !== 'number') {
            throw new TypeError(`invalid codec parameter [key:${key}s, value:${value}]`);
        }
        // Specific parameters validation.
        if (key === 'apt') {
            if (typeof value !== 'number')
                throw new TypeError('invalid codec apt parameter');
        }
    }
    // rtcpFeedback is optional. If unset, set it to an empty array.
    if (!codec.rtcpFeedback || !Array.isArray(codec.rtcpFeedback))
        codec.rtcpFeedback = [];
    for (const fb of codec.rtcpFeedback) {
        validateRtcpFeedback(fb);
    }
}
exports.validateRtpCodecParameters = validateRtpCodecParameters;
/**
 * Validates RtpHeaderExtensionParameteters. It may modify given data by adding missing
 * fields with default values.
 * It throws if invalid.
 */
function validateRtpHeaderExtensionParameters(ext) {
    if (typeof ext !== 'object')
        throw new TypeError('ext is not an object');
    // uri is mandatory.
    if (!ext.uri || typeof ext.uri !== 'string')
        throw new TypeError('missing ext.uri');
    // id is mandatory.
    if (typeof ext.id !== 'number')
        throw new TypeError('missing ext.id');
    // encrypt is optional. If unset set it to false.
    if (ext.encrypt && typeof ext.encrypt !== 'boolean')
        throw new TypeError('invalid ext.encrypt');
    else if (!ext.encrypt)
        ext.encrypt = false;
    // parameters is optional. If unset, set it to an empty object.
    if (!ext.parameters || typeof ext.parameters !== 'object')
        ext.parameters = {};
    for (const key of Object.keys(ext.parameters)) {
        let value = ext.parameters[key];
        if (value === undefined) {
            ext.parameters[key] = '';
            value = '';
        }
        if (typeof value !== 'string' && typeof value !== 'number')
            throw new TypeError('invalid header extension parameter');
    }
}
exports.validateRtpHeaderExtensionParameters = validateRtpHeaderExtensionParameters;
/**
 * Validates RtpEncodingParameters. It may modify given data by adding missing
 * fields with default values.
 * It throws if invalid.
 */
function validateRtpEncodingParameters(encoding) {
    if (typeof encoding !== 'object')
        throw new TypeError('encoding is not an object');
    // ssrc is optional.
    if (encoding.ssrc && typeof encoding.ssrc !== 'number')
        throw new TypeError('invalid encoding.ssrc');
    // rid is optional.
    if (encoding.rid && typeof encoding.rid !== 'string')
        throw new TypeError('invalid encoding.rid');
    // rtx is optional.
    if (encoding.rtx && typeof encoding.rtx !== 'object') {
        throw new TypeError('invalid encoding.rtx');
    }
    else if (encoding.rtx) {
        // RTX ssrc is mandatory if rtx is present.
        if (typeof encoding.rtx.ssrc !== 'number')
            throw new TypeError('missing encoding.rtx.ssrc');
    }
    // dtx is optional. If unset set it to false.
    if (!encoding.dtx || typeof encoding.dtx !== 'boolean')
        encoding.dtx = false;
    // scalabilityMode is optional.
    if (encoding.scalabilityMode && typeof encoding.scalabilityMode !== 'string')
        throw new TypeError('invalid encoding.scalabilityMode');
}
exports.validateRtpEncodingParameters = validateRtpEncodingParameters;
/**
 * Validates RtcpParameters. It may modify given data by adding missing
 * fields with default values.
 * It throws if invalid.
 */
function validateRtcpParameters(rtcp) {
    if (typeof rtcp !== 'object')
        throw new TypeError('rtcp is not an object');
    // cname is optional.
    if (rtcp.cname && typeof rtcp.cname !== 'string')
        throw new TypeError('invalid rtcp.cname');
    // reducedSize is optional. If unset set it to true.
    if (!rtcp.reducedSize || typeof rtcp.reducedSize !== 'boolean')
        rtcp.reducedSize = true;
}
exports.validateRtcpParameters = validateRtcpParameters;
/**
 * Validates SctpCapabilities. It may modify given data by adding missing
 * fields with default values.
 * It throws if invalid.
 */
function validateSctpCapabilities(caps) {
    if (typeof caps !== 'object')
        throw new TypeError('caps is not an object');
    // numStreams is mandatory.
    if (!caps.numStreams || typeof caps.numStreams !== 'object')
        throw new TypeError('missing caps.numStreams');
    validateNumSctpStreams(caps.numStreams);
}
exports.validateSctpCapabilities = validateSctpCapabilities;
/**
 * Validates NumSctpStreams. It may modify given data by adding missing
 * fields with default values.
 * It throws if invalid.
 */
function validateNumSctpStreams(numStreams) {
    if (typeof numStreams !== 'object')
        throw new TypeError('numStreams is not an object');
    // OS is mandatory.
    if (typeof numStreams.OS !== 'number')
        throw new TypeError('missing numStreams.OS');
    // MIS is mandatory.
    if (typeof numStreams.MIS !== 'number')
        throw new TypeError('missing numStreams.MIS');
}
exports.validateNumSctpStreams = validateNumSctpStreams;
/**
 * Validates SctpParameters. It may modify given data by adding missing
 * fields with default values.
 * It throws if invalid.
 */
function validateSctpParameters(params) {
    if (typeof params !== 'object')
        throw new TypeError('params is not an object');
    // port is mandatory.
    if (typeof params.port !== 'number')
        throw new TypeError('missing params.port');
    // OS is mandatory.
    if (typeof params.OS !== 'number')
        throw new TypeError('missing params.OS');
    // MIS is mandatory.
    if (typeof params.MIS !== 'number')
        throw new TypeError('missing params.MIS');
    // maxMessageSize is mandatory.
    if (typeof params.maxMessageSize !== 'number')
        throw new TypeError('missing params.maxMessageSize');
}
exports.validateSctpParameters = validateSctpParameters;
/**
 * Validates SctpStreamParameters. It may modify given data by adding missing
 * fields with default values.
 * It throws if invalid.
 */
function validateSctpStreamParameters(params) {
    if (typeof params !== 'object')
        throw new TypeError('params is not an object');
    // streamId is mandatory.
    if (typeof params.streamId !== 'number')
        throw new TypeError('missing params.streamId');
    // ordered is optional.
    let orderedGiven = false;
    if (typeof params.ordered === 'boolean')
        orderedGiven = true;
    else
        params.ordered = true;
    // maxPacketLifeTime is optional.
    if (params.maxPacketLifeTime && typeof params.maxPacketLifeTime !== 'number')
        throw new TypeError('invalid params.maxPacketLifeTime');
    // maxRetransmits is optional.
    if (params.maxRetransmits && typeof params.maxRetransmits !== 'number')
        throw new TypeError('invalid params.maxRetransmits');
    if (params.maxPacketLifeTime && params.maxRetransmits)
        throw new TypeError('cannot provide both maxPacketLifeTime and maxRetransmits');
    if (orderedGiven &&
        params.ordered &&
        (params.maxPacketLifeTime || params.maxRetransmits)) {
        throw new TypeError('cannot be ordered with maxPacketLifeTime or maxRetransmits');
    }
    else if (!orderedGiven && (params.maxPacketLifeTime || params.maxRetransmits)) {
        params.ordered = false;
    }
    // priority is optional.
    if (params.priority && typeof params.priority !== 'string')
        throw new TypeError('invalid params.priority');
    // label is optional.
    if (params.label && typeof params.label !== 'string')
        throw new TypeError('invalid params.label');
    // protocol is optional.
    if (params.protocol && typeof params.protocol !== 'string')
        throw new TypeError('invalid params.protocol');
}
exports.validateSctpStreamParameters = validateSctpStreamParameters;
/**
 * Generate extended RTP capabilities for sending and receiving.
 */
function getExtendedRtpCapabilities(localCaps, remoteCaps) {
    const extendedRtpCapabilities = {
        codecs: [],
        headerExtensions: []
    };
    // Match media codecs and keep the order preferred by remoteCaps.
    for (const remoteCodec of remoteCaps.codecs || []) {
        if (isRtxCodec(remoteCodec))
            continue;
        const matchingLocalCodec = (localCaps.codecs || [])
            .find((localCodec) => (matchCodecs(localCodec, remoteCodec, { strict: true, modify: true })));
        if (!matchingLocalCodec)
            continue;
        const extendedCodec = {
            mimeType: matchingLocalCodec.mimeType,
            kind: matchingLocalCodec.kind,
            clockRate: matchingLocalCodec.clockRate,
            channels: matchingLocalCodec.channels,
            localPayloadType: matchingLocalCodec.preferredPayloadType,
            localRtxPayloadType: undefined,
            remotePayloadType: remoteCodec.preferredPayloadType,
            remoteRtxPayloadType: undefined,
            localParameters: matchingLocalCodec.parameters,
            remoteParameters: remoteCodec.parameters,
            rtcpFeedback: reduceRtcpFeedback(matchingLocalCodec, remoteCodec)
        };
        extendedRtpCapabilities.codecs.push(extendedCodec);
    }
    // Match RTX codecs.
    for (const extendedCodec of extendedRtpCapabilities.codecs) {
        const matchingLocalRtxCodec = localCaps.codecs
            .find((localCodec) => (isRtxCodec(localCodec) &&
            localCodec.parameters.apt === extendedCodec.localPayloadType));
        const matchingRemoteRtxCodec = remoteCaps.codecs
            .find((remoteCodec) => (isRtxCodec(remoteCodec) &&
            remoteCodec.parameters.apt === extendedCodec.remotePayloadType));
        if (matchingLocalRtxCodec && matchingRemoteRtxCodec) {
            extendedCodec.localRtxPayloadType = matchingLocalRtxCodec.preferredPayloadType;
            extendedCodec.remoteRtxPayloadType = matchingRemoteRtxCodec.preferredPayloadType;
        }
    }
    // Match header extensions.
    for (const remoteExt of remoteCaps.headerExtensions) {
        const matchingLocalExt = localCaps.headerExtensions
            .find((localExt) => (matchHeaderExtensions(localExt, remoteExt)));
        if (!matchingLocalExt)
            continue;
        const extendedExt = {
            kind: remoteExt.kind,
            uri: remoteExt.uri,
            sendId: matchingLocalExt.preferredId,
            recvId: remoteExt.preferredId,
            encrypt: matchingLocalExt.preferredEncrypt,
            direction: 'sendrecv'
        };
        switch (remoteExt.direction) {
            case 'sendrecv':
                extendedExt.direction = 'sendrecv';
                break;
            case 'recvonly':
                extendedExt.direction = 'sendonly';
                break;
            case 'sendonly':
                extendedExt.direction = 'recvonly';
                break;
            case 'inactive':
                extendedExt.direction = 'inactive';
                break;
        }
        extendedRtpCapabilities.headerExtensions.push(extendedExt);
    }
    return extendedRtpCapabilities;
}
exports.getExtendedRtpCapabilities = getExtendedRtpCapabilities;
/**
 * Generate RTP capabilities for receiving media based on the given extended
 * RTP capabilities.
 */
function getRecvRtpCapabilities(extendedRtpCapabilities) {
    const rtpCapabilities = {
        codecs: [],
        headerExtensions: []
    };
    for (const extendedCodec of extendedRtpCapabilities.codecs) {
        const codec = {
            mimeType: extendedCodec.mimeType,
            kind: extendedCodec.kind,
            preferredPayloadType: extendedCodec.remotePayloadType,
            clockRate: extendedCodec.clockRate,
            channels: extendedCodec.channels,
            parameters: extendedCodec.localParameters,
            rtcpFeedback: extendedCodec.rtcpFeedback
        };
        rtpCapabilities.codecs.push(codec);
        // Add RTX codec.
        if (!extendedCodec.remoteRtxPayloadType)
            continue;
        const rtxCodec = {
            mimeType: `${extendedCodec.kind}/rtx`,
            kind: extendedCodec.kind,
            preferredPayloadType: extendedCodec.remoteRtxPayloadType,
            clockRate: extendedCodec.clockRate,
            parameters: {
                apt: extendedCodec.remotePayloadType
            },
            rtcpFeedback: []
        };
        rtpCapabilities.codecs.push(rtxCodec);
        // TODO: In the future, we need to add FEC, CN, etc, codecs.
    }
    for (const extendedExtension of extendedRtpCapabilities.headerExtensions) {
        // Ignore RTP extensions not valid for receiving.
        if (extendedExtension.direction !== 'sendrecv' &&
            extendedExtension.direction !== 'recvonly') {
            continue;
        }
        const ext = {
            kind: extendedExtension.kind,
            uri: extendedExtension.uri,
            preferredId: extendedExtension.recvId,
            preferredEncrypt: extendedExtension.encrypt,
            direction: extendedExtension.direction
        };
        rtpCapabilities.headerExtensions.push(ext);
    }
    return rtpCapabilities;
}
exports.getRecvRtpCapabilities = getRecvRtpCapabilities;
/**
 * Generate RTP parameters of the given kind for sending media.
 * NOTE: mid, encodings and rtcp fields are left empty.
 */
function getSendingRtpParameters(kind, extendedRtpCapabilities) {
    const rtpParameters = {
        mid: undefined,
        codecs: [],
        headerExtensions: [],
        encodings: [],
        rtcp: {}
    };
    for (const extendedCodec of extendedRtpCapabilities.codecs) {
        if (extendedCodec.kind !== kind)
            continue;
        const codec = {
            mimeType: extendedCodec.mimeType,
            payloadType: extendedCodec.localPayloadType,
            clockRate: extendedCodec.clockRate,
            channels: extendedCodec.channels,
            parameters: extendedCodec.localParameters,
            rtcpFeedback: extendedCodec.rtcpFeedback
        };
        rtpParameters.codecs.push(codec);
        // Add RTX codec.
        if (extendedCodec.localRtxPayloadType) {
            const rtxCodec = {
                mimeType: `${extendedCodec.kind}/rtx`,
                payloadType: extendedCodec.localRtxPayloadType,
                clockRate: extendedCodec.clockRate,
                parameters: {
                    apt: extendedCodec.localPayloadType
                },
                rtcpFeedback: []
            };
            rtpParameters.codecs.push(rtxCodec);
        }
    }
    for (const extendedExtension of extendedRtpCapabilities.headerExtensions) {
        // Ignore RTP extensions of a different kind and those not valid for sending.
        if ((extendedExtension.kind && extendedExtension.kind !== kind) ||
            (extendedExtension.direction !== 'sendrecv' &&
                extendedExtension.direction !== 'sendonly')) {
            continue;
        }
        const ext = {
            uri: extendedExtension.uri,
            id: extendedExtension.sendId,
            encrypt: extendedExtension.encrypt,
            parameters: {}
        };
        rtpParameters.headerExtensions.push(ext);
    }
    return rtpParameters;
}
exports.getSendingRtpParameters = getSendingRtpParameters;
/**
 * Generate RTP parameters of the given kind suitable for the remote SDP answer.
 */
function getSendingRemoteRtpParameters(kind, extendedRtpCapabilities) {
    const rtpParameters = {
        mid: undefined,
        codecs: [],
        headerExtensions: [],
        encodings: [],
        rtcp: {}
    };
    for (const extendedCodec of extendedRtpCapabilities.codecs) {
        if (extendedCodec.kind !== kind)
            continue;
        const codec = {
            mimeType: extendedCodec.mimeType,
            payloadType: extendedCodec.localPayloadType,
            clockRate: extendedCodec.clockRate,
            channels: extendedCodec.channels,
            parameters: extendedCodec.remoteParameters,
            rtcpFeedback: extendedCodec.rtcpFeedback
        };
        rtpParameters.codecs.push(codec);
        // Add RTX codec.
        if (extendedCodec.localRtxPayloadType) {
            const rtxCodec = {
                mimeType: `${extendedCodec.kind}/rtx`,
                payloadType: extendedCodec.localRtxPayloadType,
                clockRate: extendedCodec.clockRate,
                parameters: {
                    apt: extendedCodec.localPayloadType
                },
                rtcpFeedback: []
            };
            rtpParameters.codecs.push(rtxCodec);
        }
    }
    for (const extendedExtension of extendedRtpCapabilities.headerExtensions) {
        // Ignore RTP extensions of a different kind and those not valid for sending.
        if ((extendedExtension.kind && extendedExtension.kind !== kind) ||
            (extendedExtension.direction !== 'sendrecv' &&
                extendedExtension.direction !== 'sendonly')) {
            continue;
        }
        const ext = {
            uri: extendedExtension.uri,
            id: extendedExtension.sendId,
            encrypt: extendedExtension.encrypt,
            parameters: {}
        };
        rtpParameters.headerExtensions.push(ext);
    }
    // Reduce codecs' RTCP feedback. Use Transport-CC if available, REMB otherwise.
    if (rtpParameters.headerExtensions.some((ext) => (ext.uri === 'http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01'))) {
        for (const codec of rtpParameters.codecs) {
            codec.rtcpFeedback = (codec.rtcpFeedback || [])
                .filter((fb) => fb.type !== 'goog-remb');
        }
    }
    else if (rtpParameters.headerExtensions.some((ext) => (ext.uri === 'http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time'))) {
        for (const codec of rtpParameters.codecs) {
            codec.rtcpFeedback = (codec.rtcpFeedback || [])
                .filter((fb) => fb.type !== 'transport-cc');
        }
    }
    else {
        for (const codec of rtpParameters.codecs) {
            codec.rtcpFeedback = (codec.rtcpFeedback || [])
                .filter((fb) => (fb.type !== 'transport-cc' &&
                fb.type !== 'goog-remb'));
        }
    }
    return rtpParameters;
}
exports.getSendingRemoteRtpParameters = getSendingRemoteRtpParameters;
/**
 * Reduce given codecs by returning an array of codecs "compatible" with the
 * given capability codec. If no capability codec is given, take the first
 * one(s).
 *
 * Given codecs must be generated by ortc.getSendingRtpParameters() or
 * ortc.getSendingRemoteRtpParameters().
 *
 * The returned array of codecs also include a RTX codec if available.
 */
function reduceCodecs(codecs, capCodec) {
    const filteredCodecs = [];
    // If no capability codec is given, take the first one (and RTX).
    if (!capCodec) {
        filteredCodecs.push(codecs[0]);
        if (isRtxCodec(codecs[1]))
            filteredCodecs.push(codecs[1]);
    }
    // Otherwise look for a compatible set of codecs.
    else {
        for (let idx = 0; idx < codecs.length; ++idx) {
            if (matchCodecs(codecs[idx], capCodec)) {
                filteredCodecs.push(codecs[idx]);
                if (isRtxCodec(codecs[idx + 1]))
                    filteredCodecs.push(codecs[idx + 1]);
                break;
            }
        }
        if (filteredCodecs.length === 0)
            throw new TypeError('no matching codec found');
    }
    return filteredCodecs;
}
exports.reduceCodecs = reduceCodecs;
/**
 * Create RTP parameters for a Consumer for the RTP probator.
 */
function generateProbatorRtpParameters(videoRtpParameters) {
    // Clone given reference video RTP parameters.
    videoRtpParameters = utils.clone(videoRtpParameters, {});
    // This may throw.
    validateRtpParameters(videoRtpParameters);
    const rtpParameters = {
        mid: RTP_PROBATOR_MID,
        codecs: [],
        headerExtensions: [],
        encodings: [{ ssrc: RTP_PROBATOR_SSRC }],
        rtcp: { cname: 'probator' }
    };
    rtpParameters.codecs.push(videoRtpParameters.codecs[0]);
    rtpParameters.codecs[0].payloadType = RTP_PROBATOR_CODEC_PAYLOAD_TYPE;
    rtpParameters.headerExtensions = videoRtpParameters.headerExtensions;
    return rtpParameters;
}
exports.generateProbatorRtpParameters = generateProbatorRtpParameters;
/**
 * Whether media can be sent based on the given RTP capabilities.
 */
function canSend(kind, extendedRtpCapabilities) {
    return extendedRtpCapabilities.codecs.
        some((codec) => codec.kind === kind);
}
exports.canSend = canSend;
/**
 * Whether the given RTP parameters can be received with the given RTP
 * capabilities.
 */
function canReceive(rtpParameters, extendedRtpCapabilities) {
    // This may throw.
    validateRtpParameters(rtpParameters);
    if (rtpParameters.codecs.length === 0)
        return false;
    const firstMediaCodec = rtpParameters.codecs[0];
    return extendedRtpCapabilities.codecs
        .some((codec) => codec.remotePayloadType === firstMediaCodec.payloadType);
}
exports.canReceive = canReceive;
function isRtxCodec(codec) {
    if (!codec)
        return false;
    return /.+\/rtx$/i.test(codec.mimeType);
}
function matchCodecs(aCodec, bCodec, { strict = false, modify = false } = {}) {
    const aMimeType = aCodec.mimeType.toLowerCase();
    const bMimeType = bCodec.mimeType.toLowerCase();
    if (aMimeType !== bMimeType)
        return false;
    if (aCodec.clockRate !== bCodec.clockRate)
        return false;
    if (aCodec.channels !== bCodec.channels)
        return false;
    // Per codec special checks.
    switch (aMimeType) {
        case 'video/h264':
            {
                const aPacketizationMode = aCodec.parameters['packetization-mode'] || 0;
                const bPacketizationMode = bCodec.parameters['packetization-mode'] || 0;
                if (aPacketizationMode !== bPacketizationMode)
                    return false;
                // If strict matching check profile-level-id.
                if (strict) {
                    if (!h264.isSameProfile(aCodec.parameters, bCodec.parameters))
                        return false;
                    let selectedProfileLevelId;
                    try {
                        selectedProfileLevelId =
                            h264.generateProfileLevelIdForAnswer(aCodec.parameters, bCodec.parameters);
                    }
                    catch (error) {
                        return false;
                    }
                    if (modify) {
                        if (selectedProfileLevelId) {
                            aCodec.parameters['profile-level-id'] = selectedProfileLevelId;
                            bCodec.parameters['profile-level-id'] = selectedProfileLevelId;
                        }
                        else {
                            delete aCodec.parameters['profile-level-id'];
                            delete bCodec.parameters['profile-level-id'];
                        }
                    }
                }
                break;
            }
        case 'video/vp9':
            {
                // If strict matching check profile-id.
                if (strict) {
                    const aProfileId = aCodec.parameters['profile-id'] || 0;
                    const bProfileId = bCodec.parameters['profile-id'] || 0;
                    if (aProfileId !== bProfileId)
                        return false;
                }
                break;
            }
    }
    return true;
}
function matchHeaderExtensions(aExt, bExt) {
    if (aExt.kind && bExt.kind && aExt.kind !== bExt.kind)
        return false;
    if (aExt.uri !== bExt.uri)
        return false;
    return true;
}
function reduceRtcpFeedback(codecA, codecB) {
    const reducedRtcpFeedback = [];
    for (const aFb of codecA.rtcpFeedback || []) {
        const matchingBFb = (codecB.rtcpFeedback || [])
            .find((bFb) => (bFb.type === aFb.type &&
            (bFb.parameter === aFb.parameter || (!bFb.parameter && !aFb.parameter))));
        if (matchingBFb)
            reducedRtcpFeedback.push(matchingBFb);
    }
    return reducedRtcpFeedback;
}


/***/ }),
/* 15 */
/***/ (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; };


/***/ }),
/* 16 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
/**
 * Error indicating not support for something.
 */
class UnsupportedError extends Error {
    constructor(message) {
        super(message);
        this.name = 'UnsupportedError';
        if (Error.hasOwnProperty('captureStackTrace')) // Just in V8.
         {
            // @ts-ignore
            Error.captureStackTrace(this, UnsupportedError);
        }
        else {
            this.stack = (new Error(message)).stack;
        }
    }
}
exports.UnsupportedError = UnsupportedError;
/**
 * Error produced when calling a method in an invalid state.
 */
class InvalidStateError extends Error {
    constructor(message) {
        super(message);
        this.name = 'InvalidStateError';
        if (Error.hasOwnProperty('captureStackTrace')) // Just in V8.
         {
            // @ts-ignore
            Error.captureStackTrace(this, InvalidStateError);
        }
        else {
            this.stack = (new Error(message)).stack;
        }
    }
}
exports.InvalidStateError = InvalidStateError;


/***/ }),
/* 17 */
/***/ (function(module, exports, __webpack_require__) {

var parser = __webpack_require__(309);
var writer = __webpack_require__(310);

exports.write = writer;
exports.parse = parser.parse;
exports.parseParams = parser.parseParams;
exports.parseFmtpConfig = parser.parseFmtpConfig; // Alias of parseParams().
exports.parsePayloads = parser.parsePayloads;
exports.parseRemoteCandidates = parser.parseRemoteCandidates;
exports.parseImageAttributes = parser.parseImageAttributes;
exports.parseSimulcastStreamList = parser.parseSimulcastStreamList;


/***/ }),
/* 18 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
const EnhancedEventEmitter_1 = __webpack_require__(22);
class HandlerInterface extends EnhancedEventEmitter_1.EnhancedEventEmitter {
    /**
     * @emits @connect - (
     *     { dtlsParameters: DtlsParameters },
     *     callback: Function,
     *     errback: Function
     *   )
     * @emits @connectionstatechange - (connectionState: ConnectionState)
     */
    constructor() {
        super();
    }
}
exports.HandlerInterface = HandlerInterface;


/***/ }),
/* 19 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
const sdpTransform = __webpack_require__(17);
function extractRtpCapabilities({ sdpObject }) {
    // Map of RtpCodecParameters indexed by payload type.
    const codecsMap = new Map();
    // Array of RtpHeaderExtensions.
    const headerExtensions = [];
    // Whether a m=audio/video section has been already found.
    let gotAudio = false;
    let gotVideo = false;
    for (const m of sdpObject.media) {
        const kind = m.type;
        switch (kind) {
            case 'audio':
                {
                    if (gotAudio)
                        continue;
                    gotAudio = true;
                    break;
                }
            case 'video':
                {
                    if (gotVideo)
                        continue;
                    gotVideo = true;
                    break;
                }
            default:
                {
                    continue;
                }
        }
        // Get codecs.
        for (const rtp of m.rtp) {
            const codec = {
                kind: kind,
                mimeType: `${kind}/${rtp.codec}`,
                preferredPayloadType: rtp.payload,
                clockRate: rtp.rate,
                channels: rtp.encoding,
                parameters: {},
                rtcpFeedback: []
            };
            codecsMap.set(codec.preferredPayloadType, codec);
        }
        // Get codec parameters.
        for (const fmtp of m.fmtp || []) {
            const parameters = sdpTransform.parseParams(fmtp.config);
            const codec = codecsMap.get(fmtp.payload);
            if (!codec)
                continue;
            // Specials case to convert parameter value to string.
            if (parameters && parameters['profile-level-id'])
                parameters['profile-level-id'] = String(parameters['profile-level-id']);
            codec.parameters = parameters;
        }
        // Get RTCP feedback for each codec.
        for (const fb of m.rtcpFb || []) {
            const codec = codecsMap.get(fb.payload);
            if (!codec)
                continue;
            const feedback = {
                type: fb.type,
                parameter: fb.subtype
            };
            if (!feedback.parameter)
                delete feedback.parameter;
            codec.rtcpFeedback.push(feedback);
        }
        // Get RTP header extensions.
        for (const ext of m.ext || []) {
            // Ignore encrypted extensions (not yet supported in mediasoup).
            if (ext['encrypt-uri'])
                continue;
            const headerExtension = {
                kind: kind,
                uri: ext.uri,
                preferredId: ext.value
            };
            headerExtensions.push(headerExtension);
        }
    }
    const rtpCapabilities = {
        codecs: Array.from(codecsMap.values()),
        headerExtensions: headerExtensions
    };
    return rtpCapabilities;
}
exports.extractRtpCapabilities = extractRtpCapabilities;
function extractDtlsParameters({ sdpObject }) {
    const mediaObject = (sdpObject.media || [])
        .find((m) => (m.iceUfrag && m.port !== 0));
    if (!mediaObject)
        throw new Error('no active media section found');
    const fingerprint = mediaObject.fingerprint || sdpObject.fingerprint;
    let role;
    switch (mediaObject.setup) {
        case 'active':
            role = 'client';
            break;
        case 'passive':
            role = 'server';
            break;
        case 'actpass':
            role = 'auto';
            break;
    }
    const dtlsParameters = {
        role,
        fingerprints: [
            {
                algorithm: fingerprint.type,
                value: fingerprint.hash
            }
        ]
    };
    return dtlsParameters;
}
exports.extractDtlsParameters = extractDtlsParameters;
function getCname({ offerMediaObject }) {
    const ssrcCnameLine = (offerMediaObject.ssrcs || [])
        .find((line) => line.attribute === 'cname');
    if (!ssrcCnameLine)
        return '';
    return ssrcCnameLine.value;
}
exports.getCname = getCname;
/**
 * Apply codec parameters in the given SDP m= section answer based on the
 * given RTP parameters of an offer.
 */
function applyCodecParameters({ offerRtpParameters, answerMediaObject }) {
    for (const codec of offerRtpParameters.codecs) {
        const mimeType = codec.mimeType.toLowerCase();
        // Avoid parsing codec parameters for unhandled codecs.
        if (mimeType !== 'audio/opus')
            continue;
        const rtp = (answerMediaObject.rtp || [])
            .find((r) => r.payload === codec.payloadType);
        if (!rtp)
            continue;
        // Just in case.
        answerMediaObject.fmtp = answerMediaObject.fmtp || [];
        let fmtp = answerMediaObject.fmtp
            .find((f) => f.payload === codec.payloadType);
        if (!fmtp) {
            fmtp = { payload: codec.payloadType, config: '' };
            answerMediaObject.fmtp.push(fmtp);
        }
        const parameters = sdpTransform.parseParams(fmtp.config);
        switch (mimeType) {
            case 'audio/opus':
                {
                    const spropStereo = codec.parameters['sprop-stereo'];
                    if (spropStereo !== undefined)
                        parameters.stereo = spropStereo ? 1 : 0;
                    break;
                }
        }
        // Write the codec fmtp.config back.
        fmtp.config = '';
        for (const key of Object.keys(parameters)) {
            if (fmtp.config)
                fmtp.config += ';';
            fmtp.config += `${key}=${parameters[key]}`;
        }
    }
}
exports.applyCodecParameters = applyCodecParameters;


/***/ }),
/* 20 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
const sdpTransform = __webpack_require__(17);
const Logger_1 = __webpack_require__(9);
const MediaSection_1 = __webpack_require__(311);
const logger = new Logger_1.Logger('RemoteSdp');
class RemoteSdp {
    constructor({ iceParameters, iceCandidates, dtlsParameters, sctpParameters, plainRtpParameters, planB = false }) {
        // MediaSection instances with same order as in the SDP.
        this._mediaSections = [];
        // MediaSection indices indexed by MID.
        this._midToIndex = new Map();
        this._iceParameters = iceParameters;
        this._iceCandidates = iceCandidates;
        this._dtlsParameters = dtlsParameters;
        this._sctpParameters = sctpParameters;
        this._plainRtpParameters = plainRtpParameters;
        this._planB = planB;
        this._sdpObject =
            {
                version: 0,
                origin: {
                    address: '0.0.0.0',
                    ipVer: 4,
                    netType: 'IN',
                    sessionId: 10000,
                    sessionVersion: 0,
                    username: 'mediasoup-client'
                },
                name: '-',
                timing: { start: 0, stop: 0 },
                media: []
            };
        // If ICE parameters are given, add ICE-Lite indicator.
        if (iceParameters && iceParameters.iceLite) {
            this._sdpObject.icelite = 'ice-lite';
        }
        // If DTLS parameters are given, assume WebRTC and BUNDLE.
        if (dtlsParameters) {
            this._sdpObject.msidSemantic = { semantic: 'WMS', token: '*' };
            // NOTE: We take the latest fingerprint.
            const numFingerprints = this._dtlsParameters.fingerprints.length;
            this._sdpObject.fingerprint =
                {
                    type: dtlsParameters.fingerprints[numFingerprints - 1].algorithm,
                    hash: dtlsParameters.fingerprints[numFingerprints - 1].value
                };
            this._sdpObject.groups = [{ type: 'BUNDLE', mids: '' }];
        }
        // If there are plain RPT parameters, override SDP origin.
        if (plainRtpParameters) {
            this._sdpObject.origin.address = plainRtpParameters.ip;
            this._sdpObject.origin.ipVer = plainRtpParameters.ipVersion;
        }
    }
    updateIceParameters(iceParameters) {
        logger.debug('updateIceParameters() [iceParameters:%o]', iceParameters);
        this._iceParameters = iceParameters;
        this._sdpObject.icelite = iceParameters.iceLite ? 'ice-lite' : undefined;
        for (const mediaSection of this._mediaSections) {
            mediaSection.setIceParameters(iceParameters);
        }
    }
    updateDtlsRole(role) {
        logger.debug('updateDtlsRole() [role:%s]', role);
        this._dtlsParameters.role = role;
        for (const mediaSection of this._mediaSections) {
            mediaSection.setDtlsRole(role);
        }
    }
    getNextMediaSectionIdx() {
        // If a closed media section is found, return its index.
        for (let idx = 0; idx < this._mediaSections.length; ++idx) {
            const mediaSection = this._mediaSections[idx];
            if (mediaSection.closed)
                return { idx, reuseMid: mediaSection.mid };
        }
        // If no closed media section is found, return next one.
        return { idx: this._mediaSections.length };
    }
    send({ offerMediaObject, reuseMid, offerRtpParameters, answerRtpParameters, codecOptions, extmapAllowMixed = false }) {
        const mediaSection = new MediaSection_1.AnswerMediaSection({
            iceParameters: this._iceParameters,
            iceCandidates: this._iceCandidates,
            dtlsParameters: this._dtlsParameters,
            plainRtpParameters: this._plainRtpParameters,
            planB: this._planB,
            offerMediaObject,
            offerRtpParameters,
            answerRtpParameters,
            codecOptions,
            extmapAllowMixed
        });
        // Unified-Plan with closed media section replacement.
        if (reuseMid) {
            this._replaceMediaSection(mediaSection, reuseMid);
        }
        // Unified-Plan or Plan-B with different media kind.
        else if (!this._midToIndex.has(mediaSection.mid)) {
            this._addMediaSection(mediaSection);
        }
        // Plan-B with same media kind.
        else {
            this._replaceMediaSection(mediaSection);
        }
    }
    receive({ mid, kind, offerRtpParameters, streamId, trackId }) {
        const idx = this._midToIndex.get(mid);
        let mediaSection;
        if (idx !== undefined)
            mediaSection = this._mediaSections[idx];
        // Unified-Plan or different media kind.
        if (!mediaSection) {
            mediaSection = new MediaSection_1.OfferMediaSection({
                iceParameters: this._iceParameters,
                iceCandidates: this._iceCandidates,
                dtlsParameters: this._dtlsParameters,
                plainRtpParameters: this._plainRtpParameters,
                planB: this._planB,
                mid,
                kind,
                offerRtpParameters,
                streamId,
                trackId
            });
            // Let's try to recycle a closed media section (if any).
            // NOTE: Yes, we can recycle a closed m=audio section with a new m=video.
            const oldMediaSection = this._mediaSections.find((m) => (m.closed));
            if (oldMediaSection) {
                this._replaceMediaSection(mediaSection, oldMediaSection.mid);
            }
            else {
                this._addMediaSection(mediaSection);
            }
        }
        // Plan-B.
        else {
            mediaSection.planBReceive({ offerRtpParameters, streamId, trackId });
            this._replaceMediaSection(mediaSection);
        }
    }
    disableMediaSection(mid) {
        const idx = this._midToIndex.get(mid);
        if (idx === undefined) {
            throw new Error(`no media section found with mid '${mid}'`);
        }
        const mediaSection = this._mediaSections[idx];
        mediaSection.disable();
    }
    closeMediaSection(mid) {
        const idx = this._midToIndex.get(mid);
        if (idx === undefined) {
            throw new Error(`no media section found with mid '${mid}'`);
        }
        const mediaSection = this._mediaSections[idx];
        // NOTE: Closing the first m section is a pain since it invalidates the
        // bundled transport, so let's avoid it.
        if (mid === this._firstMid) {
            logger.debug('closeMediaSection() | cannot close first media section, disabling it instead [mid:%s]', mid);
            this.disableMediaSection(mid);
            return;
        }
        mediaSection.close();
        // Regenerate BUNDLE mids.
        this._regenerateBundleMids();
    }
    planBStopReceiving({ mid, offerRtpParameters }) {
        const idx = this._midToIndex.get(mid);
        if (idx === undefined) {
            throw new Error(`no media section found with mid '${mid}'`);
        }
        const mediaSection = this._mediaSections[idx];
        mediaSection.planBStopReceiving({ offerRtpParameters });
        this._replaceMediaSection(mediaSection);
    }
    sendSctpAssociation({ offerMediaObject }) {
        const mediaSection = new MediaSection_1.AnswerMediaSection({
            iceParameters: this._iceParameters,
            iceCandidates: this._iceCandidates,
            dtlsParameters: this._dtlsParameters,
            sctpParameters: this._sctpParameters,
            plainRtpParameters: this._plainRtpParameters,
            offerMediaObject
        });
        this._addMediaSection(mediaSection);
    }
    receiveSctpAssociation({ oldDataChannelSpec = false } = {}) {
        const mediaSection = new MediaSection_1.OfferMediaSection({
            iceParameters: this._iceParameters,
            iceCandidates: this._iceCandidates,
            dtlsParameters: this._dtlsParameters,
            sctpParameters: this._sctpParameters,
            plainRtpParameters: this._plainRtpParameters,
            mid: 'datachannel',
            kind: 'application',
            oldDataChannelSpec
        });
        this._addMediaSection(mediaSection);
    }
    getSdp() {
        // Increase SDP version.
        this._sdpObject.origin.sessionVersion++;
        return sdpTransform.write(this._sdpObject);
    }
    _addMediaSection(newMediaSection) {
        if (!this._firstMid)
            this._firstMid = newMediaSection.mid;
        // Add to the vector.
        this._mediaSections.push(newMediaSection);
        // Add to the map.
        this._midToIndex.set(newMediaSection.mid, this._mediaSections.length - 1);
        // Add to the SDP object.
        this._sdpObject.media.push(newMediaSection.getObject());
        // Regenerate BUNDLE mids.
        this._regenerateBundleMids();
    }
    _replaceMediaSection(newMediaSection, reuseMid) {
        // Store it in the map.
        if (typeof reuseMid === 'string') {
            const idx = this._midToIndex.get(reuseMid);
            if (idx === undefined) {
                throw new Error(`no media section found for reuseMid '${reuseMid}'`);
            }
            const oldMediaSection = this._mediaSections[idx];
            // Replace the index in the vector with the new media section.
            this._mediaSections[idx] = newMediaSection;
            // Update the map.
            this._midToIndex.delete(oldMediaSection.mid);
            this._midToIndex.set(newMediaSection.mid, idx);
            // Update the SDP object.
            this._sdpObject.media[idx] = newMediaSection.getObject();
            // Regenerate BUNDLE mids.
            this._regenerateBundleMids();
        }
        else {
            const idx = this._midToIndex.get(newMediaSection.mid);
            if (idx === undefined) {
                throw new Error(`no media section found with mid '${newMediaSection.mid}'`);
            }
            // Replace the index in the vector with the new media section.
            this._mediaSections[idx] = newMediaSection;
            // Update the SDP object.
            this._sdpObject.media[idx] = newMediaSection.getObject();
        }
    }
    _regenerateBundleMids() {
        if (!this._dtlsParameters)
            return;
        this._sdpObject.groups[0].mids = this._mediaSections
            .filter((mediaSection) => !mediaSection.closed)
            .map((mediaSection) => mediaSection.mid)
            .join(' ');
    }
}
exports.RemoteSdp = RemoteSdp;


/***/ }),
/* 21 */
/***/ (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
    }
  }
}


/***/ }),
/* 22 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
const events_1 = __webpack_require__(25);
const Logger_1 = __webpack_require__(9);
const logger = new Logger_1.Logger('EnhancedEventEmitter');
class EnhancedEventEmitter extends events_1.EventEmitter {
    constructor() {
        super();
        this.setMaxListeners(Infinity);
    }
    safeEmit(event, ...args) {
        const numListeners = this.listenerCount(event);
        try {
            return this.emit(event, ...args);
        }
        catch (error) {
            logger.error('safeEmit() | event listener threw an error [event:%s]:%o', event, error);
            return Boolean(numListeners);
        }
    }
    async safeEmitAsPromise(event, ...args) {
        return new Promise((resolve, reject) => {
            try {
                this.emit(event, ...args, resolve, reject);
            }
            catch (error) {
                logger.error('safeEmitAsPromise() | event listener threw an error [event:%s]:%o', event, error);
                reject(error);
            }
        });
    }
}
exports.EnhancedEventEmitter = EnhancedEventEmitter;


/***/ }),
/* 23 */
/***/ (function(module, exports, __webpack_require__) {

exports = module.exports = __webpack_require__(76);
exports.Stream = exports;
exports.Readable = exports;
exports.Writable = __webpack_require__(79);
exports.Duplex = __webpack_require__(26);
exports.Transform = __webpack_require__(81);
exports.PassThrough = __webpack_require__(336);


/***/ }),
/* 24 */
/***/ (function(module, exports, __webpack_require__) {


/**
 * Expose `Emitter`.
 */

if (true) {
  module.exports = Emitter;
}

/**
 * Initialize a new `Emitter`.
 *
 * @api public
 */

function Emitter(obj) {
  if (obj) return mixin(obj);
};

/**
 * Mixin the emitter properties.
 *
 * @param {Object} obj
 * @return {Object}
 * @api private
 */

function mixin(obj) {
  for (var key in Emitter.prototype) {
    obj[key] = Emitter.prototype[key];
  }
  return obj;
}

/**
 * Listen on the given `event` with `fn`.
 *
 * @param {String} event
 * @param {Function} fn
 * @return {Emitter}
 * @api public
 */

Emitter.prototype.on =
Emitter.prototype.addEventListener = function(event, fn){
  this._callbacks = this._callbacks || {};
  (this._callbacks['$' + event] = this._callbacks['$' + event] || [])
    .push(fn);
  return this;
};

/**
 * Adds an `event` listener that will be invoked a single
 * time then automatically removed.
 *
 * @param {String} event
 * @param {Function} fn
 * @return {Emitter}
 * @api public
 */

Emitter.prototype.once = function(event, fn){
  function on() {
    this.off(event, on);
    fn.apply(this, arguments);
  }

  on.fn = fn;
  this.on(event, on);
  return this;
};

/**
 * Remove the given callback for `event` or all
 * registered callbacks.
 *
 * @param {String} event
 * @param {Function} fn
 * @return {Emitter}
 * @api public
 */

Emitter.prototype.off =
Emitter.prototype.removeListener =
Emitter.prototype.removeAllListeners =
Emitter.prototype.removeEventListener = function(event, fn){
  this._callbacks = this._callbacks || {};

  // all
  if (0 == arguments.length) {
    this._callbacks = {};
    return this;
  }

  // specific event
  var callbacks = this._callbacks['$' + event];
  if (!callbacks) return this;

  // remove all handlers
  if (1 == arguments.length) {
    delete this._callbacks['$' + event];
    return this;
  }

  // remove specific handler
  var cb;
  for (var i = 0; i < callbacks.length; i++) {
    cb = callbacks[i];
    if (cb === fn || cb.fn === fn) {
      callbacks.splice(i, 1);
      break;
    }
  }

  // Remove event specific arrays for event types that no
  // one is subscribed for to avoid memory leak.
  if (callbacks.length === 0) {
    delete this._callbacks['$' + event];
  }

  return this;
};

/**
 * Emit `event` with the given args.
 *
 * @param {String} event
 * @param {Mixed} ...
 * @return {Emitter}
 */

Emitter.prototype.emit = function(event){
  this._callbacks = this._callbacks || {};

  var args = new Array(arguments.length - 1)
    , callbacks = this._callbacks['$' + event];

  for (var i = 1; i < arguments.length; i++) {
    args[i - 1] = arguments[i];
  }

  if (callbacks) {
    callbacks = callbacks.slice(0);
    for (var i = 0, len = callbacks.length; i < len; ++i) {
      callbacks[i].apply(this, args);
    }
  }

  return this;
};

/**
 * Return array of callbacks for `event`.
 *
 * @param {String} event
 * @return {Array}
 * @api public
 */

Emitter.prototype.listeners = function(event){
  this._callbacks = this._callbacks || {};
  return this._callbacks['$' + event] || [];
};

/**
 * Check if this emitter has `event` handlers.
 *
 * @param {String} event
 * @return {Boolean}
 * @api public
 */

Emitter.prototype.hasListeners = function(event){
  return !! this.listeners(event).length;
};


/***/ }),
/* 25 */
/***/ (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;
module.exports.once = once;

// 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;

function checkListener(listener) {
  if (typeof listener !== 'function') {
    throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof listener);
  }
}

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;

  checkListener(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() {
  if (!this.fired) {
    this.target.removeListener(this.type, this.wrapFn);
    this.fired = true;
    if (arguments.length === 0)
      return this.listener.call(this.target);
    return this.listener.apply(this.target, arguments);
  }
}

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) {
  checkListener(listener);
  this.on(type, _onceWrap(this, type, listener));
  return this;
};

EventEmitter.prototype.prependOnceListener =
    function prependOnceListener(type, listener) {
      checkListener(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;

      checkListener(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;
}

function once(emitter, name) {
  return new Promise(function (resolve, reject) {
    function eventListener() {
      if (errorListener !== undefined) {
        emitter.removeListener('error', errorListener);
      }
      resolve([].slice.call(arguments));
    };
    var errorListener;

    // Adding an error listener is not optional because
    // if an error is thrown on an event emitter we cannot
    // guarantee that the actual event we are waiting will
    // be fired. The result could be a silent way to create
    // memory or file descriptor leaks, which is something
    // we should avoid.
    if (name !== 'error') {
      errorListener = function errorListener(err) {
        emitter.removeListener(name, eventListener);
        reject(err);
      };

      emitter.once('error', errorListener);
    }

    emitter.once(name, eventListener);
  });
}


/***/ }),
/* 26 */
/***/ (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__(30);
/*</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 = Object.create(__webpack_require__(31));
util.inherits = __webpack_require__(21);
/*</replacement>*/

var Readable = __webpack_require__(76);
var Writable = __webpack_require__(79);

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);
};

/***/ }),
/* 27 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var _AElementNS__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(32);

/* harmony default export */ __webpack_exports__["a"] = (_AElementNS__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"]);


/***/ }),
/* 28 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
/* eslint-env node */


// SDP helpers.
var SDPUtils = {};

// Generate an alphanumeric identifier for cname or mids.
// TODO: use UUIDs instead? https://gist.github.com/jed/982883
SDPUtils.generateIdentifier = function() {
  return Math.random().toString(36).substr(2, 10);
};

// The RTCP CNAME used by all peerconnections from the same JS.
SDPUtils.localCName = SDPUtils.generateIdentifier();

// Splits SDP into lines, dealing with both CRLF and LF.
SDPUtils.splitLines = function(blob) {
  return blob.trim().split('\n').map(function(line) {
    return line.trim();
  });
};
// Splits SDP into sessionpart and mediasections. Ensures CRLF.
SDPUtils.splitSections = function(blob) {
  var parts = blob.split('\nm=');
  return parts.map(function(part, index) {
    return (index > 0 ? 'm=' + part : part).trim() + '\r\n';
  });
};

// returns the session description.
SDPUtils.getDescription = function(blob) {
  var sections = SDPUtils.splitSections(blob);
  return sections && sections[0];
};

// returns the individual media sections.
SDPUtils.getMediaSections = function(blob) {
  var sections = SDPUtils.splitSections(blob);
  sections.shift();
  return sections;
};

// Returns lines that start with a certain prefix.
SDPUtils.matchPrefix = function(blob, prefix) {
  return SDPUtils.splitLines(blob).filter(function(line) {
    return line.indexOf(prefix) === 0;
  });
};

// Parses an ICE candidate line. Sample input:
// candidate:702786350 2 udp 41819902 8.8.8.8 60769 typ relay raddr 8.8.8.8
// rport 55996"
SDPUtils.parseCandidate = function(line) {
  var parts;
  // Parse both variants.
  if (line.indexOf('a=candidate:') === 0) {
    parts = line.substring(12).split(' ');
  } else {
    parts = line.substring(10).split(' ');
  }

  var candidate = {
    foundation: parts[0],
    component: parseInt(parts[1], 10),
    protocol: parts[2].toLowerCase(),
    priority: parseInt(parts[3], 10),
    ip: parts[4],
    address: parts[4], // address is an alias for ip.
    port: parseInt(parts[5], 10),
    // skip parts[6] == 'typ'
    type: parts[7]
  };

  for (var i = 8; i < parts.length; i += 2) {
    switch (parts[i]) {
      case 'raddr':
        candidate.relatedAddress = parts[i + 1];
        break;
      case 'rport':
        candidate.relatedPort = parseInt(parts[i + 1], 10);
        break;
      case 'tcptype':
        candidate.tcpType = parts[i + 1];
        break;
      case 'ufrag':
        candidate.ufrag = parts[i + 1]; // for backward compability.
        candidate.usernameFragment = parts[i + 1];
        break;
      default: // extension handling, in particular ufrag
        candidate[parts[i]] = parts[i + 1];
        break;
    }
  }
  return candidate;
};

// Translates a candidate object into SDP candidate attribute.
SDPUtils.writeCandidate = function(candidate) {
  var sdp = [];
  sdp.push(candidate.foundation);
  sdp.push(candidate.component);
  sdp.push(candidate.protocol.toUpperCase());
  sdp.push(candidate.priority);
  sdp.push(candidate.address || candidate.ip);
  sdp.push(candidate.port);

  var type = candidate.type;
  sdp.push('typ');
  sdp.push(type);
  if (type !== 'host' && candidate.relatedAddress &&
      candidate.relatedPort) {
    sdp.push('raddr');
    sdp.push(candidate.relatedAddress);
    sdp.push('rport');
    sdp.push(candidate.relatedPort);
  }
  if (candidate.tcpType && candidate.protocol.toLowerCase() === 'tcp') {
    sdp.push('tcptype');
    sdp.push(candidate.tcpType);
  }
  if (candidate.usernameFragment || candidate.ufrag) {
    sdp.push('ufrag');
    sdp.push(candidate.usernameFragment || candidate.ufrag);
  }
  return 'candidate:' + sdp.join(' ');
};

// Parses an ice-options line, returns an array of option tags.
// a=ice-options:foo bar
SDPUtils.parseIceOptions = function(line) {
  return line.substr(14).split(' ');
};

// Parses an rtpmap line, returns RTCRtpCoddecParameters. Sample input:
// a=rtpmap:111 opus/48000/2
SDPUtils.parseRtpMap = function(line) {
  var parts = line.substr(9).split(' ');
  var parsed = {
    payloadType: parseInt(parts.shift(), 10) // was: id
  };

  parts = parts[0].split('/');

  parsed.name = parts[0];
  parsed.clockRate = parseInt(parts[1], 10); // was: clockrate
  parsed.channels = parts.length === 3 ? parseInt(parts[2], 10) : 1;
  // legacy alias, got renamed back to channels in ORTC.
  parsed.numChannels = parsed.channels;
  return parsed;
};

// Generate an a=rtpmap line from RTCRtpCodecCapability or
// RTCRtpCodecParameters.
SDPUtils.writeRtpMap = function(codec) {
  var pt = codec.payloadType;
  if (codec.preferredPayloadType !== undefined) {
    pt = codec.preferredPayloadType;
  }
  var channels = codec.channels || codec.numChannels || 1;
  return 'a=rtpmap:' + pt + ' ' + codec.name + '/' + codec.clockRate +
      (channels !== 1 ? '/' + channels : '') + '\r\n';
};

// Parses an a=extmap line (headerextension from RFC 5285). Sample input:
// a=extmap:2 urn:ietf:params:rtp-hdrext:toffset
// a=extmap:2/sendonly urn:ietf:params:rtp-hdrext:toffset
SDPUtils.parseExtmap = function(line) {
  var parts = line.substr(9).split(' ');
  return {
    id: parseInt(parts[0], 10),
    direction: parts[0].indexOf('/') > 0 ? parts[0].split('/')[1] : 'sendrecv',
    uri: parts[1]
  };
};

// Generates a=extmap line from RTCRtpHeaderExtensionParameters or
// RTCRtpHeaderExtension.
SDPUtils.writeExtmap = function(headerExtension) {
  return 'a=extmap:' + (headerExtension.id || headerExtension.preferredId) +
      (headerExtension.direction && headerExtension.direction !== 'sendrecv'
        ? '/' + headerExtension.direction
        : '') +
      ' ' + headerExtension.uri + '\r\n';
};

// Parses an ftmp line, returns dictionary. Sample input:
// a=fmtp:96 vbr=on;cng=on
// Also deals with vbr=on; cng=on
SDPUtils.parseFmtp = function(line) {
  var parsed = {};
  var kv;
  var parts = line.substr(line.indexOf(' ') + 1).split(';');
  for (var j = 0; j < parts.length; j++) {
    kv = parts[j].trim().split('=');
    parsed[kv[0].trim()] = kv[1];
  }
  return parsed;
};

// Generates an a=ftmp line from RTCRtpCodecCapability or RTCRtpCodecParameters.
SDPUtils.writeFmtp = function(codec) {
  var line = '';
  var pt = codec.payloadType;
  if (codec.preferredPayloadType !== undefined) {
    pt = codec.preferredPayloadType;
  }
  if (codec.parameters && Object.keys(codec.parameters).length) {
    var params = [];
    Object.keys(codec.parameters).forEach(function(param) {
      if (codec.parameters[param]) {
        params.push(param + '=' + codec.parameters[param]);
      } else {
        params.push(param);
      }
    });
    line += 'a=fmtp:' + pt + ' ' + params.join(';') + '\r\n';
  }
  return line;
};

// Parses an rtcp-fb line, returns RTCPRtcpFeedback object. Sample input:
// a=rtcp-fb:98 nack rpsi
SDPUtils.parseRtcpFb = function(line) {
  var parts = line.substr(line.indexOf(' ') + 1).split(' ');
  return {
    type: parts.shift(),
    parameter: parts.join(' ')
  };
};
// Generate a=rtcp-fb lines from RTCRtpCodecCapability or RTCRtpCodecParameters.
SDPUtils.writeRtcpFb = function(codec) {
  var lines = '';
  var pt = codec.payloadType;
  if (codec.preferredPayloadType !== undefined) {
    pt = codec.preferredPayloadType;
  }
  if (codec.rtcpFeedback && codec.rtcpFeedback.length) {
    // FIXME: special handling for trr-int?
    codec.rtcpFeedback.forEach(function(fb) {
      lines += 'a=rtcp-fb:' + pt + ' ' + fb.type +
      (fb.parameter && fb.parameter.length ? ' ' + fb.parameter : '') +
          '\r\n';
    });
  }
  return lines;
};

// Parses an RFC 5576 ssrc media attribute. Sample input:
// a=ssrc:3735928559 cname:something
SDPUtils.parseSsrcMedia = function(line) {
  var sp = line.indexOf(' ');
  var parts = {
    ssrc: parseInt(line.substr(7, sp - 7), 10)
  };
  var colon = line.indexOf(':', sp);
  if (colon > -1) {
    parts.attribute = line.substr(sp + 1, colon - sp - 1);
    parts.value = line.substr(colon + 1);
  } else {
    parts.attribute = line.substr(sp + 1);
  }
  return parts;
};

SDPUtils.parseSsrcGroup = function(line) {
  var parts = line.substr(13).split(' ');
  return {
    semantics: parts.shift(),
    ssrcs: parts.map(function(ssrc) {
      return parseInt(ssrc, 10);
    })
  };
};

// Extracts the MID (RFC 5888) from a media section.
// returns the MID or undefined if no mid line was found.
SDPUtils.getMid = function(mediaSection) {
  var mid = SDPUtils.matchPrefix(mediaSection, 'a=mid:')[0];
  if (mid) {
    return mid.substr(6);
  }
};

SDPUtils.parseFingerprint = function(line) {
  var parts = line.substr(14).split(' ');
  return {
    algorithm: parts[0].toLowerCase(), // algorithm is case-sensitive in Edge.
    value: parts[1]
  };
};

// Extracts DTLS parameters from SDP media section or sessionpart.
// FIXME: for consistency with other functions this should only
//   get the fingerprint line as input. See also getIceParameters.
SDPUtils.getDtlsParameters = function(mediaSection, sessionpart) {
  var lines = SDPUtils.matchPrefix(mediaSection + sessionpart,
    'a=fingerprint:');
  // Note: a=setup line is ignored since we use the 'auto' role.
  // Note2: 'algorithm' is not case sensitive except in Edge.
  return {
    role: 'auto',
    fingerprints: lines.map(SDPUtils.parseFingerprint)
  };
};

// Serializes DTLS parameters to SDP.
SDPUtils.writeDtlsParameters = function(params, setupType) {
  var sdp = 'a=setup:' + setupType + '\r\n';
  params.fingerprints.forEach(function(fp) {
    sdp += 'a=fingerprint:' + fp.algorithm + ' ' + fp.value + '\r\n';
  });
  return sdp;
};

// Parses a=crypto lines into
//   https://rawgit.com/aboba/edgertc/master/msortc-rs4.html#dictionary-rtcsrtpsdesparameters-members
SDPUtils.parseCryptoLine = function(line) {
  var parts = line.substr(9).split(' ');
  return {
    tag: parseInt(parts[0], 10),
    cryptoSuite: parts[1],
    keyParams: parts[2],
    sessionParams: parts.slice(3),
  };
};

SDPUtils.writeCryptoLine = function(parameters) {
  return 'a=crypto:' + parameters.tag + ' ' +
    parameters.cryptoSuite + ' ' +
    (typeof parameters.keyParams === 'object'
      ? SDPUtils.writeCryptoKeyParams(parameters.keyParams)
      : parameters.keyParams) +
    (parameters.sessionParams ? ' ' + parameters.sessionParams.join(' ') : '') +
    '\r\n';
};

// Parses the crypto key parameters into
//   https://rawgit.com/aboba/edgertc/master/msortc-rs4.html#rtcsrtpkeyparam*
SDPUtils.parseCryptoKeyParams = function(keyParams) {
  if (keyParams.indexOf('inline:') !== 0) {
    return null;
  }
  var parts = keyParams.substr(7).split('|');
  return {
    keyMethod: 'inline',
    keySalt: parts[0],
    lifeTime: parts[1],
    mkiValue: parts[2] ? parts[2].split(':')[0] : undefined,
    mkiLength: parts[2] ? parts[2].split(':')[1] : undefined,
  };
};

SDPUtils.writeCryptoKeyParams = function(keyParams) {
  return keyParams.keyMethod + ':'
    + keyParams.keySalt +
    (keyParams.lifeTime ? '|' + keyParams.lifeTime : '') +
    (keyParams.mkiValue && keyParams.mkiLength
      ? '|' + keyParams.mkiValue + ':' + keyParams.mkiLength
      : '');
};

// Extracts all SDES paramters.
SDPUtils.getCryptoParameters = function(mediaSection, sessionpart) {
  var lines = SDPUtils.matchPrefix(mediaSection + sessionpart,
    'a=crypto:');
  return lines.map(SDPUtils.parseCryptoLine);
};

// Parses ICE information from SDP media section or sessionpart.
// FIXME: for consistency with other functions this should only
//   get the ice-ufrag and ice-pwd lines as input.
SDPUtils.getIceParameters = function(mediaSection, sessionpart) {
  var ufrag = SDPUtils.matchPrefix(mediaSection + sessionpart,
    'a=ice-ufrag:')[0];
  var pwd = SDPUtils.matchPrefix(mediaSection + sessionpart,
    'a=ice-pwd:')[0];
  if (!(ufrag && pwd)) {
    return null;
  }
  return {
    usernameFragment: ufrag.substr(12),
    password: pwd.substr(10),
  };
};

// Serializes ICE parameters to SDP.
SDPUtils.writeIceParameters = function(params) {
  return 'a=ice-ufrag:' + params.usernameFragment + '\r\n' +
      'a=ice-pwd:' + params.password + '\r\n';
};

// Parses the SDP media section and returns RTCRtpParameters.
SDPUtils.parseRtpParameters = function(mediaSection) {
  var description = {
    codecs: [],
    headerExtensions: [],
    fecMechanisms: [],
    rtcp: []
  };
  var lines = SDPUtils.splitLines(mediaSection);
  var mline = lines[0].split(' ');
  for (var i = 3; i < mline.length; i++) { // find all codecs from mline[3..]
    var pt = mline[i];
    var rtpmapline = SDPUtils.matchPrefix(
      mediaSection, 'a=rtpmap:' + pt + ' ')[0];
    if (rtpmapline) {
      var codec = SDPUtils.parseRtpMap(rtpmapline);
      var fmtps = SDPUtils.matchPrefix(
        mediaSection, 'a=fmtp:' + pt + ' ');
      // Only the first a=fmtp:<pt> is considered.
      codec.parameters = fmtps.length ? SDPUtils.parseFmtp(fmtps[0]) : {};
      codec.rtcpFeedback = SDPUtils.matchPrefix(
        mediaSection, 'a=rtcp-fb:' + pt + ' ')
        .map(SDPUtils.parseRtcpFb);
      description.codecs.push(codec);
      // parse FEC mechanisms from rtpmap lines.
      switch (codec.name.toUpperCase()) {
        case 'RED':
        case 'ULPFEC':
          description.fecMechanisms.push(codec.name.toUpperCase());
          break;
        default: // only RED and ULPFEC are recognized as FEC mechanisms.
          break;
      }
    }
  }
  SDPUtils.matchPrefix(mediaSection, 'a=extmap:').forEach(function(line) {
    description.headerExtensions.push(SDPUtils.parseExtmap(line));
  });
  // FIXME: parse rtcp.
  return description;
};

// Generates parts of the SDP media section describing the capabilities /
// parameters.
SDPUtils.writeRtpDescription = function(kind, caps) {
  var sdp = '';

  // Build the mline.
  sdp += 'm=' + kind + ' ';
  sdp += caps.codecs.length > 0 ? '9' : '0'; // reject if no codecs.
  sdp += ' UDP/TLS/RTP/SAVPF ';
  sdp += caps.codecs.map(function(codec) {
    if (codec.preferredPayloadType !== undefined) {
      return codec.preferredPayloadType;
    }
    return codec.payloadType;
  }).join(' ') + '\r\n';

  sdp += 'c=IN IP4 0.0.0.0\r\n';
  sdp += 'a=rtcp:9 IN IP4 0.0.0.0\r\n';

  // Add a=rtpmap lines for each codec. Also fmtp and rtcp-fb.
  caps.codecs.forEach(function(codec) {
    sdp += SDPUtils.writeRtpMap(codec);
    sdp += SDPUtils.writeFmtp(codec);
    sdp += SDPUtils.writeRtcpFb(codec);
  });
  var maxptime = 0;
  caps.codecs.forEach(function(codec) {
    if (codec.maxptime > maxptime) {
      maxptime = codec.maxptime;
    }
  });
  if (maxptime > 0) {
    sdp += 'a=maxptime:' + maxptime + '\r\n';
  }
  sdp += 'a=rtcp-mux\r\n';

  if (caps.headerExtensions) {
    caps.headerExtensions.forEach(function(extension) {
      sdp += SDPUtils.writeExtmap(extension);
    });
  }
  // FIXME: write fecMechanisms.
  return sdp;
};

// Parses the SDP media section and returns an array of
// RTCRtpEncodingParameters.
SDPUtils.parseRtpEncodingParameters = function(mediaSection) {
  var encodingParameters = [];
  var description = SDPUtils.parseRtpParameters(mediaSection);
  var hasRed = description.fecMechanisms.indexOf('RED') !== -1;
  var hasUlpfec = description.fecMechanisms.indexOf('ULPFEC') !== -1;

  // filter a=ssrc:... cname:, ignore PlanB-msid
  var ssrcs = SDPUtils.matchPrefix(mediaSection, 'a=ssrc:')
    .map(function(line) {
      return SDPUtils.parseSsrcMedia(line);
    })
    .filter(function(parts) {
      return parts.attribute === 'cname';
    });
  var primarySsrc = ssrcs.length > 0 && ssrcs[0].ssrc;
  var secondarySsrc;

  var flows = SDPUtils.matchPrefix(mediaSection, 'a=ssrc-group:FID')
    .map(function(line) {
      var parts = line.substr(17).split(' ');
      return parts.map(function(part) {
        return parseInt(part, 10);
      });
    });
  if (flows.length > 0 && flows[0].length > 1 && flows[0][0] === primarySsrc) {
    secondarySsrc = flows[0][1];
  }

  description.codecs.forEach(function(codec) {
    if (codec.name.toUpperCase() === 'RTX' && codec.parameters.apt) {
      var encParam = {
        ssrc: primarySsrc,
        codecPayloadType: parseInt(codec.parameters.apt, 10)
      };
      if (primarySsrc && secondarySsrc) {
        encParam.rtx = {ssrc: secondarySsrc};
      }
      encodingParameters.push(encParam);
      if (hasRed) {
        encParam = JSON.parse(JSON.stringify(encParam));
        encParam.fec = {
          ssrc: primarySsrc,
          mechanism: hasUlpfec ? 'red+ulpfec' : 'red'
        };
        encodingParameters.push(encParam);
      }
    }
  });
  if (encodingParameters.length === 0 && primarySsrc) {
    encodingParameters.push({
      ssrc: primarySsrc
    });
  }

  // we support both b=AS and b=TIAS but interpret AS as TIAS.
  var bandwidth = SDPUtils.matchPrefix(mediaSection, 'b=');
  if (bandwidth.length) {
    if (bandwidth[0].indexOf('b=TIAS:') === 0) {
      bandwidth = parseInt(bandwidth[0].substr(7), 10);
    } else if (bandwidth[0].indexOf('b=AS:') === 0) {
      // use formula from JSEP to convert b=AS to TIAS value.
      bandwidth = parseInt(bandwidth[0].substr(5), 10) * 1000 * 0.95
          - (50 * 40 * 8);
    } else {
      bandwidth = undefined;
    }
    encodingParameters.forEach(function(params) {
      params.maxBitrate = bandwidth;
    });
  }
  return encodingParameters;
};

// parses http://draft.ortc.org/#rtcrtcpparameters*
SDPUtils.parseRtcpParameters = function(mediaSection) {
  var rtcpParameters = {};

  // Gets the first SSRC. Note tha with RTX there might be multiple
  // SSRCs.
  var remoteSsrc = SDPUtils.matchPrefix(mediaSection, 'a=ssrc:')
    .map(function(line) {
      return SDPUtils.parseSsrcMedia(line);
    })
    .filter(function(obj) {
      return obj.attribute === 'cname';
    })[0];
  if (remoteSsrc) {
    rtcpParameters.cname = remoteSsrc.value;
    rtcpParameters.ssrc = remoteSsrc.ssrc;
  }

  // Edge uses the compound attribute instead of reducedSize
  // compound is !reducedSize
  var rsize = SDPUtils.matchPrefix(mediaSection, 'a=rtcp-rsize');
  rtcpParameters.reducedSize = rsize.length > 0;
  rtcpParameters.compound = rsize.length === 0;

  // parses the rtcp-mux attrіbute.
  // Note that Edge does not support unmuxed RTCP.
  var mux = SDPUtils.matchPrefix(mediaSection, 'a=rtcp-mux');
  rtcpParameters.mux = mux.length > 0;

  return rtcpParameters;
};

// parses either a=msid: or a=ssrc:... msid lines and returns
// the id of the MediaStream and MediaStreamTrack.
SDPUtils.parseMsid = function(mediaSection) {
  var parts;
  var spec = SDPUtils.matchPrefix(mediaSection, 'a=msid:');
  if (spec.length === 1) {
    parts = spec[0].substr(7).split(' ');
    return {stream: parts[0], track: parts[1]};
  }
  var planB = SDPUtils.matchPrefix(mediaSection, 'a=ssrc:')
    .map(function(line) {
      return SDPUtils.parseSsrcMedia(line);
    })
    .filter(function(msidParts) {
      return msidParts.attribute === 'msid';
    });
  if (planB.length > 0) {
    parts = planB[0].value.split(' ');
    return {stream: parts[0], track: parts[1]};
  }
};

// SCTP
// parses draft-ietf-mmusic-sctp-sdp-26 first and falls back
// to draft-ietf-mmusic-sctp-sdp-05
SDPUtils.parseSctpDescription = function(mediaSection) {
  var mline = SDPUtils.parseMLine(mediaSection);
  var maxSizeLine = SDPUtils.matchPrefix(mediaSection, 'a=max-message-size:');
  var maxMessageSize;
  if (maxSizeLine.length > 0) {
    maxMessageSize = parseInt(maxSizeLine[0].substr(19), 10);
  }
  if (isNaN(maxMessageSize)) {
    maxMessageSize = 65536;
  }
  var sctpPort = SDPUtils.matchPrefix(mediaSection, 'a=sctp-port:');
  if (sctpPort.length > 0) {
    return {
      port: parseInt(sctpPort[0].substr(12), 10),
      protocol: mline.fmt,
      maxMessageSize: maxMessageSize
    };
  }
  var sctpMapLines = SDPUtils.matchPrefix(mediaSection, 'a=sctpmap:');
  if (sctpMapLines.length > 0) {
    var parts = SDPUtils.matchPrefix(mediaSection, 'a=sctpmap:')[0]
      .substr(10)
      .split(' ');
    return {
      port: parseInt(parts[0], 10),
      protocol: parts[1],
      maxMessageSize: maxMessageSize
    };
  }
};

// SCTP
// outputs the draft-ietf-mmusic-sctp-sdp-26 version that all browsers
// support by now receiving in this format, unless we originally parsed
// as the draft-ietf-mmusic-sctp-sdp-05 format (indicated by the m-line
// protocol of DTLS/SCTP -- without UDP/ or TCP/)
SDPUtils.writeSctpDescription = function(media, sctp) {
  var output = [];
  if (media.protocol !== 'DTLS/SCTP') {
    output = [
      'm=' + media.kind + ' 9 ' + media.protocol + ' ' + sctp.protocol + '\r\n',
      'c=IN IP4 0.0.0.0\r\n',
      'a=sctp-port:' + sctp.port + '\r\n'
    ];
  } else {
    output = [
      'm=' + media.kind + ' 9 ' + media.protocol + ' ' + sctp.port + '\r\n',
      'c=IN IP4 0.0.0.0\r\n',
      'a=sctpmap:' + sctp.port + ' ' + sctp.protocol + ' 65535\r\n'
    ];
  }
  if (sctp.maxMessageSize !== undefined) {
    output.push('a=max-message-size:' + sctp.maxMessageSize + '\r\n');
  }
  return output.join('');
};

// Generate a session ID for SDP.
// https://tools.ietf.org/html/draft-ietf-rtcweb-jsep-20#section-5.2.1
// recommends using a cryptographically random +ve 64-bit value
// but right now this should be acceptable and within the right range
SDPUtils.generateSessionId = function() {
  return Math.random().toString().substr(2, 21);
};

// Write boilder plate for start of SDP
// sessId argument is optional - if not supplied it will
// be generated randomly
// sessVersion is optional and defaults to 2
// sessUser is optional and defaults to 'thisisadapterortc'
SDPUtils.writeSessionBoilerplate = function(sessId, sessVer, sessUser) {
  var sessionId;
  var version = sessVer !== undefined ? sessVer : 2;
  if (sessId) {
    sessionId = sessId;
  } else {
    sessionId = SDPUtils.generateSessionId();
  }
  var user = sessUser || 'thisisadapterortc';
  // FIXME: sess-id should be an NTP timestamp.
  return 'v=0\r\n' +
      'o=' + user + ' ' + sessionId + ' ' + version +
        ' IN IP4 127.0.0.1\r\n' +
      's=-\r\n' +
      't=0 0\r\n';
};

SDPUtils.writeMediaSection = function(transceiver, caps, type, stream) {
  var sdp = SDPUtils.writeRtpDescription(transceiver.kind, caps);

  // Map ICE parameters (ufrag, pwd) to SDP.
  sdp += SDPUtils.writeIceParameters(
    transceiver.iceGatherer.getLocalParameters());

  // Map DTLS parameters to SDP.
  sdp += SDPUtils.writeDtlsParameters(
    transceiver.dtlsTransport.getLocalParameters(),
    type === 'offer' ? 'actpass' : 'active');

  sdp += 'a=mid:' + transceiver.mid + '\r\n';

  if (transceiver.direction) {
    sdp += 'a=' + transceiver.direction + '\r\n';
  } else if (transceiver.rtpSender && transceiver.rtpReceiver) {
    sdp += 'a=sendrecv\r\n';
  } else if (transceiver.rtpSender) {
    sdp += 'a=sendonly\r\n';
  } else if (transceiver.rtpReceiver) {
    sdp += 'a=recvonly\r\n';
  } else {
    sdp += 'a=inactive\r\n';
  }

  if (transceiver.rtpSender) {
    // spec.
    var msid = 'msid:' + stream.id + ' ' +
        transceiver.rtpSender.track.id + '\r\n';
    sdp += 'a=' + msid;

    // for Chrome.
    sdp += 'a=ssrc:' + transceiver.sendEncodingParameters[0].ssrc +
        ' ' + msid;
    if (transceiver.sendEncodingParameters[0].rtx) {
      sdp += 'a=ssrc:' + transceiver.sendEncodingParameters[0].rtx.ssrc +
          ' ' + msid;
      sdp += 'a=ssrc-group:FID ' +
          transceiver.sendEncodingParameters[0].ssrc + ' ' +
          transceiver.sendEncodingParameters[0].rtx.ssrc +
          '\r\n';
    }
  }
  // FIXME: this should be written by writeRtpDescription.
  sdp += 'a=ssrc:' + transceiver.sendEncodingParameters[0].ssrc +
      ' cname:' + SDPUtils.localCName + '\r\n';
  if (transceiver.rtpSender && transceiver.sendEncodingParameters[0].rtx) {
    sdp += 'a=ssrc:' + transceiver.sendEncodingParameters[0].rtx.ssrc +
        ' cname:' + SDPUtils.localCName + '\r\n';
  }
  return sdp;
};

// Gets the direction from the mediaSection or the sessionpart.
SDPUtils.getDirection = function(mediaSection, sessionpart) {
  // Look for sendrecv, sendonly, recvonly, inactive, default to sendrecv.
  var lines = SDPUtils.splitLines(mediaSection);
  for (var i = 0; i < lines.length; i++) {
    switch (lines[i]) {
      case 'a=sendrecv':
      case 'a=sendonly':
      case 'a=recvonly':
      case 'a=inactive':
        return lines[i].substr(2);
      default:
        // FIXME: What should happen here?
    }
  }
  if (sessionpart) {
    return SDPUtils.getDirection(sessionpart);
  }
  return 'sendrecv';
};

SDPUtils.getKind = function(mediaSection) {
  var lines = SDPUtils.splitLines(mediaSection);
  var mline = lines[0].split(' ');
  return mline[0].substr(2);
};

SDPUtils.isRejected = function(mediaSection) {
  return mediaSection.split(' ', 2)[1] === '0';
};

SDPUtils.parseMLine = function(mediaSection) {
  var lines = SDPUtils.splitLines(mediaSection);
  var parts = lines[0].substr(2).split(' ');
  return {
    kind: parts[0],
    port: parseInt(parts[1], 10),
    protocol: parts[2],
    fmt: parts.slice(3).join(' ')
  };
};

SDPUtils.parseOLine = function(mediaSection) {
  var line = SDPUtils.matchPrefix(mediaSection, 'o=')[0];
  var parts = line.substr(2).split(' ');
  return {
    username: parts[0],
    sessionId: parts[1],
    sessionVersion: parseInt(parts[2], 10),
    netType: parts[3],
    addressType: parts[4],
    address: parts[5]
  };
};

// a very naive interpretation of a valid SDP.
SDPUtils.isValidSDP = function(blob) {
  if (typeof blob !== 'string' || blob.length === 0) {
    return false;
  }
  var lines = SDPUtils.splitLines(blob);
  for (var i = 0; i < lines.length; i++) {
    if (lines[i].length < 2 || lines[i].charAt(1) !== '=') {
      return false;
    }
    // TODO: check the modifier a bit more.
  }
  return true;
};

// Expose public methods.
if (true) {
  module.exports = SDPUtils;
}


/***/ }),
/* 29 */
/***/ (function(module, exports, __webpack_require__) {

const encodePacket = __webpack_require__(295);
const decodePacket = __webpack_require__(296);

const SEPARATOR = String.fromCharCode(30); // see https://en.wikipedia.org/wiki/Delimiter#ASCII_delimited_text

const encodePayload = (packets, callback) => {
  // some packets may be added to the array while encoding, so the initial length must be saved
  const length = packets.length;
  const encodedPackets = new Array(length);
  let count = 0;

  packets.forEach((packet, i) => {
    // force base64 encoding for binary packets
    encodePacket(packet, false, encodedPacket => {
      encodedPackets[i] = encodedPacket;
      if (++count === length) {
        callback(encodedPackets.join(SEPARATOR));
      }
    });
  });
};

const decodePayload = (encodedPayload, binaryType) => {
  const encodedPackets = encodedPayload.split(SEPARATOR);
  const packets = [];
  for (let i = 0; i < encodedPackets.length; i++) {
    const decodedPacket = decodePacket(encodedPackets[i], binaryType);
    packets.push(decodedPacket);
    if (decodedPacket.type === "error") {
      break;
    }
  }
  return packets;
};

module.exports = {
  protocol: 4,
  encodePacket,
  encodePayload,
  decodePacket,
  decodePayload
};


/***/ }),
/* 30 */
/***/ (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__(15)))

/***/ }),
/* 31 */
/***/ (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__(11).Buffer))

/***/ }),
/* 32 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var _AElement__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6);
/* harmony import */ var _OOP__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(3);



/***
 * @augments AElement
 * @augments SVGGraphicsElement
 * @constructor
 */
function AElementNS() {
    _AElement__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"].call(this);
}

_OOP__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"].mixClass(AElementNS, _AElement__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"]);

AElementNS.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;
};


/***
 * @returns {Promise}
 */
AElementNS.prototype.afterAttached = function () {
    if (this.isDescendantOf(document.body)) return Promise.resolve();
    var attachHookElt = this.$attachhook || this.querySelector('.absol-attachhook');
    if (!attachHookElt) {
        attachHookElt = document.createElementNS(null, 'image');
        attachHookElt.setAttributeNS(null, 'href', '');
        attachHookElt.classList.add('absol-attachhook');
        Object.assign(attachHookElt, AElementNS.prototype);
        AElementNS.call(attachHookElt);
        this.$attachhook = attachHookElt;
        this.appendChild(attachHookElt);
    }
    return new Promise(function (rs) {
        attachHookElt.once('error', rs);
    });
};

/* harmony default export */ __webpack_exports__["a"] = (AElementNS);

/***/ }),
/* 33 */
/***/ (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 = clearTimeout;
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) {
        if (timeoutDict[timeoutId]) {
            pendingTimeout--;
            delete timeoutDict[timeoutId];
            DebugTask.$view.timeout = pendingTimeout;
        }
        return originClearTimeout.apply(global, arguments);

    };


    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 */ "b"].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__(13)))

/***/ }),
/* 34 */
/***/ (function(module, exports) {

module.exports = (() => {
  if (typeof self !== "undefined") {
    return self;
  } else if (typeof window !== "undefined") {
    return window;
  } else {
    return Function("return this")();
  }
})();


/***/ }),
/* 35 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
function getRtpEncodings({ offerMediaObject }) {
    const ssrcs = new Set();
    for (const line of offerMediaObject.ssrcs || []) {
        const ssrc = line.id;
        ssrcs.add(ssrc);
    }
    if (ssrcs.size === 0)
        throw new Error('no a=ssrc lines found');
    const ssrcToRtxSsrc = new Map();
    // First assume RTX is used.
    for (const line of offerMediaObject.ssrcGroups || []) {
        if (line.semantics !== 'FID')
            continue;
        let [ssrc, rtxSsrc] = line.ssrcs.split(/\s+/);
        ssrc = Number(ssrc);
        rtxSsrc = Number(rtxSsrc);
        if (ssrcs.has(ssrc)) {
            // Remove both the SSRC and RTX SSRC from the set so later we know that they
            // are already handled.
            ssrcs.delete(ssrc);
            ssrcs.delete(rtxSsrc);
            // Add to the map.
            ssrcToRtxSsrc.set(ssrc, rtxSsrc);
        }
    }
    // If the set of SSRCs is not empty it means that RTX is not being used, so take
    // media SSRCs from there.
    for (const ssrc of ssrcs) {
        // Add to the map.
        ssrcToRtxSsrc.set(ssrc, null);
    }
    const encodings = [];
    for (const [ssrc, rtxSsrc] of ssrcToRtxSsrc) {
        const encoding = { ssrc };
        if (rtxSsrc)
            encoding.rtx = { ssrc: rtxSsrc };
        encodings.push(encoding);
    }
    return encodings;
}
exports.getRtpEncodings = getRtpEncodings;
/**
 * Adds multi-ssrc based simulcast into the given SDP media section offer.
 */
function addLegacySimulcast({ offerMediaObject, numStreams }) {
    if (numStreams <= 1)
        throw new TypeError('numStreams must be greater than 1');
    // Get the SSRC.
    const ssrcMsidLine = (offerMediaObject.ssrcs || [])
        .find((line) => line.attribute === 'msid');
    if (!ssrcMsidLine)
        throw new Error('a=ssrc line with msid information not found');
    const [streamId, trackId] = ssrcMsidLine.value.split(' ')[0];
    const firstSsrc = ssrcMsidLine.id;
    let firstRtxSsrc;
    // Get the SSRC for RTX.
    (offerMediaObject.ssrcGroups || [])
        .some((line) => {
        if (line.semantics !== 'FID')
            return false;
        const ssrcs = line.ssrcs.split(/\s+/);
        if (Number(ssrcs[0]) === firstSsrc) {
            firstRtxSsrc = Number(ssrcs[1]);
            return true;
        }
        else {
            return false;
        }
    });
    const ssrcCnameLine = offerMediaObject.ssrcs
        .find((line) => line.attribute === 'cname');
    if (!ssrcCnameLine)
        throw new Error('a=ssrc line with cname information not found');
    const cname = ssrcCnameLine.value;
    const ssrcs = [];
    const rtxSsrcs = [];
    for (let i = 0; i < numStreams; ++i) {
        ssrcs.push(firstSsrc + i);
        if (firstRtxSsrc)
            rtxSsrcs.push(firstRtxSsrc + i);
    }
    offerMediaObject.ssrcGroups = [];
    offerMediaObject.ssrcs = [];
    offerMediaObject.ssrcGroups.push({
        semantics: 'SIM',
        ssrcs: ssrcs.join(' ')
    });
    for (let i = 0; i < ssrcs.length; ++i) {
        const ssrc = ssrcs[i];
        offerMediaObject.ssrcs.push({
            id: ssrc,
            attribute: 'cname',
            value: cname
        });
        offerMediaObject.ssrcs.push({
            id: ssrc,
            attribute: 'msid',
            value: `${streamId} ${trackId}`
        });
    }
    for (let i = 0; i < rtxSsrcs.length; ++i) {
        const ssrc = ssrcs[i];
        const rtxSsrc = rtxSsrcs[i];
        offerMediaObject.ssrcs.push({
            id: rtxSsrc,
            attribute: 'cname',
            value: cname
        });
        offerMediaObject.ssrcs.push({
            id: rtxSsrc,
            attribute: 'msid',
            value: `${streamId} ${trackId}`
        });
        offerMediaObject.ssrcGroups.push({
            semantics: 'FID',
            ssrcs: `${ssrc} ${rtxSsrc}`
        });
    }
}
exports.addLegacySimulcast = addLegacySimulcast;


/***/ }),
/* 36 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
function getRtpEncodings({ offerMediaObject, track }) {
    // First media SSRC (or the only one).
    let firstSsrc;
    const ssrcs = new Set();
    for (const line of offerMediaObject.ssrcs || []) {
        if (line.attribute !== 'msid')
            continue;
        const trackId = line.value.split(' ')[1];
        if (trackId === track.id) {
            const ssrc = line.id;
            ssrcs.add(ssrc);
            if (!firstSsrc)
                firstSsrc = ssrc;
        }
    }
    if (ssrcs.size === 0)
        throw new Error(`a=ssrc line with msid information not found [track.id:${track.id}]`);
    const ssrcToRtxSsrc = new Map();
    // First assume RTX is used.
    for (const line of offerMediaObject.ssrcGroups || []) {
        if (line.semantics !== 'FID')
            continue;
        let [ssrc, rtxSsrc] = line.ssrcs.split(/\s+/);
        ssrc = Number(ssrc);
        rtxSsrc = Number(rtxSsrc);
        if (ssrcs.has(ssrc)) {
            // Remove both the SSRC and RTX SSRC from the set so later we know that they
            // are already handled.
            ssrcs.delete(ssrc);
            ssrcs.delete(rtxSsrc);
            // Add to the map.
            ssrcToRtxSsrc.set(ssrc, rtxSsrc);
        }
    }
    // If the set of SSRCs is not empty it means that RTX is not being used, so take
    // media SSRCs from there.
    for (const ssrc of ssrcs) {
        // Add to the map.
        ssrcToRtxSsrc.set(ssrc, null);
    }
    const encodings = [];
    for (const [ssrc, rtxSsrc] of ssrcToRtxSsrc) {
        const encoding = { ssrc };
        if (rtxSsrc)
            encoding.rtx = { ssrc: rtxSsrc };
        encodings.push(encoding);
    }
    return encodings;
}
exports.getRtpEncodings = getRtpEncodings;
/**
 * Adds multi-ssrc based simulcast into the given SDP media section offer.
 */
function addLegacySimulcast({ offerMediaObject, track, numStreams }) {
    if (numStreams <= 1)
        throw new TypeError('numStreams must be greater than 1');
    let firstSsrc;
    let firstRtxSsrc;
    let streamId;
    // Get the SSRC.
    const ssrcMsidLine = (offerMediaObject.ssrcs || [])
        .find((line) => {
        if (line.attribute !== 'msid')
            return false;
        const trackId = line.value.split(' ')[1];
        if (trackId === track.id) {
            firstSsrc = line.id;
            streamId = line.value.split(' ')[0];
            return true;
        }
        else {
            return false;
        }
    });
    if (!ssrcMsidLine)
        throw new Error(`a=ssrc line with msid information not found [track.id:${track.id}]`);
    // Get the SSRC for RTX.
    (offerMediaObject.ssrcGroups || [])
        .some((line) => {
        if (line.semantics !== 'FID')
            return false;
        const ssrcs = line.ssrcs.split(/\s+/);
        if (Number(ssrcs[0]) === firstSsrc) {
            firstRtxSsrc = Number(ssrcs[1]);
            return true;
        }
        else {
            return false;
        }
    });
    const ssrcCnameLine = offerMediaObject.ssrcs
        .find((line) => (line.attribute === 'cname' && line.id === firstSsrc));
    if (!ssrcCnameLine)
        throw new Error(`a=ssrc line with cname information not found [track.id:${track.id}]`);
    const cname = ssrcCnameLine.value;
    const ssrcs = [];
    const rtxSsrcs = [];
    for (let i = 0; i < numStreams; ++i) {
        ssrcs.push(firstSsrc + i);
        if (firstRtxSsrc)
            rtxSsrcs.push(firstRtxSsrc + i);
    }
    offerMediaObject.ssrcGroups = offerMediaObject.ssrcGroups || [];
    offerMediaObject.ssrcs = offerMediaObject.ssrcs || [];
    offerMediaObject.ssrcGroups.push({
        semantics: 'SIM',
        ssrcs: ssrcs.join(' ')
    });
    for (let i = 0; i < ssrcs.length; ++i) {
        const ssrc = ssrcs[i];
        offerMediaObject.ssrcs.push({
            id: ssrc,
            attribute: 'cname',
            value: cname
        });
        offerMediaObject.ssrcs.push({
            id: ssrc,
            attribute: 'msid',
            value: `${streamId} ${track.id}`
        });
    }
    for (let i = 0; i < rtxSsrcs.length; ++i) {
        const ssrc = ssrcs[i];
        const rtxSsrc = rtxSsrcs[i];
        offerMediaObject.ssrcs.push({
            id: rtxSsrc,
            attribute: 'cname',
            value: cname
        });
        offerMediaObject.ssrcs.push({
            id: rtxSsrc,
            attribute: 'msid',
            value: `${streamId} ${track.id}`
        });
        offerMediaObject.ssrcGroups.push({
            semantics: 'FID',
            ssrcs: `${ssrc} ${rtxSsrc}`
        });
    }
}
exports.addLegacySimulcast = addLegacySimulcast;


/***/ }),
/* 37 */
/***/ (function(module, exports, __webpack_require__) {

/* eslint-disable node/no-deprecated-api */
var buffer = __webpack_require__(11)
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)
}


/***/ }),
/* 38 */
/***/ (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) {}

/***/ }),
/* 39 */
/***/ (function(module, exports, __webpack_require__) {


var content = __webpack_require__(259);

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) {}

/***/ }),
/* 40 */
/***/ (function(module, exports, __webpack_require__) {

const parser = __webpack_require__(29);
const Emitter = __webpack_require__(24);

class Transport extends Emitter {
  /**
   * Transport abstract constructor.
   *
   * @param {Object} options.
   * @api private
   */
  constructor(opts) {
    super();

    this.opts = opts;
    this.query = opts.query;
    this.readyState = "";
    this.socket = opts.socket;
  }

  /**
   * Emits an error.
   *
   * @param {String} str
   * @return {Transport} for chaining
   * @api public
   */
  onError(msg, desc) {
    const err = new Error(msg);
    err.type = "TransportError";
    err.description = desc;
    this.emit("error", err);
    return this;
  }

  /**
   * Opens the transport.
   *
   * @api public
   */
  open() {
    if ("closed" === this.readyState || "" === this.readyState) {
      this.readyState = "opening";
      this.doOpen();
    }

    return this;
  }

  /**
   * Closes the transport.
   *
   * @api private
   */
  close() {
    if ("opening" === this.readyState || "open" === this.readyState) {
      this.doClose();
      this.onClose();
    }

    return this;
  }

  /**
   * Sends multiple packets.
   *
   * @param {Array} packets
   * @api private
   */
  send(packets) {
    if ("open" === this.readyState) {
      this.write(packets);
    } else {
      throw new Error("Transport not open");
    }
  }

  /**
   * Called upon open
   *
   * @api private
   */
  onOpen() {
    this.readyState = "open";
    this.writable = true;
    this.emit("open");
  }

  /**
   * Called with data.
   *
   * @param {String} data
   * @api private
   */
  onData(data) {
    const packet = parser.decodePacket(data, this.socket.binaryType);
    this.onPacket(packet);
  }

  /**
   * Called with a decoded packet.
   */
  onPacket(packet) {
    this.emit("packet", packet);
  }

  /**
   * Called upon close.
   *
   * @api private
   */
  onClose() {
    this.readyState = "closed";
    this.emit("close");
  }
}

module.exports = Transport;


/***/ }),
/* 41 */
/***/ (function(module, exports) {

/**
 * Compiles a querystring
 * Returns string representation of the object
 *
 * @param {Object}
 * @api private
 */

exports.encode = function (obj) {
  var str = '';

  for (var i in obj) {
    if (obj.hasOwnProperty(i)) {
      if (str.length) str += '&';
      str += encodeURIComponent(i) + '=' + encodeURIComponent(obj[i]);
    }
  }

  return str;
};

/**
 * Parses a simple querystring into an object
 *
 * @param {String} qs
 * @api private
 */

exports.decode = function(qs){
  var qry = {};
  var pairs = qs.split('&');
  for (var i = 0, l = pairs.length; i < l; i++) {
    var pair = pairs[i].split('=');
    qry[decodeURIComponent(pair[0])] = decodeURIComponent(pair[1]);
  }
  return qry;
};


/***/ }),
/* 42 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.Decoder = exports.Encoder = exports.PacketType = exports.protocol = void 0;
const Emitter = __webpack_require__(24);
const binary_1 = __webpack_require__(303);
const is_binary_1 = __webpack_require__(65);
const debug = __webpack_require__(8)("socket.io-parser");
/**
 * Protocol version.
 *
 * @public
 */
exports.protocol = 5;
var PacketType;
(function (PacketType) {
    PacketType[PacketType["CONNECT"] = 0] = "CONNECT";
    PacketType[PacketType["DISCONNECT"] = 1] = "DISCONNECT";
    PacketType[PacketType["EVENT"] = 2] = "EVENT";
    PacketType[PacketType["ACK"] = 3] = "ACK";
    PacketType[PacketType["CONNECT_ERROR"] = 4] = "CONNECT_ERROR";
    PacketType[PacketType["BINARY_EVENT"] = 5] = "BINARY_EVENT";
    PacketType[PacketType["BINARY_ACK"] = 6] = "BINARY_ACK";
})(PacketType = exports.PacketType || (exports.PacketType = {}));
/**
 * A socket.io Encoder instance
 */
class Encoder {
    /**
     * Encode a packet as a single string if non-binary, or as a
     * buffer sequence, depending on packet type.
     *
     * @param {Object} obj - packet object
     */
    encode(obj) {
        debug("encoding packet %j", obj);
        if (obj.type === PacketType.EVENT || obj.type === PacketType.ACK) {
            if (is_binary_1.hasBinary(obj)) {
                obj.type =
                    obj.type === PacketType.EVENT
                        ? PacketType.BINARY_EVENT
                        : PacketType.BINARY_ACK;
                return this.encodeAsBinary(obj);
            }
        }
        return [this.encodeAsString(obj)];
    }
    /**
     * Encode packet as string.
     */
    encodeAsString(obj) {
        // first is type
        let str = "" + obj.type;
        // attachments if we have them
        if (obj.type === PacketType.BINARY_EVENT ||
            obj.type === PacketType.BINARY_ACK) {
            str += obj.attachments + "-";
        }
        // if we have a namespace other than `/`
        // we append it followed by a comma `,`
        if (obj.nsp && "/" !== obj.nsp) {
            str += obj.nsp + ",";
        }
        // immediately followed by the id
        if (null != obj.id) {
            str += obj.id;
        }
        // json data
        if (null != obj.data) {
            str += JSON.stringify(obj.data);
        }
        debug("encoded %j as %s", obj, str);
        return str;
    }
    /**
     * Encode packet as 'buffer sequence' by removing blobs, and
     * deconstructing packet into object with placeholders and
     * a list of buffers.
     */
    encodeAsBinary(obj) {
        const deconstruction = binary_1.deconstructPacket(obj);
        const pack = this.encodeAsString(deconstruction.packet);
        const buffers = deconstruction.buffers;
        buffers.unshift(pack); // add packet info to beginning of data list
        return buffers; // write all the buffers
    }
}
exports.Encoder = Encoder;
/**
 * A socket.io Decoder instance
 *
 * @return {Object} decoder
 */
class Decoder extends Emitter {
    constructor() {
        super();
    }
    /**
     * Decodes an encoded packet string into packet JSON.
     *
     * @param {String} obj - encoded packet
     */
    add(obj) {
        let packet;
        if (typeof obj === "string") {
            packet = this.decodeString(obj);
            if (packet.type === PacketType.BINARY_EVENT ||
                packet.type === PacketType.BINARY_ACK) {
                // binary packet's json
                this.reconstructor = new BinaryReconstructor(packet);
                // no attachments, labeled binary but no binary data to follow
                if (packet.attachments === 0) {
                    super.emit("decoded", packet);
                }
            }
            else {
                // non-binary full packet
                super.emit("decoded", packet);
            }
        }
        else if (is_binary_1.isBinary(obj) || obj.base64) {
            // raw binary data
            if (!this.reconstructor) {
                throw new Error("got binary data when not reconstructing a packet");
            }
            else {
                packet = this.reconstructor.takeBinaryData(obj);
                if (packet) {
                    // received final buffer
                    this.reconstructor = null;
                    super.emit("decoded", packet);
                }
            }
        }
        else {
            throw new Error("Unknown type: " + obj);
        }
    }
    /**
     * Decode a packet String (JSON data)
     *
     * @param {String} str
     * @return {Object} packet
     */
    decodeString(str) {
        let i = 0;
        // look up type
        const p = {
            type: Number(str.charAt(0)),
        };
        if (PacketType[p.type] === undefined) {
            throw new Error("unknown packet type " + p.type);
        }
        // look up attachments if type binary
        if (p.type === PacketType.BINARY_EVENT ||
            p.type === PacketType.BINARY_ACK) {
            const start = i + 1;
            while (str.charAt(++i) !== "-" && i != str.length) { }
            const buf = str.substring(start, i);
            if (buf != Number(buf) || str.charAt(i) !== "-") {
                throw new Error("Illegal attachments");
            }
            p.attachments = Number(buf);
        }
        // look up namespace (if any)
        if ("/" === str.charAt(i + 1)) {
            const start = i + 1;
            while (++i) {
                const c = str.charAt(i);
                if ("," === c)
                    break;
                if (i === str.length)
                    break;
            }
            p.nsp = str.substring(start, i);
        }
        else {
            p.nsp = "/";
        }
        // look up id
        const next = str.charAt(i + 1);
        if ("" !== next && Number(next) == next) {
            const start = i + 1;
            while (++i) {
                const c = str.charAt(i);
                if (null == c || Number(c) != c) {
                    --i;
                    break;
                }
                if (i === str.length)
                    break;
            }
            p.id = Number(str.substring(start, i + 1));
        }
        // look up json data
        if (str.charAt(++i)) {
            const payload = tryParse(str.substr(i));
            if (Decoder.isPayloadValid(p.type, payload)) {
                p.data = payload;
            }
            else {
                throw new Error("invalid payload");
            }
        }
        debug("decoded %s as %j", str, p);
        return p;
    }
    static isPayloadValid(type, payload) {
        switch (type) {
            case PacketType.CONNECT:
                return typeof payload === "object";
            case PacketType.DISCONNECT:
                return payload === undefined;
            case PacketType.CONNECT_ERROR:
                return typeof payload === "string" || typeof payload === "object";
            case PacketType.EVENT:
            case PacketType.BINARY_EVENT:
                return Array.isArray(payload) && payload.length > 0;
            case PacketType.ACK:
            case PacketType.BINARY_ACK:
                return Array.isArray(payload);
        }
    }
    /**
     * Deallocates a parser's resources
     */
    destroy() {
        if (this.reconstructor) {
            this.reconstructor.finishedReconstruction();
        }
    }
}
exports.Decoder = Decoder;
function tryParse(str) {
    try {
        return JSON.parse(str);
    }
    catch (e) {
        return false;
    }
}
/**
 * A manager of a binary event's 'buffer sequence'. Should
 * be constructed whenever a packet of type BINARY_EVENT is
 * decoded.
 *
 * @param {Object} packet
 * @return {BinaryReconstructor} initialized reconstructor
 */
class BinaryReconstructor {
    constructor(packet) {
        this.packet = packet;
        this.buffers = [];
        this.reconPack = packet;
    }
    /**
     * Method to be called when binary data received from connection
     * after a BINARY_EVENT packet.
     *
     * @param {Buffer | ArrayBuffer} binData - the raw binary data received
     * @return {null | Object} returns null if more binary data is expected or
     *   a reconstructed packet object if all buffers have been received.
     */
    takeBinaryData(binData) {
        this.buffers.push(binData);
        if (this.buffers.length === this.reconPack.attachments) {
            // done with buffer list
            const packet = binary_1.reconstructPacket(this.reconPack, this.buffers);
            this.finishedReconstruction();
            return packet;
        }
        return null;
    }
    /**
     * Cleans up binary packet reconstruction variables.
     */
    finishedReconstruction() {
        this.reconPack = null;
        this.buffers = [];
    }
}


/***/ }),
/* 43 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
const ScalabilityModeRegex = new RegExp('^[LS]([1-9]\\d{0,1})T([1-9]\\d{0,1})');
function parse(scalabilityMode) {
    const match = ScalabilityModeRegex.exec(scalabilityMode || '');
    if (match) {
        return {
            spatialLayers: Number(match[1]),
            temporalLayers: Number(match[2])
        };
    }
    else {
        return {
            spatialLayers: 1,
            temporalLayers: 1
        };
    }
}
exports.parse = parse;


/***/ }),
/* 44 */
/***/ (function(module, exports) {

module.exports = extend

var hasOwnProperty = Object.prototype.hasOwnProperty;

function extend() {
    var target = {}

    for (var i = 0; i < arguments.length; i++) {
        var source = arguments[i]

        for (var key in source) {
            if (hasOwnProperty.call(source, key)) {
                target[key] = source[key]
            }
        }
    }

    return target
}


/***/ }),
/* 45 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var tls = __webpack_require__(354)
var debug = __webpack_require__(8)('mqttjs:tls')

function buildBuilder (mqttClient, opts) {
  var connection
  opts.port = opts.port || 8883
  opts.host = opts.hostname || opts.host || 'localhost'
  opts.servername = opts.host

  opts.rejectUnauthorized = opts.rejectUnauthorized !== false

  delete opts.path

  debug('port %d host %s rejectUnauthorized %b', opts.port, opts.host, opts.rejectUnauthorized)

  connection = tls.connect(opts)
  /* eslint no-use-before-define: [2, "nofunc"] */
  connection.on('secureConnect', function () {
    if (opts.rejectUnauthorized && !connection.authorized) {
      connection.emit('error', new Error('TLS not authorized'))
    } else {
      connection.removeListener('error', handleTLSerrors)
    }
  })

  function handleTLSerrors (err) {
    // How can I get verify this error is a tls error?
    if (opts.rejectUnauthorized) {
      mqttClient.emit('error', err)
    }

    // close this connection to match the behaviour of net
    // otherwise all we get is an error from the connection
    // and close event doesn't fire. This is a work around
    // to enable the reconnect code to work the same as with
    // net.createConnection
    connection.end()
  }

  connection.on('error', handleTLSerrors)
  return connection
}

module.exports = buildBuilder


/***/ }),
/* 46 */
/***/ (function(module, exports, __webpack_require__) {

/* WEBPACK VAR INJECTION */(function(Buffer, process) {var stream = __webpack_require__(23)
var eos = __webpack_require__(355)
var inherits = __webpack_require__(21)
var shift = __webpack_require__(358)

var SIGNAL_FLUSH = (Buffer.from && Buffer.from !== Uint8Array.from)
  ? Buffer.from([0])
  : new Buffer([0])

var onuncork = function(self, fn) {
  if (self._corked) self.once('uncork', fn)
  else fn()
}

var autoDestroy = function (self, err) {
  if (self._autoDestroy) self.destroy(err)
}

var destroyer = function(self, end) {
  return function(err) {
    if (err) autoDestroy(self, err.message === 'premature close' ? null : err)
    else if (end && !self._ended) self.end()
  }
}

var end = function(ws, fn) {
  if (!ws) return fn()
  if (ws._writableState && ws._writableState.finished) return fn()
  if (ws._writableState) return ws.end(fn)
  ws.end()
  fn()
}

var toStreams2 = function(rs) {
  return new (stream.Readable)({objectMode:true, highWaterMark:16}).wrap(rs)
}

var Duplexify = function(writable, readable, opts) {
  if (!(this instanceof Duplexify)) return new Duplexify(writable, readable, opts)
  stream.Duplex.call(this, opts)

  this._writable = null
  this._readable = null
  this._readable2 = null

  this._autoDestroy = !opts || opts.autoDestroy !== false
  this._forwardDestroy = !opts || opts.destroy !== false
  this._forwardEnd = !opts || opts.end !== false
  this._corked = 1 // start corked
  this._ondrain = null
  this._drained = false
  this._forwarding = false
  this._unwrite = null
  this._unread = null
  this._ended = false

  this.destroyed = false

  if (writable) this.setWritable(writable)
  if (readable) this.setReadable(readable)
}

inherits(Duplexify, stream.Duplex)

Duplexify.obj = function(writable, readable, opts) {
  if (!opts) opts = {}
  opts.objectMode = true
  opts.highWaterMark = 16
  return new Duplexify(writable, readable, opts)
}

Duplexify.prototype.cork = function() {
  if (++this._corked === 1) this.emit('cork')
}

Duplexify.prototype.uncork = function() {
  if (this._corked && --this._corked === 0) this.emit('uncork')
}

Duplexify.prototype.setWritable = function(writable) {
  if (this._unwrite) this._unwrite()

  if (this.destroyed) {
    if (writable && writable.destroy) writable.destroy()
    return
  }

  if (writable === null || writable === false) {
    this.end()
    return
  }

  var self = this
  var unend = eos(writable, {writable:true, readable:false}, destroyer(this, this._forwardEnd))

  var ondrain = function() {
    var ondrain = self._ondrain
    self._ondrain = null
    if (ondrain) ondrain()
  }

  var clear = function() {
    self._writable.removeListener('drain', ondrain)
    unend()
  }

  if (this._unwrite) process.nextTick(ondrain) // force a drain on stream reset to avoid livelocks

  this._writable = writable
  this._writable.on('drain', ondrain)
  this._unwrite = clear

  this.uncork() // always uncork setWritable
}

Duplexify.prototype.setReadable = function(readable) {
  if (this._unread) this._unread()

  if (this.destroyed) {
    if (readable && readable.destroy) readable.destroy()
    return
  }

  if (readable === null || readable === false) {
    this.push(null)
    this.resume()
    return
  }

  var self = this
  var unend = eos(readable, {writable:false, readable:true}, destroyer(this))

  var onreadable = function() {
    self._forward()
  }

  var onend = function() {
    self.push(null)
  }

  var clear = function() {
    self._readable2.removeListener('readable', onreadable)
    self._readable2.removeListener('end', onend)
    unend()
  }

  this._drained = true
  this._readable = readable
  this._readable2 = readable._readableState ? readable : toStreams2(readable)
  this._readable2.on('readable', onreadable)
  this._readable2.on('end', onend)
  this._unread = clear

  this._forward()
}

Duplexify.prototype._read = function() {
  this._drained = true
  this._forward()
}

Duplexify.prototype._forward = function() {
  if (this._forwarding || !this._readable2 || !this._drained) return
  this._forwarding = true

  var data

  while (this._drained && (data = shift(this._readable2)) !== null) {
    if (this.destroyed) continue
    this._drained = this.push(data)
  }

  this._forwarding = false
}

Duplexify.prototype.destroy = function(err) {
  if (this.destroyed) return
  this.destroyed = true

  var self = this
  process.nextTick(function() {
    self._destroy(err)
  })
}

Duplexify.prototype._destroy = function(err) {
  if (err) {
    var ondrain = this._ondrain
    this._ondrain = null
    if (ondrain) ondrain(err)
    else this.emit('error', err)
  }

  if (this._forwardDestroy) {
    if (this._readable && this._readable.destroy) this._readable.destroy()
    if (this._writable && this._writable.destroy) this._writable.destroy()
  }

  this.emit('close')
}

Duplexify.prototype._write = function(data, enc, cb) {
  if (this.destroyed) return cb()
  if (this._corked) return onuncork(this, this._write.bind(this, data, enc, cb))
  if (data === SIGNAL_FLUSH) return this._finish(cb)
  if (!this._writable) return cb()

  if (this._writable.write(data) === false) this._ondrain = cb
  else cb()
}

Duplexify.prototype._finish = function(cb) {
  var self = this
  this.emit('preend')
  onuncork(this, function() {
    end(self._forwardEnd && self._writable, function() {
      // haxx to not emit prefinish twice
      if (self._writableState.prefinished === false) self._writableState.prefinished = true
      self.emit('prefinish')
      onuncork(self, cb)
    })
  })
}

Duplexify.prototype.end = function(data, enc, cb) {
  if (typeof data === 'function') return this.end(null, null, data)
  if (typeof enc === 'function') return this.end(data, null, enc)
  this._ended = true
  if (data) this.write(data)
  if (!this._writableState.ending) this.write(SIGNAL_FLUSH)
  return stream.Writable.prototype.end.call(this, cb)
}

module.exports = Duplexify

/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(11).Buffer, __webpack_require__(15)))

/***/ }),
/* 47 */
/***/ (function(module, exports, __webpack_require__) {


var content = __webpack_require__(98);

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) {}

/***/ }),
/* 48 */
/***/ (function(module, exports, __webpack_require__) {


var content = __webpack_require__(123);

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) {}

/***/ }),
/* 49 */
/***/ (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) {}

/***/ }),
/* 50 */
/***/ (function(module, exports, __webpack_require__) {


var content = __webpack_require__(125);

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) {}

/***/ }),
/* 51 */
/***/ (function(module, exports, __webpack_require__) {


var content = __webpack_require__(167);

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) {}

/***/ }),
/* 52 */
/***/ (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) {}

/***/ }),
/* 53 */
/***/ (function(module, exports, __webpack_require__) {


var content = __webpack_require__(183);

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) {}

/***/ }),
/* 54 */
/***/ (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) {}

/***/ }),
/* 55 */
/***/ (function(module, exports) {

/**
 * Parses an URI
 *
 * @author Steven Levithan <stevenlevithan.com> (MIT license)
 * @api private
 */

var re = /^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/;

var parts = [
    'source', 'protocol', 'authority', 'userInfo', 'user', 'password', 'host', 'port', 'relative', 'path', 'directory', 'file', 'query', 'anchor'
];

module.exports = function parseuri(str) {
    var src = str,
        b = str.indexOf('['),
        e = str.indexOf(']');

    if (b != -1 && e != -1) {
        str = str.substring(0, b) + str.substring(b, e).replace(/:/g, ';') + str.substring(e, str.length);
    }

    var m = re.exec(str || ''),
        uri = {},
        i = 14;

    while (i--) {
        uri[parts[i]] = m[i] || '';
    }

    if (b != -1 && e != -1) {
        uri.source = src;
        uri.host = uri.host.substring(1, uri.host.length - 1).replace(/;/g, ':');
        uri.authority = uri.authority.replace('[', '').replace(']', '').replace(/;/g, ':');
        uri.ipv6uri = true;
    }

    uri.pathNames = pathNames(uri, uri['path']);
    uri.queryKey = queryKey(uri, uri['query']);

    return uri;
};

function pathNames(obj, path) {
    var regx = /\/{2,9}/g,
        names = path.replace(regx, "/").split("/");

    if (path.substr(0, 1) == '/' || path.length === 0) {
        names.splice(0, 1);
    }
    if (path.substr(path.length - 1, 1) == '/') {
        names.splice(names.length - 1, 1);
    }

    return names;
}

function queryKey(uri, query) {
    var data = {};

    query.replace(/(?:^|&)([^&=]*)=?([^&]*)/g, function ($0, $1, $2) {
        if ($1) {
            data[$1] = $2;
        }
    });

    return data;
}


/***/ }),
/* 56 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.Manager = void 0;
const eio = __webpack_require__(291);
const socket_1 = __webpack_require__(64);
const Emitter = __webpack_require__(24);
const parser = __webpack_require__(42);
const on_1 = __webpack_require__(66);
const Backoff = __webpack_require__(304);
const debug = __webpack_require__(8)("socket.io-client:manager");
class Manager extends Emitter {
    constructor(uri, opts) {
        super();
        this.nsps = {};
        this.subs = [];
        if (uri && "object" === typeof uri) {
            opts = uri;
            uri = undefined;
        }
        opts = opts || {};
        opts.path = opts.path || "/socket.io";
        this.opts = opts;
        this.reconnection(opts.reconnection !== false);
        this.reconnectionAttempts(opts.reconnectionAttempts || Infinity);
        this.reconnectionDelay(opts.reconnectionDelay || 1000);
        this.reconnectionDelayMax(opts.reconnectionDelayMax || 5000);
        this.randomizationFactor(opts.randomizationFactor || 0.5);
        this.backoff = new Backoff({
            min: this.reconnectionDelay(),
            max: this.reconnectionDelayMax(),
            jitter: this.randomizationFactor(),
        });
        this.timeout(null == opts.timeout ? 20000 : opts.timeout);
        this._readyState = "closed";
        this.uri = uri;
        const _parser = opts.parser || parser;
        this.encoder = new _parser.Encoder();
        this.decoder = new _parser.Decoder();
        this._autoConnect = opts.autoConnect !== false;
        if (this._autoConnect)
            this.open();
    }
    reconnection(v) {
        if (!arguments.length)
            return this._reconnection;
        this._reconnection = !!v;
        return this;
    }
    reconnectionAttempts(v) {
        if (v === undefined)
            return this._reconnectionAttempts;
        this._reconnectionAttempts = v;
        return this;
    }
    reconnectionDelay(v) {
        var _a;
        if (v === undefined)
            return this._reconnectionDelay;
        this._reconnectionDelay = v;
        (_a = this.backoff) === null || _a === void 0 ? void 0 : _a.setMin(v);
        return this;
    }
    randomizationFactor(v) {
        var _a;
        if (v === undefined)
            return this._randomizationFactor;
        this._randomizationFactor = v;
        (_a = this.backoff) === null || _a === void 0 ? void 0 : _a.setJitter(v);
        return this;
    }
    reconnectionDelayMax(v) {
        var _a;
        if (v === undefined)
            return this._reconnectionDelayMax;
        this._reconnectionDelayMax = v;
        (_a = this.backoff) === null || _a === void 0 ? void 0 : _a.setMax(v);
        return this;
    }
    timeout(v) {
        if (!arguments.length)
            return this._timeout;
        this._timeout = v;
        return this;
    }
    /**
     * Starts trying to reconnect if reconnection is enabled and we have not
     * started reconnecting yet
     *
     * @private
     */
    maybeReconnectOnOpen() {
        // Only try to reconnect if it's the first time we're connecting
        if (!this._reconnecting &&
            this._reconnection &&
            this.backoff.attempts === 0) {
            // keeps reconnection from firing twice for the same reconnection loop
            this.reconnect();
        }
    }
    /**
     * Sets the current transport `socket`.
     *
     * @param {Function} fn - optional, callback
     * @return self
     * @public
     */
    open(fn) {
        debug("readyState %s", this._readyState);
        if (~this._readyState.indexOf("open"))
            return this;
        debug("opening %s", this.uri);
        this.engine = eio(this.uri, this.opts);
        const socket = this.engine;
        const self = this;
        this._readyState = "opening";
        this.skipReconnect = false;
        // emit `open`
        const openSubDestroy = on_1.on(socket, "open", function () {
            self.onopen();
            fn && fn();
        });
        // emit `error`
        const errorSub = on_1.on(socket, "error", (err) => {
            debug("error");
            self.cleanup();
            self._readyState = "closed";
            super.emit("error", err);
            if (fn) {
                fn(err);
            }
            else {
                // Only do this if there is no fn to handle the error
                self.maybeReconnectOnOpen();
            }
        });
        if (false !== this._timeout) {
            const timeout = this._timeout;
            debug("connect attempt will timeout after %d", timeout);
            if (timeout === 0) {
                openSubDestroy(); // prevents a race condition with the 'open' event
            }
            // set timer
            const timer = setTimeout(() => {
                debug("connect attempt timed out after %d", timeout);
                openSubDestroy();
                socket.close();
                socket.emit("error", new Error("timeout"));
            }, timeout);
            this.subs.push(function subDestroy() {
                clearTimeout(timer);
            });
        }
        this.subs.push(openSubDestroy);
        this.subs.push(errorSub);
        return this;
    }
    /**
     * Alias for open()
     *
     * @return self
     * @public
     */
    connect(fn) {
        return this.open(fn);
    }
    /**
     * Called upon transport open.
     *
     * @private
     */
    onopen() {
        debug("open");
        // clear old subs
        this.cleanup();
        // mark as open
        this._readyState = "open";
        super.emit("open");
        // add new subs
        const socket = this.engine;
        this.subs.push(on_1.on(socket, "ping", this.onping.bind(this)), on_1.on(socket, "data", this.ondata.bind(this)), on_1.on(socket, "error", this.onerror.bind(this)), on_1.on(socket, "close", this.onclose.bind(this)), on_1.on(this.decoder, "decoded", this.ondecoded.bind(this)));
    }
    /**
     * Called upon a ping.
     *
     * @private
     */
    onping() {
        super.emit("ping");
    }
    /**
     * Called with data.
     *
     * @private
     */
    ondata(data) {
        this.decoder.add(data);
    }
    /**
     * Called when parser fully decodes a packet.
     *
     * @private
     */
    ondecoded(packet) {
        super.emit("packet", packet);
    }
    /**
     * Called upon socket error.
     *
     * @private
     */
    onerror(err) {
        debug("error", err);
        super.emit("error", err);
    }
    /**
     * Creates a new socket for the given `nsp`.
     *
     * @return {Socket}
     * @public
     */
    socket(nsp, opts) {
        let socket = this.nsps[nsp];
        if (!socket) {
            socket = new socket_1.Socket(this, nsp, opts);
            this.nsps[nsp] = socket;
        }
        return socket;
    }
    /**
     * Called upon a socket close.
     *
     * @param socket
     * @private
     */
    _destroy(socket) {
        const nsps = Object.keys(this.nsps);
        for (const nsp of nsps) {
            const socket = this.nsps[nsp];
            if (socket.active) {
                debug("socket %s is still active, skipping close", nsp);
                return;
            }
        }
        this._close();
    }
    /**
     * Writes a packet.
     *
     * @param packet
     * @private
     */
    _packet(packet) {
        debug("writing packet %j", packet);
        if (packet.query && packet.type === 0)
            packet.nsp += "?" + packet.query;
        const encodedPackets = this.encoder.encode(packet);
        for (let i = 0; i < encodedPackets.length; i++) {
            this.engine.write(encodedPackets[i], packet.options);
        }
    }
    /**
     * Clean up transport subscriptions and packet buffer.
     *
     * @private
     */
    cleanup() {
        debug("cleanup");
        this.subs.forEach((subDestroy) => subDestroy());
        this.subs.length = 0;
        this.decoder.destroy();
    }
    /**
     * Close the current socket.
     *
     * @private
     */
    _close() {
        debug("disconnect");
        this.skipReconnect = true;
        this._reconnecting = false;
        if ("opening" === this._readyState) {
            // `onclose` will not fire because
            // an open event never happened
            this.cleanup();
        }
        this.backoff.reset();
        this._readyState = "closed";
        if (this.engine)
            this.engine.close();
    }
    /**
     * Alias for close()
     *
     * @private
     */
    disconnect() {
        return this._close();
    }
    /**
     * Called upon engine close.
     *
     * @private
     */
    onclose(reason) {
        debug("onclose");
        this.cleanup();
        this.backoff.reset();
        this._readyState = "closed";
        super.emit("close", reason);
        if (this._reconnection && !this.skipReconnect) {
            this.reconnect();
        }
    }
    /**
     * Attempt a reconnection.
     *
     * @private
     */
    reconnect() {
        if (this._reconnecting || this.skipReconnect)
            return this;
        const self = this;
        if (this.backoff.attempts >= this._reconnectionAttempts) {
            debug("reconnect failed");
            this.backoff.reset();
            super.emit("reconnect_failed");
            this._reconnecting = false;
        }
        else {
            const delay = this.backoff.duration();
            debug("will wait %dms before reconnect attempt", delay);
            this._reconnecting = true;
            const timer = setTimeout(() => {
                if (self.skipReconnect)
                    return;
                debug("attempting reconnect");
                super.emit("reconnect_attempt", self.backoff.attempts);
                // check again for the case socket closed in above events
                if (self.skipReconnect)
                    return;
                self.open((err) => {
                    if (err) {
                        debug("reconnect attempt error");
                        self._reconnecting = false;
                        self.reconnect();
                        super.emit("reconnect_error", err);
                    }
                    else {
                        debug("reconnect success");
                        self.onreconnect();
                    }
                });
            }, delay);
            this.subs.push(function subDestroy() {
                clearTimeout(timer);
            });
        }
    }
    /**
     * Called upon successful reconnect.
     *
     * @private
     */
    onreconnect() {
        const attempt = this.backoff.attempts;
        this._reconnecting = false;
        this.backoff.reset();
        super.emit("reconnect", attempt);
    }
}
exports.Manager = Manager;


/***/ }),
/* 57 */
/***/ (function(module, exports, __webpack_require__) {

const XMLHttpRequest = __webpack_require__(58);
const XHR = __webpack_require__(294);
const JSONP = __webpack_require__(298);
const websocket = __webpack_require__(299);

exports.polling = polling;
exports.websocket = websocket;

/**
 * Polling transport polymorphic constructor.
 * Decides on xhr vs jsonp based on feature detection.
 *
 * @api private
 */

function polling(opts) {
  let xhr;
  let xd = false;
  let xs = false;
  const jsonp = false !== opts.jsonp;

  if (typeof location !== "undefined") {
    const isSSL = "https:" === location.protocol;
    let port = location.port;

    // some user agents have empty `location.port`
    if (!port) {
      port = isSSL ? 443 : 80;
    }

    xd = opts.hostname !== location.hostname || port !== opts.port;
    xs = opts.secure !== isSSL;
  }

  opts.xdomain = xd;
  opts.xscheme = xs;
  xhr = new XMLHttpRequest(opts);

  if ("open" in xhr && !opts.forceJSONP) {
    return new XHR(opts);
  } else {
    if (!jsonp) throw new Error("JSONP disabled");
    return new JSONP(opts);
  }
}


/***/ }),
/* 58 */
/***/ (function(module, exports, __webpack_require__) {

// browser shim for xmlhttprequest module

const hasCORS = __webpack_require__(293);
const globalThis = __webpack_require__(34);

module.exports = function(opts) {
  const xdomain = opts.xdomain;

  // scheme must be same when usign XDomainRequest
  // http://blogs.msdn.com/b/ieinternals/archive/2010/05/13/xdomainrequest-restrictions-limitations-and-workarounds.aspx
  const xscheme = opts.xscheme;

  // XDomainRequest has a flow of not sending cookie, therefore it should be disabled as a default.
  // https://github.com/Automattic/engine.io-client/pull/217
  const enablesXDR = opts.enablesXDR;

  // XMLHttpRequest can be disabled on IE
  try {
    if ("undefined" !== typeof XMLHttpRequest && (!xdomain || hasCORS)) {
      return new XMLHttpRequest();
    }
  } catch (e) {}

  // Use XDomainRequest for IE8 if enablesXDR is true
  // because loading bar keeps flashing when using jsonp-polling
  // https://github.com/yujiosaka/socke.io-ie8-loading-example
  try {
    if ("undefined" !== typeof XDomainRequest && !xscheme && enablesXDR) {
      return new XDomainRequest();
    }
  } catch (e) {}

  if (!xdomain) {
    try {
      return new globalThis[["Active"].concat("Object").join("X")](
        "Microsoft.XMLHTTP"
      );
    } catch (e) {}
  }
};


/***/ }),
/* 59 */
/***/ (function(module, exports, __webpack_require__) {

const Transport = __webpack_require__(40);
const parseqs = __webpack_require__(41);
const parser = __webpack_require__(29);
const yeast = __webpack_require__(61);

const debug = __webpack_require__(8)("engine.io-client:polling");

class Polling extends Transport {
  /**
   * Transport name.
   */
  get name() {
    return "polling";
  }

  /**
   * Opens the socket (triggers polling). We write a PING message to determine
   * when the transport is open.
   *
   * @api private
   */
  doOpen() {
    this.poll();
  }

  /**
   * Pauses polling.
   *
   * @param {Function} callback upon buffers are flushed and transport is paused
   * @api private
   */
  pause(onPause) {
    const self = this;

    this.readyState = "pausing";

    function pause() {
      debug("paused");
      self.readyState = "paused";
      onPause();
    }

    if (this.polling || !this.writable) {
      let total = 0;

      if (this.polling) {
        debug("we are currently polling - waiting to pause");
        total++;
        this.once("pollComplete", function() {
          debug("pre-pause polling complete");
          --total || pause();
        });
      }

      if (!this.writable) {
        debug("we are currently writing - waiting to pause");
        total++;
        this.once("drain", function() {
          debug("pre-pause writing complete");
          --total || pause();
        });
      }
    } else {
      pause();
    }
  }

  /**
   * Starts polling cycle.
   *
   * @api public
   */
  poll() {
    debug("polling");
    this.polling = true;
    this.doPoll();
    this.emit("poll");
  }

  /**
   * Overloads onData to detect payloads.
   *
   * @api private
   */
  onData(data) {
    const self = this;
    debug("polling got data %s", data);
    const callback = function(packet, index, total) {
      // if its the first message we consider the transport open
      if ("opening" === self.readyState && packet.type === "open") {
        self.onOpen();
      }

      // if its a close packet, we close the ongoing requests
      if ("close" === packet.type) {
        self.onClose();
        return false;
      }

      // otherwise bypass onData and handle the message
      self.onPacket(packet);
    };

    // decode payload
    parser.decodePayload(data, this.socket.binaryType).forEach(callback);

    // if an event did not trigger closing
    if ("closed" !== this.readyState) {
      // if we got data we're not polling
      this.polling = false;
      this.emit("pollComplete");

      if ("open" === this.readyState) {
        this.poll();
      } else {
        debug('ignoring poll - transport state "%s"', this.readyState);
      }
    }
  }

  /**
   * For polling, send a close packet.
   *
   * @api private
   */
  doClose() {
    const self = this;

    function close() {
      debug("writing close packet");
      self.write([{ type: "close" }]);
    }

    if ("open" === this.readyState) {
      debug("transport open - closing");
      close();
    } else {
      // in case we're trying to close while
      // handshaking is in progress (GH-164)
      debug("transport not open - deferring close");
      this.once("open", close);
    }
  }

  /**
   * Writes a packets payload.
   *
   * @param {Array} data packets
   * @param {Function} drain callback
   * @api private
   */
  write(packets) {
    this.writable = false;

    parser.encodePayload(packets, data => {
      this.doWrite(data, () => {
        this.writable = true;
        this.emit("drain");
      });
    });
  }

  /**
   * Generates uri for connection.
   *
   * @api private
   */
  uri() {
    let query = this.query || {};
    const schema = this.opts.secure ? "https" : "http";
    let port = "";

    // cache busting is forced
    if (false !== this.opts.timestampRequests) {
      query[this.opts.timestampParam] = yeast();
    }

    if (!this.supportsBinary && !query.sid) {
      query.b64 = 1;
    }

    query = parseqs.encode(query);

    // avoid port if default for schema
    if (
      this.opts.port &&
      (("https" === schema && Number(this.opts.port) !== 443) ||
        ("http" === schema && Number(this.opts.port) !== 80))
    ) {
      port = ":" + this.opts.port;
    }

    // prepend ? to query
    if (query.length) {
      query = "?" + query;
    }

    const ipv6 = this.opts.hostname.indexOf(":") !== -1;
    return (
      schema +
      "://" +
      (ipv6 ? "[" + this.opts.hostname + "]" : this.opts.hostname) +
      port +
      this.opts.path +
      query
    );
  }
}

module.exports = Polling;


/***/ }),
/* 60 */
/***/ (function(module, exports) {

const PACKET_TYPES = Object.create(null); // no Map = no polyfill
PACKET_TYPES["open"] = "0";
PACKET_TYPES["close"] = "1";
PACKET_TYPES["ping"] = "2";
PACKET_TYPES["pong"] = "3";
PACKET_TYPES["message"] = "4";
PACKET_TYPES["upgrade"] = "5";
PACKET_TYPES["noop"] = "6";

const PACKET_TYPES_REVERSE = Object.create(null);
Object.keys(PACKET_TYPES).forEach(key => {
  PACKET_TYPES_REVERSE[PACKET_TYPES[key]] = key;
});

const ERROR_PACKET = { type: "error", data: "parser error" };

module.exports = {
  PACKET_TYPES,
  PACKET_TYPES_REVERSE,
  ERROR_PACKET
};


/***/ }),
/* 61 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var alphabet = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_'.split('')
  , length = 64
  , map = {}
  , seed = 0
  , i = 0
  , prev;

/**
 * Return a string representing the specified number.
 *
 * @param {Number} num The number to convert.
 * @returns {String} The string representation of the number.
 * @api public
 */
function encode(num) {
  var encoded = '';

  do {
    encoded = alphabet[num % length] + encoded;
    num = Math.floor(num / length);
  } while (num > 0);

  return encoded;
}

/**
 * Return the integer value specified by the given string.
 *
 * @param {String} str The string to convert.
 * @returns {Number} The integer value represented by the string.
 * @api public
 */
function decode(str) {
  var decoded = 0;

  for (i = 0; i < str.length; i++) {
    decoded = decoded * length + map[str.charAt(i)];
  }

  return decoded;
}

/**
 * Yeast: A tiny growing id generator.
 *
 * @returns {String} A unique id.
 * @api public
 */
function yeast() {
  var now = encode(+new Date());

  if (now !== prev) return seed = 0, prev = now;
  return now +'.'+ encode(seed++);
}

//
// Map each character to its index.
//
for (; i < length; i++) map[alphabet[i]] = i;

//
// Expose the `yeast`, `encode` and `decode` functions.
//
yeast.encode = encode;
yeast.decode = decode;
module.exports = yeast;


/***/ }),
/* 62 */
/***/ (function(module, exports) {

module.exports.pick = (obj, ...attr) => {
  return attr.reduce((acc, k) => {
    if (obj.hasOwnProperty(k)) {
      acc[k] = obj[k];
    }
    return acc;
  }, {});
};


/***/ }),
/* 63 */
/***/ (function(module, exports) {

var toString = {}.toString;

module.exports = Array.isArray || function (arr) {
  return toString.call(arr) == '[object Array]';
};


/***/ }),
/* 64 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.Socket = void 0;
const socket_io_parser_1 = __webpack_require__(42);
const Emitter = __webpack_require__(24);
const on_1 = __webpack_require__(66);
const debug = __webpack_require__(8)("socket.io-client:socket");
/**
 * Internal events.
 * These events can't be emitted by the user.
 */
const RESERVED_EVENTS = Object.freeze({
    connect: 1,
    connect_error: 1,
    disconnect: 1,
    disconnecting: 1,
    // EventEmitter reserved events: https://nodejs.org/api/events.html#events_event_newlistener
    newListener: 1,
    removeListener: 1,
});
class Socket extends Emitter {
    /**
     * `Socket` constructor.
     *
     * @public
     */
    constructor(io, nsp, opts) {
        super();
        this.receiveBuffer = [];
        this.sendBuffer = [];
        this.ids = 0;
        this.acks = {};
        this.flags = {};
        this.io = io;
        this.nsp = nsp;
        this.ids = 0;
        this.acks = {};
        this.receiveBuffer = [];
        this.sendBuffer = [];
        this.connected = false;
        this.disconnected = true;
        this.flags = {};
        if (opts && opts.auth) {
            this.auth = opts.auth;
        }
        if (this.io._autoConnect)
            this.open();
    }
    /**
     * Subscribe to open, close and packet events
     *
     * @private
     */
    subEvents() {
        if (this.subs)
            return;
        const io = this.io;
        this.subs = [
            on_1.on(io, "open", this.onopen.bind(this)),
            on_1.on(io, "packet", this.onpacket.bind(this)),
            on_1.on(io, "error", this.onerror.bind(this)),
            on_1.on(io, "close", this.onclose.bind(this)),
        ];
    }
    /**
     * Whether the Socket will try to reconnect when its Manager connects or reconnects
     */
    get active() {
        return !!this.subs;
    }
    /**
     * "Opens" the socket.
     *
     * @public
     */
    connect() {
        if (this.connected)
            return this;
        this.subEvents();
        if (!this.io["_reconnecting"])
            this.io.open(); // ensure open
        if ("open" === this.io._readyState)
            this.onopen();
        return this;
    }
    /**
     * Alias for connect()
     */
    open() {
        return this.connect();
    }
    /**
     * Sends a `message` event.
     *
     * @return self
     * @public
     */
    send(...args) {
        args.unshift("message");
        this.emit.apply(this, args);
        return this;
    }
    /**
     * Override `emit`.
     * If the event is in `events`, it's emitted normally.
     *
     * @param ev - event name
     * @return self
     * @public
     */
    emit(ev, ...args) {
        if (RESERVED_EVENTS.hasOwnProperty(ev)) {
            throw new Error('"' + ev + '" is a reserved event name');
        }
        args.unshift(ev);
        const packet = {
            type: socket_io_parser_1.PacketType.EVENT,
            data: args,
        };
        packet.options = {};
        packet.options.compress = this.flags.compress !== false;
        // event ack callback
        if ("function" === typeof args[args.length - 1]) {
            debug("emitting packet with ack id %d", this.ids);
            this.acks[this.ids] = args.pop();
            packet.id = this.ids++;
        }
        const isTransportWritable = this.io.engine &&
            this.io.engine.transport &&
            this.io.engine.transport.writable;
        const discardPacket = this.flags.volatile && (!isTransportWritable || !this.connected);
        if (discardPacket) {
            debug("discard packet as the transport is not currently writable");
        }
        else if (this.connected) {
            this.packet(packet);
        }
        else {
            this.sendBuffer.push(packet);
        }
        this.flags = {};
        return this;
    }
    /**
     * Sends a packet.
     *
     * @param packet
     * @private
     */
    packet(packet) {
        packet.nsp = this.nsp;
        this.io._packet(packet);
    }
    /**
     * Called upon engine `open`.
     *
     * @private
     */
    onopen() {
        debug("transport is open - connecting");
        if (typeof this.auth == "function") {
            this.auth((data) => {
                this.packet({ type: socket_io_parser_1.PacketType.CONNECT, data });
            });
        }
        else {
            this.packet({ type: socket_io_parser_1.PacketType.CONNECT, data: this.auth });
        }
    }
    /**
     * Called upon engine or manager `error`.
     *
     * @param err
     * @private
     */
    onerror(err) {
        if (!this.connected) {
            super.emit("connect_error", err);
        }
    }
    /**
     * Called upon engine `close`.
     *
     * @param reason
     * @private
     */
    onclose(reason) {
        debug("close (%s)", reason);
        this.connected = false;
        this.disconnected = true;
        delete this.id;
        super.emit("disconnect", reason);
    }
    /**
     * Called with socket packet.
     *
     * @param packet
     * @private
     */
    onpacket(packet) {
        const sameNamespace = packet.nsp === this.nsp;
        if (!sameNamespace)
            return;
        switch (packet.type) {
            case socket_io_parser_1.PacketType.CONNECT:
                if (packet.data && packet.data.sid) {
                    const id = packet.data.sid;
                    this.onconnect(id);
                }
                else {
                    super.emit("connect_error", new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));
                }
                break;
            case socket_io_parser_1.PacketType.EVENT:
                this.onevent(packet);
                break;
            case socket_io_parser_1.PacketType.BINARY_EVENT:
                this.onevent(packet);
                break;
            case socket_io_parser_1.PacketType.ACK:
                this.onack(packet);
                break;
            case socket_io_parser_1.PacketType.BINARY_ACK:
                this.onack(packet);
                break;
            case socket_io_parser_1.PacketType.DISCONNECT:
                this.ondisconnect();
                break;
            case socket_io_parser_1.PacketType.CONNECT_ERROR:
                const err = new Error(packet.data.message);
                // @ts-ignore
                err.data = packet.data.data;
                super.emit("connect_error", err);
                break;
        }
    }
    /**
     * Called upon a server event.
     *
     * @param packet
     * @private
     */
    onevent(packet) {
        const args = packet.data || [];
        debug("emitting event %j", args);
        if (null != packet.id) {
            debug("attaching ack callback to event");
            args.push(this.ack(packet.id));
        }
        if (this.connected) {
            this.emitEvent(args);
        }
        else {
            this.receiveBuffer.push(Object.freeze(args));
        }
    }
    emitEvent(args) {
        if (this._anyListeners && this._anyListeners.length) {
            const listeners = this._anyListeners.slice();
            for (const listener of listeners) {
                listener.apply(this, args);
            }
        }
        super.emit.apply(this, args);
    }
    /**
     * Produces an ack callback to emit with an event.
     *
     * @private
     */
    ack(id) {
        const self = this;
        let sent = false;
        return function (...args) {
            // prevent double callbacks
            if (sent)
                return;
            sent = true;
            debug("sending ack %j", args);
            self.packet({
                type: socket_io_parser_1.PacketType.ACK,
                id: id,
                data: args,
            });
        };
    }
    /**
     * Called upon a server acknowlegement.
     *
     * @param packet
     * @private
     */
    onack(packet) {
        const ack = this.acks[packet.id];
        if ("function" === typeof ack) {
            debug("calling ack %s with %j", packet.id, packet.data);
            ack.apply(this, packet.data);
            delete this.acks[packet.id];
        }
        else {
            debug("bad ack %s", packet.id);
        }
    }
    /**
     * Called upon server connect.
     *
     * @private
     */
    onconnect(id) {
        debug("socket connected with id %s", id);
        this.id = id;
        this.connected = true;
        this.disconnected = false;
        super.emit("connect");
        this.emitBuffered();
    }
    /**
     * Emit buffered events (received and emitted).
     *
     * @private
     */
    emitBuffered() {
        this.receiveBuffer.forEach((args) => this.emitEvent(args));
        this.receiveBuffer = [];
        this.sendBuffer.forEach((packet) => this.packet(packet));
        this.sendBuffer = [];
    }
    /**
     * Called upon server disconnect.
     *
     * @private
     */
    ondisconnect() {
        debug("server disconnect (%s)", this.nsp);
        this.destroy();
        this.onclose("io server disconnect");
    }
    /**
     * Called upon forced client/server side disconnections,
     * this method ensures the manager stops tracking us and
     * that reconnections don't get triggered for this.
     *
     * @private
     */
    destroy() {
        if (this.subs) {
            // clean subscriptions to avoid reconnections
            this.subs.forEach((subDestroy) => subDestroy());
            this.subs = undefined;
        }
        this.io["_destroy"](this);
    }
    /**
     * Disconnects the socket manually.
     *
     * @return self
     * @public
     */
    disconnect() {
        if (this.connected) {
            debug("performing disconnect (%s)", this.nsp);
            this.packet({ type: socket_io_parser_1.PacketType.DISCONNECT });
        }
        // remove socket from pool
        this.destroy();
        if (this.connected) {
            // fire events
            this.onclose("io client disconnect");
        }
        return this;
    }
    /**
     * Alias for disconnect()
     *
     * @return self
     * @public
     */
    close() {
        return this.disconnect();
    }
    /**
     * Sets the compress flag.
     *
     * @param compress - if `true`, compresses the sending data
     * @return self
     * @public
     */
    compress(compress) {
        this.flags.compress = compress;
        return this;
    }
    /**
     * Sets a modifier for a subsequent event emission that the event message will be dropped when this socket is not
     * ready to send messages.
     *
     * @returns self
     * @public
     */
    get volatile() {
        this.flags.volatile = true;
        return this;
    }
    /**
     * Adds a listener that will be fired when any event is emitted. The event name is passed as the first argument to the
     * callback.
     *
     * @param listener
     * @public
     */
    onAny(listener) {
        this._anyListeners = this._anyListeners || [];
        this._anyListeners.push(listener);
        return this;
    }
    /**
     * Adds a listener that will be fired when any event is emitted. The event name is passed as the first argument to the
     * callback. The listener is added to the beginning of the listeners array.
     *
     * @param listener
     * @public
     */
    prependAny(listener) {
        this._anyListeners = this._anyListeners || [];
        this._anyListeners.unshift(listener);
        return this;
    }
    /**
     * Removes the listener that will be fired when any event is emitted.
     *
     * @param listener
     * @public
     */
    offAny(listener) {
        if (!this._anyListeners) {
            return this;
        }
        if (listener) {
            const listeners = this._anyListeners;
            for (let i = 0; i < listeners.length; i++) {
                if (listener === listeners[i]) {
                    listeners.splice(i, 1);
                    return this;
                }
            }
        }
        else {
            this._anyListeners = [];
        }
        return this;
    }
    /**
     * Returns an array of listeners that are listening for any event that is specified. This array can be manipulated,
     * e.g. to remove listeners.
     *
     * @public
     */
    listenersAny() {
        return this._anyListeners || [];
    }
}
exports.Socket = Socket;


/***/ }),
/* 65 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.hasBinary = exports.isBinary = void 0;
const withNativeArrayBuffer = typeof ArrayBuffer === "function";
const isView = (obj) => {
    return typeof ArrayBuffer.isView === "function"
        ? ArrayBuffer.isView(obj)
        : obj.buffer instanceof ArrayBuffer;
};
const toString = Object.prototype.toString;
const withNativeBlob = typeof Blob === "function" ||
    (typeof Blob !== "undefined" &&
        toString.call(Blob) === "[object BlobConstructor]");
const withNativeFile = typeof File === "function" ||
    (typeof File !== "undefined" &&
        toString.call(File) === "[object FileConstructor]");
/**
 * Returns true if obj is a Buffer, an ArrayBuffer, a Blob or a File.
 *
 * @private
 */
function isBinary(obj) {
    return ((withNativeArrayBuffer && (obj instanceof ArrayBuffer || isView(obj))) ||
        (withNativeBlob && obj instanceof Blob) ||
        (withNativeFile && obj instanceof File));
}
exports.isBinary = isBinary;
function hasBinary(obj, toJSON) {
    if (!obj || typeof obj !== "object") {
        return false;
    }
    if (Array.isArray(obj)) {
        for (let i = 0, l = obj.length; i < l; i++) {
            if (hasBinary(obj[i])) {
                return true;
            }
        }
        return false;
    }
    if (isBinary(obj)) {
        return true;
    }
    if (obj.toJSON &&
        typeof obj.toJSON === "function" &&
        arguments.length === 1) {
        return hasBinary(obj.toJSON(), true);
    }
    for (const key in obj) {
        if (Object.prototype.hasOwnProperty.call(obj, key) && hasBinary(obj[key])) {
            return true;
        }
    }
    return false;
}
exports.hasBinary = hasBinary;


/***/ }),
/* 66 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.on = void 0;
function on(obj, ev, fn) {
    obj.on(ev, fn);
    return function subDestroy() {
        obj.off(ev, fn);
    };
}
exports.on = on;


/***/ }),
/* 67 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

/* global RTCRtpTransceiver */
Object.defineProperty(exports, "__esModule", { value: true });
const bowser = __webpack_require__(305);
const Logger_1 = __webpack_require__(9);
const EnhancedEventEmitter_1 = __webpack_require__(22);
const errors_1 = __webpack_require__(16);
const utils = __webpack_require__(10);
const ortc = __webpack_require__(14);
const Transport_1 = __webpack_require__(68);
const Chrome74_1 = __webpack_require__(308);
const Chrome70_1 = __webpack_require__(312);
const Chrome67_1 = __webpack_require__(313);
const Chrome55_1 = __webpack_require__(314);
const Firefox60_1 = __webpack_require__(315);
const Safari12_1 = __webpack_require__(316);
const Safari11_1 = __webpack_require__(317);
const Edge11_1 = __webpack_require__(318);
const ReactNative_1 = __webpack_require__(320);
const logger = new Logger_1.Logger('Device');
function detectDevice() {
    // React-Native.
    // NOTE: react-native-webrtc >= 1.75.0 is required.
    if (typeof navigator === 'object' && navigator.product === 'ReactNative') {
        if (typeof RTCPeerConnection === 'undefined') {
            logger.warn('this._detectDevice() | unsupported ReactNative without RTCPeerConnection');
            return undefined;
        }
        logger.debug('this._detectDevice() | ReactNative handler chosen');
        return 'ReactNative';
    }
    // Browser.
    else if (typeof navigator === 'object' && typeof navigator.userAgent === 'string') {
        const ua = navigator.userAgent;
        const browser = bowser.getParser(ua);
        const engine = browser.getEngine();
        // Chrome and Chromium.
        if (browser.satisfies({ chrome: '>=74', chromium: '>=74' })) {
            return 'Chrome74';
        }
        else if (browser.satisfies({ chrome: '>=70', chromium: '>=70' })) {
            return 'Chrome70';
        }
        else if (browser.satisfies({ chrome: '>=67', chromium: '>=67' })) {
            return 'Chrome67';
        }
        else if (browser.satisfies({ chrome: '>=55', chromium: '>=55' })) {
            return 'Chrome55';
        }
        // Firefox.
        else if (browser.satisfies({ firefox: '>=60' })) {
            return 'Firefox60';
        }
        // Safari with Unified-Plan support enabled.
        else if (browser.satisfies({ safari: '>=12.0' }) &&
            typeof RTCRtpTransceiver !== 'undefined' &&
            RTCRtpTransceiver.prototype.hasOwnProperty('currentDirection')) {
            return 'Safari12';
        }
        // Safari with Plab-B support.
        else if (browser.satisfies({ safari: '>=11' })) {
            return 'Safari11';
        }
        // Old Edge with ORTC support.
        else if (browser.satisfies({ 'microsoft edge': '>=11' }) &&
            browser.satisfies({ 'microsoft edge': '<=18' })) {
            return 'Edge11';
        }
        // Best effort for Chromium based browsers.
        else if (engine.name && engine.name.toLowerCase() === 'blink') {
            const match = ua.match(/(?:(?:Chrome|Chromium))[ /](\w+)/i);
            if (match) {
                const version = Number(match[1]);
                if (version >= 74) {
                    return 'Chrome74';
                }
                else if (version >= 70) {
                    return 'Chrome70';
                }
                else if (version >= 67) {
                    return 'Chrome67';
                }
                else {
                    return 'Chrome55';
                }
            }
            else {
                return 'Chrome74';
            }
        }
        // Unsupported browser.
        else {
            logger.warn('this._detectDevice() | browser not supported [name:%s, version:%s]', browser.getBrowserName(), browser.getBrowserVersion());
            return undefined;
        }
    }
    // Unknown device.
    else {
        logger.warn('this._detectDevice() | unknown device');
        return undefined;
    }
}
exports.detectDevice = detectDevice;
class Device {
    /**
     * Create a new Device to connect to mediasoup server.
     *
     * @throws {UnsupportedError} if device is not supported.
     */
    constructor({ handlerName, handlerFactory, Handler } = {}) {
        // Loaded flag.
        this._loaded = false;
        // Observer instance.
        this._observer = new EnhancedEventEmitter_1.EnhancedEventEmitter();
        logger.debug('constructor()');
        // Handle deprecated option.
        if (Handler) {
            logger.warn('constructor() | Handler option is DEPRECATED, use handlerName or handlerFactory instead');
            if (typeof Handler === 'string')
                handlerName = Handler;
            else
                throw new TypeError('non string Handler option no longer supported, use handlerFactory instead');
        }
        if (handlerName && handlerFactory) {
            throw new TypeError('just one of handlerName or handlerInterface can be given');
        }
        if (handlerFactory) {
            this._handlerFactory = handlerFactory;
        }
        else {
            if (handlerName) {
                logger.debug('constructor() | handler given: %s', handlerName);
            }
            else {
                handlerName = detectDevice();
                if (handlerName)
                    logger.debug('constructor() | detected handler: %s', handlerName);
                else
                    throw new errors_1.UnsupportedError('device not supported');
            }
            switch (handlerName) {
                case 'Chrome74':
                    this._handlerFactory = Chrome74_1.Chrome74.createFactory();
                    break;
                case 'Chrome70':
                    this._handlerFactory = Chrome70_1.Chrome70.createFactory();
                    break;
                case 'Chrome67':
                    this._handlerFactory = Chrome67_1.Chrome67.createFactory();
                    break;
                case 'Chrome55':
                    this._handlerFactory = Chrome55_1.Chrome55.createFactory();
                    break;
                case 'Firefox60':
                    this._handlerFactory = Firefox60_1.Firefox60.createFactory();
                    break;
                case 'Safari12':
                    this._handlerFactory = Safari12_1.Safari12.createFactory();
                    break;
                case 'Safari11':
                    this._handlerFactory = Safari11_1.Safari11.createFactory();
                    break;
                case 'Edge11':
                    this._handlerFactory = Edge11_1.Edge11.createFactory();
                    break;
                case 'ReactNative':
                    this._handlerFactory = ReactNative_1.ReactNative.createFactory();
                    break;
                default:
                    throw new TypeError(`unknown handlerName "${handlerName}"`);
            }
        }
        // Create a temporal handler to get its name.
        const handler = this._handlerFactory();
        this._handlerName = handler.name;
        handler.close();
        this._extendedRtpCapabilities = undefined;
        this._recvRtpCapabilities = undefined;
        this._canProduceByKind =
            {
                audio: false,
                video: false
            };
        this._sctpCapabilities = undefined;
    }
    /**
     * The RTC handler name.
     */
    get handlerName() {
        return this._handlerName;
    }
    /**
     * Whether the Device is loaded.
     */
    get loaded() {
        return this._loaded;
    }
    /**
     * RTP capabilities of the Device for receiving media.
     *
     * @throws {InvalidStateError} if not loaded.
     */
    get rtpCapabilities() {
        if (!this._loaded)
            throw new errors_1.InvalidStateError('not loaded');
        return this._recvRtpCapabilities;
    }
    /**
     * SCTP capabilities of the Device.
     *
     * @throws {InvalidStateError} if not loaded.
     */
    get sctpCapabilities() {
        if (!this._loaded)
            throw new errors_1.InvalidStateError('not loaded');
        return this._sctpCapabilities;
    }
    /**
     * Observer.
     *
     * @emits newtransport - (transport: Transport)
     */
    get observer() {
        return this._observer;
    }
    /**
     * Initialize the Device.
     */
    async load({ routerRtpCapabilities }) {
        logger.debug('load() [routerRtpCapabilities:%o]', routerRtpCapabilities);
        routerRtpCapabilities = utils.clone(routerRtpCapabilities, undefined);
        // Temporal handler to get its capabilities.
        let handler;
        try {
            if (this._loaded)
                throw new errors_1.InvalidStateError('already loaded');
            // This may throw.
            ortc.validateRtpCapabilities(routerRtpCapabilities);
            handler = this._handlerFactory();
            const nativeRtpCapabilities = await handler.getNativeRtpCapabilities();
            logger.debug('load() | got native RTP capabilities:%o', nativeRtpCapabilities);
            // This may throw.
            ortc.validateRtpCapabilities(nativeRtpCapabilities);
            // Get extended RTP capabilities.
            this._extendedRtpCapabilities = ortc.getExtendedRtpCapabilities(nativeRtpCapabilities, routerRtpCapabilities);
            logger.debug('load() | got extended RTP capabilities:%o', this._extendedRtpCapabilities);
            // Check whether we can produce audio/video.
            this._canProduceByKind.audio =
                ortc.canSend('audio', this._extendedRtpCapabilities);
            this._canProduceByKind.video =
                ortc.canSend('video', this._extendedRtpCapabilities);
            // Generate our receiving RTP capabilities for receiving media.
            this._recvRtpCapabilities =
                ortc.getRecvRtpCapabilities(this._extendedRtpCapabilities);
            // This may throw.
            ortc.validateRtpCapabilities(this._recvRtpCapabilities);
            logger.debug('load() | got receiving RTP capabilities:%o', this._recvRtpCapabilities);
            // Generate our SCTP capabilities.
            this._sctpCapabilities = await handler.getNativeSctpCapabilities();
            logger.debug('load() | got native SCTP capabilities:%o', this._sctpCapabilities);
            // This may throw.
            ortc.validateSctpCapabilities(this._sctpCapabilities);
            logger.debug('load() succeeded');
            this._loaded = true;
            handler.close();
        }
        catch (error) {
            if (handler)
                handler.close();
            throw error;
        }
    }
    /**
     * Whether we can produce audio/video.
     *
     * @throws {InvalidStateError} if not loaded.
     * @throws {TypeError} if wrong arguments.
     */
    canProduce(kind) {
        if (!this._loaded)
            throw new errors_1.InvalidStateError('not loaded');
        else if (kind !== 'audio' && kind !== 'video')
            throw new TypeError(`invalid kind "${kind}"`);
        return this._canProduceByKind[kind];
    }
    /**
     * Creates a Transport for sending media.
     *
     * @throws {InvalidStateError} if not loaded.
     * @throws {TypeError} if wrong arguments.
     */
    createSendTransport({ id, iceParameters, iceCandidates, dtlsParameters, sctpParameters, iceServers, iceTransportPolicy, additionalSettings, proprietaryConstraints, appData = {} }) {
        logger.debug('createSendTransport()');
        return this._createTransport({
            direction: 'send',
            id: id,
            iceParameters: iceParameters,
            iceCandidates: iceCandidates,
            dtlsParameters: dtlsParameters,
            sctpParameters: sctpParameters,
            iceServers: iceServers,
            iceTransportPolicy: iceTransportPolicy,
            additionalSettings: additionalSettings,
            proprietaryConstraints: proprietaryConstraints,
            appData: appData
        });
    }
    /**
     * Creates a Transport for receiving media.
     *
     * @throws {InvalidStateError} if not loaded.
     * @throws {TypeError} if wrong arguments.
     */
    createRecvTransport({ id, iceParameters, iceCandidates, dtlsParameters, sctpParameters, iceServers, iceTransportPolicy, additionalSettings, proprietaryConstraints, appData = {} }) {
        logger.debug('createRecvTransport()');
        return this._createTransport({
            direction: 'recv',
            id: id,
            iceParameters: iceParameters,
            iceCandidates: iceCandidates,
            dtlsParameters: dtlsParameters,
            sctpParameters: sctpParameters,
            iceServers: iceServers,
            iceTransportPolicy: iceTransportPolicy,
            additionalSettings: additionalSettings,
            proprietaryConstraints: proprietaryConstraints,
            appData: appData
        });
    }
    _createTransport({ direction, id, iceParameters, iceCandidates, dtlsParameters, sctpParameters, iceServers, iceTransportPolicy, additionalSettings, proprietaryConstraints, appData = {} }) {
        if (!this._loaded)
            throw new errors_1.InvalidStateError('not loaded');
        else if (typeof id !== 'string')
            throw new TypeError('missing id');
        else if (typeof iceParameters !== 'object')
            throw new TypeError('missing iceParameters');
        else if (!Array.isArray(iceCandidates))
            throw new TypeError('missing iceCandidates');
        else if (typeof dtlsParameters !== 'object')
            throw new TypeError('missing dtlsParameters');
        else if (sctpParameters && typeof sctpParameters !== 'object')
            throw new TypeError('wrong sctpParameters');
        else if (appData && typeof appData !== 'object')
            throw new TypeError('if given, appData must be an object');
        // Create a new Transport.
        const transport = new Transport_1.Transport({
            direction,
            id,
            iceParameters,
            iceCandidates,
            dtlsParameters,
            sctpParameters,
            iceServers,
            iceTransportPolicy,
            additionalSettings,
            proprietaryConstraints,
            appData,
            handlerFactory: this._handlerFactory,
            extendedRtpCapabilities: this._extendedRtpCapabilities,
            canProduceByKind: this._canProduceByKind
        });
        // Emit observer event.
        this._observer.safeEmit('newtransport', transport);
        return transport;
    }
}
exports.Device = Device;


/***/ }),
/* 68 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
const awaitqueue_1 = __webpack_require__(307);
const Logger_1 = __webpack_require__(9);
const EnhancedEventEmitter_1 = __webpack_require__(22);
const errors_1 = __webpack_require__(16);
const utils = __webpack_require__(10);
const ortc = __webpack_require__(14);
const Producer_1 = __webpack_require__(69);
const Consumer_1 = __webpack_require__(70);
const DataProducer_1 = __webpack_require__(71);
const DataConsumer_1 = __webpack_require__(72);
const logger = new Logger_1.Logger('Transport');
class Transport extends EnhancedEventEmitter_1.EnhancedEventEmitter {
    /**
     * @emits connect - (transportLocalParameters: any, callback: Function, errback: Function)
     * @emits connectionstatechange - (connectionState: ConnectionState)
     * @emits produce - (producerLocalParameters: any, callback: Function, errback: Function)
     * @emits producedata - (dataProducerLocalParameters: any, callback: Function, errback: Function)
     */
    constructor({ direction, id, iceParameters, iceCandidates, dtlsParameters, sctpParameters, iceServers, iceTransportPolicy, additionalSettings, proprietaryConstraints, appData, handlerFactory, extendedRtpCapabilities, canProduceByKind }) {
        super();
        // Closed flag.
        this._closed = false;
        // Transport connection state.
        this._connectionState = 'new';
        // Map of Producers indexed by id.
        this._producers = new Map();
        // Map of Consumers indexed by id.
        this._consumers = new Map();
        // Map of DataProducers indexed by id.
        this._dataProducers = new Map();
        // Map of DataConsumers indexed by id.
        this._dataConsumers = new Map();
        // Whether the Consumer for RTP probation has been created.
        this._probatorConsumerCreated = false;
        // AwaitQueue instance to make async tasks happen sequentially.
        this._awaitQueue = new awaitqueue_1.AwaitQueue({ ClosedErrorClass: errors_1.InvalidStateError });
        // Observer instance.
        this._observer = new EnhancedEventEmitter_1.EnhancedEventEmitter();
        logger.debug('constructor() [id:%s, direction:%s]', id, direction);
        this._id = id;
        this._direction = direction;
        this._extendedRtpCapabilities = extendedRtpCapabilities;
        this._canProduceByKind = canProduceByKind;
        this._maxSctpMessageSize =
            sctpParameters ? sctpParameters.maxMessageSize : null;
        // Clone and sanitize additionalSettings.
        additionalSettings = utils.clone(additionalSettings, {});
        delete additionalSettings.iceServers;
        delete additionalSettings.iceTransportPolicy;
        delete additionalSettings.bundlePolicy;
        delete additionalSettings.rtcpMuxPolicy;
        delete additionalSettings.sdpSemantics;
        this._handler = handlerFactory();
        this._handler.run({
            direction,
            iceParameters,
            iceCandidates,
            dtlsParameters,
            sctpParameters,
            iceServers,
            iceTransportPolicy,
            additionalSettings,
            proprietaryConstraints,
            extendedRtpCapabilities
        });
        this._appData = appData;
        this._handleHandler();
    }
    /**
     * Transport id.
     */
    get id() {
        return this._id;
    }
    /**
     * Whether the Transport is closed.
     */
    get closed() {
        return this._closed;
    }
    /**
     * Transport direction.
     */
    get direction() {
        return this._direction;
    }
    /**
     * RTC handler instance.
     */
    get handler() {
        return this._handler;
    }
    /**
     * Connection state.
     */
    get connectionState() {
        return this._connectionState;
    }
    /**
     * App custom data.
     */
    get appData() {
        return this._appData;
    }
    /**
     * Invalid setter.
     */
    set appData(appData) {
        throw new Error('cannot override appData object');
    }
    /**
     * Observer.
     *
     * @emits close
     * @emits newproducer - (producer: Producer)
     * @emits newconsumer - (producer: Producer)
     * @emits newdataproducer - (dataProducer: DataProducer)
     * @emits newdataconsumer - (dataProducer: DataProducer)
     */
    get observer() {
        return this._observer;
    }
    /**
     * Close the Transport.
     */
    close() {
        if (this._closed)
            return;
        logger.debug('close()');
        this._closed = true;
        // Close the AwaitQueue.
        this._awaitQueue.close();
        // Close the handler.
        this._handler.close();
        // Close all Producers.
        for (const producer of this._producers.values()) {
            producer.transportClosed();
        }
        this._producers.clear();
        // Close all Consumers.
        for (const consumer of this._consumers.values()) {
            consumer.transportClosed();
        }
        this._consumers.clear();
        // Close all DataProducers.
        for (const dataProducer of this._dataProducers.values()) {
            dataProducer.transportClosed();
        }
        this._dataProducers.clear();
        // Close all DataConsumers.
        for (const dataConsumer of this._dataConsumers.values()) {
            dataConsumer.transportClosed();
        }
        this._dataConsumers.clear();
        // Emit observer event.
        this._observer.safeEmit('close');
    }
    /**
     * Get associated Transport (RTCPeerConnection) stats.
     *
     * @returns {RTCStatsReport}
     */
    async getStats() {
        if (this._closed)
            throw new errors_1.InvalidStateError('closed');
        return this._handler.getTransportStats();
    }
    /**
     * Restart ICE connection.
     */
    async restartIce({ iceParameters }) {
        logger.debug('restartIce()');
        if (this._closed)
            throw new errors_1.InvalidStateError('closed');
        else if (!iceParameters)
            throw new TypeError('missing iceParameters');
        // Enqueue command.
        return this._awaitQueue.push(async () => this._handler.restartIce(iceParameters), 'transport.restartIce()');
    }
    /**
     * Update ICE servers.
     */
    async updateIceServers({ iceServers } = {}) {
        logger.debug('updateIceServers()');
        if (this._closed)
            throw new errors_1.InvalidStateError('closed');
        else if (!Array.isArray(iceServers))
            throw new TypeError('missing iceServers');
        // Enqueue command.
        return this._awaitQueue.push(async () => this._handler.updateIceServers(iceServers), 'transport.updateIceServers()');
    }
    /**
     * Create a Producer.
     */
    async produce({ track, encodings, codecOptions, codec, stopTracks = true, disableTrackOnPause = true, zeroRtpOnPause = false, appData = {} } = {}) {
        logger.debug('produce() [track:%o]', track);
        if (!track)
            throw new TypeError('missing track');
        else if (this._direction !== 'send')
            throw new errors_1.UnsupportedError('not a sending Transport');
        else if (!this._canProduceByKind[track.kind])
            throw new errors_1.UnsupportedError(`cannot produce ${track.kind}`);
        else if (track.readyState === 'ended')
            throw new errors_1.InvalidStateError('track ended');
        else if (this.listenerCount('connect') === 0 && this._connectionState === 'new')
            throw new TypeError('no "connect" listener set into this transport');
        else if (this.listenerCount('produce') === 0)
            throw new TypeError('no "produce" listener set into this transport');
        else if (appData && typeof appData !== 'object')
            throw new TypeError('if given, appData must be an object');
        // Enqueue command.
        return this._awaitQueue.push(async () => {
            let normalizedEncodings;
            if (encodings && !Array.isArray(encodings)) {
                throw TypeError('encodings must be an array');
            }
            else if (encodings && encodings.length === 0) {
                normalizedEncodings = undefined;
            }
            else if (encodings) {
                normalizedEncodings = encodings
                    .map((encoding) => {
                    const normalizedEncoding = { active: true };
                    if (encoding.active === false)
                        normalizedEncoding.active = false;
                    if (typeof encoding.dtx === 'boolean')
                        normalizedEncoding.dtx = encoding.dtx;
                    if (typeof encoding.scalabilityMode === 'string')
                        normalizedEncoding.scalabilityMode = encoding.scalabilityMode;
                    if (typeof encoding.scaleResolutionDownBy === 'number')
                        normalizedEncoding.scaleResolutionDownBy = encoding.scaleResolutionDownBy;
                    if (typeof encoding.maxBitrate === 'number')
                        normalizedEncoding.maxBitrate = encoding.maxBitrate;
                    if (typeof encoding.maxFramerate === 'number')
                        normalizedEncoding.maxFramerate = encoding.maxFramerate;
                    if (typeof encoding.adaptivePtime === 'boolean')
                        normalizedEncoding.adaptivePtime = encoding.adaptivePtime;
                    if (typeof encoding.priority === 'string')
                        normalizedEncoding.priority = encoding.priority;
                    if (typeof encoding.networkPriority === 'string')
                        normalizedEncoding.networkPriority = encoding.networkPriority;
                    return normalizedEncoding;
                });
            }
            const { localId, rtpParameters, rtpSender } = await this._handler.send({
                track,
                encodings: normalizedEncodings,
                codecOptions,
                codec
            });
            try {
                // This will fill rtpParameters's missing fields with default values.
                ortc.validateRtpParameters(rtpParameters);
                const { id } = await this.safeEmitAsPromise('produce', {
                    kind: track.kind,
                    rtpParameters,
                    appData
                });
                const producer = new Producer_1.Producer({
                    id,
                    localId,
                    rtpSender,
                    track,
                    rtpParameters,
                    stopTracks,
                    disableTrackOnPause,
                    zeroRtpOnPause,
                    appData
                });
                this._producers.set(producer.id, producer);
                this._handleProducer(producer);
                // Emit observer event.
                this._observer.safeEmit('newproducer', producer);
                return producer;
            }
            catch (error) {
                this._handler.stopSending(localId)
                    .catch(() => { });
                throw error;
            }
        }, 'transport.produce()')
            // This catch is needed to stop the given track if the command above
            // failed due to closed Transport.
            .catch((error) => {
            if (stopTracks) {
                try {
                    track.stop();
                }
                catch (error2) { }
            }
            throw error;
        });
    }
    /**
     * Create a Consumer to consume a remote Producer.
     */
    async consume({ id, producerId, kind, rtpParameters, appData = {} }) {
        logger.debug('consume()');
        rtpParameters = utils.clone(rtpParameters, undefined);
        if (this._closed)
            throw new errors_1.InvalidStateError('closed');
        else if (this._direction !== 'recv')
            throw new errors_1.UnsupportedError('not a receiving Transport');
        else if (typeof id !== 'string')
            throw new TypeError('missing id');
        else if (typeof producerId !== 'string')
            throw new TypeError('missing producerId');
        else if (kind !== 'audio' && kind !== 'video')
            throw new TypeError(`invalid kind '${kind}'`);
        else if (this.listenerCount('connect') === 0 && this._connectionState === 'new')
            throw new TypeError('no "connect" listener set into this transport');
        else if (appData && typeof appData !== 'object')
            throw new TypeError('if given, appData must be an object');
        // Enqueue command.
        return this._awaitQueue.push(async () => {
            // Ensure the device can consume it.
            const canConsume = ortc.canReceive(rtpParameters, this._extendedRtpCapabilities);
            if (!canConsume)
                throw new errors_1.UnsupportedError('cannot consume this Producer');
            const { localId, rtpReceiver, track } = await this._handler.receive({ trackId: id, kind, rtpParameters });
            const consumer = new Consumer_1.Consumer({
                id,
                localId,
                producerId,
                rtpReceiver,
                track,
                rtpParameters,
                appData
            });
            this._consumers.set(consumer.id, consumer);
            this._handleConsumer(consumer);
            // If this is the first video Consumer and the Consumer for RTP probation
            // has not yet been created, create it now.
            if (!this._probatorConsumerCreated && kind === 'video') {
                try {
                    const probatorRtpParameters = ortc.generateProbatorRtpParameters(consumer.rtpParameters);
                    await this._handler.receive({
                        trackId: 'probator',
                        kind: 'video',
                        rtpParameters: probatorRtpParameters
                    });
                    logger.debug('consume() | Consumer for RTP probation created');
                    this._probatorConsumerCreated = true;
                }
                catch (error) {
                    logger.error('consume() | failed to create Consumer for RTP probation:%o', error);
                }
            }
            // Emit observer event.
            this._observer.safeEmit('newconsumer', consumer);
            return consumer;
        }, 'transport.consume()');
    }
    /**
     * Create a DataProducer
     */
    async produceData({ ordered = true, maxPacketLifeTime, maxRetransmits, priority = 'low', label = '', protocol = '', appData = {} } = {}) {
        logger.debug('produceData()');
        if (this._direction !== 'send')
            throw new errors_1.UnsupportedError('not a sending Transport');
        else if (!this._maxSctpMessageSize)
            throw new errors_1.UnsupportedError('SCTP not enabled by remote Transport');
        else if (!['very-low', 'low', 'medium', 'high'].includes(priority))
            throw new TypeError('wrong priority');
        else if (this.listenerCount('connect') === 0 && this._connectionState === 'new')
            throw new TypeError('no "connect" listener set into this transport');
        else if (this.listenerCount('producedata') === 0)
            throw new TypeError('no "producedata" listener set into this transport');
        else if (appData && typeof appData !== 'object')
            throw new TypeError('if given, appData must be an object');
        if (maxPacketLifeTime || maxRetransmits)
            ordered = false;
        // Enqueue command.
        return this._awaitQueue.push(async () => {
            const { dataChannel, sctpStreamParameters } = await this._handler.sendDataChannel({
                ordered,
                maxPacketLifeTime,
                maxRetransmits,
                priority,
                label,
                protocol
            });
            // This will fill sctpStreamParameters's missing fields with default values.
            ortc.validateSctpStreamParameters(sctpStreamParameters);
            const { id } = await this.safeEmitAsPromise('producedata', {
                sctpStreamParameters,
                label,
                protocol,
                appData
            });
            const dataProducer = new DataProducer_1.DataProducer({ id, dataChannel, sctpStreamParameters, appData });
            this._dataProducers.set(dataProducer.id, dataProducer);
            this._handleDataProducer(dataProducer);
            // Emit observer event.
            this._observer.safeEmit('newdataproducer', dataProducer);
            return dataProducer;
        }, 'transport.produceData()');
    }
    /**
     * Create a DataConsumer
     */
    async consumeData({ id, dataProducerId, sctpStreamParameters, label = '', protocol = '', appData = {} }) {
        logger.debug('consumeData()');
        sctpStreamParameters = utils.clone(sctpStreamParameters, undefined);
        if (this._closed)
            throw new errors_1.InvalidStateError('closed');
        else if (this._direction !== 'recv')
            throw new errors_1.UnsupportedError('not a receiving Transport');
        else if (!this._maxSctpMessageSize)
            throw new errors_1.UnsupportedError('SCTP not enabled by remote Transport');
        else if (typeof id !== 'string')
            throw new TypeError('missing id');
        else if (typeof dataProducerId !== 'string')
            throw new TypeError('missing dataProducerId');
        else if (this.listenerCount('connect') === 0 && this._connectionState === 'new')
            throw new TypeError('no "connect" listener set into this transport');
        else if (appData && typeof appData !== 'object')
            throw new TypeError('if given, appData must be an object');
        // This may throw.
        ortc.validateSctpStreamParameters(sctpStreamParameters);
        // Enqueue command.
        return this._awaitQueue.push(async () => {
            const { dataChannel } = await this._handler.receiveDataChannel({
                sctpStreamParameters,
                label,
                protocol
            });
            const dataConsumer = new DataConsumer_1.DataConsumer({
                id,
                dataProducerId,
                dataChannel,
                sctpStreamParameters,
                appData
            });
            this._dataConsumers.set(dataConsumer.id, dataConsumer);
            this._handleDataConsumer(dataConsumer);
            // Emit observer event.
            this._observer.safeEmit('newdataconsumer', dataConsumer);
            return dataConsumer;
        }, 'transport.consumeData()');
    }
    _handleHandler() {
        const handler = this._handler;
        handler.on('@connect', ({ dtlsParameters }, callback, errback) => {
            if (this._closed) {
                errback(new errors_1.InvalidStateError('closed'));
                return;
            }
            this.safeEmit('connect', { dtlsParameters }, callback, errback);
        });
        handler.on('@connectionstatechange', (connectionState) => {
            if (connectionState === this._connectionState)
                return;
            logger.debug('connection state changed to %s', connectionState);
            this._connectionState = connectionState;
            if (!this._closed)
                this.safeEmit('connectionstatechange', connectionState);
        });
    }
    _handleProducer(producer) {
        producer.on('@close', () => {
            this._producers.delete(producer.id);
            if (this._closed)
                return;
            this._awaitQueue.push(async () => this._handler.stopSending(producer.localId), 'producer @close event')
                .catch((error) => logger.warn('producer.close() failed:%o', error));
        });
        producer.on('@replacetrack', (track, callback, errback) => {
            this._awaitQueue.push(async () => this._handler.replaceTrack(producer.localId, track), 'producer @replacetrack event')
                .then(callback)
                .catch(errback);
        });
        producer.on('@setmaxspatiallayer', (spatialLayer, callback, errback) => {
            this._awaitQueue.push(async () => (this._handler.setMaxSpatialLayer(producer.localId, spatialLayer)), 'producer @setmaxspatiallayer event')
                .then(callback)
                .catch(errback);
        });
        producer.on('@setrtpencodingparameters', (params, callback, errback) => {
            this._awaitQueue.push(async () => (this._handler.setRtpEncodingParameters(producer.localId, params)), 'producer @setrtpencodingparameters event')
                .then(callback)
                .catch(errback);
        });
        producer.on('@getstats', (callback, errback) => {
            if (this._closed)
                return errback(new errors_1.InvalidStateError('closed'));
            this._handler.getSenderStats(producer.localId)
                .then(callback)
                .catch(errback);
        });
    }
    _handleConsumer(consumer) {
        consumer.on('@close', () => {
            this._consumers.delete(consumer.id);
            if (this._closed)
                return;
            this._awaitQueue.push(async () => this._handler.stopReceiving(consumer.localId), 'consumer @close event')
                .catch(() => { });
        });
        consumer.on('@getstats', (callback, errback) => {
            if (this._closed)
                return errback(new errors_1.InvalidStateError('closed'));
            this._handler.getReceiverStats(consumer.localId)
                .then(callback)
                .catch(errback);
        });
    }
    _handleDataProducer(dataProducer) {
        dataProducer.on('@close', () => {
            this._dataProducers.delete(dataProducer.id);
        });
    }
    _handleDataConsumer(dataConsumer) {
        dataConsumer.on('@close', () => {
            this._dataConsumers.delete(dataConsumer.id);
        });
    }
}
exports.Transport = Transport;


/***/ }),
/* 69 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
const Logger_1 = __webpack_require__(9);
const EnhancedEventEmitter_1 = __webpack_require__(22);
const errors_1 = __webpack_require__(16);
const logger = new Logger_1.Logger('Producer');
class Producer extends EnhancedEventEmitter_1.EnhancedEventEmitter {
    /**
     * @emits transportclose
     * @emits trackended
     * @emits @replacetrack - (track: MediaStreamTrack | null)
     * @emits @setmaxspatiallayer - (spatialLayer: string)
     * @emits @setrtpencodingparameters - (params: any)
     * @emits @getstats
     * @emits @close
     */
    constructor({ id, localId, rtpSender, track, rtpParameters, stopTracks, disableTrackOnPause, zeroRtpOnPause, appData }) {
        super();
        // Closed flag.
        this._closed = false;
        // Observer instance.
        this._observer = new EnhancedEventEmitter_1.EnhancedEventEmitter();
        logger.debug('constructor()');
        this._id = id;
        this._localId = localId;
        this._rtpSender = rtpSender;
        this._track = track;
        this._kind = track.kind;
        this._rtpParameters = rtpParameters;
        this._paused = disableTrackOnPause ? !track.enabled : false;
        this._maxSpatialLayer = undefined;
        this._stopTracks = stopTracks;
        this._disableTrackOnPause = disableTrackOnPause;
        this._zeroRtpOnPause = zeroRtpOnPause;
        this._appData = appData;
        this._onTrackEnded = this._onTrackEnded.bind(this);
        // NOTE: Minor issue. If zeroRtpOnPause is true, we cannot emit the
        // '@replacetrack' event here, so RTCRtpSender.track won't be null.
        this._handleTrack();
    }
    /**
     * Producer id.
     */
    get id() {
        return this._id;
    }
    /**
     * Local id.
     */
    get localId() {
        return this._localId;
    }
    /**
     * Whether the Producer is closed.
     */
    get closed() {
        return this._closed;
    }
    /**
     * Media kind.
     */
    get kind() {
        return this._kind;
    }
    /**
     * Associated RTCRtpSender.
     */
    get rtpSender() {
        return this._rtpSender;
    }
    /**
     * The associated track.
     */
    get track() {
        return this._track;
    }
    /**
     * RTP parameters.
     */
    get rtpParameters() {
        return this._rtpParameters;
    }
    /**
     * Whether the Producer is paused.
     */
    get paused() {
        return this._paused;
    }
    /**
     * Max spatial layer.
     *
     * @type {Number | undefined}
     */
    get maxSpatialLayer() {
        return this._maxSpatialLayer;
    }
    /**
     * App custom data.
     */
    get appData() {
        return this._appData;
    }
    /**
     * Invalid setter.
     */
    set appData(appData) {
        throw new Error('cannot override appData object');
    }
    /**
     * Observer.
     *
     * @emits close
     * @emits pause
     * @emits resume
     * @emits trackended
     */
    get observer() {
        return this._observer;
    }
    /**
     * Closes the Producer.
     */
    close() {
        if (this._closed)
            return;
        logger.debug('close()');
        this._closed = true;
        this._destroyTrack();
        this.emit('@close');
        // Emit observer event.
        this._observer.safeEmit('close');
    }
    /**
     * Transport was closed.
     */
    transportClosed() {
        if (this._closed)
            return;
        logger.debug('transportClosed()');
        this._closed = true;
        this._destroyTrack();
        this.safeEmit('transportclose');
        // Emit observer event.
        this._observer.safeEmit('close');
    }
    /**
     * Get associated RTCRtpSender stats.
     */
    async getStats() {
        if (this._closed)
            throw new errors_1.InvalidStateError('closed');
        return this.safeEmitAsPromise('@getstats');
    }
    /**
     * Pauses sending media.
     */
    pause() {
        logger.debug('pause()');
        if (this._closed) {
            logger.error('pause() | Producer closed');
            return;
        }
        this._paused = true;
        if (this._track && this._disableTrackOnPause) {
            this._track.enabled = false;
        }
        if (this._zeroRtpOnPause) {
            this.safeEmitAsPromise('@replacetrack', null)
                .catch(() => { });
        }
        // Emit observer event.
        this._observer.safeEmit('pause');
    }
    /**
     * Resumes sending media.
     */
    resume() {
        logger.debug('resume()');
        if (this._closed) {
            logger.error('resume() | Producer closed');
            return;
        }
        this._paused = false;
        if (this._track && this._disableTrackOnPause) {
            this._track.enabled = true;
        }
        if (this._zeroRtpOnPause) {
            this.safeEmitAsPromise('@replacetrack', this._track)
                .catch(() => { });
        }
        // Emit observer event.
        this._observer.safeEmit('resume');
    }
    /**
     * Replaces the current track with a new one or null.
     */
    async replaceTrack({ track }) {
        logger.debug('replaceTrack() [track:%o]', track);
        if (this._closed) {
            // This must be done here. Otherwise there is no chance to stop the given
            // track.
            if (track && this._stopTracks) {
                try {
                    track.stop();
                }
                catch (error) { }
            }
            throw new errors_1.InvalidStateError('closed');
        }
        else if (track && track.readyState === 'ended') {
            throw new errors_1.InvalidStateError('track ended');
        }
        // Do nothing if this is the same track as the current handled one.
        if (track === this._track) {
            logger.debug('replaceTrack() | same track, ignored');
            return;
        }
        if (!this._zeroRtpOnPause || !this._paused) {
            await this.safeEmitAsPromise('@replacetrack', track);
        }
        // Destroy the previous track.
        this._destroyTrack();
        // Set the new track.
        this._track = track;
        // If this Producer was paused/resumed and the state of the new
        // track does not match, fix it.
        if (this._track && this._disableTrackOnPause) {
            if (!this._paused)
                this._track.enabled = true;
            else if (this._paused)
                this._track.enabled = false;
        }
        // Handle the effective track.
        this._handleTrack();
    }
    /**
     * Sets the video max spatial layer to be sent.
     */
    async setMaxSpatialLayer(spatialLayer) {
        if (this._closed)
            throw new errors_1.InvalidStateError('closed');
        else if (this._kind !== 'video')
            throw new errors_1.UnsupportedError('not a video Producer');
        else if (typeof spatialLayer !== 'number')
            throw new TypeError('invalid spatialLayer');
        if (spatialLayer === this._maxSpatialLayer)
            return;
        await this.safeEmitAsPromise('@setmaxspatiallayer', spatialLayer);
        this._maxSpatialLayer = spatialLayer;
    }
    /**
     * Sets the DSCP value.
     */
    async setRtpEncodingParameters(params) {
        if (this._closed)
            throw new errors_1.InvalidStateError('closed');
        else if (typeof params !== 'object')
            throw new TypeError('invalid params');
        await this.safeEmitAsPromise('@setrtpencodingparameters', params);
    }
    _onTrackEnded() {
        logger.debug('track "ended" event');
        this.safeEmit('trackended');
        // Emit observer event.
        this._observer.safeEmit('trackended');
    }
    _handleTrack() {
        if (!this._track)
            return;
        this._track.addEventListener('ended', this._onTrackEnded);
    }
    _destroyTrack() {
        if (!this._track)
            return;
        try {
            this._track.removeEventListener('ended', this._onTrackEnded);
            // Just stop the track unless the app set stopTracks: false.
            if (this._stopTracks)
                this._track.stop();
        }
        catch (error) { }
    }
}
exports.Producer = Producer;


/***/ }),
/* 70 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
const Logger_1 = __webpack_require__(9);
const EnhancedEventEmitter_1 = __webpack_require__(22);
const errors_1 = __webpack_require__(16);
const logger = new Logger_1.Logger('Consumer');
class Consumer extends EnhancedEventEmitter_1.EnhancedEventEmitter {
    /**
     * @emits transportclose
     * @emits trackended
     * @emits @getstats
     * @emits @close
     */
    constructor({ id, localId, producerId, rtpReceiver, track, rtpParameters, appData }) {
        super();
        // Closed flag.
        this._closed = false;
        // Observer instance.
        this._observer = new EnhancedEventEmitter_1.EnhancedEventEmitter();
        logger.debug('constructor()');
        this._id = id;
        this._localId = localId;
        this._producerId = producerId;
        this._rtpReceiver = rtpReceiver;
        this._track = track;
        this._rtpParameters = rtpParameters;
        this._paused = !track.enabled;
        this._appData = appData;
        this._onTrackEnded = this._onTrackEnded.bind(this);
        this._handleTrack();
    }
    /**
     * Consumer id.
     */
    get id() {
        return this._id;
    }
    /**
     * Local id.
     */
    get localId() {
        return this._localId;
    }
    /**
     * Associated Producer id.
     */
    get producerId() {
        return this._producerId;
    }
    /**
     * Whether the Consumer is closed.
     */
    get closed() {
        return this._closed;
    }
    /**
     * Media kind.
     */
    get kind() {
        return this._track.kind;
    }
    /**
     * Associated RTCRtpReceiver.
     */
    get rtpReceiver() {
        return this._rtpReceiver;
    }
    /**
     * The associated track.
     */
    get track() {
        return this._track;
    }
    /**
     * RTP parameters.
     */
    get rtpParameters() {
        return this._rtpParameters;
    }
    /**
     * Whether the Consumer is paused.
     */
    get paused() {
        return this._paused;
    }
    /**
     * App custom data.
     */
    get appData() {
        return this._appData;
    }
    /**
     * Invalid setter.
     */
    set appData(appData) {
        throw new Error('cannot override appData object');
    }
    /**
     * Observer.
     *
     * @emits close
     * @emits pause
     * @emits resume
     * @emits trackended
     */
    get observer() {
        return this._observer;
    }
    /**
     * Closes the Consumer.
     */
    close() {
        if (this._closed)
            return;
        logger.debug('close()');
        this._closed = true;
        this._destroyTrack();
        this.emit('@close');
        // Emit observer event.
        this._observer.safeEmit('close');
    }
    /**
     * Transport was closed.
     */
    transportClosed() {
        if (this._closed)
            return;
        logger.debug('transportClosed()');
        this._closed = true;
        this._destroyTrack();
        this.safeEmit('transportclose');
        // Emit observer event.
        this._observer.safeEmit('close');
    }
    /**
     * Get associated RTCRtpReceiver stats.
     */
    async getStats() {
        if (this._closed)
            throw new errors_1.InvalidStateError('closed');
        return this.safeEmitAsPromise('@getstats');
    }
    /**
     * Pauses receiving media.
     */
    pause() {
        logger.debug('pause()');
        if (this._closed) {
            logger.error('pause() | Consumer closed');
            return;
        }
        this._paused = true;
        this._track.enabled = false;
        // Emit observer event.
        this._observer.safeEmit('pause');
    }
    /**
     * Resumes receiving media.
     */
    resume() {
        logger.debug('resume()');
        if (this._closed) {
            logger.error('resume() | Consumer closed');
            return;
        }
        this._paused = false;
        this._track.enabled = true;
        // Emit observer event.
        this._observer.safeEmit('resume');
    }
    _onTrackEnded() {
        logger.debug('track "ended" event');
        this.safeEmit('trackended');
        // Emit observer event.
        this._observer.safeEmit('trackended');
    }
    _handleTrack() {
        this._track.addEventListener('ended', this._onTrackEnded);
    }
    _destroyTrack() {
        try {
            this._track.removeEventListener('ended', this._onTrackEnded);
            this._track.stop();
        }
        catch (error) { }
    }
}
exports.Consumer = Consumer;


/***/ }),
/* 71 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
const Logger_1 = __webpack_require__(9);
const EnhancedEventEmitter_1 = __webpack_require__(22);
const errors_1 = __webpack_require__(16);
const logger = new Logger_1.Logger('DataProducer');
class DataProducer extends EnhancedEventEmitter_1.EnhancedEventEmitter {
    /**
     * @emits transportclose
     * @emits open
     * @emits error - (error: Error)
     * @emits close
     * @emits bufferedamountlow
     * @emits @close
     */
    constructor({ id, dataChannel, sctpStreamParameters, appData }) {
        super();
        // Closed flag.
        this._closed = false;
        // Observer instance.
        this._observer = new EnhancedEventEmitter_1.EnhancedEventEmitter();
        logger.debug('constructor()');
        this._id = id;
        this._dataChannel = dataChannel;
        this._sctpStreamParameters = sctpStreamParameters;
        this._appData = appData;
        this._handleDataChannel();
    }
    /**
     * DataProducer id.
     */
    get id() {
        return this._id;
    }
    /**
     * Whether the DataProducer is closed.
     */
    get closed() {
        return this._closed;
    }
    /**
     * SCTP stream parameters.
     */
    get sctpStreamParameters() {
        return this._sctpStreamParameters;
    }
    /**
     * DataChannel readyState.
     */
    get readyState() {
        return this._dataChannel.readyState;
    }
    /**
     * DataChannel label.
     */
    get label() {
        return this._dataChannel.label;
    }
    /**
     * DataChannel protocol.
     */
    get protocol() {
        return this._dataChannel.protocol;
    }
    /**
     * DataChannel bufferedAmount.
     */
    get bufferedAmount() {
        return this._dataChannel.bufferedAmount;
    }
    /**
     * DataChannel bufferedAmountLowThreshold.
     */
    get bufferedAmountLowThreshold() {
        return this._dataChannel.bufferedAmountLowThreshold;
    }
    /**
     * Set DataChannel bufferedAmountLowThreshold.
     */
    set bufferedAmountLowThreshold(bufferedAmountLowThreshold) {
        this._dataChannel.bufferedAmountLowThreshold = bufferedAmountLowThreshold;
    }
    /**
     * App custom data.
     */
    get appData() {
        return this._appData;
    }
    /**
     * Invalid setter.
     */
    set appData(appData) {
        throw new Error('cannot override appData object');
    }
    /**
     * Observer.
     *
     * @emits close
     */
    get observer() {
        return this._observer;
    }
    /**
     * Closes the DataProducer.
     */
    close() {
        if (this._closed)
            return;
        logger.debug('close()');
        this._closed = true;
        this._dataChannel.close();
        this.emit('@close');
        // Emit observer event.
        this._observer.safeEmit('close');
    }
    /**
     * Transport was closed.
     */
    transportClosed() {
        if (this._closed)
            return;
        logger.debug('transportClosed()');
        this._closed = true;
        this._dataChannel.close();
        this.safeEmit('transportclose');
        // Emit observer event.
        this._observer.safeEmit('close');
    }
    /**
     * Send a message.
     *
     * @param {String|Blob|ArrayBuffer|ArrayBufferView} data.
     */
    send(data) {
        logger.debug('send()');
        if (this._closed)
            throw new errors_1.InvalidStateError('closed');
        this._dataChannel.send(data);
    }
    _handleDataChannel() {
        this._dataChannel.addEventListener('open', () => {
            if (this._closed)
                return;
            logger.debug('DataChannel "open" event');
            this.safeEmit('open');
        });
        this._dataChannel.addEventListener('error', (event) => {
            if (this._closed)
                return;
            let { error } = event;
            if (!error)
                error = new Error('unknown DataChannel error');
            if (error.errorDetail === 'sctp-failure') {
                logger.error('DataChannel SCTP error [sctpCauseCode:%s]: %s', error.sctpCauseCode, error.message);
            }
            else {
                logger.error('DataChannel "error" event: %o', error);
            }
            this.safeEmit('error', error);
        });
        this._dataChannel.addEventListener('close', () => {
            if (this._closed)
                return;
            logger.warn('DataChannel "close" event');
            this._closed = true;
            this.emit('@close');
            this.safeEmit('close');
        });
        this._dataChannel.addEventListener('message', () => {
            if (this._closed)
                return;
            logger.warn('DataChannel "message" event in a DataProducer, message discarded');
        });
        this._dataChannel.addEventListener('bufferedamountlow', () => {
            if (this._closed)
                return;
            this.safeEmit('bufferedamountlow');
        });
    }
}
exports.DataProducer = DataProducer;


/***/ }),
/* 72 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
const Logger_1 = __webpack_require__(9);
const EnhancedEventEmitter_1 = __webpack_require__(22);
const logger = new Logger_1.Logger('DataConsumer');
class DataConsumer extends EnhancedEventEmitter_1.EnhancedEventEmitter {
    /**
     * @emits transportclose
     * @emits open
     * @emits error - (error: Error)
     * @emits close
     * @emits message - (message: any)
     * @emits @close
     */
    constructor({ id, dataProducerId, dataChannel, sctpStreamParameters, appData }) {
        super();
        // Closed flag.
        this._closed = false;
        // Observer instance.
        this._observer = new EnhancedEventEmitter_1.EnhancedEventEmitter();
        logger.debug('constructor()');
        this._id = id;
        this._dataProducerId = dataProducerId;
        this._dataChannel = dataChannel;
        this._sctpStreamParameters = sctpStreamParameters;
        this._appData = appData;
        this._handleDataChannel();
    }
    /**
     * DataConsumer id.
     */
    get id() {
        return this._id;
    }
    /**
     * Associated DataProducer id.
     */
    get dataProducerId() {
        return this._dataProducerId;
    }
    /**
     * Whether the DataConsumer is closed.
     */
    get closed() {
        return this._closed;
    }
    /**
     * SCTP stream parameters.
     */
    get sctpStreamParameters() {
        return this._sctpStreamParameters;
    }
    /**
     * DataChannel readyState.
     */
    get readyState() {
        return this._dataChannel.readyState;
    }
    /**
     * DataChannel label.
     */
    get label() {
        return this._dataChannel.label;
    }
    /**
     * DataChannel protocol.
     */
    get protocol() {
        return this._dataChannel.protocol;
    }
    /**
     * DataChannel binaryType.
     */
    get binaryType() {
        return this._dataChannel.binaryType;
    }
    /**
     * Set DataChannel binaryType.
     */
    set binaryType(binaryType) {
        this._dataChannel.binaryType = binaryType;
    }
    /**
     * App custom data.
     */
    get appData() {
        return this._appData;
    }
    /**
     * Invalid setter.
     */
    set appData(appData) {
        throw new Error('cannot override appData object');
    }
    /**
     * Observer.
     *
     * @emits close
     */
    get observer() {
        return this._observer;
    }
    /**
     * Closes the DataConsumer.
     */
    close() {
        if (this._closed)
            return;
        logger.debug('close()');
        this._closed = true;
        this._dataChannel.close();
        this.emit('@close');
        // Emit observer event.
        this._observer.safeEmit('close');
    }
    /**
     * Transport was closed.
     */
    transportClosed() {
        if (this._closed)
            return;
        logger.debug('transportClosed()');
        this._closed = true;
        this._dataChannel.close();
        this.safeEmit('transportclose');
        // Emit observer event.
        this._observer.safeEmit('close');
    }
    _handleDataChannel() {
        this._dataChannel.addEventListener('open', () => {
            if (this._closed)
                return;
            logger.debug('DataChannel "open" event');
            this.safeEmit('open');
        });
        this._dataChannel.addEventListener('error', (event) => {
            if (this._closed)
                return;
            let { error } = event;
            if (!error)
                error = new Error('unknown DataChannel error');
            if (error.errorDetail === 'sctp-failure') {
                logger.error('DataChannel SCTP error [sctpCauseCode:%s]: %s', error.sctpCauseCode, error.message);
            }
            else {
                logger.error('DataChannel "error" event: %o', error);
            }
            this.safeEmit('error', error);
        });
        this._dataChannel.addEventListener('close', () => {
            if (this._closed)
                return;
            logger.warn('DataChannel "close" event');
            this._closed = true;
            this.emit('@close');
            this.safeEmit('close');
        });
        this._dataChannel.addEventListener('message', (event) => {
            if (this._closed)
                return;
            this.safeEmit('message', event.data);
        });
    }
}
exports.DataConsumer = DataConsumer;


/***/ }),
/* 73 */
/***/ (function(module, exports) {

var grammar = module.exports = {
  v: [{
    name: 'version',
    reg: /^(\d*)$/
  }],
  o: [{
    // o=- 20518 0 IN IP4 203.0.113.1
    // NB: sessionId will be a String in most cases because it is huge
    name: 'origin',
    reg: /^(\S*) (\d*) (\d*) (\S*) IP(\d) (\S*)/,
    names: ['username', 'sessionId', 'sessionVersion', 'netType', 'ipVer', 'address'],
    format: '%s %s %d %s IP%d %s'
  }],
  // default parsing of these only (though some of these feel outdated)
  s: [{ name: 'name' }],
  i: [{ name: 'description' }],
  u: [{ name: 'uri' }],
  e: [{ name: 'email' }],
  p: [{ name: 'phone' }],
  z: [{ name: 'timezones' }], // TODO: this one can actually be parsed properly...
  r: [{ name: 'repeats' }],   // TODO: this one can also be parsed properly
  // k: [{}], // outdated thing ignored
  t: [{
    // t=0 0
    name: 'timing',
    reg: /^(\d*) (\d*)/,
    names: ['start', 'stop'],
    format: '%d %d'
  }],
  c: [{
    // c=IN IP4 10.47.197.26
    name: 'connection',
    reg: /^IN IP(\d) (\S*)/,
    names: ['version', 'ip'],
    format: 'IN IP%d %s'
  }],
  b: [{
    // b=AS:4000
    push: 'bandwidth',
    reg: /^(TIAS|AS|CT|RR|RS):(\d*)/,
    names: ['type', 'limit'],
    format: '%s:%s'
  }],
  m: [{
    // m=video 51744 RTP/AVP 126 97 98 34 31
    // NB: special - pushes to session
    // TODO: rtp/fmtp should be filtered by the payloads found here?
    reg: /^(\w*) (\d*) ([\w/]*)(?: (.*))?/,
    names: ['type', 'port', 'protocol', 'payloads'],
    format: '%s %d %s %s'
  }],
  a: [
    {
      // a=rtpmap:110 opus/48000/2
      push: 'rtp',
      reg: /^rtpmap:(\d*) ([\w\-.]*)(?:\s*\/(\d*)(?:\s*\/(\S*))?)?/,
      names: ['payload', 'codec', 'rate', 'encoding'],
      format: function (o) {
        return (o.encoding)
          ? 'rtpmap:%d %s/%s/%s'
          : o.rate
            ? 'rtpmap:%d %s/%s'
            : 'rtpmap:%d %s';
      }
    },
    {
      // a=fmtp:108 profile-level-id=24;object=23;bitrate=64000
      // a=fmtp:111 minptime=10; useinbandfec=1
      push: 'fmtp',
      reg: /^fmtp:(\d*) ([\S| ]*)/,
      names: ['payload', 'config'],
      format: 'fmtp:%d %s'
    },
    {
      // a=control:streamid=0
      name: 'control',
      reg: /^control:(.*)/,
      format: 'control:%s'
    },
    {
      // a=rtcp:65179 IN IP4 193.84.77.194
      name: 'rtcp',
      reg: /^rtcp:(\d*)(?: (\S*) IP(\d) (\S*))?/,
      names: ['port', 'netType', 'ipVer', 'address'],
      format: function (o) {
        return (o.address != null)
          ? 'rtcp:%d %s IP%d %s'
          : 'rtcp:%d';
      }
    },
    {
      // a=rtcp-fb:98 trr-int 100
      push: 'rtcpFbTrrInt',
      reg: /^rtcp-fb:(\*|\d*) trr-int (\d*)/,
      names: ['payload', 'value'],
      format: 'rtcp-fb:%s trr-int %d'
    },
    {
      // a=rtcp-fb:98 nack rpsi
      push: 'rtcpFb',
      reg: /^rtcp-fb:(\*|\d*) ([\w-_]*)(?: ([\w-_]*))?/,
      names: ['payload', 'type', 'subtype'],
      format: function (o) {
        return (o.subtype != null)
          ? 'rtcp-fb:%s %s %s'
          : 'rtcp-fb:%s %s';
      }
    },
    {
      // a=extmap:2 urn:ietf:params:rtp-hdrext:toffset
      // a=extmap:1/recvonly URI-gps-string
      // a=extmap:3 urn:ietf:params:rtp-hdrext:encrypt urn:ietf:params:rtp-hdrext:smpte-tc 25@600/24
      push: 'ext',
      reg: /^extmap:(\d+)(?:\/(\w+))?(?: (urn:ietf:params:rtp-hdrext:encrypt))? (\S*)(?: (\S*))?/,
      names: ['value', 'direction', 'encrypt-uri', 'uri', 'config'],
      format: function (o) {
        return (
          'extmap:%d' +
          (o.direction ? '/%s' : '%v') +
          (o['encrypt-uri'] ? ' %s' : '%v') +
          ' %s' +
          (o.config ? ' %s' : '')
        );
      }
    },
    {
      // a=extmap-allow-mixed
      name: 'extmapAllowMixed',
      reg: /^(extmap-allow-mixed)/
    },
    {
      // a=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:PS1uQCVeeCFCanVmcjkpPywjNWhcYD0mXXtxaVBR|2^20|1:32
      push: 'crypto',
      reg: /^crypto:(\d*) ([\w_]*) (\S*)(?: (\S*))?/,
      names: ['id', 'suite', 'config', 'sessionConfig'],
      format: function (o) {
        return (o.sessionConfig != null)
          ? 'crypto:%d %s %s %s'
          : 'crypto:%d %s %s';
      }
    },
    {
      // a=setup:actpass
      name: 'setup',
      reg: /^setup:(\w*)/,
      format: 'setup:%s'
    },
    {
      // a=connection:new
      name: 'connectionType',
      reg: /^connection:(new|existing)/,
      format: 'connection:%s'
    },
    {
      // a=mid:1
      name: 'mid',
      reg: /^mid:([^\s]*)/,
      format: 'mid:%s'
    },
    {
      // a=msid:0c8b064d-d807-43b4-b434-f92a889d8587 98178685-d409-46e0-8e16-7ef0db0db64a
      name: 'msid',
      reg: /^msid:(.*)/,
      format: 'msid:%s'
    },
    {
      // a=ptime:20
      name: 'ptime',
      reg: /^ptime:(\d*(?:\.\d*)*)/,
      format: 'ptime:%d'
    },
    {
      // a=maxptime:60
      name: 'maxptime',
      reg: /^maxptime:(\d*(?:\.\d*)*)/,
      format: 'maxptime:%d'
    },
    {
      // a=sendrecv
      name: 'direction',
      reg: /^(sendrecv|recvonly|sendonly|inactive)/
    },
    {
      // a=ice-lite
      name: 'icelite',
      reg: /^(ice-lite)/
    },
    {
      // a=ice-ufrag:F7gI
      name: 'iceUfrag',
      reg: /^ice-ufrag:(\S*)/,
      format: 'ice-ufrag:%s'
    },
    {
      // a=ice-pwd:x9cml/YzichV2+XlhiMu8g
      name: 'icePwd',
      reg: /^ice-pwd:(\S*)/,
      format: 'ice-pwd:%s'
    },
    {
      // a=fingerprint:SHA-1 00:11:22:33:44:55:66:77:88:99:AA:BB:CC:DD:EE:FF:00:11:22:33
      name: 'fingerprint',
      reg: /^fingerprint:(\S*) (\S*)/,
      names: ['type', 'hash'],
      format: 'fingerprint:%s %s'
    },
    {
      // a=candidate:0 1 UDP 2113667327 203.0.113.1 54400 typ host
      // a=candidate:1162875081 1 udp 2113937151 192.168.34.75 60017 typ host generation 0 network-id 3 network-cost 10
      // a=candidate:3289912957 2 udp 1845501695 193.84.77.194 60017 typ srflx raddr 192.168.34.75 rport 60017 generation 0 network-id 3 network-cost 10
      // a=candidate:229815620 1 tcp 1518280447 192.168.150.19 60017 typ host tcptype active generation 0 network-id 3 network-cost 10
      // a=candidate:3289912957 2 tcp 1845501695 193.84.77.194 60017 typ srflx raddr 192.168.34.75 rport 60017 tcptype passive generation 0 network-id 3 network-cost 10
      push:'candidates',
      reg: /^candidate:(\S*) (\d*) (\S*) (\d*) (\S*) (\d*) typ (\S*)(?: raddr (\S*) rport (\d*))?(?: tcptype (\S*))?(?: generation (\d*))?(?: network-id (\d*))?(?: network-cost (\d*))?/,
      names: ['foundation', 'component', 'transport', 'priority', 'ip', 'port', 'type', 'raddr', 'rport', 'tcptype', 'generation', 'network-id', 'network-cost'],
      format: function (o) {
        var str = 'candidate:%s %d %s %d %s %d typ %s';

        str += (o.raddr != null) ? ' raddr %s rport %d' : '%v%v';

        // NB: candidate has three optional chunks, so %void middles one if it's missing
        str += (o.tcptype != null) ? ' tcptype %s' : '%v';

        if (o.generation != null) {
          str += ' generation %d';
        }

        str += (o['network-id'] != null) ? ' network-id %d' : '%v';
        str += (o['network-cost'] != null) ? ' network-cost %d' : '%v';
        return str;
      }
    },
    {
      // a=end-of-candidates (keep after the candidates line for readability)
      name: 'endOfCandidates',
      reg: /^(end-of-candidates)/
    },
    {
      // a=remote-candidates:1 203.0.113.1 54400 2 203.0.113.1 54401 ...
      name: 'remoteCandidates',
      reg: /^remote-candidates:(.*)/,
      format: 'remote-candidates:%s'
    },
    {
      // a=ice-options:google-ice
      name: 'iceOptions',
      reg: /^ice-options:(\S*)/,
      format: 'ice-options:%s'
    },
    {
      // a=ssrc:2566107569 cname:t9YU8M1UxTF8Y1A1
      push: 'ssrcs',
      reg: /^ssrc:(\d*) ([\w_-]*)(?::(.*))?/,
      names: ['id', 'attribute', 'value'],
      format: function (o) {
        var str = 'ssrc:%d';
        if (o.attribute != null) {
          str += ' %s';
          if (o.value != null) {
            str += ':%s';
          }
        }
        return str;
      }
    },
    {
      // a=ssrc-group:FEC 1 2
      // a=ssrc-group:FEC-FR 3004364195 1080772241
      push: 'ssrcGroups',
      // token-char = %x21 / %x23-27 / %x2A-2B / %x2D-2E / %x30-39 / %x41-5A / %x5E-7E
      reg: /^ssrc-group:([\x21\x23\x24\x25\x26\x27\x2A\x2B\x2D\x2E\w]*) (.*)/,
      names: ['semantics', 'ssrcs'],
      format: 'ssrc-group:%s %s'
    },
    {
      // a=msid-semantic: WMS Jvlam5X3SX1OP6pn20zWogvaKJz5Hjf9OnlV
      name: 'msidSemantic',
      reg: /^msid-semantic:\s?(\w*) (\S*)/,
      names: ['semantic', 'token'],
      format: 'msid-semantic: %s %s' // space after ':' is not accidental
    },
    {
      // a=group:BUNDLE audio video
      push: 'groups',
      reg: /^group:(\w*) (.*)/,
      names: ['type', 'mids'],
      format: 'group:%s %s'
    },
    {
      // a=rtcp-mux
      name: 'rtcpMux',
      reg: /^(rtcp-mux)/
    },
    {
      // a=rtcp-rsize
      name: 'rtcpRsize',
      reg: /^(rtcp-rsize)/
    },
    {
      // a=sctpmap:5000 webrtc-datachannel 1024
      name: 'sctpmap',
      reg: /^sctpmap:([\w_/]*) (\S*)(?: (\S*))?/,
      names: ['sctpmapNumber', 'app', 'maxMessageSize'],
      format: function (o) {
        return (o.maxMessageSize != null)
          ? 'sctpmap:%s %s %s'
          : 'sctpmap:%s %s';
      }
    },
    {
      // a=x-google-flag:conference
      name: 'xGoogleFlag',
      reg: /^x-google-flag:([^\s]*)/,
      format: 'x-google-flag:%s'
    },
    {
      // a=rid:1 send max-width=1280;max-height=720;max-fps=30;depend=0
      push: 'rids',
      reg: /^rid:([\d\w]+) (\w+)(?: ([\S| ]*))?/,
      names: ['id', 'direction', 'params'],
      format: function (o) {
        return (o.params) ? 'rid:%s %s %s' : 'rid:%s %s';
      }
    },
    {
      // a=imageattr:97 send [x=800,y=640,sar=1.1,q=0.6] [x=480,y=320] recv [x=330,y=250]
      // a=imageattr:* send [x=800,y=640] recv *
      // a=imageattr:100 recv [x=320,y=240]
      push: 'imageattrs',
      reg: new RegExp(
        // a=imageattr:97
        '^imageattr:(\\d+|\\*)' +
        // send [x=800,y=640,sar=1.1,q=0.6] [x=480,y=320]
        '[\\s\\t]+(send|recv)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*)' +
        // recv [x=330,y=250]
        '(?:[\\s\\t]+(recv|send)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*))?'
      ),
      names: ['pt', 'dir1', 'attrs1', 'dir2', 'attrs2'],
      format: function (o) {
        return 'imageattr:%s %s %s' + (o.dir2 ? ' %s %s' : '');
      }
    },
    {
      // a=simulcast:send 1,2,3;~4,~5 recv 6;~7,~8
      // a=simulcast:recv 1;4,5 send 6;7
      name: 'simulcast',
      reg: new RegExp(
        // a=simulcast:
        '^simulcast:' +
        // send 1,2,3;~4,~5
        '(send|recv) ([a-zA-Z0-9\\-_~;,]+)' +
        // space + recv 6;~7,~8
        '(?:\\s?(send|recv) ([a-zA-Z0-9\\-_~;,]+))?' +
        // end
        '$'
      ),
      names: ['dir1', 'list1', 'dir2', 'list2'],
      format: function (o) {
        return 'simulcast:%s %s' + (o.dir2 ? ' %s %s' : '');
      }
    },
    {
      // old simulcast draft 03 (implemented by Firefox)
      //   https://tools.ietf.org/html/draft-ietf-mmusic-sdp-simulcast-03
      // a=simulcast: recv pt=97;98 send pt=97
      // a=simulcast: send rid=5;6;7 paused=6,7
      name: 'simulcast_03',
      reg: /^simulcast:[\s\t]+([\S+\s\t]+)$/,
      names: ['value'],
      format: 'simulcast: %s'
    },
    {
      // a=framerate:25
      // a=framerate:29.97
      name: 'framerate',
      reg: /^framerate:(\d+(?:$|\.\d+))/,
      format: 'framerate:%s'
    },
    {
      // RFC4570
      // a=source-filter: incl IN IP4 239.5.2.31 10.1.15.5
      name: 'sourceFilter',
      reg: /^source-filter: *(excl|incl) (\S*) (IP4|IP6|\*) (\S*) (.*)/,
      names: ['filterMode', 'netType', 'addressTypes', 'destAddress', 'srcList'],
      format: 'source-filter: %s %s %s %s %s'
    },
    {
      // a=bundle-only
      name: 'bundleOnly',
      reg: /^(bundle-only)/
    },
    {
      // a=label:1
      name: 'label',
      reg: /^label:(.+)/,
      format: 'label:%s'
    },
    {
      // RFC version 26 for SCTP over DTLS
      // https://tools.ietf.org/html/draft-ietf-mmusic-sctp-sdp-26#section-5
      name: 'sctpPort',
      reg: /^sctp-port:(\d+)$/,
      format: 'sctp-port:%s'
    },
    {
      // RFC version 26 for SCTP over DTLS
      // https://tools.ietf.org/html/draft-ietf-mmusic-sctp-sdp-26#section-6
      name: 'maxMessageSize',
      reg: /^max-message-size:(\d+)$/,
      format: 'max-message-size:%s'
    },
    {
      // RFC7273
      // a=ts-refclk:ptp=IEEE1588-2008:39-A7-94-FF-FE-07-CB-D0:37
      push:'tsRefClocks',
      reg: /^ts-refclk:([^\s=]*)(?:=(\S*))?/,
      names: ['clksrc', 'clksrcExt'],
      format: function (o) {
        return 'ts-refclk:%s' + (o.clksrcExt != null ? '=%s' : '');
      }
    },
    {
      // RFC7273
      // a=mediaclk:direct=963214424
      name:'mediaClk',
      reg: /^mediaclk:(?:id=(\S*))? *([^\s=]*)(?:=(\S*))?(?: *rate=(\d+)\/(\d+))?/,
      names: ['id', 'mediaClockName', 'mediaClockValue', 'rateNumerator', 'rateDenominator'],
      format: function (o) {
        var str = 'mediaclk:';
        str += (o.id != null ? 'id=%s %s' : '%v%s');
        str += (o.mediaClockValue != null ? '=%s' : '');
        str += (o.rateNumerator != null ? ' rate=%s' : '');
        str += (o.rateDenominator != null ? '/%s' : '');
        return str;
      }
    },
    {
      // a=keywds:keywords
      name: 'keywords',
      reg: /^keywds:(.+)$/,
      format: 'keywds:%s'
    },
    {
      // a=content:main
      name: 'content',
      reg: /^content:(.+)/,
      format: 'content:%s'
    },
    // BFCP https://tools.ietf.org/html/rfc4583
    {
      // a=floorctrl:c-s
      name: 'bfcpFloorCtrl',
      reg: /^floorctrl:(c-only|s-only|c-s)/,
      format: 'floorctrl:%s'
    },
    {
      // a=confid:1
      name: 'bfcpConfId',
      reg: /^confid:(\d+)/,
      format: 'confid:%s'
    },
    {
      // a=userid:1
      name: 'bfcpUserId',
      reg: /^userid:(\d+)/,
      format: 'userid:%s'
    },
    {
      // a=floorid:1
      name: 'bfcpFloorId',
      reg: /^floorid:(.+) (?:m-stream|mstrm):(.+)/,
      names: ['id', 'mStream'],
      format: 'floorid:%s mstrm:%s'
    },
    {
      // any a= that we don't understand is kept verbatim on media.invalid
      push: 'invalid',
      names: ['value']
    }
  ]
};

// set sensible defaults to avoid polluting the grammar with boring details
Object.keys(grammar).forEach(function (key) {
  var objs = grammar[key];
  objs.forEach(function (obj) {
    if (!obj.reg) {
      obj.reg = /(.*)/;
    }
    if (!obj.format) {
      obj.format = '%s';
    }
  });
});


/***/ }),
/* 74 */
/***/ (function(module, exports, __webpack_require__) {


var content = __webpack_require__(328);

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) {}

/***/ }),
/* 75 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


/**
 * Module dependencies
 */
var xtend = __webpack_require__(44)

var Readable = __webpack_require__(23).Readable
var streamsOpts = { objectMode: true }
var defaultStoreOptions = {
  clean: true
}

/**
 * In-memory implementation of the message store
 * This can actually be saved into files.
 *
 * @param {Object} [options] - store options
 */
function Store (options) {
  if (!(this instanceof Store)) {
    return new Store(options)
  }

  this.options = options || {}

  // Defaults
  this.options = xtend(defaultStoreOptions, options)

  this._inflights = new Map()
}

/**
 * Adds a packet to the store, a packet is
 * anything that has a messageId property.
 *
 */
Store.prototype.put = function (packet, cb) {
  this._inflights.set(packet.messageId, packet)

  if (cb) {
    cb()
  }

  return this
}

/**
 * Creates a stream with all the packets in the store
 *
 */
Store.prototype.createStream = function () {
  var stream = new Readable(streamsOpts)
  var destroyed = false
  var values = []
  var i = 0

  this._inflights.forEach(function (value, key) {
    values.push(value)
  })

  stream._read = function () {
    if (!destroyed && i < values.length) {
      this.push(values[i++])
    } else {
      this.push(null)
    }
  }

  stream.destroy = function () {
    if (destroyed) {
      return
    }

    var self = this

    destroyed = true

    setTimeout(function () {
      self.emit('close')
    }, 0)
  }

  return stream
}

/**
 * deletes a packet from the store.
 */
Store.prototype.del = function (packet, cb) {
  packet = this._inflights.get(packet.messageId)
  if (packet) {
    this._inflights.delete(packet.messageId)
    cb(null, packet)
  } else if (cb) {
    cb(new Error('missing packet'))
  }

  return this
}

/**
 * get a packet from the store.
 */
Store.prototype.get = function (packet, cb) {
  packet = this._inflights.get(packet.messageId)
  if (packet) {
    cb(null, packet)
  } else if (cb) {
    cb(new Error('missing packet'))
  }

  return this
}

/**
 * Close the store
 */
Store.prototype.close = function (cb) {
  if (this.options.clean) {
    this._inflights = null
  }
  if (cb) {
    cb()
  }
}

module.exports = Store


/***/ }),
/* 76 */
/***/ (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__(30);
/*</replacement>*/

module.exports = Readable;

/*<replacement>*/
var isArray = __webpack_require__(63);
/*</replacement>*/

/*<replacement>*/
var Duplex;
/*</replacement>*/

Readable.ReadableState = ReadableState;

/*<replacement>*/
var EE = __webpack_require__(25).EventEmitter;

var EElistenerCount = function (emitter, type) {
  return emitter.listeners(type).length;
};
/*</replacement>*/

/*<replacement>*/
var Stream = __webpack_require__(77);
/*</replacement>*/

/*<replacement>*/

var Buffer = __webpack_require__(37).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 = Object.create(__webpack_require__(31));
util.inherits = __webpack_require__(21);
/*</replacement>*/

/*<replacement>*/
var debugUtil = __webpack_require__(330);
var debug = void 0;
if (debugUtil && debugUtil.debuglog) {
  debug = debugUtil.debuglog('stream');
} else {
  debug = function () {};
}
/*</replacement>*/

var BufferList = __webpack_require__(331);
var destroyImpl = __webpack_require__(78);
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__(26);

  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__(80).StringDecoder;
    this.decoder = new StringDecoder(options.encoding);
    this.encoding = options.encoding;
  }
}

function Readable(options) {
  Duplex = Duplex || __webpack_require__(26);

  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__(80).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__(13), __webpack_require__(15)))

/***/ }),
/* 77 */
/***/ (function(module, exports, __webpack_require__) {

module.exports = __webpack_require__(25).EventEmitter;


/***/ }),
/* 78 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


/*<replacement>*/

var pna = __webpack_require__(30);
/*</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
};

/***/ }),
/* 79 */
/***/ (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__(30);
/*</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 = Object.create(__webpack_require__(31));
util.inherits = __webpack_require__(21);
/*</replacement>*/

/*<replacement>*/
var internalUtil = {
  deprecate: __webpack_require__(335)
};
/*</replacement>*/

/*<replacement>*/
var Stream = __webpack_require__(77);
/*</replacement>*/

/*<replacement>*/

var Buffer = __webpack_require__(37).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__(78);

util.inherits(Writable, Stream);

function nop() {}

function WritableState(options, stream) {
  Duplex = Duplex || __webpack_require__(26);

  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__(26);

  // 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__(15), __webpack_require__(333).setImmediate, __webpack_require__(13)))

/***/ }),
/* 80 */
/***/ (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__(37).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) : '';
}

/***/ }),
/* 81 */
/***/ (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__(26);

/*<replacement>*/
var util = Object.create(__webpack_require__(31));
util.inherits = __webpack_require__(21);
/*</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);
}

/***/ }),
/* 82 */
/***/ (function(module, exports, __webpack_require__) {

/* WEBPACK VAR INJECTION */(function(Buffer) {/* Protocol - protocol constants */
const protocol = module.exports

/* Command code => mnemonic */
protocol.types = {
  0: 'reserved',
  1: 'connect',
  2: 'connack',
  3: 'publish',
  4: 'puback',
  5: 'pubrec',
  6: 'pubrel',
  7: 'pubcomp',
  8: 'subscribe',
  9: 'suback',
  10: 'unsubscribe',
  11: 'unsuback',
  12: 'pingreq',
  13: 'pingresp',
  14: 'disconnect',
  15: 'auth'
}

/* Mnemonic => Command code */
protocol.codes = {}
for (const k in protocol.types) {
  const v = protocol.types[k]
  protocol.codes[v] = k
}

/* Header */
protocol.CMD_SHIFT = 4
protocol.CMD_MASK = 0xF0
protocol.DUP_MASK = 0x08
protocol.QOS_MASK = 0x03
protocol.QOS_SHIFT = 1
protocol.RETAIN_MASK = 0x01

/* Length */
protocol.VARBYTEINT_MASK = 0x7F
protocol.VARBYTEINT_FIN_MASK = 0x80
protocol.VARBYTEINT_MAX = 268435455

/* Connack */
protocol.SESSIONPRESENT_MASK = 0x01
protocol.SESSIONPRESENT_HEADER = Buffer.from([protocol.SESSIONPRESENT_MASK])
protocol.CONNACK_HEADER = Buffer.from([protocol.codes.connack << protocol.CMD_SHIFT])

/* Connect */
protocol.USERNAME_MASK = 0x80
protocol.PASSWORD_MASK = 0x40
protocol.WILL_RETAIN_MASK = 0x20
protocol.WILL_QOS_MASK = 0x18
protocol.WILL_QOS_SHIFT = 3
protocol.WILL_FLAG_MASK = 0x04
protocol.CLEAN_SESSION_MASK = 0x02
protocol.CONNECT_HEADER = Buffer.from([protocol.codes.connect << protocol.CMD_SHIFT])

/* Properties */
protocol.properties = {
  sessionExpiryInterval: 17,
  willDelayInterval: 24,
  receiveMaximum: 33,
  maximumPacketSize: 39,
  topicAliasMaximum: 34,
  requestResponseInformation: 25,
  requestProblemInformation: 23,
  userProperties: 38,
  authenticationMethod: 21,
  authenticationData: 22,
  payloadFormatIndicator: 1,
  messageExpiryInterval: 2,
  contentType: 3,
  responseTopic: 8,
  correlationData: 9,
  maximumQoS: 36,
  retainAvailable: 37,
  assignedClientIdentifier: 18,
  reasonString: 31,
  wildcardSubscriptionAvailable: 40,
  subscriptionIdentifiersAvailable: 41,
  sharedSubscriptionAvailable: 42,
  serverKeepAlive: 19,
  responseInformation: 26,
  serverReference: 28,
  topicAlias: 35,
  subscriptionIdentifier: 11
}
protocol.propertiesCodes = {}
for (const prop in protocol.properties) {
  const id = protocol.properties[prop]
  protocol.propertiesCodes[id] = prop
}
protocol.propertiesTypes = {
  sessionExpiryInterval: 'int32',
  willDelayInterval: 'int32',
  receiveMaximum: 'int16',
  maximumPacketSize: 'int32',
  topicAliasMaximum: 'int16',
  requestResponseInformation: 'byte',
  requestProblemInformation: 'byte',
  userProperties: 'pair',
  authenticationMethod: 'string',
  authenticationData: 'binary',
  payloadFormatIndicator: 'byte',
  messageExpiryInterval: 'int32',
  contentType: 'string',
  responseTopic: 'string',
  correlationData: 'binary',
  maximumQoS: 'int8',
  retainAvailable: 'byte',
  assignedClientIdentifier: 'string',
  reasonString: 'string',
  wildcardSubscriptionAvailable: 'byte',
  subscriptionIdentifiersAvailable: 'byte',
  sharedSubscriptionAvailable: 'byte',
  serverKeepAlive: 'int16',
  responseInformation: 'string',
  serverReference: 'string',
  topicAlias: 'int16',
  subscriptionIdentifier: 'var'
}

function genHeader (type) {
  return [0, 1, 2].map(qos => {
    return [0, 1].map(dup => {
      return [0, 1].map(retain => {
        const buf = Buffer.alloc(1)
        buf.writeUInt8(
          protocol.codes[type] << protocol.CMD_SHIFT |
          (dup ? protocol.DUP_MASK : 0) |
          qos << protocol.QOS_SHIFT | retain, 0, true)
        return buf
      })
    })
  })
}

/* Publish */
protocol.PUBLISH_HEADER = genHeader('publish')

/* Subscribe */
protocol.SUBSCRIBE_HEADER = genHeader('subscribe')
protocol.SUBSCRIBE_OPTIONS_QOS_MASK = 0x03
protocol.SUBSCRIBE_OPTIONS_NL_MASK = 0x01
protocol.SUBSCRIBE_OPTIONS_NL_SHIFT = 2
protocol.SUBSCRIBE_OPTIONS_RAP_MASK = 0x01
protocol.SUBSCRIBE_OPTIONS_RAP_SHIFT = 3
protocol.SUBSCRIBE_OPTIONS_RH_MASK = 0x03
protocol.SUBSCRIBE_OPTIONS_RH_SHIFT = 4
protocol.SUBSCRIBE_OPTIONS_RH = [0x00, 0x10, 0x20]
protocol.SUBSCRIBE_OPTIONS_NL = 0x04
protocol.SUBSCRIBE_OPTIONS_RAP = 0x08
protocol.SUBSCRIBE_OPTIONS_QOS = [0x00, 0x01, 0x02]

/* Unsubscribe */
protocol.UNSUBSCRIBE_HEADER = genHeader('unsubscribe')

/* Confirmations */
protocol.ACKS = {
  unsuback: genHeader('unsuback'),
  puback: genHeader('puback'),
  pubcomp: genHeader('pubcomp'),
  pubrel: genHeader('pubrel'),
  pubrec: genHeader('pubrec')
}

protocol.SUBACK_HEADER = Buffer.from([protocol.codes.suback << protocol.CMD_SHIFT])

/* Protocol versions */
protocol.VERSION3 = Buffer.from([3])
protocol.VERSION4 = Buffer.from([4])
protocol.VERSION5 = Buffer.from([5])

/* QoS */
protocol.QOS = [0, 1, 2].map(qos => {
  return Buffer.from([qos])
})

/* Empty packets */
protocol.EMPTY = {
  pingreq: Buffer.from([protocol.codes.pingreq << 4, 0]),
  pingresp: Buffer.from([protocol.codes.pingresp << 4, 0]),
  disconnect: Buffer.from([protocol.codes.disconnect << 4, 0])
}

/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(11).Buffer))

/***/ }),
/* 83 */
/***/ (function(module, exports, __webpack_require__) {

/* WEBPACK VAR INJECTION */(function(Buffer) {const protocol = __webpack_require__(82)
const empty = Buffer.allocUnsafe(0)
const zeroBuf = Buffer.from([0])
const numbers = __webpack_require__(343)
const nextTick = __webpack_require__(30).nextTick
const debug = __webpack_require__(8)('mqtt-packet:writeToStream')

const numCache = numbers.cache
const generateNumber = numbers.generateNumber
const generateCache = numbers.generateCache
const genBufVariableByteInt = numbers.genBufVariableByteInt
const generate4ByteBuffer = numbers.generate4ByteBuffer
let writeNumber = writeNumberCached
let toGenerate = true

function generate (packet, stream, opts) {
  debug('generate called')
  if (stream.cork) {
    stream.cork()
    nextTick(uncork, stream)
  }

  if (toGenerate) {
    toGenerate = false
    generateCache()
  }
  debug('generate: packet.cmd: %s', packet.cmd)
  switch (packet.cmd) {
    case 'connect':
      return connect(packet, stream, opts)
    case 'connack':
      return connack(packet, stream, opts)
    case 'publish':
      return publish(packet, stream, opts)
    case 'puback':
    case 'pubrec':
    case 'pubrel':
    case 'pubcomp':
      return confirmation(packet, stream, opts)
    case 'subscribe':
      return subscribe(packet, stream, opts)
    case 'suback':
      return suback(packet, stream, opts)
    case 'unsubscribe':
      return unsubscribe(packet, stream, opts)
    case 'unsuback':
      return unsuback(packet, stream, opts)
    case 'pingreq':
    case 'pingresp':
      return emptyPacket(packet, stream, opts)
    case 'disconnect':
      return disconnect(packet, stream, opts)
    case 'auth':
      return auth(packet, stream, opts)
    default:
      stream.emit('error', new Error('Unknown command'))
      return false
  }
}
/**
 * Controls numbers cache.
 * Set to "false" to allocate buffers on-the-flight instead of pre-generated cache
 */
Object.defineProperty(generate, 'cacheNumbers', {
  get () {
    return writeNumber === writeNumberCached
  },
  set (value) {
    if (value) {
      if (!numCache || Object.keys(numCache).length === 0) toGenerate = true
      writeNumber = writeNumberCached
    } else {
      toGenerate = false
      writeNumber = writeNumberGenerated
    }
  }
})

function uncork (stream) {
  stream.uncork()
}

function connect (packet, stream, opts) {
  const settings = packet || {}
  const protocolId = settings.protocolId || 'MQTT'
  const protocolVersion = settings.protocolVersion || 4
  const will = settings.will
  let clean = settings.clean
  const keepalive = settings.keepalive || 0
  const clientId = settings.clientId || ''
  const username = settings.username
  const password = settings.password
  /* mqtt5 new oprions */
  const properties = settings.properties

  if (clean === undefined) clean = true

  let length = 0

  // Must be a string and non-falsy
  if (!protocolId ||
     (typeof protocolId !== 'string' && !Buffer.isBuffer(protocolId))) {
    stream.emit('error', new Error('Invalid protocolId'))
    return false
  } else length += protocolId.length + 2

  // Must be 3 or 4 or 5
  if (protocolVersion !== 3 && protocolVersion !== 4 && protocolVersion !== 5) {
    stream.emit('error', new Error('Invalid protocol version'))
    return false
  } else length += 1

  // ClientId might be omitted in 3.1.1, but only if cleanSession is set to 1
  if ((typeof clientId === 'string' || Buffer.isBuffer(clientId)) &&
     (clientId || protocolVersion === 4) && (clientId || clean)) {
    length += clientId.length + 2
  } else {
    if (protocolVersion < 4) {
      stream.emit('error', new Error('clientId must be supplied before 3.1.1'))
      return false
    }
    if ((clean * 1) === 0) {
      stream.emit('error', new Error('clientId must be given if cleanSession set to 0'))
      return false
    }
  }

  // Must be a two byte number
  if (typeof keepalive !== 'number' ||
      keepalive < 0 ||
      keepalive > 65535 ||
      keepalive % 1 !== 0) {
    stream.emit('error', new Error('Invalid keepalive'))
    return false
  } else length += 2

  // Connect flags
  length += 1

  // Properties
  if (protocolVersion === 5) {
    var propertiesData = getProperties(stream, properties)
    if (!propertiesData) { return false }
    length += propertiesData.length
  }

  // If will exists...
  if (will) {
    // It must be an object
    if (typeof will !== 'object') {
      stream.emit('error', new Error('Invalid will'))
      return false
    }
    // It must have topic typeof string
    if (!will.topic || typeof will.topic !== 'string') {
      stream.emit('error', new Error('Invalid will topic'))
      return false
    } else {
      length += Buffer.byteLength(will.topic) + 2
    }

    // Payload
    length += 2 // payload length
    if (will.payload) {
      if (will.payload.length >= 0) {
        if (typeof will.payload === 'string') {
          length += Buffer.byteLength(will.payload)
        } else {
          length += will.payload.length
        }
      } else {
        stream.emit('error', new Error('Invalid will payload'))
        return false
      }
    }
    // will properties
    var willProperties = {}
    if (protocolVersion === 5) {
      willProperties = getProperties(stream, will.properties)
      if (!willProperties) { return false }
      length += willProperties.length
    }
  }

  // Username
  let providedUsername = false
  if (username != null) {
    if (isStringOrBuffer(username)) {
      providedUsername = true
      length += Buffer.byteLength(username) + 2
    } else {
      stream.emit('error', new Error('Invalid username'))
      return false
    }
  }

  // Password
  if (password != null) {
    if (!providedUsername) {
      stream.emit('error', new Error('Username is required to use password'))
      return false
    }

    if (isStringOrBuffer(password)) {
      length += byteLength(password) + 2
    } else {
      stream.emit('error', new Error('Invalid password'))
      return false
    }
  }

  // Generate header
  stream.write(protocol.CONNECT_HEADER)

  // Generate length
  writeVarByteInt(stream, length)

  // Generate protocol ID
  writeStringOrBuffer(stream, protocolId)
  stream.write(
    protocolVersion === 4
      ? protocol.VERSION4
      : protocolVersion === 5
        ? protocol.VERSION5
        : protocol.VERSION3
  )

  // Connect flags
  let flags = 0
  flags |= (username != null) ? protocol.USERNAME_MASK : 0
  flags |= (password != null) ? protocol.PASSWORD_MASK : 0
  flags |= (will && will.retain) ? protocol.WILL_RETAIN_MASK : 0
  flags |= (will && will.qos) ? will.qos << protocol.WILL_QOS_SHIFT : 0
  flags |= will ? protocol.WILL_FLAG_MASK : 0
  flags |= clean ? protocol.CLEAN_SESSION_MASK : 0

  stream.write(Buffer.from([flags]))

  // Keepalive
  writeNumber(stream, keepalive)

  // Properties
  if (protocolVersion === 5) {
    propertiesData.write()
  }

  // Client ID
  writeStringOrBuffer(stream, clientId)

  // Will
  if (will) {
    if (protocolVersion === 5) {
      willProperties.write()
    }
    writeString(stream, will.topic)
    writeStringOrBuffer(stream, will.payload)
  }

  // Username and password
  if (username != null) {
    writeStringOrBuffer(stream, username)
  }
  if (password != null) {
    writeStringOrBuffer(stream, password)
  }
  // This is a small packet that happens only once on a stream
  // We assume the stream is always free to receive more data after this
  return true
}

function connack (packet, stream, opts) {
  const version = opts ? opts.protocolVersion : 4
  const settings = packet || {}
  const rc = version === 5 ? settings.reasonCode : settings.returnCode
  const properties = settings.properties
  let length = 2 // length of rc and sessionHeader

  // Check return code
  if (typeof rc !== 'number') {
    stream.emit('error', new Error('Invalid return code'))
    return false
  }
  // mqtt5 properties
  let propertiesData = null
  if (version === 5) {
    propertiesData = getProperties(stream, properties)
    if (!propertiesData) { return false }
    length += propertiesData.length
  }

  stream.write(protocol.CONNACK_HEADER)
  // length
  writeVarByteInt(stream, length)
  stream.write(settings.sessionPresent ? protocol.SESSIONPRESENT_HEADER : zeroBuf)

  stream.write(Buffer.from([rc]))
  if (propertiesData != null) {
    propertiesData.write()
  }
  return true
}

function publish (packet, stream, opts) {
  debug('publish: packet: %o', packet)
  const version = opts ? opts.protocolVersion : 4
  const settings = packet || {}
  const qos = settings.qos || 0
  const retain = settings.retain ? protocol.RETAIN_MASK : 0
  const topic = settings.topic
  const payload = settings.payload || empty
  const id = settings.messageId
  const properties = settings.properties

  let length = 0

  // Topic must be a non-empty string or Buffer
  if (typeof topic === 'string') length += Buffer.byteLength(topic) + 2
  else if (Buffer.isBuffer(topic)) length += topic.length + 2
  else {
    stream.emit('error', new Error('Invalid topic'))
    return false
  }

  // Get the payload length
  if (!Buffer.isBuffer(payload)) length += Buffer.byteLength(payload)
  else length += payload.length

  // Message ID must a number if qos > 0
  if (qos && typeof id !== 'number') {
    stream.emit('error', new Error('Invalid messageId'))
    return false
  } else if (qos) length += 2

  // mqtt5 properties
  let propertiesData = null
  if (version === 5) {
    propertiesData = getProperties(stream, properties)
    if (!propertiesData) { return false }
    length += propertiesData.length
  }

  // Header
  stream.write(protocol.PUBLISH_HEADER[qos][settings.dup ? 1 : 0][retain ? 1 : 0])

  // Remaining length
  writeVarByteInt(stream, length)

  // Topic
  writeNumber(stream, byteLength(topic))
  stream.write(topic)

  // Message ID
  if (qos > 0) writeNumber(stream, id)

  // Properties
  if (propertiesData != null) {
    propertiesData.write()
  }

  // Payload
  debug('publish: payload: %o', payload)
  return stream.write(payload)
}

/* Puback, pubrec, pubrel and pubcomp */
function confirmation (packet, stream, opts) {
  const version = opts ? opts.protocolVersion : 4
  const settings = packet || {}
  const type = settings.cmd || 'puback'
  const id = settings.messageId
  const dup = (settings.dup && type === 'pubrel') ? protocol.DUP_MASK : 0
  let qos = 0
  const reasonCode = settings.reasonCode
  const properties = settings.properties
  let length = version === 5 ? 3 : 2

  if (type === 'pubrel') qos = 1

  // Check message ID
  if (typeof id !== 'number') {
    stream.emit('error', new Error('Invalid messageId'))
    return false
  }

  // properies mqtt 5
  let propertiesData = null
  if (version === 5) {
    // Confirm should not add empty property length with no properties (rfc 3.4.2.2.1)
    if (typeof properties === 'object') {
      propertiesData = getPropertiesByMaximumPacketSize(stream, properties, opts, length)
      if (!propertiesData) { return false }
      length += propertiesData.length
    }
  }

  // Header
  stream.write(protocol.ACKS[type][qos][dup][0])

  // Length
  writeVarByteInt(stream, length)

  // Message ID
  writeNumber(stream, id)

  // reason code in header
  if (version === 5) {
    stream.write(Buffer.from([reasonCode]))
  }

  // properies mqtt 5
  if (propertiesData !== null) {
    propertiesData.write()
  }
  return true
}

function subscribe (packet, stream, opts) {
  debug('subscribe: packet: ')
  const version = opts ? opts.protocolVersion : 4
  const settings = packet || {}
  const dup = settings.dup ? protocol.DUP_MASK : 0
  const id = settings.messageId
  const subs = settings.subscriptions
  const properties = settings.properties

  let length = 0

  // Check message ID
  if (typeof id !== 'number') {
    stream.emit('error', new Error('Invalid messageId'))
    return false
  } else length += 2

  // properies mqtt 5
  let propertiesData = null
  if (version === 5) {
    propertiesData = getProperties(stream, properties)
    if (!propertiesData) { return false }
    length += propertiesData.length
  }

  // Check subscriptions
  if (typeof subs === 'object' && subs.length) {
    for (let i = 0; i < subs.length; i += 1) {
      const itopic = subs[i].topic
      const iqos = subs[i].qos

      if (typeof itopic !== 'string') {
        stream.emit('error', new Error('Invalid subscriptions - invalid topic'))
        return false
      }
      if (typeof iqos !== 'number') {
        stream.emit('error', new Error('Invalid subscriptions - invalid qos'))
        return false
      }

      if (version === 5) {
        const nl = subs[i].nl || false
        if (typeof nl !== 'boolean') {
          stream.emit('error', new Error('Invalid subscriptions - invalid No Local'))
          return false
        }
        const rap = subs[i].rap || false
        if (typeof rap !== 'boolean') {
          stream.emit('error', new Error('Invalid subscriptions - invalid Retain as Published'))
          return false
        }
        const rh = subs[i].rh || 0
        if (typeof rh !== 'number' || rh > 2) {
          stream.emit('error', new Error('Invalid subscriptions - invalid Retain Handling'))
          return false
        }
      }

      length += Buffer.byteLength(itopic) + 2 + 1
    }
  } else {
    stream.emit('error', new Error('Invalid subscriptions'))
    return false
  }

  // Generate header
  debug('subscribe: writing to stream: %o', protocol.SUBSCRIBE_HEADER)
  stream.write(protocol.SUBSCRIBE_HEADER[1][dup ? 1 : 0][0])

  // Generate length
  writeVarByteInt(stream, length)

  // Generate message ID
  writeNumber(stream, id)

  // properies mqtt 5
  if (propertiesData !== null) {
    propertiesData.write()
  }

  let result = true

  // Generate subs
  for (const sub of subs) {
    const jtopic = sub.topic
    const jqos = sub.qos
    const jnl = +sub.nl
    const jrap = +sub.rap
    const jrh = sub.rh
    let joptions

    // Write topic string
    writeString(stream, jtopic)

    // options process
    joptions = protocol.SUBSCRIBE_OPTIONS_QOS[jqos]
    if (version === 5) {
      joptions |= jnl ? protocol.SUBSCRIBE_OPTIONS_NL : 0
      joptions |= jrap ? protocol.SUBSCRIBE_OPTIONS_RAP : 0
      joptions |= jrh ? protocol.SUBSCRIBE_OPTIONS_RH[jrh] : 0
    }
    // Write options
    result = stream.write(Buffer.from([joptions]))
  }

  return result
}

function suback (packet, stream, opts) {
  const version = opts ? opts.protocolVersion : 4
  const settings = packet || {}
  const id = settings.messageId
  const granted = settings.granted
  const properties = settings.properties
  let length = 0

  // Check message ID
  if (typeof id !== 'number') {
    stream.emit('error', new Error('Invalid messageId'))
    return false
  } else length += 2

  // Check granted qos vector
  if (typeof granted === 'object' && granted.length) {
    for (let i = 0; i < granted.length; i += 1) {
      if (typeof granted[i] !== 'number') {
        stream.emit('error', new Error('Invalid qos vector'))
        return false
      }
      length += 1
    }
  } else {
    stream.emit('error', new Error('Invalid qos vector'))
    return false
  }

  // properies mqtt 5
  let propertiesData = null
  if (version === 5) {
    propertiesData = getPropertiesByMaximumPacketSize(stream, properties, opts, length)
    if (!propertiesData) { return false }
    length += propertiesData.length
  }

  // header
  stream.write(protocol.SUBACK_HEADER)

  // Length
  writeVarByteInt(stream, length)

  // Message ID
  writeNumber(stream, id)

  // properies mqtt 5
  if (propertiesData !== null) {
    propertiesData.write()
  }

  return stream.write(Buffer.from(granted))
}

function unsubscribe (packet, stream, opts) {
  const version = opts ? opts.protocolVersion : 4
  const settings = packet || {}
  const id = settings.messageId
  const dup = settings.dup ? protocol.DUP_MASK : 0
  const unsubs = settings.unsubscriptions
  const properties = settings.properties

  let length = 0

  // Check message ID
  if (typeof id !== 'number') {
    stream.emit('error', new Error('Invalid messageId'))
    return false
  } else {
    length += 2
  }
  // Check unsubs
  if (typeof unsubs === 'object' && unsubs.length) {
    for (let i = 0; i < unsubs.length; i += 1) {
      if (typeof unsubs[i] !== 'string') {
        stream.emit('error', new Error('Invalid unsubscriptions'))
        return false
      }
      length += Buffer.byteLength(unsubs[i]) + 2
    }
  } else {
    stream.emit('error', new Error('Invalid unsubscriptions'))
    return false
  }
  // properies mqtt 5
  let propertiesData = null
  if (version === 5) {
    propertiesData = getProperties(stream, properties)
    if (!propertiesData) { return false }
    length += propertiesData.length
  }

  // Header
  stream.write(protocol.UNSUBSCRIBE_HEADER[1][dup ? 1 : 0][0])

  // Length
  writeVarByteInt(stream, length)

  // Message ID
  writeNumber(stream, id)

  // properies mqtt 5
  if (propertiesData !== null) {
    propertiesData.write()
  }

  // Unsubs
  let result = true
  for (let j = 0; j < unsubs.length; j++) {
    result = writeString(stream, unsubs[j])
  }

  return result
}

function unsuback (packet, stream, opts) {
  const version = opts ? opts.protocolVersion : 4
  const settings = packet || {}
  const id = settings.messageId
  const dup = settings.dup ? protocol.DUP_MASK : 0
  const granted = settings.granted
  const properties = settings.properties
  const type = settings.cmd
  const qos = 0

  let length = 2

  // Check message ID
  if (typeof id !== 'number') {
    stream.emit('error', new Error('Invalid messageId'))
    return false
  }

  // Check granted
  if (version === 5) {
    if (typeof granted === 'object' && granted.length) {
      for (let i = 0; i < granted.length; i += 1) {
        if (typeof granted[i] !== 'number') {
          stream.emit('error', new Error('Invalid qos vector'))
          return false
        }
        length += 1
      }
    } else {
      stream.emit('error', new Error('Invalid qos vector'))
      return false
    }
  }

  // properies mqtt 5
  let propertiesData = null
  if (version === 5) {
    propertiesData = getPropertiesByMaximumPacketSize(stream, properties, opts, length)
    if (!propertiesData) { return false }
    length += propertiesData.length
  }

  // Header
  stream.write(protocol.ACKS[type][qos][dup][0])

  // Length
  writeVarByteInt(stream, length)

  // Message ID
  writeNumber(stream, id)

  // properies mqtt 5
  if (propertiesData !== null) {
    propertiesData.write()
  }

  // payload
  if (version === 5) {
    stream.write(Buffer.from(granted))
  }
  return true
}

function emptyPacket (packet, stream, opts) {
  return stream.write(protocol.EMPTY[packet.cmd])
}

function disconnect (packet, stream, opts) {
  const version = opts ? opts.protocolVersion : 4
  const settings = packet || {}
  const reasonCode = settings.reasonCode
  const properties = settings.properties
  let length = version === 5 ? 1 : 0

  // properies mqtt 5
  let propertiesData = null
  if (version === 5) {
    propertiesData = getPropertiesByMaximumPacketSize(stream, properties, opts, length)
    if (!propertiesData) { return false }
    length += propertiesData.length
  }

  // Header
  stream.write(Buffer.from([protocol.codes.disconnect << 4]))

  // Length
  writeVarByteInt(stream, length)

  // reason code in header
  if (version === 5) {
    stream.write(Buffer.from([reasonCode]))
  }

  // properies mqtt 5
  if (propertiesData !== null) {
    propertiesData.write()
  }

  return true
}

function auth (packet, stream, opts) {
  const version = opts ? opts.protocolVersion : 4
  const settings = packet || {}
  const reasonCode = settings.reasonCode
  const properties = settings.properties
  let length = version === 5 ? 1 : 0

  if (version !== 5) stream.emit('error', new Error('Invalid mqtt version for auth packet'))

  // properies mqtt 5
  const propertiesData = getPropertiesByMaximumPacketSize(stream, properties, opts, length)
  if (!propertiesData) { return false }
  length += propertiesData.length

  // Header
  stream.write(Buffer.from([protocol.codes.auth << 4]))

  // Length
  writeVarByteInt(stream, length)

  // reason code in header
  stream.write(Buffer.from([reasonCode]))

  // properies mqtt 5
  if (propertiesData !== null) {
    propertiesData.write()
  }
  return true
}

/**
 * writeVarByteInt - write an MQTT style variable byte integer to the buffer
 *
 * @param <Buffer> buffer - destination
 * @param <Number> pos - offset
 * @param <Number> length - length (>0)
 * @returns <Number> number of bytes written
 *
 * @api private
 */

const varByteIntCache = {}
function writeVarByteInt (stream, num) {
  if (num > protocol.VARBYTEINT_MAX) {
    stream.emit('error', new Error(`Invalid variable byte integer: ${num}`))
    return false
  }

  let buffer = varByteIntCache[num]

  if (!buffer) {
    buffer = genBufVariableByteInt(num)
    if (num < 16384) varByteIntCache[num] = buffer
  }
  debug('writeVarByteInt: writing to stream: %o', buffer)
  return stream.write(buffer)
}

/**
 * writeString - write a utf8 string to the buffer
 *
 * @param <Buffer> buffer - destination
 * @param <Number> pos - offset
 * @param <String> string - string to write
 * @return <Number> number of bytes written
 *
 * @api private
 */

function writeString (stream, string) {
  const strlen = Buffer.byteLength(string)
  writeNumber(stream, strlen)

  debug('writeString: %s', string)
  return stream.write(string, 'utf8')
}

/**
 * writeStringPair - write a utf8 string pairs to the buffer
 *
 * @param <Buffer> buffer - destination
 * @param <String> name - string name to write
 * @param <String> value - string value to write
 * @return <Number> number of bytes written
 *
 * @api private
 */
function writeStringPair (stream, name, value) {
  writeString(stream, name)
  writeString(stream, value)
}

/**
 * writeNumber - write a two byte number to the buffer
 *
 * @param <Buffer> buffer - destination
 * @param <Number> pos - offset
 * @param <String> number - number to write
 * @return <Number> number of bytes written
 *
 * @api private
 */
function writeNumberCached (stream, number) {
  debug('writeNumberCached: number: %d', number)
  debug('writeNumberCached: %o', numCache[number])
  return stream.write(numCache[number])
}
function writeNumberGenerated (stream, number) {
  const generatedNumber = generateNumber(number)
  debug('writeNumberGenerated: %o', generatedNumber)
  return stream.write(generatedNumber)
}
function write4ByteNumber (stream, number) {
  const generated4ByteBuffer = generate4ByteBuffer(number)
  debug('write4ByteNumber: %o', generated4ByteBuffer)
  return stream.write(generated4ByteBuffer)
}
/**
 * writeStringOrBuffer - write a String or Buffer with the its length prefix
 *
 * @param <Buffer> buffer - destination
 * @param <Number> pos - offset
 * @param <String> toWrite - String or Buffer
 * @return <Number> number of bytes written
 */
function writeStringOrBuffer (stream, toWrite) {
  if (typeof toWrite === 'string') {
    writeString(stream, toWrite)
  } else if (toWrite) {
    writeNumber(stream, toWrite.length)
    stream.write(toWrite)
  } else writeNumber(stream, 0)
}

function getProperties (stream, properties) {
  /* connect properties */
  if (typeof properties !== 'object' || properties.length != null) {
    return {
      length: 1,
      write () {
        writeProperties(stream, {}, 0)
      }
    }
  }
  let propertiesLength = 0
  function getLengthProperty (name, value) {
    const type = protocol.propertiesTypes[name]
    let length = 0
    switch (type) {
      case 'byte': {
        if (typeof value !== 'boolean') {
          stream.emit('error', new Error(`Invalid ${name}: ${value}`))
          return false
        }
        length += 1 + 1
        break
      }
      case 'int8': {
        if (typeof value !== 'number' || value < 0 || value > 0xff) {
          stream.emit('error', new Error(`Invalid ${name}: ${value}`))
          return false
        }
        length += 1 + 1
        break
      }
      case 'binary': {
        if (value && value === null) {
          stream.emit('error', new Error(`Invalid ${name}: ${value}`))
          return false
        }
        length += 1 + Buffer.byteLength(value) + 2
        break
      }
      case 'int16': {
        if (typeof value !== 'number' || value < 0 || value > 0xffff) {
          stream.emit('error', new Error(`Invalid ${name}: ${value}`))
          return false
        }
        length += 1 + 2
        break
      }
      case 'int32': {
        if (typeof value !== 'number' || value < 0 || value > 0xffffffff) {
          stream.emit('error', new Error(`Invalid ${name}: ${value}`))
          return false
        }
        length += 1 + 4
        break
      }
      case 'var': {
        // var byte integer is max 24 bits packed in 32 bits
        if (typeof value !== 'number' || value < 0 || value > 0x0fffffff) {
          stream.emit('error', new Error(`Invalid ${name}: ${value}`))
          return false
        }
        length += 1 + Buffer.byteLength(genBufVariableByteInt(value))
        break
      }
      case 'string': {
        if (typeof value !== 'string') {
          stream.emit('error', new Error(`Invalid ${name}: ${value}`))
          return false
        }
        length += 1 + 2 + Buffer.byteLength(value.toString())
        break
      }
      case 'pair': {
        if (typeof value !== 'object') {
          stream.emit('error', new Error(`Invalid ${name}: ${value}`))
          return false
        }
        length += Object.getOwnPropertyNames(value).reduce((result, name) => {
          const currentValue = value[name]
          if (Array.isArray(currentValue)) {
            result += currentValue.reduce((currentLength, value) => {
              currentLength += 1 + 2 + Buffer.byteLength(name.toString()) + 2 + Buffer.byteLength(value.toString())
              return currentLength
            }, 0)
          } else {
            result += 1 + 2 + Buffer.byteLength(name.toString()) + 2 + Buffer.byteLength(value[name].toString())
          }
          return result
        }, 0)
        break
      }
      default: {
        stream.emit('error', new Error(`Invalid property ${name}: ${value}`))
        return false
      }
    }
    return length
  }
  if (properties) {
    for (const propName in properties) {
      let propLength = 0
      let propValueLength = 0
      const propValue = properties[propName]
      if (Array.isArray(propValue)) {
        for (let valueIndex = 0; valueIndex < propValue.length; valueIndex++) {
          propValueLength = getLengthProperty(propName, propValue[valueIndex])
          if (!propValueLength) { return false }
          propLength += propValueLength
        }
      } else {
        propValueLength = getLengthProperty(propName, propValue)
        if (!propValueLength) { return false }
        propLength = propValueLength
      }
      if (!propLength) return false
      propertiesLength += propLength
    }
  }
  const propertiesLengthLength = Buffer.byteLength(genBufVariableByteInt(propertiesLength))

  return {
    length: propertiesLengthLength + propertiesLength,
    write () {
      writeProperties(stream, properties, propertiesLength)
    }
  }
}

function getPropertiesByMaximumPacketSize (stream, properties, opts, length) {
  const mayEmptyProps = ['reasonString', 'userProperties']
  const maximumPacketSize = opts && opts.properties && opts.properties.maximumPacketSize ? opts.properties.maximumPacketSize : 0

  let propertiesData = getProperties(stream, properties)
  if (maximumPacketSize) {
    while (length + propertiesData.length > maximumPacketSize) {
      const currentMayEmptyProp = mayEmptyProps.shift()
      if (currentMayEmptyProp && properties[currentMayEmptyProp]) {
        delete properties[currentMayEmptyProp]
        propertiesData = getProperties(stream, properties)
      } else {
        return false
      }
    }
  }
  return propertiesData
}

function writeProperty (stream, propName, value) {
  const type = protocol.propertiesTypes[propName]
  switch (type) {
    case 'byte': {
      stream.write(Buffer.from([protocol.properties[propName]]))
      stream.write(Buffer.from([+value]))
      break
    }
    case 'int8': {
      stream.write(Buffer.from([protocol.properties[propName]]))
      stream.write(Buffer.from([value]))
      break
    }
    case 'binary': {
      stream.write(Buffer.from([protocol.properties[propName]]))
      writeStringOrBuffer(stream, value)
      break
    }
    case 'int16': {
      stream.write(Buffer.from([protocol.properties[propName]]))
      writeNumber(stream, value)
      break
    }
    case 'int32': {
      stream.write(Buffer.from([protocol.properties[propName]]))
      write4ByteNumber(stream, value)
      break
    }
    case 'var': {
      stream.write(Buffer.from([protocol.properties[propName]]))
      writeVarByteInt(stream, value)
      break
    }
    case 'string': {
      stream.write(Buffer.from([protocol.properties[propName]]))
      writeString(stream, value)
      break
    }
    case 'pair': {
      Object.getOwnPropertyNames(value).forEach(name => {
        const currentValue = value[name]
        if (Array.isArray(currentValue)) {
          currentValue.forEach(value => {
            stream.write(Buffer.from([protocol.properties[propName]]))
            writeStringPair(stream, name.toString(), value.toString())
          })
        } else {
          stream.write(Buffer.from([protocol.properties[propName]]))
          writeStringPair(stream, name.toString(), currentValue.toString())
        }
      })
      break
    }
    default: {
      stream.emit('error', new Error(`Invalid property ${propName} value: ${value}`))
      return false
    }
  }
}

function writeProperties (stream, properties, propertiesLength) {
  /* write properties to stream */
  writeVarByteInt(stream, propertiesLength)
  for (const propName in properties) {
    if (Object.prototype.hasOwnProperty.call(properties, propName) && properties[propName] !== null) {
      const value = properties[propName]
      if (Array.isArray(value)) {
        for (let valueIndex = 0; valueIndex < value.length; valueIndex++) {
          writeProperty(stream, propName, value[valueIndex])
        }
      } else {
        writeProperty(stream, propName, value)
      }
    }
  }
}

function byteLength (bufOrString) {
  if (!bufOrString) return 0
  else if (bufOrString instanceof Buffer) return bufOrString.length
  else return Buffer.byteLength(bufOrString)
}

function isStringOrBuffer (field) {
  return typeof field === 'string' || field instanceof Buffer
}

module.exports = generate

/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(11).Buffer))

/***/ }),
/* 84 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var net = __webpack_require__(353)
var debug = __webpack_require__(8)('mqttjs:tcp')

/*
  variables port and host can be removed since
  you have all required information in opts object
*/
function streamBuilder (client, opts) {
  var port, host
  opts.port = opts.port || 1883
  opts.hostname = opts.hostname || opts.host || 'localhost'

  port = opts.port
  host = opts.hostname

  debug('port %d and host %s', port, host)
  return net.createConnection(port, host)
}

module.exports = streamBuilder


/***/ }),
/* 85 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
/* WEBPACK VAR INJECTION */(function(Buffer) {

var Transform = __webpack_require__(23).Transform
var duplexify = __webpack_require__(46)

/* global wx */
var socketTask
var proxy
var stream

function buildProxy () {
  var proxy = new Transform()
  proxy._write = function (chunk, encoding, next) {
    socketTask.send({
      data: chunk.buffer,
      success: function () {
        next()
      },
      fail: function (errMsg) {
        next(new Error(errMsg))
      }
    })
  }
  proxy._flush = function socketEnd (done) {
    socketTask.close({
      success: function () {
        done()
      }
    })
  }

  return proxy
}

function setDefaultOpts (opts) {
  if (!opts.hostname) {
    opts.hostname = 'localhost'
  }
  if (!opts.path) {
    opts.path = '/'
  }

  if (!opts.wsOptions) {
    opts.wsOptions = {}
  }
}

function buildUrl (opts, client) {
  var protocol = opts.protocol === 'wxs' ? 'wss' : 'ws'
  var url = protocol + '://' + opts.hostname + opts.path
  if (opts.port && opts.port !== 80 && opts.port !== 443) {
    url = protocol + '://' + opts.hostname + ':' + opts.port + opts.path
  }
  if (typeof (opts.transformWsUrl) === 'function') {
    url = opts.transformWsUrl(url, opts, client)
  }
  return url
}

function bindEventHandler () {
  socketTask.onOpen(function () {
    stream.setReadable(proxy)
    stream.setWritable(proxy)
    stream.emit('connect')
  })

  socketTask.onMessage(function (res) {
    var data = res.data

    if (data instanceof ArrayBuffer) data = Buffer.from(data)
    else data = Buffer.from(data, 'utf8')
    proxy.push(data)
  })

  socketTask.onClose(function () {
    stream.end()
    stream.destroy()
  })

  socketTask.onError(function (res) {
    stream.destroy(new Error(res.errMsg))
  })
}

function buildStream (client, opts) {
  opts.hostname = opts.hostname || opts.host

  if (!opts.hostname) {
    throw new Error('Could not determine host. Specify host manually.')
  }

  var websocketSubProtocol =
    (opts.protocolId === 'MQIsdp') && (opts.protocolVersion === 3)
      ? 'mqttv3.1'
      : 'mqtt'

  setDefaultOpts(opts)

  var url = buildUrl(opts, client)
  socketTask = wx.connectSocket({
    url: url,
    protocols: [websocketSubProtocol]
  })

  proxy = buildProxy()
  stream = duplexify.obj()
  stream._destroy = function (err, cb) {
    socketTask.close({
      success: function () {
        cb && cb(err)
      }
    })
  }

  var destroyRef = stream.destroy
  stream.destroy = function () {
    stream.destroy = destroyRef

    var self = this
    setTimeout(function () {
      socketTask.close({
        fail: function () {
          self._destroy(new Error())
        }
      })
    }, 0)
  }.bind(stream)

  bindEventHandler()

  return stream
}

module.exports = buildStream

/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(11).Buffer))

/***/ }),
/* 86 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
/* WEBPACK VAR INJECTION */(function(Buffer) {

var Transform = __webpack_require__(23).Transform
var duplexify = __webpack_require__(46)

/* global FileReader */
var my
var proxy
var stream
var isInitialized = false

function buildProxy () {
  var proxy = new Transform()
  proxy._write = function (chunk, encoding, next) {
    my.sendSocketMessage({
      data: chunk.buffer,
      success: function () {
        next()
      },
      fail: function () {
        next(new Error())
      }
    })
  }
  proxy._flush = function socketEnd (done) {
    my.closeSocket({
      success: function () {
        done()
      }
    })
  }

  return proxy
}

function setDefaultOpts (opts) {
  if (!opts.hostname) {
    opts.hostname = 'localhost'
  }
  if (!opts.path) {
    opts.path = '/'
  }

  if (!opts.wsOptions) {
    opts.wsOptions = {}
  }
}

function buildUrl (opts, client) {
  var protocol = opts.protocol === 'alis' ? 'wss' : 'ws'
  var url = protocol + '://' + opts.hostname + opts.path
  if (opts.port && opts.port !== 80 && opts.port !== 443) {
    url = protocol + '://' + opts.hostname + ':' + opts.port + opts.path
  }
  if (typeof (opts.transformWsUrl) === 'function') {
    url = opts.transformWsUrl(url, opts, client)
  }
  return url
}

function bindEventHandler () {
  if (isInitialized) return

  isInitialized = true

  my.onSocketOpen(function () {
    stream.setReadable(proxy)
    stream.setWritable(proxy)
    stream.emit('connect')
  })

  my.onSocketMessage(function (res) {
    if (typeof res.data === 'string') {
      var buffer = Buffer.from(res.data, 'base64')
      proxy.push(buffer)
    } else {
      var reader = new FileReader()
      reader.addEventListener('load', function () {
        var data = reader.result

        if (data instanceof ArrayBuffer) data = Buffer.from(data)
        else data = Buffer.from(data, 'utf8')
        proxy.push(data)
      })
      reader.readAsArrayBuffer(res.data)
    }
  })

  my.onSocketClose(function () {
    stream.end()
    stream.destroy()
  })

  my.onSocketError(function (res) {
    stream.destroy(res)
  })
}

function buildStream (client, opts) {
  opts.hostname = opts.hostname || opts.host

  if (!opts.hostname) {
    throw new Error('Could not determine host. Specify host manually.')
  }

  var websocketSubProtocol =
    (opts.protocolId === 'MQIsdp') && (opts.protocolVersion === 3)
      ? 'mqttv3.1'
      : 'mqtt'

  setDefaultOpts(opts)

  var url = buildUrl(opts, client)
  my = opts.my
  my.connectSocket({
    url: url,
    protocols: websocketSubProtocol
  })

  proxy = buildProxy()
  stream = duplexify.obj()

  bindEventHandler()

  return stream
}

module.exports = buildStream

/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(11).Buffer))

/***/ }),
/* 87 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
/* WEBPACK VAR INJECTION */(function(process, Buffer) {

const WS = __webpack_require__(359)
const debug = __webpack_require__(8)('mqttjs:ws')
const duplexify = __webpack_require__(46)
const Transform = __webpack_require__(23).Transform

let WSS_OPTIONS = [
  'rejectUnauthorized',
  'ca',
  'cert',
  'key',
  'pfx',
  'passphrase'
]
// eslint-disable-next-line camelcase
const IS_BROWSER = (typeof process !== 'undefined' && process.title === 'browser') || typeof __webpack_require__ === 'function'
function buildUrl (opts, client) {
  let url = opts.protocol + '://' + opts.hostname + ':' + opts.port + opts.path
  if (typeof (opts.transformWsUrl) === 'function') {
    url = opts.transformWsUrl(url, opts, client)
  }
  return url
}

function setDefaultOpts (opts) {
  let options = opts
  if (!opts.hostname) {
    options.hostname = 'localhost'
  }
  if (!opts.port) {
    if (opts.protocol === 'wss') {
      options.port = 443
    } else {
      options.port = 80
    }
  }
  if (!opts.path) {
    options.path = '/'
  }

  if (!opts.wsOptions) {
    options.wsOptions = {}
  }
  if (!IS_BROWSER && opts.protocol === 'wss') {
    // Add cert/key/ca etc options
    WSS_OPTIONS.forEach(function (prop) {
      if (opts.hasOwnProperty(prop) && !opts.wsOptions.hasOwnProperty(prop)) {
        options.wsOptions[prop] = opts[prop]
      }
    })
  }

  return options
}

function setDefaultBrowserOpts (opts) {
  let options = setDefaultOpts(opts)

  if (!options.hostname) {
    options.hostname = options.host
  }

  if (!options.hostname) {
    // Throwing an error in a Web Worker if no `hostname` is given, because we
    // can not determine the `hostname` automatically.  If connecting to
    // localhost, please supply the `hostname` as an argument.
    if (typeof (document) === 'undefined') {
      throw new Error('Could not determine host. Specify host manually.')
    }
    const parsed = new URL(document.URL)
    options.hostname = parsed.hostname

    if (!options.port) {
      options.port = parsed.port
    }
  }

  // objectMode should be defined for logic
  if (options.objectMode === undefined) {
    options.objectMode = !(options.binary === true || options.binary === undefined)
  }

  return options
}

function createWebSocket (client, url, opts) {
  debug('createWebSocket')
  debug('protocol: ' + opts.protocolId + ' ' + opts.protocolVersion)
  const websocketSubProtocol =
    (opts.protocolId === 'MQIsdp') && (opts.protocolVersion === 3)
      ? 'mqttv3.1'
      : 'mqtt'

  debug('creating new Websocket for url: ' + url + ' and protocol: ' + websocketSubProtocol)
  let socket = new WS(url, [websocketSubProtocol], opts.wsOptions)
  return socket
}

function createBrowserWebSocket (client, opts) {
  const websocketSubProtocol =
  (opts.protocolId === 'MQIsdp') && (opts.protocolVersion === 3)
    ? 'mqttv3.1'
    : 'mqtt'

  let url = buildUrl(opts, client)
  /* global WebSocket */
  let socket = new WebSocket(url, [websocketSubProtocol])
  socket.binaryType = 'arraybuffer'
  return socket
}

function streamBuilder (client, opts) {
  debug('streamBuilder')
  let options = setDefaultOpts(opts)
  const url = buildUrl(options, client)
  let socket = createWebSocket(client, url, options)
  let webSocketStream = WS.createWebSocketStream(socket, options.wsOptions)
  webSocketStream.url = url
  return webSocketStream
}

function browserStreamBuilder (client, opts) {
  debug('browserStreamBuilder')
  let stream
  let options = setDefaultBrowserOpts(opts)
  // sets the maximum socket buffer size before throttling
  const bufferSize = options.browserBufferSize || 1024 * 512

  const bufferTimeout = opts.browserBufferTimeout || 1000

  const coerceToBuffer = !opts.objectMode

  let socket = createBrowserWebSocket(client, opts)

  let proxy = buildProxy(opts, socketWriteBrowser, socketEndBrowser)

  if (!opts.objectMode) {
    proxy._writev = writev
  }
  proxy.on('close', () => { socket.close() })

  const eventListenerSupport = (typeof socket.addEventListener === 'undefined')

  // was already open when passed in
  if (socket.readyState === socket.OPEN) {
    stream = proxy
  } else {
    stream = stream = duplexify(undefined, undefined, opts)
    if (!opts.objectMode) {
      stream._writev = writev
    }

    if (eventListenerSupport) {
      socket.addEventListener('open', onopen)
    } else {
      socket.onopen = onopen
    }
  }

  stream.socket = socket

  if (eventListenerSupport) {
    socket.addEventListener('close', onclose)
    socket.addEventListener('error', onerror)
    socket.addEventListener('message', onmessage)
  } else {
    socket.onclose = onclose
    socket.onerror = onerror
    socket.onmessage = onmessage
  }

  // methods for browserStreamBuilder

  function buildProxy (options, socketWrite, socketEnd) {
    let proxy = new Transform({
      objectModeMode: options.objectMode
    })

    proxy._write = socketWrite
    proxy._flush = socketEnd

    return proxy
  }

  function onopen () {
    stream.setReadable(proxy)
    stream.setWritable(proxy)
    stream.emit('connect')
  }

  function onclose () {
    stream.end()
    stream.destroy()
  }

  function onerror (err) {
    stream.destroy(err)
  }

  function onmessage (event) {
    let data = event.data
    if (data instanceof ArrayBuffer) data = Buffer.from(data)
    else data = Buffer.from(data, 'utf8')
    proxy.push(data)
  }

  // this is to be enabled only if objectMode is false
  function writev (chunks, cb) {
    const buffers = new Array(chunks.length)
    for (let i = 0; i < chunks.length; i++) {
      if (typeof chunks[i].chunk === 'string') {
        buffers[i] = Buffer.from(chunks[i], 'utf8')
      } else {
        buffers[i] = chunks[i].chunk
      }
    }

    this._write(Buffer.concat(buffers), 'binary', cb)
  }

  function socketWriteBrowser (chunk, enc, next) {
    if (socket.bufferedAmount > bufferSize) {
      // throttle data until buffered amount is reduced.
      setTimeout(socketWriteBrowser, bufferTimeout, chunk, enc, next)
    }

    if (coerceToBuffer && typeof chunk === 'string') {
      chunk = Buffer.from(chunk, 'utf8')
    }

    try {
      socket.send(chunk)
    } catch (err) {
      return next(err)
    }

    next()
  }

  function socketEndBrowser (done) {
    socket.close()
    done()
  }

  // end methods for browserStreamBuilder

  return stream
}

if (IS_BROWSER) {
  module.exports = browserStreamBuilder
} else {
  module.exports = streamBuilder
}

/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(15), __webpack_require__(11).Buffer))

/***/ }),
/* 88 */
/***/ (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__(13)))

/***/ }),
/* 89 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.Socket = exports.io = exports.Manager = exports.protocol = void 0;
const url_1 = __webpack_require__(288);
const manager_1 = __webpack_require__(56);
const socket_1 = __webpack_require__(64);
Object.defineProperty(exports, "Socket", { enumerable: true, get: function () { return socket_1.Socket; } });
const debug = __webpack_require__(8)("socket.io-client");
/**
 * Module exports.
 */
module.exports = exports = lookup;
/**
 * Managers cache.
 */
const cache = (exports.managers = {});
function lookup(uri, opts) {
    if (typeof uri === "object") {
        opts = uri;
        uri = undefined;
    }
    opts = opts || {};
    const parsed = url_1.url(uri);
    const source = parsed.source;
    const id = parsed.id;
    const path = parsed.path;
    const sameNamespace = cache[id] && path in cache[id]["nsps"];
    const newConnection = opts.forceNew ||
        opts["force new connection"] ||
        false === opts.multiplex ||
        sameNamespace;
    let io;
    if (newConnection) {
        debug("ignoring socket cache for %s", source);
        io = new manager_1.Manager(source, opts);
    }
    else {
        if (!cache[id]) {
            debug("new io instance for %s", source);
            cache[id] = new manager_1.Manager(source, opts);
        }
        io = cache[id];
    }
    if (parsed.query && !opts.query) {
        opts.query = parsed.query;
    }
    return io.socket(parsed.path, opts);
}
exports.io = lookup;
/**
 * Protocol version.
 *
 * @public
 */
var socket_io_parser_1 = __webpack_require__(42);
Object.defineProperty(exports, "protocol", { enumerable: true, get: function () { return socket_io_parser_1.protocol; } });
/**
 * `connect`.
 *
 * @param {String} uri
 * @public
 */
exports.connect = lookup;
/**
 * Expose constructors for standalone build.
 *
 * @public
 */
var manager_2 = __webpack_require__(56);
Object.defineProperty(exports, "Manager", { enumerable: true, get: function () { return manager_2.Manager; } });


/***/ }),
/* 90 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
const Device_1 = __webpack_require__(67);
exports.Device = Device_1.Device;
exports.detectDevice = Device_1.detectDevice;
const types = __webpack_require__(321);
exports.types = types;
/**
 * Expose mediasoup-client version.
 */
exports.version = '3.6.27';
/**
 * Expose parseScalabilityMode() function.
 */
var scalabilityModes_1 = __webpack_require__(43);
exports.parseScalabilityMode = scalabilityModes_1.parse;


/***/ }),
/* 91 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
/*
 *  Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
 *
 *  Use of this source code is governed by a BSD-style license
 *  that can be found in the LICENSE file in the root of the source
 *  tree.
 */
 /* eslint-env node */


var SDPUtils = __webpack_require__(28);

function fixStatsType(stat) {
  return {
    inboundrtp: 'inbound-rtp',
    outboundrtp: 'outbound-rtp',
    candidatepair: 'candidate-pair',
    localcandidate: 'local-candidate',
    remotecandidate: 'remote-candidate'
  }[stat.type] || stat.type;
}

function writeMediaSection(transceiver, caps, type, stream, dtlsRole) {
  var sdp = SDPUtils.writeRtpDescription(transceiver.kind, caps);

  // Map ICE parameters (ufrag, pwd) to SDP.
  sdp += SDPUtils.writeIceParameters(
      transceiver.iceGatherer.getLocalParameters());

  // Map DTLS parameters to SDP.
  sdp += SDPUtils.writeDtlsParameters(
      transceiver.dtlsTransport.getLocalParameters(),
      type === 'offer' ? 'actpass' : dtlsRole || 'active');

  sdp += 'a=mid:' + transceiver.mid + '\r\n';

  if (transceiver.rtpSender && transceiver.rtpReceiver) {
    sdp += 'a=sendrecv\r\n';
  } else if (transceiver.rtpSender) {
    sdp += 'a=sendonly\r\n';
  } else if (transceiver.rtpReceiver) {
    sdp += 'a=recvonly\r\n';
  } else {
    sdp += 'a=inactive\r\n';
  }

  if (transceiver.rtpSender) {
    var trackId = transceiver.rtpSender._initialTrackId ||
        transceiver.rtpSender.track.id;
    transceiver.rtpSender._initialTrackId = trackId;
    // spec.
    var msid = 'msid:' + (stream ? stream.id : '-') + ' ' +
        trackId + '\r\n';
    sdp += 'a=' + msid;
    // for Chrome. Legacy should no longer be required.
    sdp += 'a=ssrc:' + transceiver.sendEncodingParameters[0].ssrc +
        ' ' + msid;

    // RTX
    if (transceiver.sendEncodingParameters[0].rtx) {
      sdp += 'a=ssrc:' + transceiver.sendEncodingParameters[0].rtx.ssrc +
          ' ' + msid;
      sdp += 'a=ssrc-group:FID ' +
          transceiver.sendEncodingParameters[0].ssrc + ' ' +
          transceiver.sendEncodingParameters[0].rtx.ssrc +
          '\r\n';
    }
  }
  // FIXME: this should be written by writeRtpDescription.
  sdp += 'a=ssrc:' + transceiver.sendEncodingParameters[0].ssrc +
      ' cname:' + SDPUtils.localCName + '\r\n';
  if (transceiver.rtpSender && transceiver.sendEncodingParameters[0].rtx) {
    sdp += 'a=ssrc:' + transceiver.sendEncodingParameters[0].rtx.ssrc +
        ' cname:' + SDPUtils.localCName + '\r\n';
  }
  return sdp;
}

// Edge does not like
// 1) stun: filtered after 14393 unless ?transport=udp is present
// 2) turn: that does not have all of turn:host:port?transport=udp
// 3) turn: with ipv6 addresses
// 4) turn: occurring muliple times
function filterIceServers(iceServers, edgeVersion) {
  var hasTurn = false;
  iceServers = JSON.parse(JSON.stringify(iceServers));
  return iceServers.filter(function(server) {
    if (server && (server.urls || server.url)) {
      var urls = server.urls || server.url;
      if (server.url && !server.urls) {
        console.warn('RTCIceServer.url is deprecated! Use urls instead.');
      }
      var isString = typeof urls === 'string';
      if (isString) {
        urls = [urls];
      }
      urls = urls.filter(function(url) {
        var validTurn = url.indexOf('turn:') === 0 &&
            url.indexOf('transport=udp') !== -1 &&
            url.indexOf('turn:[') === -1 &&
            !hasTurn;

        if (validTurn) {
          hasTurn = true;
          return true;
        }
        return url.indexOf('stun:') === 0 && edgeVersion >= 14393 &&
            url.indexOf('?transport=udp') === -1;
      });

      delete server.url;
      server.urls = isString ? urls[0] : urls;
      return !!urls.length;
    }
  });
}

// Determines the intersection of local and remote capabilities.
function getCommonCapabilities(localCapabilities, remoteCapabilities) {
  var commonCapabilities = {
    codecs: [],
    headerExtensions: [],
    fecMechanisms: []
  };

  var findCodecByPayloadType = function(pt, codecs) {
    pt = parseInt(pt, 10);
    for (var i = 0; i < codecs.length; i++) {
      if (codecs[i].payloadType === pt ||
          codecs[i].preferredPayloadType === pt) {
        return codecs[i];
      }
    }
  };

  var rtxCapabilityMatches = function(lRtx, rRtx, lCodecs, rCodecs) {
    var lCodec = findCodecByPayloadType(lRtx.parameters.apt, lCodecs);
    var rCodec = findCodecByPayloadType(rRtx.parameters.apt, rCodecs);
    return lCodec && rCodec &&
        lCodec.name.toLowerCase() === rCodec.name.toLowerCase();
  };

  localCapabilities.codecs.forEach(function(lCodec) {
    for (var i = 0; i < remoteCapabilities.codecs.length; i++) {
      var rCodec = remoteCapabilities.codecs[i];
      if (lCodec.name.toLowerCase() === rCodec.name.toLowerCase() &&
          lCodec.clockRate === rCodec.clockRate) {
        if (lCodec.name.toLowerCase() === 'rtx' &&
            lCodec.parameters && rCodec.parameters.apt) {
          // for RTX we need to find the local rtx that has a apt
          // which points to the same local codec as the remote one.
          if (!rtxCapabilityMatches(lCodec, rCodec,
              localCapabilities.codecs, remoteCapabilities.codecs)) {
            continue;
          }
        }
        rCodec = JSON.parse(JSON.stringify(rCodec)); // deepcopy
        // number of channels is the highest common number of channels
        rCodec.numChannels = Math.min(lCodec.numChannels,
            rCodec.numChannels);
        // push rCodec so we reply with offerer payload type
        commonCapabilities.codecs.push(rCodec);

        // determine common feedback mechanisms
        rCodec.rtcpFeedback = rCodec.rtcpFeedback.filter(function(fb) {
          for (var j = 0; j < lCodec.rtcpFeedback.length; j++) {
            if (lCodec.rtcpFeedback[j].type === fb.type &&
                lCodec.rtcpFeedback[j].parameter === fb.parameter) {
              return true;
            }
          }
          return false;
        });
        // FIXME: also need to determine .parameters
        //  see https://github.com/openpeer/ortc/issues/569
        break;
      }
    }
  });

  localCapabilities.headerExtensions.forEach(function(lHeaderExtension) {
    for (var i = 0; i < remoteCapabilities.headerExtensions.length;
         i++) {
      var rHeaderExtension = remoteCapabilities.headerExtensions[i];
      if (lHeaderExtension.uri === rHeaderExtension.uri) {
        commonCapabilities.headerExtensions.push(rHeaderExtension);
        break;
      }
    }
  });

  // FIXME: fecMechanisms
  return commonCapabilities;
}

// is action=setLocalDescription with type allowed in signalingState
function isActionAllowedInSignalingState(action, type, signalingState) {
  return {
    offer: {
      setLocalDescription: ['stable', 'have-local-offer'],
      setRemoteDescription: ['stable', 'have-remote-offer']
    },
    answer: {
      setLocalDescription: ['have-remote-offer', 'have-local-pranswer'],
      setRemoteDescription: ['have-local-offer', 'have-remote-pranswer']
    }
  }[type][action].indexOf(signalingState) !== -1;
}

function maybeAddCandidate(iceTransport, candidate) {
  // Edge's internal representation adds some fields therefore
  // not all fieldѕ are taken into account.
  var alreadyAdded = iceTransport.getRemoteCandidates()
      .find(function(remoteCandidate) {
        return candidate.foundation === remoteCandidate.foundation &&
            candidate.ip === remoteCandidate.ip &&
            candidate.port === remoteCandidate.port &&
            candidate.priority === remoteCandidate.priority &&
            candidate.protocol === remoteCandidate.protocol &&
            candidate.type === remoteCandidate.type;
      });
  if (!alreadyAdded) {
    iceTransport.addRemoteCandidate(candidate);
  }
  return !alreadyAdded;
}


function makeError(name, description) {
  var e = new Error(description);
  e.name = name;
  // legacy error codes from https://heycam.github.io/webidl/#idl-DOMException-error-names
  e.code = {
    NotSupportedError: 9,
    InvalidStateError: 11,
    InvalidAccessError: 15,
    TypeError: undefined,
    OperationError: undefined
  }[name];
  return e;
}

module.exports = function(window, edgeVersion) {
  // https://w3c.github.io/mediacapture-main/#mediastream
  // Helper function to add the track to the stream and
  // dispatch the event ourselves.
  function addTrackToStreamAndFireEvent(track, stream) {
    stream.addTrack(track);
    stream.dispatchEvent(new window.MediaStreamTrackEvent('addtrack',
        {track: track}));
  }

  function removeTrackFromStreamAndFireEvent(track, stream) {
    stream.removeTrack(track);
    stream.dispatchEvent(new window.MediaStreamTrackEvent('removetrack',
        {track: track}));
  }

  function fireAddTrack(pc, track, receiver, streams) {
    var trackEvent = new Event('track');
    trackEvent.track = track;
    trackEvent.receiver = receiver;
    trackEvent.transceiver = {receiver: receiver};
    trackEvent.streams = streams;
    window.setTimeout(function() {
      pc._dispatchEvent('track', trackEvent);
    });
  }

  var RTCPeerConnection = function(config) {
    var pc = this;

    var _eventTarget = document.createDocumentFragment();
    ['addEventListener', 'removeEventListener', 'dispatchEvent']
        .forEach(function(method) {
          pc[method] = _eventTarget[method].bind(_eventTarget);
        });

    this.canTrickleIceCandidates = null;

    this.needNegotiation = false;

    this.localStreams = [];
    this.remoteStreams = [];

    this._localDescription = null;
    this._remoteDescription = null;

    this.signalingState = 'stable';
    this.iceConnectionState = 'new';
    this.connectionState = 'new';
    this.iceGatheringState = 'new';

    config = JSON.parse(JSON.stringify(config || {}));

    this.usingBundle = config.bundlePolicy === 'max-bundle';
    if (config.rtcpMuxPolicy === 'negotiate') {
      throw(makeError('NotSupportedError',
          'rtcpMuxPolicy \'negotiate\' is not supported'));
    } else if (!config.rtcpMuxPolicy) {
      config.rtcpMuxPolicy = 'require';
    }

    switch (config.iceTransportPolicy) {
      case 'all':
      case 'relay':
        break;
      default:
        config.iceTransportPolicy = 'all';
        break;
    }

    switch (config.bundlePolicy) {
      case 'balanced':
      case 'max-compat':
      case 'max-bundle':
        break;
      default:
        config.bundlePolicy = 'balanced';
        break;
    }

    config.iceServers = filterIceServers(config.iceServers || [], edgeVersion);

    this._iceGatherers = [];
    if (config.iceCandidatePoolSize) {
      for (var i = config.iceCandidatePoolSize; i > 0; i--) {
        this._iceGatherers.push(new window.RTCIceGatherer({
          iceServers: config.iceServers,
          gatherPolicy: config.iceTransportPolicy
        }));
      }
    } else {
      config.iceCandidatePoolSize = 0;
    }

    this._config = config;

    // per-track iceGathers, iceTransports, dtlsTransports, rtpSenders, ...
    // everything that is needed to describe a SDP m-line.
    this.transceivers = [];

    this._sdpSessionId = SDPUtils.generateSessionId();
    this._sdpSessionVersion = 0;

    this._dtlsRole = undefined; // role for a=setup to use in answers.

    this._isClosed = false;
  };

  Object.defineProperty(RTCPeerConnection.prototype, 'localDescription', {
    configurable: true,
    get: function() {
      return this._localDescription;
    }
  });
  Object.defineProperty(RTCPeerConnection.prototype, 'remoteDescription', {
    configurable: true,
    get: function() {
      return this._remoteDescription;
    }
  });

  // set up event handlers on prototype
  RTCPeerConnection.prototype.onicecandidate = null;
  RTCPeerConnection.prototype.onaddstream = null;
  RTCPeerConnection.prototype.ontrack = null;
  RTCPeerConnection.prototype.onremovestream = null;
  RTCPeerConnection.prototype.onsignalingstatechange = null;
  RTCPeerConnection.prototype.oniceconnectionstatechange = null;
  RTCPeerConnection.prototype.onconnectionstatechange = null;
  RTCPeerConnection.prototype.onicegatheringstatechange = null;
  RTCPeerConnection.prototype.onnegotiationneeded = null;
  RTCPeerConnection.prototype.ondatachannel = null;

  RTCPeerConnection.prototype._dispatchEvent = function(name, event) {
    if (this._isClosed) {
      return;
    }
    this.dispatchEvent(event);
    if (typeof this['on' + name] === 'function') {
      this['on' + name](event);
    }
  };

  RTCPeerConnection.prototype._emitGatheringStateChange = function() {
    var event = new Event('icegatheringstatechange');
    this._dispatchEvent('icegatheringstatechange', event);
  };

  RTCPeerConnection.prototype.getConfiguration = function() {
    return this._config;
  };

  RTCPeerConnection.prototype.getLocalStreams = function() {
    return this.localStreams;
  };

  RTCPeerConnection.prototype.getRemoteStreams = function() {
    return this.remoteStreams;
  };

  // internal helper to create a transceiver object.
  // (which is not yet the same as the WebRTC 1.0 transceiver)
  RTCPeerConnection.prototype._createTransceiver = function(kind, doNotAdd) {
    var hasBundleTransport = this.transceivers.length > 0;
    var transceiver = {
      track: null,
      iceGatherer: null,
      iceTransport: null,
      dtlsTransport: null,
      localCapabilities: null,
      remoteCapabilities: null,
      rtpSender: null,
      rtpReceiver: null,
      kind: kind,
      mid: null,
      sendEncodingParameters: null,
      recvEncodingParameters: null,
      stream: null,
      associatedRemoteMediaStreams: [],
      wantReceive: true
    };
    if (this.usingBundle && hasBundleTransport) {
      transceiver.iceTransport = this.transceivers[0].iceTransport;
      transceiver.dtlsTransport = this.transceivers[0].dtlsTransport;
    } else {
      var transports = this._createIceAndDtlsTransports();
      transceiver.iceTransport = transports.iceTransport;
      transceiver.dtlsTransport = transports.dtlsTransport;
    }
    if (!doNotAdd) {
      this.transceivers.push(transceiver);
    }
    return transceiver;
  };

  RTCPeerConnection.prototype.addTrack = function(track, stream) {
    if (this._isClosed) {
      throw makeError('InvalidStateError',
          'Attempted to call addTrack on a closed peerconnection.');
    }

    var alreadyExists = this.transceivers.find(function(s) {
      return s.track === track;
    });

    if (alreadyExists) {
      throw makeError('InvalidAccessError', 'Track already exists.');
    }

    var transceiver;
    for (var i = 0; i < this.transceivers.length; i++) {
      if (!this.transceivers[i].track &&
          this.transceivers[i].kind === track.kind) {
        transceiver = this.transceivers[i];
      }
    }
    if (!transceiver) {
      transceiver = this._createTransceiver(track.kind);
    }

    this._maybeFireNegotiationNeeded();

    if (this.localStreams.indexOf(stream) === -1) {
      this.localStreams.push(stream);
    }

    transceiver.track = track;
    transceiver.stream = stream;
    transceiver.rtpSender = new window.RTCRtpSender(track,
        transceiver.dtlsTransport);
    return transceiver.rtpSender;
  };

  RTCPeerConnection.prototype.addStream = function(stream) {
    var pc = this;
    if (edgeVersion >= 15025) {
      stream.getTracks().forEach(function(track) {
        pc.addTrack(track, stream);
      });
    } else {
      // Clone is necessary for local demos mostly, attaching directly
      // to two different senders does not work (build 10547).
      // Fixed in 15025 (or earlier)
      var clonedStream = stream.clone();
      stream.getTracks().forEach(function(track, idx) {
        var clonedTrack = clonedStream.getTracks()[idx];
        track.addEventListener('enabled', function(event) {
          clonedTrack.enabled = event.enabled;
        });
      });
      clonedStream.getTracks().forEach(function(track) {
        pc.addTrack(track, clonedStream);
      });
    }
  };

  RTCPeerConnection.prototype.removeTrack = function(sender) {
    if (this._isClosed) {
      throw makeError('InvalidStateError',
          'Attempted to call removeTrack on a closed peerconnection.');
    }

    if (!(sender instanceof window.RTCRtpSender)) {
      throw new TypeError('Argument 1 of RTCPeerConnection.removeTrack ' +
          'does not implement interface RTCRtpSender.');
    }

    var transceiver = this.transceivers.find(function(t) {
      return t.rtpSender === sender;
    });

    if (!transceiver) {
      throw makeError('InvalidAccessError',
          'Sender was not created by this connection.');
    }
    var stream = transceiver.stream;

    transceiver.rtpSender.stop();
    transceiver.rtpSender = null;
    transceiver.track = null;
    transceiver.stream = null;

    // remove the stream from the set of local streams
    var localStreams = this.transceivers.map(function(t) {
      return t.stream;
    });
    if (localStreams.indexOf(stream) === -1 &&
        this.localStreams.indexOf(stream) > -1) {
      this.localStreams.splice(this.localStreams.indexOf(stream), 1);
    }

    this._maybeFireNegotiationNeeded();
  };

  RTCPeerConnection.prototype.removeStream = function(stream) {
    var pc = this;
    stream.getTracks().forEach(function(track) {
      var sender = pc.getSenders().find(function(s) {
        return s.track === track;
      });
      if (sender) {
        pc.removeTrack(sender);
      }
    });
  };

  RTCPeerConnection.prototype.getSenders = function() {
    return this.transceivers.filter(function(transceiver) {
      return !!transceiver.rtpSender;
    })
    .map(function(transceiver) {
      return transceiver.rtpSender;
    });
  };

  RTCPeerConnection.prototype.getReceivers = function() {
    return this.transceivers.filter(function(transceiver) {
      return !!transceiver.rtpReceiver;
    })
    .map(function(transceiver) {
      return transceiver.rtpReceiver;
    });
  };


  RTCPeerConnection.prototype._createIceGatherer = function(sdpMLineIndex,
      usingBundle) {
    var pc = this;
    if (usingBundle && sdpMLineIndex > 0) {
      return this.transceivers[0].iceGatherer;
    } else if (this._iceGatherers.length) {
      return this._iceGatherers.shift();
    }
    var iceGatherer = new window.RTCIceGatherer({
      iceServers: this._config.iceServers,
      gatherPolicy: this._config.iceTransportPolicy
    });
    Object.defineProperty(iceGatherer, 'state',
        {value: 'new', writable: true}
    );

    this.transceivers[sdpMLineIndex].bufferedCandidateEvents = [];
    this.transceivers[sdpMLineIndex].bufferCandidates = function(event) {
      var end = !event.candidate || Object.keys(event.candidate).length === 0;
      // polyfill since RTCIceGatherer.state is not implemented in
      // Edge 10547 yet.
      iceGatherer.state = end ? 'completed' : 'gathering';
      if (pc.transceivers[sdpMLineIndex].bufferedCandidateEvents !== null) {
        pc.transceivers[sdpMLineIndex].bufferedCandidateEvents.push(event);
      }
    };
    iceGatherer.addEventListener('localcandidate',
      this.transceivers[sdpMLineIndex].bufferCandidates);
    return iceGatherer;
  };

  // start gathering from an RTCIceGatherer.
  RTCPeerConnection.prototype._gather = function(mid, sdpMLineIndex) {
    var pc = this;
    var iceGatherer = this.transceivers[sdpMLineIndex].iceGatherer;
    if (iceGatherer.onlocalcandidate) {
      return;
    }
    var bufferedCandidateEvents =
      this.transceivers[sdpMLineIndex].bufferedCandidateEvents;
    this.transceivers[sdpMLineIndex].bufferedCandidateEvents = null;
    iceGatherer.removeEventListener('localcandidate',
      this.transceivers[sdpMLineIndex].bufferCandidates);
    iceGatherer.onlocalcandidate = function(evt) {
      if (pc.usingBundle && sdpMLineIndex > 0) {
        // if we know that we use bundle we can drop candidates with
        // ѕdpMLineIndex > 0. If we don't do this then our state gets
        // confused since we dispose the extra ice gatherer.
        return;
      }
      var event = new Event('icecandidate');
      event.candidate = {sdpMid: mid, sdpMLineIndex: sdpMLineIndex};

      var cand = evt.candidate;
      // Edge emits an empty object for RTCIceCandidateComplete‥
      var end = !cand || Object.keys(cand).length === 0;
      if (end) {
        // polyfill since RTCIceGatherer.state is not implemented in
        // Edge 10547 yet.
        if (iceGatherer.state === 'new' || iceGatherer.state === 'gathering') {
          iceGatherer.state = 'completed';
        }
      } else {
        if (iceGatherer.state === 'new') {
          iceGatherer.state = 'gathering';
        }
        // RTCIceCandidate doesn't have a component, needs to be added
        cand.component = 1;
        // also the usernameFragment. TODO: update SDP to take both variants.
        cand.ufrag = iceGatherer.getLocalParameters().usernameFragment;

        var serializedCandidate = SDPUtils.writeCandidate(cand);
        event.candidate = Object.assign(event.candidate,
            SDPUtils.parseCandidate(serializedCandidate));

        event.candidate.candidate = serializedCandidate;
        event.candidate.toJSON = function() {
          return {
            candidate: event.candidate.candidate,
            sdpMid: event.candidate.sdpMid,
            sdpMLineIndex: event.candidate.sdpMLineIndex,
            usernameFragment: event.candidate.usernameFragment
          };
        };
      }

      // update local description.
      var sections = SDPUtils.getMediaSections(pc._localDescription.sdp);
      if (!end) {
        sections[event.candidate.sdpMLineIndex] +=
            'a=' + event.candidate.candidate + '\r\n';
      } else {
        sections[event.candidate.sdpMLineIndex] +=
            'a=end-of-candidates\r\n';
      }
      pc._localDescription.sdp =
          SDPUtils.getDescription(pc._localDescription.sdp) +
          sections.join('');
      var complete = pc.transceivers.every(function(transceiver) {
        return transceiver.iceGatherer &&
            transceiver.iceGatherer.state === 'completed';
      });

      if (pc.iceGatheringState !== 'gathering') {
        pc.iceGatheringState = 'gathering';
        pc._emitGatheringStateChange();
      }

      // Emit candidate. Also emit null candidate when all gatherers are
      // complete.
      if (!end) {
        pc._dispatchEvent('icecandidate', event);
      }
      if (complete) {
        pc._dispatchEvent('icecandidate', new Event('icecandidate'));
        pc.iceGatheringState = 'complete';
        pc._emitGatheringStateChange();
      }
    };

    // emit already gathered candidates.
    window.setTimeout(function() {
      bufferedCandidateEvents.forEach(function(e) {
        iceGatherer.onlocalcandidate(e);
      });
    }, 0);
  };

  // Create ICE transport and DTLS transport.
  RTCPeerConnection.prototype._createIceAndDtlsTransports = function() {
    var pc = this;
    var iceTransport = new window.RTCIceTransport(null);
    iceTransport.onicestatechange = function() {
      pc._updateIceConnectionState();
      pc._updateConnectionState();
    };

    var dtlsTransport = new window.RTCDtlsTransport(iceTransport);
    dtlsTransport.ondtlsstatechange = function() {
      pc._updateConnectionState();
    };
    dtlsTransport.onerror = function() {
      // onerror does not set state to failed by itself.
      Object.defineProperty(dtlsTransport, 'state',
          {value: 'failed', writable: true});
      pc._updateConnectionState();
    };

    return {
      iceTransport: iceTransport,
      dtlsTransport: dtlsTransport
    };
  };

  // Destroy ICE gatherer, ICE transport and DTLS transport.
  // Without triggering the callbacks.
  RTCPeerConnection.prototype._disposeIceAndDtlsTransports = function(
      sdpMLineIndex) {
    var iceGatherer = this.transceivers[sdpMLineIndex].iceGatherer;
    if (iceGatherer) {
      delete iceGatherer.onlocalcandidate;
      delete this.transceivers[sdpMLineIndex].iceGatherer;
    }
    var iceTransport = this.transceivers[sdpMLineIndex].iceTransport;
    if (iceTransport) {
      delete iceTransport.onicestatechange;
      delete this.transceivers[sdpMLineIndex].iceTransport;
    }
    var dtlsTransport = this.transceivers[sdpMLineIndex].dtlsTransport;
    if (dtlsTransport) {
      delete dtlsTransport.ondtlsstatechange;
      delete dtlsTransport.onerror;
      delete this.transceivers[sdpMLineIndex].dtlsTransport;
    }
  };

  // Start the RTP Sender and Receiver for a transceiver.
  RTCPeerConnection.prototype._transceive = function(transceiver,
      send, recv) {
    var params = getCommonCapabilities(transceiver.localCapabilities,
        transceiver.remoteCapabilities);
    if (send && transceiver.rtpSender) {
      params.encodings = transceiver.sendEncodingParameters;
      params.rtcp = {
        cname: SDPUtils.localCName,
        compound: transceiver.rtcpParameters.compound
      };
      if (transceiver.recvEncodingParameters.length) {
        params.rtcp.ssrc = transceiver.recvEncodingParameters[0].ssrc;
      }
      transceiver.rtpSender.send(params);
    }
    if (recv && transceiver.rtpReceiver && params.codecs.length > 0) {
      // remove RTX field in Edge 14942
      if (transceiver.kind === 'video'
          && transceiver.recvEncodingParameters
          && edgeVersion < 15019) {
        transceiver.recvEncodingParameters.forEach(function(p) {
          delete p.rtx;
        });
      }
      if (transceiver.recvEncodingParameters.length) {
        params.encodings = transceiver.recvEncodingParameters;
      } else {
        params.encodings = [{}];
      }
      params.rtcp = {
        compound: transceiver.rtcpParameters.compound
      };
      if (transceiver.rtcpParameters.cname) {
        params.rtcp.cname = transceiver.rtcpParameters.cname;
      }
      if (transceiver.sendEncodingParameters.length) {
        params.rtcp.ssrc = transceiver.sendEncodingParameters[0].ssrc;
      }
      transceiver.rtpReceiver.receive(params);
    }
  };

  RTCPeerConnection.prototype.setLocalDescription = function(description) {
    var pc = this;

    // Note: pranswer is not supported.
    if (['offer', 'answer'].indexOf(description.type) === -1) {
      return Promise.reject(makeError('TypeError',
          'Unsupported type "' + description.type + '"'));
    }

    if (!isActionAllowedInSignalingState('setLocalDescription',
        description.type, pc.signalingState) || pc._isClosed) {
      return Promise.reject(makeError('InvalidStateError',
          'Can not set local ' + description.type +
          ' in state ' + pc.signalingState));
    }

    var sections;
    var sessionpart;
    if (description.type === 'offer') {
      // VERY limited support for SDP munging. Limited to:
      // * changing the order of codecs
      sections = SDPUtils.splitSections(description.sdp);
      sessionpart = sections.shift();
      sections.forEach(function(mediaSection, sdpMLineIndex) {
        var caps = SDPUtils.parseRtpParameters(mediaSection);
        pc.transceivers[sdpMLineIndex].localCapabilities = caps;
      });

      pc.transceivers.forEach(function(transceiver, sdpMLineIndex) {
        pc._gather(transceiver.mid, sdpMLineIndex);
      });
    } else if (description.type === 'answer') {
      sections = SDPUtils.splitSections(pc._remoteDescription.sdp);
      sessionpart = sections.shift();
      var isIceLite = SDPUtils.matchPrefix(sessionpart,
          'a=ice-lite').length > 0;
      sections.forEach(function(mediaSection, sdpMLineIndex) {
        var transceiver = pc.transceivers[sdpMLineIndex];
        var iceGatherer = transceiver.iceGatherer;
        var iceTransport = transceiver.iceTransport;
        var dtlsTransport = transceiver.dtlsTransport;
        var localCapabilities = transceiver.localCapabilities;
        var remoteCapabilities = transceiver.remoteCapabilities;

        // treat bundle-only as not-rejected.
        var rejected = SDPUtils.isRejected(mediaSection) &&
            SDPUtils.matchPrefix(mediaSection, 'a=bundle-only').length === 0;

        if (!rejected && !transceiver.rejected) {
          var remoteIceParameters = SDPUtils.getIceParameters(
              mediaSection, sessionpart);
          var remoteDtlsParameters = SDPUtils.getDtlsParameters(
              mediaSection, sessionpart);
          if (isIceLite) {
            remoteDtlsParameters.role = 'server';
          }

          if (!pc.usingBundle || sdpMLineIndex === 0) {
            pc._gather(transceiver.mid, sdpMLineIndex);
            if (iceTransport.state === 'new') {
              iceTransport.start(iceGatherer, remoteIceParameters,
                  isIceLite ? 'controlling' : 'controlled');
            }
            if (dtlsTransport.state === 'new') {
              dtlsTransport.start(remoteDtlsParameters);
            }
          }

          // Calculate intersection of capabilities.
          var params = getCommonCapabilities(localCapabilities,
              remoteCapabilities);

          // Start the RTCRtpSender. The RTCRtpReceiver for this
          // transceiver has already been started in setRemoteDescription.
          pc._transceive(transceiver,
              params.codecs.length > 0,
              false);
        }
      });
    }

    pc._localDescription = {
      type: description.type,
      sdp: description.sdp
    };
    if (description.type === 'offer') {
      pc._updateSignalingState('have-local-offer');
    } else {
      pc._updateSignalingState('stable');
    }

    return Promise.resolve();
  };

  RTCPeerConnection.prototype.setRemoteDescription = function(description) {
    var pc = this;

    // Note: pranswer is not supported.
    if (['offer', 'answer'].indexOf(description.type) === -1) {
      return Promise.reject(makeError('TypeError',
          'Unsupported type "' + description.type + '"'));
    }

    if (!isActionAllowedInSignalingState('setRemoteDescription',
        description.type, pc.signalingState) || pc._isClosed) {
      return Promise.reject(makeError('InvalidStateError',
          'Can not set remote ' + description.type +
          ' in state ' + pc.signalingState));
    }

    var streams = {};
    pc.remoteStreams.forEach(function(stream) {
      streams[stream.id] = stream;
    });
    var receiverList = [];
    var sections = SDPUtils.splitSections(description.sdp);
    var sessionpart = sections.shift();
    var isIceLite = SDPUtils.matchPrefix(sessionpart,
        'a=ice-lite').length > 0;
    var usingBundle = SDPUtils.matchPrefix(sessionpart,
        'a=group:BUNDLE ').length > 0;
    pc.usingBundle = usingBundle;
    var iceOptions = SDPUtils.matchPrefix(sessionpart,
        'a=ice-options:')[0];
    if (iceOptions) {
      pc.canTrickleIceCandidates = iceOptions.substr(14).split(' ')
          .indexOf('trickle') >= 0;
    } else {
      pc.canTrickleIceCandidates = false;
    }

    sections.forEach(function(mediaSection, sdpMLineIndex) {
      var lines = SDPUtils.splitLines(mediaSection);
      var kind = SDPUtils.getKind(mediaSection);
      // treat bundle-only as not-rejected.
      var rejected = SDPUtils.isRejected(mediaSection) &&
          SDPUtils.matchPrefix(mediaSection, 'a=bundle-only').length === 0;
      var protocol = lines[0].substr(2).split(' ')[2];

      var direction = SDPUtils.getDirection(mediaSection, sessionpart);
      var remoteMsid = SDPUtils.parseMsid(mediaSection);

      var mid = SDPUtils.getMid(mediaSection) || SDPUtils.generateIdentifier();

      // Reject datachannels which are not implemented yet.
      if (rejected || (kind === 'application' && (protocol === 'DTLS/SCTP' ||
          protocol === 'UDP/DTLS/SCTP'))) {
        // TODO: this is dangerous in the case where a non-rejected m-line
        //     becomes rejected.
        pc.transceivers[sdpMLineIndex] = {
          mid: mid,
          kind: kind,
          protocol: protocol,
          rejected: true
        };
        return;
      }

      if (!rejected && pc.transceivers[sdpMLineIndex] &&
          pc.transceivers[sdpMLineIndex].rejected) {
        // recycle a rejected transceiver.
        pc.transceivers[sdpMLineIndex] = pc._createTransceiver(kind, true);
      }

      var transceiver;
      var iceGatherer;
      var iceTransport;
      var dtlsTransport;
      var rtpReceiver;
      var sendEncodingParameters;
      var recvEncodingParameters;
      var localCapabilities;

      var track;
      // FIXME: ensure the mediaSection has rtcp-mux set.
      var remoteCapabilities = SDPUtils.parseRtpParameters(mediaSection);
      var remoteIceParameters;
      var remoteDtlsParameters;
      if (!rejected) {
        remoteIceParameters = SDPUtils.getIceParameters(mediaSection,
            sessionpart);
        remoteDtlsParameters = SDPUtils.getDtlsParameters(mediaSection,
            sessionpart);
        remoteDtlsParameters.role = 'client';
      }
      recvEncodingParameters =
          SDPUtils.parseRtpEncodingParameters(mediaSection);

      var rtcpParameters = SDPUtils.parseRtcpParameters(mediaSection);

      var isComplete = SDPUtils.matchPrefix(mediaSection,
          'a=end-of-candidates', sessionpart).length > 0;
      var cands = SDPUtils.matchPrefix(mediaSection, 'a=candidate:')
          .map(function(cand) {
            return SDPUtils.parseCandidate(cand);
          })
          .filter(function(cand) {
            return cand.component === 1;
          });

      // Check if we can use BUNDLE and dispose transports.
      if ((description.type === 'offer' || description.type === 'answer') &&
          !rejected && usingBundle && sdpMLineIndex > 0 &&
          pc.transceivers[sdpMLineIndex]) {
        pc._disposeIceAndDtlsTransports(sdpMLineIndex);
        pc.transceivers[sdpMLineIndex].iceGatherer =
            pc.transceivers[0].iceGatherer;
        pc.transceivers[sdpMLineIndex].iceTransport =
            pc.transceivers[0].iceTransport;
        pc.transceivers[sdpMLineIndex].dtlsTransport =
            pc.transceivers[0].dtlsTransport;
        if (pc.transceivers[sdpMLineIndex].rtpSender) {
          pc.transceivers[sdpMLineIndex].rtpSender.setTransport(
              pc.transceivers[0].dtlsTransport);
        }
        if (pc.transceivers[sdpMLineIndex].rtpReceiver) {
          pc.transceivers[sdpMLineIndex].rtpReceiver.setTransport(
              pc.transceivers[0].dtlsTransport);
        }
      }
      if (description.type === 'offer' && !rejected) {
        transceiver = pc.transceivers[sdpMLineIndex] ||
            pc._createTransceiver(kind);
        transceiver.mid = mid;

        if (!transceiver.iceGatherer) {
          transceiver.iceGatherer = pc._createIceGatherer(sdpMLineIndex,
              usingBundle);
        }

        if (cands.length && transceiver.iceTransport.state === 'new') {
          if (isComplete && (!usingBundle || sdpMLineIndex === 0)) {
            transceiver.iceTransport.setRemoteCandidates(cands);
          } else {
            cands.forEach(function(candidate) {
              maybeAddCandidate(transceiver.iceTransport, candidate);
            });
          }
        }

        localCapabilities = window.RTCRtpReceiver.getCapabilities(kind);

        // filter RTX until additional stuff needed for RTX is implemented
        // in adapter.js
        if (edgeVersion < 15019) {
          localCapabilities.codecs = localCapabilities.codecs.filter(
              function(codec) {
                return codec.name !== 'rtx';
              });
        }

        sendEncodingParameters = transceiver.sendEncodingParameters || [{
          ssrc: (2 * sdpMLineIndex + 2) * 1001
        }];

        // TODO: rewrite to use http://w3c.github.io/webrtc-pc/#set-associated-remote-streams
        var isNewTrack = false;
        if (direction === 'sendrecv' || direction === 'sendonly') {
          isNewTrack = !transceiver.rtpReceiver;
          rtpReceiver = transceiver.rtpReceiver ||
              new window.RTCRtpReceiver(transceiver.dtlsTransport, kind);

          if (isNewTrack) {
            var stream;
            track = rtpReceiver.track;
            // FIXME: does not work with Plan B.
            if (remoteMsid && remoteMsid.stream === '-') {
              // no-op. a stream id of '-' means: no associated stream.
            } else if (remoteMsid) {
              if (!streams[remoteMsid.stream]) {
                streams[remoteMsid.stream] = new window.MediaStream();
                Object.defineProperty(streams[remoteMsid.stream], 'id', {
                  get: function() {
                    return remoteMsid.stream;
                  }
                });
              }
              Object.defineProperty(track, 'id', {
                get: function() {
                  return remoteMsid.track;
                }
              });
              stream = streams[remoteMsid.stream];
            } else {
              if (!streams.default) {
                streams.default = new window.MediaStream();
              }
              stream = streams.default;
            }
            if (stream) {
              addTrackToStreamAndFireEvent(track, stream);
              transceiver.associatedRemoteMediaStreams.push(stream);
            }
            receiverList.push([track, rtpReceiver, stream]);
          }
        } else if (transceiver.rtpReceiver && transceiver.rtpReceiver.track) {
          transceiver.associatedRemoteMediaStreams.forEach(function(s) {
            var nativeTrack = s.getTracks().find(function(t) {
              return t.id === transceiver.rtpReceiver.track.id;
            });
            if (nativeTrack) {
              removeTrackFromStreamAndFireEvent(nativeTrack, s);
            }
          });
          transceiver.associatedRemoteMediaStreams = [];
        }

        transceiver.localCapabilities = localCapabilities;
        transceiver.remoteCapabilities = remoteCapabilities;
        transceiver.rtpReceiver = rtpReceiver;
        transceiver.rtcpParameters = rtcpParameters;
        transceiver.sendEncodingParameters = sendEncodingParameters;
        transceiver.recvEncodingParameters = recvEncodingParameters;

        // Start the RTCRtpReceiver now. The RTPSender is started in
        // setLocalDescription.
        pc._transceive(pc.transceivers[sdpMLineIndex],
            false,
            isNewTrack);
      } else if (description.type === 'answer' && !rejected) {
        transceiver = pc.transceivers[sdpMLineIndex];
        iceGatherer = transceiver.iceGatherer;
        iceTransport = transceiver.iceTransport;
        dtlsTransport = transceiver.dtlsTransport;
        rtpReceiver = transceiver.rtpReceiver;
        sendEncodingParameters = transceiver.sendEncodingParameters;
        localCapabilities = transceiver.localCapabilities;

        pc.transceivers[sdpMLineIndex].recvEncodingParameters =
            recvEncodingParameters;
        pc.transceivers[sdpMLineIndex].remoteCapabilities =
            remoteCapabilities;
        pc.transceivers[sdpMLineIndex].rtcpParameters = rtcpParameters;

        if (cands.length && iceTransport.state === 'new') {
          if ((isIceLite || isComplete) &&
              (!usingBundle || sdpMLineIndex === 0)) {
            iceTransport.setRemoteCandidates(cands);
          } else {
            cands.forEach(function(candidate) {
              maybeAddCandidate(transceiver.iceTransport, candidate);
            });
          }
        }

        if (!usingBundle || sdpMLineIndex === 0) {
          if (iceTransport.state === 'new') {
            iceTransport.start(iceGatherer, remoteIceParameters,
                'controlling');
          }
          if (dtlsTransport.state === 'new') {
            dtlsTransport.start(remoteDtlsParameters);
          }
        }

        // If the offer contained RTX but the answer did not,
        // remove RTX from sendEncodingParameters.
        var commonCapabilities = getCommonCapabilities(
          transceiver.localCapabilities,
          transceiver.remoteCapabilities);

        var hasRtx = commonCapabilities.codecs.filter(function(c) {
          return c.name.toLowerCase() === 'rtx';
        }).length;
        if (!hasRtx && transceiver.sendEncodingParameters[0].rtx) {
          delete transceiver.sendEncodingParameters[0].rtx;
        }

        pc._transceive(transceiver,
            direction === 'sendrecv' || direction === 'recvonly',
            direction === 'sendrecv' || direction === 'sendonly');

        // TODO: rewrite to use http://w3c.github.io/webrtc-pc/#set-associated-remote-streams
        if (rtpReceiver &&
            (direction === 'sendrecv' || direction === 'sendonly')) {
          track = rtpReceiver.track;
          if (remoteMsid) {
            if (!streams[remoteMsid.stream]) {
              streams[remoteMsid.stream] = new window.MediaStream();
            }
            addTrackToStreamAndFireEvent(track, streams[remoteMsid.stream]);
            receiverList.push([track, rtpReceiver, streams[remoteMsid.stream]]);
          } else {
            if (!streams.default) {
              streams.default = new window.MediaStream();
            }
            addTrackToStreamAndFireEvent(track, streams.default);
            receiverList.push([track, rtpReceiver, streams.default]);
          }
        } else {
          // FIXME: actually the receiver should be created later.
          delete transceiver.rtpReceiver;
        }
      }
    });

    if (pc._dtlsRole === undefined) {
      pc._dtlsRole = description.type === 'offer' ? 'active' : 'passive';
    }

    pc._remoteDescription = {
      type: description.type,
      sdp: description.sdp
    };
    if (description.type === 'offer') {
      pc._updateSignalingState('have-remote-offer');
    } else {
      pc._updateSignalingState('stable');
    }
    Object.keys(streams).forEach(function(sid) {
      var stream = streams[sid];
      if (stream.getTracks().length) {
        if (pc.remoteStreams.indexOf(stream) === -1) {
          pc.remoteStreams.push(stream);
          var event = new Event('addstream');
          event.stream = stream;
          window.setTimeout(function() {
            pc._dispatchEvent('addstream', event);
          });
        }

        receiverList.forEach(function(item) {
          var track = item[0];
          var receiver = item[1];
          if (stream.id !== item[2].id) {
            return;
          }
          fireAddTrack(pc, track, receiver, [stream]);
        });
      }
    });
    receiverList.forEach(function(item) {
      if (item[2]) {
        return;
      }
      fireAddTrack(pc, item[0], item[1], []);
    });

    // check whether addIceCandidate({}) was called within four seconds after
    // setRemoteDescription.
    window.setTimeout(function() {
      if (!(pc && pc.transceivers)) {
        return;
      }
      pc.transceivers.forEach(function(transceiver) {
        if (transceiver.iceTransport &&
            transceiver.iceTransport.state === 'new' &&
            transceiver.iceTransport.getRemoteCandidates().length > 0) {
          console.warn('Timeout for addRemoteCandidate. Consider sending ' +
              'an end-of-candidates notification');
          transceiver.iceTransport.addRemoteCandidate({});
        }
      });
    }, 4000);

    return Promise.resolve();
  };

  RTCPeerConnection.prototype.close = function() {
    this.transceivers.forEach(function(transceiver) {
      /* not yet
      if (transceiver.iceGatherer) {
        transceiver.iceGatherer.close();
      }
      */
      if (transceiver.iceTransport) {
        transceiver.iceTransport.stop();
      }
      if (transceiver.dtlsTransport) {
        transceiver.dtlsTransport.stop();
      }
      if (transceiver.rtpSender) {
        transceiver.rtpSender.stop();
      }
      if (transceiver.rtpReceiver) {
        transceiver.rtpReceiver.stop();
      }
    });
    // FIXME: clean up tracks, local streams, remote streams, etc
    this._isClosed = true;
    this._updateSignalingState('closed');
  };

  // Update the signaling state.
  RTCPeerConnection.prototype._updateSignalingState = function(newState) {
    this.signalingState = newState;
    var event = new Event('signalingstatechange');
    this._dispatchEvent('signalingstatechange', event);
  };

  // Determine whether to fire the negotiationneeded event.
  RTCPeerConnection.prototype._maybeFireNegotiationNeeded = function() {
    var pc = this;
    if (this.signalingState !== 'stable' || this.needNegotiation === true) {
      return;
    }
    this.needNegotiation = true;
    window.setTimeout(function() {
      if (pc.needNegotiation) {
        pc.needNegotiation = false;
        var event = new Event('negotiationneeded');
        pc._dispatchEvent('negotiationneeded', event);
      }
    }, 0);
  };

  // Update the ice connection state.
  RTCPeerConnection.prototype._updateIceConnectionState = function() {
    var newState;
    var states = {
      'new': 0,
      closed: 0,
      checking: 0,
      connected: 0,
      completed: 0,
      disconnected: 0,
      failed: 0
    };
    this.transceivers.forEach(function(transceiver) {
      if (transceiver.iceTransport && !transceiver.rejected) {
        states[transceiver.iceTransport.state]++;
      }
    });

    newState = 'new';
    if (states.failed > 0) {
      newState = 'failed';
    } else if (states.checking > 0) {
      newState = 'checking';
    } else if (states.disconnected > 0) {
      newState = 'disconnected';
    } else if (states.new > 0) {
      newState = 'new';
    } else if (states.connected > 0) {
      newState = 'connected';
    } else if (states.completed > 0) {
      newState = 'completed';
    }

    if (newState !== this.iceConnectionState) {
      this.iceConnectionState = newState;
      var event = new Event('iceconnectionstatechange');
      this._dispatchEvent('iceconnectionstatechange', event);
    }
  };

  // Update the connection state.
  RTCPeerConnection.prototype._updateConnectionState = function() {
    var newState;
    var states = {
      'new': 0,
      closed: 0,
      connecting: 0,
      connected: 0,
      completed: 0,
      disconnected: 0,
      failed: 0
    };
    this.transceivers.forEach(function(transceiver) {
      if (transceiver.iceTransport && transceiver.dtlsTransport &&
          !transceiver.rejected) {
        states[transceiver.iceTransport.state]++;
        states[transceiver.dtlsTransport.state]++;
      }
    });
    // ICETransport.completed and connected are the same for this purpose.
    states.connected += states.completed;

    newState = 'new';
    if (states.failed > 0) {
      newState = 'failed';
    } else if (states.connecting > 0) {
      newState = 'connecting';
    } else if (states.disconnected > 0) {
      newState = 'disconnected';
    } else if (states.new > 0) {
      newState = 'new';
    } else if (states.connected > 0) {
      newState = 'connected';
    }

    if (newState !== this.connectionState) {
      this.connectionState = newState;
      var event = new Event('connectionstatechange');
      this._dispatchEvent('connectionstatechange', event);
    }
  };

  RTCPeerConnection.prototype.createOffer = function() {
    var pc = this;

    if (pc._isClosed) {
      return Promise.reject(makeError('InvalidStateError',
          'Can not call createOffer after close'));
    }

    var numAudioTracks = pc.transceivers.filter(function(t) {
      return t.kind === 'audio';
    }).length;
    var numVideoTracks = pc.transceivers.filter(function(t) {
      return t.kind === 'video';
    }).length;

    // Determine number of audio and video tracks we need to send/recv.
    var offerOptions = arguments[0];
    if (offerOptions) {
      // Reject Chrome legacy constraints.
      if (offerOptions.mandatory || offerOptions.optional) {
        throw new TypeError(
            'Legacy mandatory/optional constraints not supported.');
      }
      if (offerOptions.offerToReceiveAudio !== undefined) {
        if (offerOptions.offerToReceiveAudio === true) {
          numAudioTracks = 1;
        } else if (offerOptions.offerToReceiveAudio === false) {
          numAudioTracks = 0;
        } else {
          numAudioTracks = offerOptions.offerToReceiveAudio;
        }
      }
      if (offerOptions.offerToReceiveVideo !== undefined) {
        if (offerOptions.offerToReceiveVideo === true) {
          numVideoTracks = 1;
        } else if (offerOptions.offerToReceiveVideo === false) {
          numVideoTracks = 0;
        } else {
          numVideoTracks = offerOptions.offerToReceiveVideo;
        }
      }
    }

    pc.transceivers.forEach(function(transceiver) {
      if (transceiver.kind === 'audio') {
        numAudioTracks--;
        if (numAudioTracks < 0) {
          transceiver.wantReceive = false;
        }
      } else if (transceiver.kind === 'video') {
        numVideoTracks--;
        if (numVideoTracks < 0) {
          transceiver.wantReceive = false;
        }
      }
    });

    // Create M-lines for recvonly streams.
    while (numAudioTracks > 0 || numVideoTracks > 0) {
      if (numAudioTracks > 0) {
        pc._createTransceiver('audio');
        numAudioTracks--;
      }
      if (numVideoTracks > 0) {
        pc._createTransceiver('video');
        numVideoTracks--;
      }
    }

    var sdp = SDPUtils.writeSessionBoilerplate(pc._sdpSessionId,
        pc._sdpSessionVersion++);
    pc.transceivers.forEach(function(transceiver, sdpMLineIndex) {
      // For each track, create an ice gatherer, ice transport,
      // dtls transport, potentially rtpsender and rtpreceiver.
      var track = transceiver.track;
      var kind = transceiver.kind;
      var mid = transceiver.mid || SDPUtils.generateIdentifier();
      transceiver.mid = mid;

      if (!transceiver.iceGatherer) {
        transceiver.iceGatherer = pc._createIceGatherer(sdpMLineIndex,
            pc.usingBundle);
      }

      var localCapabilities = window.RTCRtpSender.getCapabilities(kind);
      // filter RTX until additional stuff needed for RTX is implemented
      // in adapter.js
      if (edgeVersion < 15019) {
        localCapabilities.codecs = localCapabilities.codecs.filter(
            function(codec) {
              return codec.name !== 'rtx';
            });
      }
      localCapabilities.codecs.forEach(function(codec) {
        // work around https://bugs.chromium.org/p/webrtc/issues/detail?id=6552
        // by adding level-asymmetry-allowed=1
        if (codec.name === 'H264' &&
            codec.parameters['level-asymmetry-allowed'] === undefined) {
          codec.parameters['level-asymmetry-allowed'] = '1';
        }

        // for subsequent offers, we might have to re-use the payload
        // type of the last offer.
        if (transceiver.remoteCapabilities &&
            transceiver.remoteCapabilities.codecs) {
          transceiver.remoteCapabilities.codecs.forEach(function(remoteCodec) {
            if (codec.name.toLowerCase() === remoteCodec.name.toLowerCase() &&
                codec.clockRate === remoteCodec.clockRate) {
              codec.preferredPayloadType = remoteCodec.payloadType;
            }
          });
        }
      });
      localCapabilities.headerExtensions.forEach(function(hdrExt) {
        var remoteExtensions = transceiver.remoteCapabilities &&
            transceiver.remoteCapabilities.headerExtensions || [];
        remoteExtensions.forEach(function(rHdrExt) {
          if (hdrExt.uri === rHdrExt.uri) {
            hdrExt.id = rHdrExt.id;
          }
        });
      });

      // generate an ssrc now, to be used later in rtpSender.send
      var sendEncodingParameters = transceiver.sendEncodingParameters || [{
        ssrc: (2 * sdpMLineIndex + 1) * 1001
      }];
      if (track) {
        // add RTX
        if (edgeVersion >= 15019 && kind === 'video' &&
            !sendEncodingParameters[0].rtx) {
          sendEncodingParameters[0].rtx = {
            ssrc: sendEncodingParameters[0].ssrc + 1
          };
        }
      }

      if (transceiver.wantReceive) {
        transceiver.rtpReceiver = new window.RTCRtpReceiver(
            transceiver.dtlsTransport, kind);
      }

      transceiver.localCapabilities = localCapabilities;
      transceiver.sendEncodingParameters = sendEncodingParameters;
    });

    // always offer BUNDLE and dispose on return if not supported.
    if (pc._config.bundlePolicy !== 'max-compat') {
      sdp += 'a=group:BUNDLE ' + pc.transceivers.map(function(t) {
        return t.mid;
      }).join(' ') + '\r\n';
    }
    sdp += 'a=ice-options:trickle\r\n';

    pc.transceivers.forEach(function(transceiver, sdpMLineIndex) {
      sdp += writeMediaSection(transceiver, transceiver.localCapabilities,
          'offer', transceiver.stream, pc._dtlsRole);
      sdp += 'a=rtcp-rsize\r\n';

      if (transceiver.iceGatherer && pc.iceGatheringState !== 'new' &&
          (sdpMLineIndex === 0 || !pc.usingBundle)) {
        transceiver.iceGatherer.getLocalCandidates().forEach(function(cand) {
          cand.component = 1;
          sdp += 'a=' + SDPUtils.writeCandidate(cand) + '\r\n';
        });

        if (transceiver.iceGatherer.state === 'completed') {
          sdp += 'a=end-of-candidates\r\n';
        }
      }
    });

    var desc = new window.RTCSessionDescription({
      type: 'offer',
      sdp: sdp
    });
    return Promise.resolve(desc);
  };

  RTCPeerConnection.prototype.createAnswer = function() {
    var pc = this;

    if (pc._isClosed) {
      return Promise.reject(makeError('InvalidStateError',
          'Can not call createAnswer after close'));
    }

    if (!(pc.signalingState === 'have-remote-offer' ||
        pc.signalingState === 'have-local-pranswer')) {
      return Promise.reject(makeError('InvalidStateError',
          'Can not call createAnswer in signalingState ' + pc.signalingState));
    }

    var sdp = SDPUtils.writeSessionBoilerplate(pc._sdpSessionId,
        pc._sdpSessionVersion++);
    if (pc.usingBundle) {
      sdp += 'a=group:BUNDLE ' + pc.transceivers.map(function(t) {
        return t.mid;
      }).join(' ') + '\r\n';
    }
    sdp += 'a=ice-options:trickle\r\n';

    var mediaSectionsInOffer = SDPUtils.getMediaSections(
        pc._remoteDescription.sdp).length;
    pc.transceivers.forEach(function(transceiver, sdpMLineIndex) {
      if (sdpMLineIndex + 1 > mediaSectionsInOffer) {
        return;
      }
      if (transceiver.rejected) {
        if (transceiver.kind === 'application') {
          if (transceiver.protocol === 'DTLS/SCTP') { // legacy fmt
            sdp += 'm=application 0 DTLS/SCTP 5000\r\n';
          } else {
            sdp += 'm=application 0 ' + transceiver.protocol +
                ' webrtc-datachannel\r\n';
          }
        } else if (transceiver.kind === 'audio') {
          sdp += 'm=audio 0 UDP/TLS/RTP/SAVPF 0\r\n' +
              'a=rtpmap:0 PCMU/8000\r\n';
        } else if (transceiver.kind === 'video') {
          sdp += 'm=video 0 UDP/TLS/RTP/SAVPF 120\r\n' +
              'a=rtpmap:120 VP8/90000\r\n';
        }
        sdp += 'c=IN IP4 0.0.0.0\r\n' +
            'a=inactive\r\n' +
            'a=mid:' + transceiver.mid + '\r\n';
        return;
      }

      // FIXME: look at direction.
      if (transceiver.stream) {
        var localTrack;
        if (transceiver.kind === 'audio') {
          localTrack = transceiver.stream.getAudioTracks()[0];
        } else if (transceiver.kind === 'video') {
          localTrack = transceiver.stream.getVideoTracks()[0];
        }
        if (localTrack) {
          // add RTX
          if (edgeVersion >= 15019 && transceiver.kind === 'video' &&
              !transceiver.sendEncodingParameters[0].rtx) {
            transceiver.sendEncodingParameters[0].rtx = {
              ssrc: transceiver.sendEncodingParameters[0].ssrc + 1
            };
          }
        }
      }

      // Calculate intersection of capabilities.
      var commonCapabilities = getCommonCapabilities(
          transceiver.localCapabilities,
          transceiver.remoteCapabilities);

      var hasRtx = commonCapabilities.codecs.filter(function(c) {
        return c.name.toLowerCase() === 'rtx';
      }).length;
      if (!hasRtx && transceiver.sendEncodingParameters[0].rtx) {
        delete transceiver.sendEncodingParameters[0].rtx;
      }

      sdp += writeMediaSection(transceiver, commonCapabilities,
          'answer', transceiver.stream, pc._dtlsRole);
      if (transceiver.rtcpParameters &&
          transceiver.rtcpParameters.reducedSize) {
        sdp += 'a=rtcp-rsize\r\n';
      }
    });

    var desc = new window.RTCSessionDescription({
      type: 'answer',
      sdp: sdp
    });
    return Promise.resolve(desc);
  };

  RTCPeerConnection.prototype.addIceCandidate = function(candidate) {
    var pc = this;
    var sections;
    if (candidate && !(candidate.sdpMLineIndex !== undefined ||
        candidate.sdpMid)) {
      return Promise.reject(new TypeError('sdpMLineIndex or sdpMid required'));
    }

    // TODO: needs to go into ops queue.
    return new Promise(function(resolve, reject) {
      if (!pc._remoteDescription) {
        return reject(makeError('InvalidStateError',
            'Can not add ICE candidate without a remote description'));
      } else if (!candidate || candidate.candidate === '') {
        for (var j = 0; j < pc.transceivers.length; j++) {
          if (pc.transceivers[j].rejected) {
            continue;
          }
          pc.transceivers[j].iceTransport.addRemoteCandidate({});
          sections = SDPUtils.getMediaSections(pc._remoteDescription.sdp);
          sections[j] += 'a=end-of-candidates\r\n';
          pc._remoteDescription.sdp =
              SDPUtils.getDescription(pc._remoteDescription.sdp) +
              sections.join('');
          if (pc.usingBundle) {
            break;
          }
        }
      } else {
        var sdpMLineIndex = candidate.sdpMLineIndex;
        if (candidate.sdpMid) {
          for (var i = 0; i < pc.transceivers.length; i++) {
            if (pc.transceivers[i].mid === candidate.sdpMid) {
              sdpMLineIndex = i;
              break;
            }
          }
        }
        var transceiver = pc.transceivers[sdpMLineIndex];
        if (transceiver) {
          if (transceiver.rejected) {
            return resolve();
          }
          var cand = Object.keys(candidate.candidate).length > 0 ?
              SDPUtils.parseCandidate(candidate.candidate) : {};
          // Ignore Chrome's invalid candidates since Edge does not like them.
          if (cand.protocol === 'tcp' && (cand.port === 0 || cand.port === 9)) {
            return resolve();
          }
          // Ignore RTCP candidates, we assume RTCP-MUX.
          if (cand.component && cand.component !== 1) {
            return resolve();
          }
          // when using bundle, avoid adding candidates to the wrong
          // ice transport. And avoid adding candidates added in the SDP.
          if (sdpMLineIndex === 0 || (sdpMLineIndex > 0 &&
              transceiver.iceTransport !== pc.transceivers[0].iceTransport)) {
            if (!maybeAddCandidate(transceiver.iceTransport, cand)) {
              return reject(makeError('OperationError',
                  'Can not add ICE candidate'));
            }
          }

          // update the remoteDescription.
          var candidateString = candidate.candidate.trim();
          if (candidateString.indexOf('a=') === 0) {
            candidateString = candidateString.substr(2);
          }
          sections = SDPUtils.getMediaSections(pc._remoteDescription.sdp);
          sections[sdpMLineIndex] += 'a=' +
              (cand.type ? candidateString : 'end-of-candidates')
              + '\r\n';
          pc._remoteDescription.sdp =
              SDPUtils.getDescription(pc._remoteDescription.sdp) +
              sections.join('');
        } else {
          return reject(makeError('OperationError',
              'Can not add ICE candidate'));
        }
      }
      resolve();
    });
  };

  RTCPeerConnection.prototype.getStats = function(selector) {
    if (selector && selector instanceof window.MediaStreamTrack) {
      var senderOrReceiver = null;
      this.transceivers.forEach(function(transceiver) {
        if (transceiver.rtpSender &&
            transceiver.rtpSender.track === selector) {
          senderOrReceiver = transceiver.rtpSender;
        } else if (transceiver.rtpReceiver &&
            transceiver.rtpReceiver.track === selector) {
          senderOrReceiver = transceiver.rtpReceiver;
        }
      });
      if (!senderOrReceiver) {
        throw makeError('InvalidAccessError', 'Invalid selector.');
      }
      return senderOrReceiver.getStats();
    }

    var promises = [];
    this.transceivers.forEach(function(transceiver) {
      ['rtpSender', 'rtpReceiver', 'iceGatherer', 'iceTransport',
          'dtlsTransport'].forEach(function(method) {
            if (transceiver[method]) {
              promises.push(transceiver[method].getStats());
            }
          });
    });
    return Promise.all(promises).then(function(allStats) {
      var results = new Map();
      allStats.forEach(function(stats) {
        stats.forEach(function(stat) {
          results.set(stat.id, stat);
        });
      });
      return results;
    });
  };

  // fix low-level stat names and return Map instead of object.
  var ortcObjects = ['RTCRtpSender', 'RTCRtpReceiver', 'RTCIceGatherer',
    'RTCIceTransport', 'RTCDtlsTransport'];
  ortcObjects.forEach(function(ortcObjectName) {
    var obj = window[ortcObjectName];
    if (obj && obj.prototype && obj.prototype.getStats) {
      var nativeGetstats = obj.prototype.getStats;
      obj.prototype.getStats = function() {
        return nativeGetstats.apply(this)
        .then(function(nativeStats) {
          var mapStats = new Map();
          Object.keys(nativeStats).forEach(function(id) {
            nativeStats[id].type = fixStatsType(nativeStats[id]);
            mapStats.set(id, nativeStats[id]);
          });
          return mapStats;
        });
      };
    }
  });

  // legacy callback shims. Should be moved to adapter.js some days.
  var methods = ['createOffer', 'createAnswer'];
  methods.forEach(function(method) {
    var nativeMethod = RTCPeerConnection.prototype[method];
    RTCPeerConnection.prototype[method] = function() {
      var args = arguments;
      if (typeof args[0] === 'function' ||
          typeof args[1] === 'function') { // legacy
        return nativeMethod.apply(this, [arguments[2]])
        .then(function(description) {
          if (typeof args[0] === 'function') {
            args[0].apply(null, [description]);
          }
        }, function(error) {
          if (typeof args[1] === 'function') {
            args[1].apply(null, [error]);
          }
        });
      }
      return nativeMethod.apply(this, arguments);
    };
  });

  methods = ['setLocalDescription', 'setRemoteDescription', 'addIceCandidate'];
  methods.forEach(function(method) {
    var nativeMethod = RTCPeerConnection.prototype[method];
    RTCPeerConnection.prototype[method] = function() {
      var args = arguments;
      if (typeof args[1] === 'function' ||
          typeof args[2] === 'function') { // legacy
        return nativeMethod.apply(this, arguments)
        .then(function() {
          if (typeof args[1] === 'function') {
            args[1].apply(null);
          }
        }, function(error) {
          if (typeof args[2] === 'function') {
            args[2].apply(null, [error]);
          }
        });
      }
      return nativeMethod.apply(this, arguments);
    };
  });

  // getStats is special. It doesn't have a spec legacy method yet we support
  // getStats(something, cb) without error callbacks.
  ['getStats'].forEach(function(method) {
    var nativeMethod = RTCPeerConnection.prototype[method];
    RTCPeerConnection.prototype[method] = function() {
      var args = arguments;
      if (typeof args[1] === 'function') {
        return nativeMethod.apply(this, arguments)
        .then(function() {
          if (typeof args[1] === 'function') {
            args[1].apply(null);
          }
        });
      }
      return nativeMethod.apply(this, arguments);
    };
  });

  return RTCPeerConnection;
};


/***/ }),
/* 92 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
/* WEBPACK VAR INJECTION */(function(process) {

var MqttClient = __webpack_require__(329)
var Store = __webpack_require__(75)
var url = __webpack_require__(346)
var xtend = __webpack_require__(44)
var debug = __webpack_require__(8)('mqttjs')

var protocols = {}

// eslint-disable-next-line camelcase
if ((typeof process !== 'undefined' && process.title !== 'browser') || typeof __webpack_require__ !== 'function') {
  protocols.mqtt = __webpack_require__(84)
  protocols.tcp = __webpack_require__(84)
  protocols.ssl = __webpack_require__(45)
  protocols.tls = __webpack_require__(45)
  protocols.mqtts = __webpack_require__(45)
} else {
  protocols.wx = __webpack_require__(85)
  protocols.wxs = __webpack_require__(85)

  protocols.ali = __webpack_require__(86)
  protocols.alis = __webpack_require__(86)
}

protocols.ws = __webpack_require__(87)
protocols.wss = __webpack_require__(87)

/**
 * Parse the auth attribute and merge username and password in the options object.
 *
 * @param {Object} [opts] option object
 */
function parseAuthOptions (opts) {
  var matches
  if (opts.auth) {
    matches = opts.auth.match(/^(.+):(.+)$/)
    if (matches) {
      opts.username = matches[1]
      opts.password = matches[2]
    } else {
      opts.username = opts.auth
    }
  }
}

/**
 * connect - connect to an MQTT broker.
 *
 * @param {String} [brokerUrl] - url of the broker, optional
 * @param {Object} opts - see MqttClient#constructor
 */
function connect (brokerUrl, opts) {
  debug('connecting to an MQTT broker...')
  if ((typeof brokerUrl === 'object') && !opts) {
    opts = brokerUrl
    brokerUrl = null
  }

  opts = opts || {}

  if (brokerUrl) {
    var parsed = url.parse(brokerUrl, true)
    if (parsed.port != null) {
      parsed.port = Number(parsed.port)
    }

    opts = xtend(parsed, opts)

    if (opts.protocol === null) {
      throw new Error('Missing protocol')
    }

    opts.protocol = opts.protocol.replace(/:$/, '')
  }

  // merge in the auth options if supplied
  parseAuthOptions(opts)

  // support clientId passed in the query string of the url
  if (opts.query && typeof opts.query.clientId === 'string') {
    opts.clientId = opts.query.clientId
  }

  if (opts.cert && opts.key) {
    if (opts.protocol) {
      if (['mqtts', 'wss', 'wxs', 'alis'].indexOf(opts.protocol) === -1) {
        switch (opts.protocol) {
          case 'mqtt':
            opts.protocol = 'mqtts'
            break
          case 'ws':
            opts.protocol = 'wss'
            break
          case 'wx':
            opts.protocol = 'wxs'
            break
          case 'ali':
            opts.protocol = 'alis'
            break
          default:
            throw new Error('Unknown protocol for secure connection: "' + opts.protocol + '"!')
        }
      }
    } else {
      // A cert and key was provided, however no protocol was specified, so we will throw an error.
      throw new Error('Missing secure protocol key')
    }
  }

  if (!protocols[opts.protocol]) {
    var isSecure = ['mqtts', 'wss'].indexOf(opts.protocol) !== -1
    opts.protocol = [
      'mqtt',
      'mqtts',
      'ws',
      'wss',
      'wx',
      'wxs',
      'ali',
      'alis'
    ].filter(function (key, index) {
      if (isSecure && index % 2 === 0) {
        // Skip insecure protocols when requesting a secure one.
        return false
      }
      return (typeof protocols[key] === 'function')
    })[0]
  }

  if (opts.clean === false && !opts.clientId) {
    throw new Error('Missing clientId for unclean clients')
  }

  if (opts.protocol) {
    opts.defaultProtocol = opts.protocol
  }

  function wrapper (client) {
    if (opts.servers) {
      if (!client._reconnectCount || client._reconnectCount === opts.servers.length) {
        client._reconnectCount = 0
      }

      opts.host = opts.servers[client._reconnectCount].host
      opts.port = opts.servers[client._reconnectCount].port
      opts.protocol = (!opts.servers[client._reconnectCount].protocol ? opts.defaultProtocol : opts.servers[client._reconnectCount].protocol)
      opts.hostname = opts.host

      client._reconnectCount++
    }

    debug('calling streambuilder for', opts.protocol)
    return protocols[opts.protocol](client, opts)
  }
  var client = new MqttClient(wrapper, opts)
  client.on('error', function () { /* Automatically set up client error handling */ })
  return client
}

module.exports = connect
module.exports.connect = connect
module.exports.MqttClient = MqttClient
module.exports.Store = Store

/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(15)))

/***/ }),
/* 93 */
/***/ (function(module, exports) {

module.exports = {
  host: 'absol.cf',
  port: 4000,
  ip: '45.117.171.211',
  sslCrt: '/etc/letsencrypt/live/www.absol.cf/fullchain.pem',
  sslKey: '/etc/letsencrypt/live/www.absol.cf/privkey.pem',
  mediasoup: {
    // Worker settings
    worker: {
      rtcMinPort: 10000,
      rtcMaxPort: 10100,
      logLevel: 'warn',
      logTags: ['info', 'ice', 'dtls', 'rtp', 'srtp', 'rtcp' // 'rtx',
      // 'bwe',
      // 'score',
      // 'simulcast',
      // 'svc'
      ]
    },
    // Router settings
    router: {
      mediaCodecs: [{
        kind: 'audio',
        mimeType: 'audio/opus',
        clockRate: 48000,
        channels: 2
      }, {
        kind: 'video',
        mimeType: 'video/VP8',
        clockRate: 90000,
        parameters: {
          'x-google-start-bitrate': 1000
        }
      }]
    },
    // WebRtcTransport settings
    webRtcTransport: {
      listenIps: [{
        ip: '45.117.171.211',
        announcedIp: null
      }],
      maxIncomingBitrate: 1500000,
      initialAvailableOutgoingBitrate: 1000000
    }
  }
};

/***/ }),
/* 94 */
/***/ (function(module, exports, __webpack_require__) {

module.exports = __webpack_require__(360);


/***/ }),
/* 95 */
/***/ (function(module, exports, __webpack_require__) {


var content = __webpack_require__(96);

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) {}

/***/ }),
/* 96 */
/***/ (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 .as-bscroller{\r\n    overflow-y: auto;\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: rgba(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: rgba(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}", ""]);



/***/ }),
/* 97 */
/***/ (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;
};


/***/ }),
/* 98 */
/***/ (function(module, exports, __webpack_require__) {

exports = module.exports = __webpack_require__(4)(false);
// Module
exports.push([module.i, ".as-has-board-table-drag,\r\n.as-has-board-table-drag * {\r\n    cursor: grabbing;\r\n    -webkit-user-select: none !important;\r\n    -moz-user-select: none !important;\r\n    -ms-user-select: none !important;\r\n    user-select: none !important;\r\n}\r\n\r\n\r\n\r\n.as-board-table {\r\n    overflow: visible;\r\n    position: relative;\r\n\r\n}\r\n\r\n.as-board-drag-zone {\r\n    -webkit-user-select: none !important;\r\n    -moz-user-select: none !important;\r\n    -ms-user-select: none !important;\r\n    user-select: none !important;\r\n}\r\n\r\n\r\n.as-board {\r\n    white-space: normal;\r\n    box-sizing: border-box;\r\n    position: relative;\r\n    vertical-align: middle;\r\n}\r\n\r\n/**\r\nBug note: don't put fixed position element to a element which has transform\r\n */\r\n.as-board-moving {\r\n    transform-origin: 30% 55%;\r\n    transform: rotate(5deg);\r\n    transition: transform 0.05s;\r\n    user-select: none;\r\n    pointer-events: none;\r\n    position: fixed !important;\r\n    z-index: 2000;\r\n}\r\n\r\n\r\n.as-board-place-holder {\r\n    opacity: 0.3;\r\n}\r\n\r\n.as-board-table-prevent-context {\r\n    position: fixed;\r\n    --x: -10000px;\r\n    --y: -10000px;\r\n    left: calc(var(--x) - 100px);\r\n    top: calc(var(--y) - 100px);\r\n    opacity: 0;\r\n    z-index: 100000000;\r\n    width: 200px;\r\n    height: 200px;\r\n    cursor: default;\r\n    -webkit-user-select: none;\r\n    -webkit-touch-callout: none;\r\n    -khtml-user-select: none;\r\n    -moz-user-select: none;\r\n    -ms-user-select: none;\r\n    -o-user-select: none;\r\n}", ""]);



/***/ }),
/* 99 */
/***/ (function(module, exports, __webpack_require__) {


var content = __webpack_require__(100);

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) {}

/***/ }),
/* 100 */
/***/ (function(module, exports, __webpack_require__) {

exports = module.exports = __webpack_require__(4)(false);
// Module
exports.push([module.i, ".as-has-hanger-drag,\r\n.as-has-hanger-drag * {\r\n    touch-action: none;\r\n    -webkit-user-select: none !important;\r\n    -moz-user-select: none !important;\r\n    -ms-user-select: none !important;\r\n    user-select: none !important;\r\n}", ""]);



/***/ }),
/* 101 */
/***/ (function(module, exports, __webpack_require__) {


var content = __webpack_require__(102);

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) {}

/***/ }),
/* 102 */
/***/ (function(module, exports, __webpack_require__) {

exports = module.exports = __webpack_require__(4)(false);
// Module
exports.push([module.i, "/* OLD module */\r\n\r\n.absol-bscroller {\r\n    scrollbar-width: thin;\r\n    scrollbar-color: rgba(151, 151, 151, 0.4) rgba(220, 220, 220, 0.4);\r\n    overflow: auto;\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: rgba(220, 220, 220, 0.4);\r\n}\r\n\r\n.absol-bscroller::-webkit-scrollbar-thumb {\r\n    background: rgba(182, 182, 182, 0.4);\r\n}\r\n\r\n.absol-bscroller::-webkit-scrollbar-thumb:hover {\r\n    background: rgba(32, 32, 32, 0.4);\r\n}\r\n\r\n.absol-bscroller::-webkit-scrollbar-thumb:active {\r\n    background: rgba(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: rgba(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: rgba(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: rgba(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: rgba(242, 242, 242, 0.6);\r\n}\r\n\r\n/*******************************************/\r\n.as-bscroller {\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.as-bscroller::-webkit-scrollbar {\r\n    width: 6px;\r\n    height: 6px;\r\n}\r\n\r\n.as-bscroller::-webkit-scrollbar-track {\r\n    background: rgba(220, 220, 220, 0.4);\r\n}\r\n\r\n.as-bscroller::-webkit-scrollbar-thumb {\r\n    background: rgba(182, 182, 182, 0.4);\r\n}\r\n\r\n.as-bscroller::-webkit-scrollbar-thumb:hover {\r\n    background: rgba(32, 32, 32, 0.4);\r\n}\r\n\r\n.as-bscroller::-webkit-scrollbar-thumb:active {\r\n    background: rgba(13, 13, 13, 0.6);\r\n}\r\n\r\n.as-bscroller.dark,\r\n.dark .as-bscroller,\r\n.as-dark .as-bscroller,\r\n.as-dark.as-bscroller\r\n{\r\n    scrollbar-color: rgba(104, 104, 104, 0.4) rgba(150, 150, 150, 0.4);\r\n}\r\n\r\n\r\n.as-bscroller.dark::-webkit-scrollbar-track,\r\n.dark .as-bscroller::-webkit-scrollbar-track,\r\n.as-dark .as-bscroller::-webkit-scrollbar-track,\r\n.as-dark.as-bscroller::-webkit-scrollbar-track\r\n{\r\n    background: rgba(150, 150, 150, 0.4);\r\n}\r\n\r\n.as-bscroller.dark::-webkit-scrollbar-thumb,\r\n.dark .as-bscroller::-webkit-scrollbar-thumb,\r\n.as-dark .as-bscroller::-webkit-scrollbar-thumb,\r\n.as-dark.as-bscroller::-webkit-scrollbar-thumb\r\n{\r\n    background: rgba(104, 104, 104, 0.4);\r\n}\r\n\r\n.as-bscroller.dark::-webkit-scrollbar-thumb:hover,\r\n.dark .as-bscroller::-webkit-scrollbar-thumb:hover,\r\n.as-dark .as-bscroller::-webkit-scrollbar-thumb:hover,\r\n.as-dark.as-bscroller::-webkit-scrollbar-thumb:hover\r\n{\r\n    background: rgba(223, 223, 223, 0.4);\r\n}\r\n\r\n.as-bscroller.dark::-webkit-scrollbar-thumb:active,\r\n.dark .as-bscroller::-webkit-scrollbar-thumb:active,\r\n.as-dark .as-bscroller::-webkit-scrollbar-thumb:active,\r\n.as-dark.as-bscroller::-webkit-scrollbar-thumb:active\r\n{\r\n    background: rgba(242, 242, 242, 0.6);\r\n}", ""]);



/***/ }),
/* 103 */
/***/ (function(module, exports, __webpack_require__) {


var content = __webpack_require__(104);

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) {}

/***/ }),
/* 104 */
/***/ (function(module, exports, __webpack_require__) {

exports = module.exports = __webpack_require__(4)(false);
// Module
exports.push([module.i, ".as-button-array {\r\n    font-size: 14px;\r\n    border: 1px solid #006ce5;\r\n    display: inline-block;\r\n    border-radius: 0.2em;\r\n    overflow: hidden;\r\n}\r\n\r\n.as-button-array-item {\r\n    text-align: center;\r\n    font-size: inherit;\r\n    height: 2em;\r\n    border: none;\r\n    box-sizing: border-box;\r\n    padding-left: 0.35714em;\r\n    padding-right: 0.35714em;\r\n    outline: none;\r\n    color: #006ce5;\r\n    background-color: white;\r\n    border-radius: 0;\r\n    transition: background-color 0.1s, color 0.1s;\r\n    margin: 0;\r\n}\r\n\r\n.as-button-array-item:not(:first-child) {\r\n    border-left: 1px solid #006ce5;\r\n    border-right: none;\r\n}\r\n\r\n\r\n.as-button-array-item.as-active {\r\n    color: white;\r\n    background-color: #006ce5;\r\n}", ""]);



/***/ }),
/* 105 */
/***/ (function(module, exports, __webpack_require__) {


var content = __webpack_require__(106);

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) {}

/***/ }),
/* 106 */
/***/ (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    padding: 0;\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}", ""]);



/***/ }),
/* 107 */
/***/ (function(module, exports, __webpack_require__) {


var content = __webpack_require__(108);

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) {}

/***/ }),
/* 108 */
/***/ (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}", ""]);



/***/ }),
/* 109 */
/***/ (function(module, exports, __webpack_require__) {


var content = __webpack_require__(110);

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) {}

/***/ }),
/* 110 */
/***/ (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}", ""]);



/***/ }),
/* 111 */
/***/ (function(module, exports, __webpack_require__) {


var content = __webpack_require__(112);

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) {}

/***/ }),
/* 112 */
/***/ (function(module, exports, __webpack_require__) {

exports = module.exports = __webpack_require__(4)(false);
// Module
exports.push([module.i, ":root {\r\n    --candy-border-color: #929292;\r\n    --candy-hover-background-color: #eeeee9;\r\n    --candy-disabled-background-color: #ebebe4;\r\n}\r\n\r\nlabel.as-checkbox-input {\r\n    display: inline-block;\r\n    position: relative;\r\n    width: calc(1em + 2px);\r\n    height: calc(1em + 2px);\r\n    cursor: pointer;\r\n    font-size: inherit;\r\n    box-sizing: border-box;\r\n    vertical-align: middle;\r\n    border-radius: 0.25em;\r\n    padding: 0;\r\n    margin: 0; /*fix boostrap override*/\r\n}\r\n\r\nlabel.as-checkbox-input:hover .bound,\r\n.absol-checkbox:hover .bound {\r\n    fill: var(--candy-hover-background-color);\r\n}\r\n\r\n.as-checkbox-input .tick {\r\n    fill: #606060;\r\n}\r\n\r\n.as-checkbox-input input.as-checkbox-input-value {\r\n    font-size: inherit;\r\n    position: absolute;\r\n    right: 100%;\r\n    top: 0;\r\n    opacity: 0.0;\r\n    z-index: -100000000000;\r\n}\r\n\r\ninput.as-checkbox-input-value:not(:checked) ~ svg .tick {\r\n    opacity: 0;\r\n}\r\n\r\nlabel.as-checkbox-input .bound {\r\n    stroke: var(--candy-border-color);\r\n    fill: white;\r\n}\r\n\r\nlabel.as-checkbox-input .tick {\r\n    opacity: 1;\r\n    transition: opacity 0.1s;\r\n}\r\n\r\nlabel.as-checkbox-input.as-disabled > svg .bound,\r\nlabel.as-checkbox-input.as-disabled:hover > svg .bound {\r\n    stroke: #929292;\r\n    fill: #ebebe4;\r\n}\r\n\r\n\r\n.as-checkbox-input > svg {\r\n    width: 100%;\r\n    height: 100%;\r\n}", ""]);



/***/ }),
/* 113 */
/***/ (function(module, exports, __webpack_require__) {


var content = __webpack_require__(114);

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) {}

/***/ }),
/* 114 */
/***/ (function(module, exports, __webpack_require__) {

exports = module.exports = __webpack_require__(4)(false);
// Module
exports.push([module.i, "/** align middle in table cell **/\r\ntd > .absol-checkbox:first-child:last-child,\r\ntd > .absol-checkbox.as-no-label:first-child:last-child .as-checkbox-input{\r\n    display: block;\r\n    margin: auto;\r\n}\r\n\r\n.absol-checkbox {\r\n    display: inline-block;\r\n    vertical-align: middle;\r\n    cursor: pointer;\r\n    user-select: none;\r\n    line-height: 16px;\r\n}\r\n\r\n.absol-checkbox.right > .absol-checkbox-label.as-right {\r\n    display: none;\r\n}\r\n\r\n\r\n.absol-checkbox:not(.right) > .absol-checkbox-label.as-left {\r\n    display: none;\r\n}\r\n\r\n.absol-checkbox-label {\r\n    vertical-align: middle;\r\n    display: inline-block;\r\n}\r\n\r\n\r\n.absol-checkbox-label.as-left {\r\n    padding-right: 0.3em;\r\n}\r\n\r\n\r\n.absol-checkbox-label.as-right {\r\n    padding-left: 0.3em;\r\n}\r\n\r\n.absol-checkbox.as-no-label {\r\n    width: calc(1em + 2px);\r\n    height: calc(1em + 2px);\r\n}\r\n\r\n\r\n.absol-checkbox.as-no-label .absol-checkbox-label {\r\n    display: none;\r\n}\r\n\r\n.absol-checkbox.as-no-label .as-checkbox-input {\r\n    display: block;\r\n}\r\n\r\n.absol-checkbox.as-disabled .absol-checkbox-label {\r\n    color: #777;\r\n}\r\n", ""]);



/***/ }),
/* 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-circle-section-label {\r\n    position: relative;\r\n    -webkit-print-color-adjust: exact;\r\n    /*friendly print*/\r\n}\r\n\r\n.as-circle-section-label-text {\r\n    position: relative;\r\n    display: inline-block;\r\n    vertical-align: middle;\r\n    font-size: 1em;\r\n    padding-right: 2.5em;\r\n    color: white;\r\n    font-weight: bold;\r\n    z-index: 2;\r\n}\r\n\r\n\r\n.as-circle-section-label-index {\r\n    position: relative;\r\n    display: inline-block;\r\n    vertical-align: middle;\r\n    text-align: center;\r\n    color: rgb(30, 162, 245);\r\n    font-weight: 900;\r\n    z-index: 2;\r\n}\r\n\r\n\r\n@media print {\r\n    .as-circle-section-label-text {\r\n        color: white !important;\r\n    }\r\n\r\n    .as-circle-section-label-index {\r\n        color: rgb(30, 162, 245) !important;\r\n    }\r\n}\r\n\r\n\r\n.as-circle-section-label-background {\r\n    position: absolute;\r\n    top: 0;\r\n    left: 0;\r\n    bottom: 0;\r\n    z-index: 1;\r\n}\r\n\r\n.as-circle-section-label-background>svg {\r\n    display: block;\r\n}\r\n\r\n.as-circle-section-label-index-box {\r\n    stroke: rgb(129, 211, 246);\r\n    fill: white;\r\n    stroke-width: 2.5;\r\n}\r\n\r\n.as-circle-section-label-arrow {\r\n    stroke: rgb(30, 162, 245);\r\n    fill: none;\r\n    stroke-linecap: round;\r\n}\r\n\r\n.as-circle-section-label-text-box {\r\n    fill: rgb(30, 162, 245);\r\n    stroke: none;\r\n}\r\n\r\n.as-circle-section-label-arrow-marker-path {\r\n    fill: rgb(30, 162, 245);\r\n    stroke: none;\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-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: 1000000001;\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.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-menu-anchor.dark .absol-hmenu,\r\n.absol-context-menu-anchor.dark .absol-vmenu,\r\n.dark .absol-context-menu-anchor .absol-hmenu,\r\n.dark .absol-context-menu-anchor .absol-vmenu {\r\n    background-color: rgb(37, 37, 38);\r\n}\r\n\r\n\r\n.absol-context-menu-anchor {\r\n    position: fixed;\r\n    z-index: -1000;\r\n    left: 0;\r\n    top: 0;\r\n    display: block;\r\n    opacity: 0;\r\n    visibility: hidden;\r\n    font-size: inherit;\r\n}\r\n\r\n.absol-context-menu-anchor > textarea {\r\n    width: 160px;\r\n    height: 160px;\r\n    margin: 0;\r\n    resize: none;\r\n    border: none;\r\n    opacity: 0;\r\n    cursor: default;\r\n}\r\n\r\n.absol-context-menu-anchor.absol-active {\r\n    z-index: 100000000;\r\n    opacity: 1;\r\n    visibility: visible;\r\n}\r\n\r\n\r\n.absol-context-menu-anchor .absol-vmenu,\r\n.absol-context-menu-anchor .absol-hmenu {\r\n    padding-top: 0.4em;\r\n    padding-bottom: 0.4em;\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\r\n.as-system-context-menu {\r\n    /** nothing here, to define use system context menu**/\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, ".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: fixed;\r\n    left: 0;\r\n    top: 0;\r\n    overflow: auto;\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.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: fixed;\r\n    left: 0;\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    overflow: auto;\r\n}\r\n\r\n.absol-dropright.overlap-top > .absol-dropright-content {\r\n    top: unset;\r\n    bottom: 0;\r\n}\r\n\r\n.absol-drop-hidden > .absol-dropdown-content,\r\n.absol-drop-hidden > .absol-dropright-content {\r\n    display: none;\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\r\n.absol-hmenu .absol-dropdown-content,\r\n.absol-hmenu .absol-dropright-content,\r\n.as-v-root-menu .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    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.5em;\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\r\n.absol-vmenu-arrow-container::after {\r\n    content: \"\";\r\n    display: inline-block;\r\n    vertical-align: middle;\r\n    height: 100%;\r\n}\r\n\r\n\r\n.absol-vmenu-arrow {\r\n    display: inline-block;\r\n    font-size: inherit;\r\n    vertical-align: middle;\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\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}\r\n\r\n.as-v-root-menu {\r\n    display: inline-block;\r\n    box-sizing: border-box;\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-follower {\r\n    position: fixed;\r\n    z-index: 100;\r\n}\r\n\r\n.absol-follower-hidden{\r\n    z-index: -1000 !important;\r\n    opacity: 0;\r\n    visibility: hidden;\r\n}", ""]);



/***/ }),
/* 123 */
/***/ (function(module, exports, __webpack_require__) {

exports = module.exports = __webpack_require__(4)(false);
// Module
exports.push([module.i, ".as-date-input {\r\n    border: 1px solid #ddd;\r\n    border-radius: 3px;\r\n    height: 30px;\r\n    width: calc(6em + 30px);\r\n    box-sizing: border-box;\r\n    display: inline-block;\r\n    vertical-align: middle;\r\n    position: relative;\r\n    background-color: white;\r\n}\r\n\r\n.as-date-input input {\r\n    outline: none;\r\n    width: calc(100% - 30px);\r\n    height: 100%;\r\n    border: none;\r\n    background-color: transparent;\r\n    display: block;\r\n    padding: 0 0 0 0.5em;\r\n\r\n}\r\n\r\n.as-date-input-icon-ctn {\r\n    border-left: 1px solid #ddd;\r\n    text-align: center;\r\n    position: absolute;\r\n    right: 0;\r\n    width: 29px;\r\n    box-sizing: border-box;\r\n    top: 0;\r\n    height: 28px;\r\n    background-color: rgba(169, 169, 169, 0.1);\r\n    cursor: pointer;\r\n}\r\n\r\n\r\n.as-date-input-icon-ctn:hover {\r\n    background-color: rgba(169, 169, 169, 0.25);\r\n}\r\n\r\n.as-date-input-icon-ctn:active {\r\n    background-color: rgba(169, 169, 169, 0.5);\r\n}\r\n\r\n\r\n.as-date-input-icon-ctn > span {\r\n    line-height: 28px;\r\n    font-size: 16px;\r\n}\r\n\r\n.as-date-input.as-disabled {\r\n    color: rgb(102, 102, 102);\r\n    pointer-events: none;\r\n}", ""]);



/***/ }),
/* 124 */
/***/ (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    touch-action: none;\r\n}\r\n\r\n.absol-draggable-stack > .as-dragging {\r\n    opacity: 0.2 !important;\r\n}\r\n\r\n.absol-draggable-stack-child-container.as-dragging {\r\n    opacity: 0.2 !important;\r\n}\r\n\r\n.absol-draggable-stack-clone-container {\r\n    position: fixed;\r\n    left: 0;\r\n    top: 0;\r\n    z-index: 100000;\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    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 > * {\r\n    width: 100% !important;\r\n    height: 100% !important;\r\n    box-sizing: border-box;\r\n}\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    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\r\n.absol-draggable-hstack {\r\n    --dest-x: 0px;\r\n}\r\n\r\n.absol-draggable-hstack.as-has-dragging::after {\r\n    content: \"\";\r\n    position: absolute;\r\n    transition: left 0.1s;\r\n    top: 0;\r\n    bottom: 0;\r\n    left: calc(var(--dest-x) - 3px);\r\n    border-left: solid 3px rgb(74, 174, 233);\r\n    border-right: solid 3px rgb(74, 174, 233);\r\n}\r\n\r\n.absol-draggable-hstack.as-no-change::after {\r\n    visibility: hidden;\r\n}\r\n\r\n\r\n.absol-draggable-hstack > * {\r\n    display: inline-block;\r\n    vertical-align: middle;\r\n}\r\n\r\n\r\n.absol-draggable-vstack {\r\n    --dest-y: unset;\r\n}\r\n\r\n/**.as-state-drag*/\r\n.absol-draggable-vstack.as-state-drag::after {\r\n    content: \"\";\r\n    display: block;\r\n    position: absolute;\r\n    top: calc(var(--dest-y) - 3px);\r\n    left: 0;\r\n    right: 0;\r\n    transition: top 0.1s;\r\n    border-top: solid 3px rgb(74, 174, 233);\r\n    border-bottom: solid 3px rgb(74, 174, 233);\r\n    z-index: 999;\r\n}\r\n\r\n\r\n.absol-draggable-vstack.as-state-no-change::after {\r\n    visibility: hidden;\r\n}", ""]);



/***/ }),
/* 125 */
/***/ (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", ""]);



/***/ }),
/* 126 */
/***/ (function(module, exports, __webpack_require__) {


var content = __webpack_require__(127);

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) {}

/***/ }),
/* 127 */
/***/ (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: rgba(169, 169, 172, 0.1);\r\n}\r\n\r\n.absol-exp-node:focus,\r\n.absol-exp-node.as-active:focus {\r\n    background-color: rgba(20, 185, 235, 0.3);\r\n}\r\n\r\n.absol-exp-node.as-active {\r\n    background-color: rgba(169, 169, 172, 0.2);\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}", ""]);



/***/ }),
/* 128 */
/***/ (function(module, exports, __webpack_require__) {


var content = __webpack_require__(129);

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) {}

/***/ }),
/* 129 */
/***/ (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", ""]);



/***/ }),
/* 130 */
/***/ (function(module, exports, __webpack_require__) {


var content = __webpack_require__(131);

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) {}

/***/ }),
/* 131 */
/***/ (function(module, exports, __webpack_require__) {

exports = module.exports = __webpack_require__(4)(false);
// Module
exports.push([module.i, ".as-emoji-picker {\r\n    font-size: 12px;\r\n    border: 1px solid #dddddd;\r\n    box-sizing: border-box;\r\n    font-family: Arial, Helvetica, sans-serif;\r\n}\r\n\r\n.as-emoji-picker-preview {\r\n    display: inline-block;\r\n    vertical-align: top;\r\n    width: 80px;\r\n    height: 110px;\r\n    border-right: 1px solid #dddddd;\r\n    text-align: center;\r\n\r\n}\r\n\r\n\r\n.as-emoji-picker-preview-anim {\r\n    width: 60px;\r\n    height: 60px;\r\n    margin-top: 5px;\r\n}\r\n\r\n.as-emoji-picker-preview-desc {\r\n    font-size: 12px;\r\n    font-weight: bold;\r\n    color: black;\r\n}\r\n\r\n.as-emoji-picker-preview-shortcut {\r\n    font-size: 12px;\r\n    color: rgb(70, 70, 70);\r\n}\r\n\r\n\r\n.as-emoji-picker-list {\r\n    display: inline-block;\r\n    vertical-align: top;\r\n    overflow-y: auto;\r\n    width: calc(100% - 81px);\r\n    height: 110px;\r\n    padding: 5px;\r\n    box-sizing: border-box;\r\n}\r\n\r\n\r\n.as-emoji-picker-item {\r\n    display: inline-block;\r\n    padding: 5px;\r\n    width: 30px;\r\n    height: 30px;\r\n    box-sizing: border-box;\r\n    border-radius: 6px;\r\n}\r\n\r\n.as-emoji-picker-item:hover {\r\n    background-color: rgba(169, 169, 170, 0.3);\r\n}\r\n\r\n.as-emoji-picker-item:active {\r\n    background-color: rgba(169, 169, 170, 0.7);\r\n}", ""]);



/***/ }),
/* 132 */
/***/ (function(module, exports, __webpack_require__) {


var content = __webpack_require__(133);

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) {}

/***/ }),
/* 133 */
/***/ (function(module, exports, __webpack_require__) {

exports = module.exports = __webpack_require__(4)(false);
// Module
exports.push([module.i, ".as-flexicon-button {\r\n    box-sizing: border-box;\r\n    border: solid 1px #bfbfbf;\r\n    background-color: #ebebeb;\r\n    border-radius: 0.2em;\r\n    outline: none;\r\n    padding: 0;\r\n    overflow: hidden;\r\n    display: inline-block;\r\n    vertical-align: middle;\r\n}\r\n\r\n.as-flexicon-button div,\r\n.as-flexicon-button span {\r\n    font-weight: inherit;\r\n    font-size: inherit;\r\n}\r\n\r\n\r\n.as-icon-button-table-box {\r\n    display: table;\r\n    width: 100%;\r\n    height: 100%;\r\n}\r\n\r\n.as-flexicon-button:hover .as-flexicon-button-content {\r\n    background-color: rgba(0, 0, 0, 0.1);\r\n}\r\n\r\n.as-flexicon-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\r\n.as-flexicon-button-content {\r\n    display: table-row;\r\n}\r\n\r\n\r\n.as-flexicon-button-icon-container,\r\n.as-flexicon-button-text-container {\r\n    display: table-cell;\r\n    box-sizing: content-box;\r\n    vertical-align: middle;\r\n    text-align: center;\r\n}\r\n\r\n.as-flexicon-button-icon-container:empty,\r\n.as-flexicon-button-text-container:empty {\r\n    display: none;\r\n}\r\n\r\n.as-flexicon-button-icon-container {\r\n    width: 2em;\r\n    background-color: rgba(0, 0, 0, 0.0893617021);\r\n    color: rgb(146, 146, 146);\r\n}\r\n\r\n\r\n.as-flexicon-button-icon-container > span,\r\n.as-flexicon-button-icon-container > i,\r\n.as-flexicon-button-icon-container > svg,\r\n.as-flexicon-button-icon-container > img {\r\n    font-size: 1em;\r\n}\r\n\r\n.as-flexicon-button-text-container {\r\n    padding-left: 0.357em;\r\n    padding-right: 0.357em;\r\n    box-sizing: border-box;\r\n    min-width: 2em;\r\n}\r\n\r\n\r\n.as-flexicon-button-icon-container + .as-flexicon-button-text-container {\r\n    border-left: solid 1px #bfbfbf;\r\n}\r\n\r\n.as-flexicon-button-icon-container:empty + .as-flexicon-button-text-container {\r\n    border-left: none;\r\n    padding-left: 0.714em;\r\n    padding-right: 0.714em;\r\n}\r\n\r\n/*** theme  ***/\r\n\r\n.as-flexicon-button.primary {\r\n    border-color: #005bbd;\r\n    background-color: #007bff;\r\n    color: white;\r\n}\r\n\r\n.as-flexicon-button.primary .as-flexicon-button-icon-container {\r\n    color: white;\r\n}\r\n\r\n.as-flexicon-button.primary .as-flexicon-button-text-container {\r\n    border-color: #005bbd;\r\n}\r\n\r\n\r\n.as-flexicon-button.secondary {\r\n    border-color: #4e555a;\r\n    background-color: #6d767e;\r\n    color: white;\r\n}\r\n\r\n.as-flexicon-button.secondary .as-flexicon-button-icon-container {\r\n    color: white;\r\n}\r\n\r\n.as-flexicon-button.secondary .as-flexicon-button-text-container {\r\n    border-left-color: #4e555a;\r\n}\r\n\r\n\r\n.as-flexicon-button.success {\r\n    border-color: #1e7b34;\r\n    background-color: #29a847;\r\n    color: white;\r\n}\r\n\r\n.as-flexicon-button.success .as-flexicon-button-icon-container {\r\n    color: white;\r\n}\r\n\r\n.as-flexicon-button.success .as-flexicon-button-text-container {\r\n    border-left-color: #1e7b34;\r\n}\r\n\r\n\r\n.as-flexicon-button.danger {\r\n    border-color: #b21f2e;\r\n    background-color: #dc3848;\r\n    color: white;\r\n}\r\n\r\n.as-flexicon-button.danger .as-flexicon-button-icon-container {\r\n    color: white;\r\n}\r\n\r\n.as-flexicon-button.danger .as-flexicon-button-text-container {\r\n    border-left-color: #b21f2e;\r\n}\r\n\r\n.as-flexicon-button.warning {\r\n    border-color: #9e7700;\r\n    background-color: #e0a800;\r\n    color: black;\r\n}\r\n\r\n.as-flexicon-button.warning .as-flexicon-button-icon-container {\r\n    color: white;\r\n}\r\n\r\n.as-flexicon-button.warning .as-flexicon-button-text-container {\r\n    border-left-color: #9e7700;\r\n}\r\n\r\n.as-flexicon-button.info {\r\n    border-color: #117888;\r\n    background-color: #17a2b8;\r\n    color: white;\r\n}\r\n\r\n.as-flexicon-button.info .as-flexicon-button-icon-container {\r\n    color: white;\r\n}\r\n\r\n.as-flexicon-button.info .as-flexicon-button-text-container {\r\n    border-left-color: #117888;\r\n}\r\n\r\n.as-flexicon-button.light {\r\n    border-color: #c9d1d9;\r\n    background-color: #f8f9fa;\r\n    color: #212529;\r\n}\r\n\r\n.as-flexicon-button.light .as-flexicon-button-icon-container {\r\n    color: white;\r\n}\r\n\r\n.as-flexicon-button.light .as-flexicon-button-text-container {\r\n    border-left-color: #c9d1d9;\r\n}\r\n\r\n.as-flexicon-button.dark {\r\n    border-color: #171a1c;\r\n    background-color: #343a40;\r\n    color: white;\r\n}\r\n\r\n.as-flexicon-button.dark .as-flexicon-button-icon-container {\r\n    color: white;\r\n}\r\n\r\n.as-flexicon-button.dark .as-flexicon-button-text-container {\r\n    border-left-color: #171a1c;\r\n}\r\n\r\n.as-flexicon-button.link {\r\n    border-color: transparent;\r\n    background-color: transparent;\r\n    color: #007bff;\r\n}\r\n\r\n.as-flexicon-button.link .as-flexicon-button-icon-container {\r\n    color: #007bff;\r\n    background: transparent;\r\n}\r\n\r\n.as-flexicon-button.link .as-flexicon-button-text-container {\r\n    border-left-color: transparent;\r\n}\r\n\r\n.as-flexicon-button.link:hover .as-flexicon-button-text-container {\r\n    text-decoration: underline;\r\n}", ""]);



/***/ }),
/* 134 */
/***/ (function(module, exports, __webpack_require__) {


var content = __webpack_require__(135);

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) {}

/***/ }),
/* 135 */
/***/ (function(module, exports, __webpack_require__) {

exports = module.exports = __webpack_require__(4)(false);
// Module
exports.push([module.i, ".as-flexicon-input-icon-ctn > span,\r\n.as-flexicon-input-icon-ctn > i,\r\n.as-flexicon-input-icon-ctn > svg,\r\n.as-flexicon-input-icon-ctn > img {\r\n    font-size: 1em;\r\n    line-height: 1;\r\n}\r\n\r\n.as-flexicon-input {\r\n    position: relative;\r\n    border: 1px solid #dddddd;\r\n    display: inline-block;\r\n    vertical-align: middle;\r\n    height: 2em;\r\n    font-size: 14px;\r\n    box-sizing: border-box;\r\n    border-radius: 3px;\r\n    text-align: left;\r\n    white-space: nowrap;\r\n}\r\n\r\n.as-flexicon-input::before {\r\n    content: \"\";\r\n    width: 0;\r\n    height: 100%;\r\n    display: inline-block;\r\n    vertical-align: middle;\r\n}\r\n\r\n\r\n.as-flexicon-input-icon-ctn:empty {\r\n    display: none;\r\n}\r\n\r\n\r\n.as-flexicon-input:not(.as-flexicon-input-has-icon) input{\r\n    padding-left: 0.3em;\r\n}\r\n\r\n.as-flexicon-input-icon-ctn {\r\n    display: inline-block;\r\n    vertical-align: middle;\r\n    /*text-align: center;*/\r\n    font-size: 1.2em;\r\n    width: 1.25em;\r\n    text-align: center;\r\n}\r\n\r\n.as-flexicon-input-unit-ctn {\r\n    width: 1.5em;\r\n    display: inline-block;\r\n    vertical-align: middle;\r\n    text-align: center;\r\n}\r\n\r\n.as-flexicon-input-unit-ctn:empty {\r\n    display: none;\r\n}\r\n\r\n\r\n.as-flexicon-input input {\r\n    border: none;\r\n    font-size: 1em;\r\n    outline: none;\r\n    height: 100%;\r\n    background-color: transparent;\r\n    box-sizing: border-box;\r\n    width: 100%;\r\n    font-family: inherit;\r\n    padding-left: 0;\r\n    padding-right: 0;\r\n    display: inline-block;\r\n    vertical-align: middle;\r\n}\r\n\r\n\r\n.as-flexicon-input.as-flexicon-input-has-icon input,\r\n.as-flexicon-input.as-flexicon-input-has-unit input {\r\n    width: calc(100% - 1.5em);\r\n}\r\n\r\n.as-flexicon-input.as-flexicon-input-has-unit input{\r\n    text-align: right;\r\n}\r\n\r\n\r\n.as-flexicon-input.as-flexicon-input-has-icon.as-flexicon-input-has-unit input {\r\n    width: calc(100% - 3em);\r\n}", ""]);



/***/ }),
/* 136 */
/***/ (function(module, exports, __webpack_require__) {


var content = __webpack_require__(137);

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) {}

/***/ }),
/* 137 */
/***/ (function(module, exports, __webpack_require__) {

exports = module.exports = __webpack_require__(4)(false);
// Module
exports.push([module.i, ".absol-frame{\r\n    \r\n}", ""]);



/***/ }),
/* 138 */
/***/ (function(module, exports, __webpack_require__) {


var content = __webpack_require__(139);

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) {}

/***/ }),
/* 139 */
/***/ (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:not(.absol-active) *,\r\n.absol-frame-view-frame-container:not(.absol-active) {\r\n    pointer-events: none;\r\n    user-select: none;\r\n    -webkit-user-select: none;\r\n    -moz-user-select: none;\r\n}\r\n\r\n\r\n.absol-frame-view-frame-container > div {\r\n    width: 100%;\r\n    height: 100%;\r\n}", ""]);



/***/ }),
/* 140 */
/***/ (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:active .absol-scrollbar-container {\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.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.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-icon-container > span {\r\n    display: inline;\r\n    vertical-align: middle;\r\n    font-size: 1em;\r\n}\r\n\r\n.absol-tabbar-button .absol-tabbar-button-close,\r\n.absol-tabbar-button .absol-tabbar-button-close-circle\r\n{\r\n    visibility: hidden;\r\n    color: rgb(190, 190, 190);\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\r\n\r\n.absol-tabbar-button:hover .absol-tabbar-button-close,\r\n.absol-tabbar-button-active .absol-tabbar-button-close,\r\n.absol-tabbar-button:hover .absol-tabbar-button-close-circle,\r\n.absol-tabbar-button-active .absol-tabbar-button-close-circle\r\n{\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.absol-tabbar-button:not(.absol-tabbar-button-modified) .absol-tabbar-button-icon-container:not(:hover) .absol-tabbar-button-close-circle,\r\n.absol-tabbar-button:not(.absol-tabbar-button-modified) .absol-tabbar-button-icon-container:hover .absol-tabbar-button-close,\r\n.absol-tabbar-button.absol-tabbar-button-modified .absol-tabbar-button-close-circle,\r\n.absol-tabbar-button.absol-tabbar-button-modified .absol-tabbar-button-icon-container:not(:hover) .absol-tabbar-button-close\r\n{\r\n    display: none;\r\n}\r\n\r\n\r\n.absol-button-range {\r\n}\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.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.absol-tabview-container-hidden *,\r\n.absol-tabview-container.absol-tabview-container-hidden {\r\n    pointer-events: none;\r\n    user-select: none;\r\n    -webkit-user-select: none;\r\n    -moz-user-select: none;\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    box-sizing: border-box;\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/************** 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.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-icon-container\r\n{\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}\r\n\r\n\r\n.absol-tabview.as-without-close-button > .absol-tabbar .absol-tabbar-button .absol-tabbar-button-icon-container {\r\n    display: none;\r\n}\r\n\r\n.absol-tabview.as-without-close-button > .absol-tabbar .absol-tabbar-button {\r\n    padding-right: 1em;\r\n}\r\n\r\n/************************ Like Metro theme *********************/\r\n\r\n.absol-tabview.metro-flat > .absol-tabbar .absol-tabbar-button {\r\n    border-radius: 0;\r\n    margin-right: 0;\r\n    margin-left: 0;\r\n    border-left: none;\r\n    border-top: none;\r\n    border-bottom: none;\r\n    border-right: solid 1px rgba(169, 169, 169, 0.3);\r\n    font-size: 1em;\r\n}\r\n\r\n.absol-tabview.metro-flat > .absol-tabbar {\r\n    box-shadow: 0px -1px 0px 0px #ccc;\r\n}\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-single-page {\r\n    position: relative;\r\n}\r\n\r\n\r\n.absol-single-page-header {\r\n    box-sizing: border-box;\r\n    z-index: 2;\r\n    display: block;\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    position: absolute;\r\n    left: 0;\r\n    right: 0;\r\n    top: 0;\r\n    bottom: 0;\r\n    overflow-y: auto;\r\n}\r\n\r\n.absol-single-page.as-viewport-full > .absol-single-page-scroller > .absol-single-page-scroller-viewport {\r\n    height: 100%;\r\n    width: 100%;\r\n    overflow: hidden;\r\n}\r\n\r\n.absol-single-page.as-no-scroll > .absol-single-page-scroller {\r\n    overflow: hidden;\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, ".as-hexa-section-label {\r\n    position: relative;\r\n    -webkit-print-color-adjust: exact;\r\n    /*friendly print*/\r\n}\r\n\r\n.as-hexa-section-label-text {\r\n    position: relative;\r\n    display: inline-block;\r\n    vertical-align: middle;\r\n    font-size: 1em;\r\n    padding-right: 2.5em;\r\n    color: white;\r\n    font-weight: bold;\r\n    z-index: 2;\r\n}\r\n\r\n@media print {\r\n    .as-hexa-section-label-text {\r\n        color: white !important;\r\n    }\r\n\r\n    .as-hexa-section-label-index {\r\n        color: rgb(237, 147, 54) !important;\r\n    }\r\n}\r\n\r\n\r\n.as-hexa-section-label-index {\r\n    position: relative;\r\n    display: inline-block;\r\n    vertical-align: middle;\r\n    text-align: center;\r\n    color: rgb(237, 147, 54);\r\n    font-weight: 900;\r\n    z-index: 2;\r\n}\r\n\r\n.as-hexa-section-label-background {\r\n    position: absolute;\r\n    top: 0;\r\n    left: 0;\r\n    bottom: 0;\r\n    z-index: 1;\r\n}\r\n\r\n.as-hexa-section-label-background>svg {\r\n    display: block;\r\n}\r\n\r\n.as-hexa-section-label-index-box {\r\n    stroke: rgb(251, 186, 130);\r\n    fill: white;\r\n    stroke-width: 2.5;\r\n}\r\n\r\n.as-hexa-section-label-text-box {\r\n    fill: rgb(237, 147, 54);\r\n    stroke: 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, "/*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}", ""]);



/***/ }),
/* 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, "/*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} ", ""]);



/***/ }),
/* 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, ".as-linear-color-bar {\r\n    position: relative;\r\n    height: 2em;\r\n}\r\n\r\n.as-linear-color-background {\r\n    position: absolute;\r\n    top: 0;\r\n    left: 0;\r\n    right: 0;\r\n    bottom: 0;\r\n    display: block;\r\n}\r\n\r\n.as-linear-color-value-text {\r\n    position: absolute;\r\n    top: 0;\r\n    font-weight: 900;\r\n    white-space: nowrap;\r\n}\r\n\r\n.as-linear-color-min-value-text,\r\n.as-linear-color-max-value-text {\r\n    position: absolute;\r\n    bottom: 0;\r\n    white-space: nowrap;\r\n    font-weight: bold;\r\n}\r\n\r\n\r\n\r\n.as-linear-color-min-value-text {\r\n    left: 0;\r\n}\r\n\r\n.as-linear-color-rect {\r\n    stroke: none;\r\n}\r\n\r\n\r\n.as-linear-color-value-arrow {\r\n    fill: rgb(244, 124, 32);\r\n    stroke: rgb(244, 124, 32);\r\n}\r\n\r\n.as-linear-color-split-line {\r\n    stroke: white;\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, ".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}", ""]);



/***/ }),
/* 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, ".as-conversation-box {\r\n    display: flex;\r\n    flex-direction: column;\r\n}\r\n\r\n.as-conversation-box-message-ctn {\r\n    flex-grow: 1;\r\n}\r\n\r\n.as-conversation-box-input-ctn {\r\n    /** empty**/\r\n}\r\n\r\n.as-message-input {\r\n    position: relative;\r\n    box-sizing: border-box;\r\n    padding-top: 5px;\r\n    padding-bottom: 5px;\r\n    padding-left: 5px;\r\n    overflow: visible;\r\n    --plugin-buttons-width: 0px;\r\n}\r\n\r\n\r\n.as-message-input-plugin-btn {\r\n    font-size: inherit;\r\n    width: 40px;\r\n    height: 40px;\r\n    padding: 0;\r\n    border: none;\r\n    color: rgb(122, 122, 122);\r\n    background-color: rgb(241, 241, 241);\r\n    outline: none;\r\n    border-radius: 50%;\r\n    display: inline-block;\r\n    vertical-align: middle;\r\n}\r\n\r\n\r\n.as-message-input-plugin-btn:active {\r\n    background-color: rgb(212, 212, 212);\r\n}\r\n\r\n.as-message-input-plugin-btn:hover {\r\n    background-color: rgb(235, 235, 235);\r\n\r\n}\r\n\r\n\r\n.as-message-input-plugin-btn span {\r\n    font-size: 24px;\r\n}\r\n\r\n\r\n.as-message-input-right {\r\n    position: absolute;\r\n    bottom: 10px;\r\n    right: 5px;\r\n    z-index: 0;\r\n    white-space: nowrap;\r\n}\r\n\r\n.as-message-input-right .as-message-input-plugin-btn {\r\n    margin-left: 10px;\r\n}\r\n\r\n\r\n.as-message-input-emoji-btn-ctn {\r\n    position: absolute;\r\n    left: 5px;\r\n    bottom: 5px;\r\n}\r\n\r\n\r\n.as-message-input-pre-ctn {\r\n    position: relative;\r\n    width: calc(100% - 55px - var(--plugin-buttons-width));\r\n    border-radius: 25px;\r\n    box-sizing: border-box;\r\n    transition: width 0.1s;\r\n    padding: 10px 20px 10px 50px;\r\n    background-color: rgb(241, 241, 244);\r\n}\r\n\r\n\r\n.as-message-input-pre-ctn::after {\r\n    display: inline-block;\r\n    content: \"\";\r\n    height: 30px;\r\n    vertical-align: middle;\r\n}\r\n\r\n\r\n.as-message-input.as-has-text .as-message-input-pre-ctn,\r\n.as-message-input.as-has-quote .as-message-input-pre-ctn,\r\n.as-message-input.as-has-attachment .as-message-input-pre-ctn {\r\n    width: calc(100% - 55px);\r\n}\r\n\r\n\r\n.as-message-input-pre {\r\n    display: inline-block;\r\n    width: calc(100% - 2px);\r\n    max-height: 6.5em;\r\n    box-sizing: border-box;\r\n    font-family: inherit;\r\n    font-size: inherit;\r\n    outline: none;\r\n    vertical-align: middle;\r\n    margin: 0;\r\n    white-space: pre-wrap;\r\n    overflow-x: hidden;\r\n    overflow-y: auto;\r\n    line-height: 1.5;\r\n    border: none;\r\n}\r\n\r\n.as-message-input-pre:before {\r\n    content: \"\";\r\n    line-height: 30px;\r\n    display: inline;\r\n    vertical-align: middle;\r\n}\r\n\r\n.as-message-input-camera-caller,\r\n.as-message-input-camera-microphone {\r\n    display: none;\r\n}\r\n\r\n.as-message-input-emoji-picker-ctn {\r\n    position: absolute;\r\n    bottom: 100%;\r\n    left: 0;\r\n    right: 0;\r\n    user-select: none;\r\n    -webkit-user-select: none;\r\n    background-color: white;\r\n}\r\n\r\n\r\n.as-message-input-plugin-btn.as-message-input-plugin-send {\r\n    color: white;\r\n    background: linear-gradient(135deg, rgb(0, 120, 212), rgb(0, 188, 242));\r\n    transform: scale(1);\r\n    transition: scale 0.1s;\r\n}\r\n\r\n.as-message-input-plugin-btn.as-message-input-plugin-send span {\r\n    font-size: 20px;\r\n}\r\n\r\n.as-message-input-plugin-btn.as-message-input-plugin-send:hover {\r\n    background: linear-gradient(135deg, rgb(0, 140, 212), rgb(0, 208, 252));\r\n}\r\n\r\n.as-message-input-plugin-btn.as-message-input-plugin-send:active {\r\n    transform: scale(0.9);\r\n}\r\n\r\n\r\n.as-message-input:not(.as-text-changed):not(.as-has-attachment):not(.as-has-quote) .as-message-input-plugin-send,\r\n.as-message-input:not(.as-has-text):not(.as-has-attachment):not(.as-has-quote) .as-message-input-plugin-send,\r\n.as-message-input:not(.as-mode-edit) .as-message-input-plugin-cancel,\r\n.as-message-input.as-mode-edit.as-text-changed.as-has-text .as-message-input-plugin-cancel,\r\n.as-message-input:not(.as-has-attachment):not(.as-drag-hover) .as-message-input-attachment-ctn,\r\n.as-message-input.as-auto-send .as-message-input-attachment-ctn,\r\n.as-message-input.as-mode-edit .as-message-input-plugin-file,\r\n.as-message-input.as-has-text .as-message-input-plugin-file,\r\n.as-message-input.as-has-quote .as-message-input-plugin-file,\r\n.as-message-input:not(.as-has-quote) .as-message-quote-box {\r\n    display: none;\r\n}\r\n\r\n.as-message-input .as-message-quote-box {\r\n    border-bottom: 1px solid #ddd;\r\n}\r\n\r\n.as-message-quote-box {\r\n    position: relative;\r\n\r\n}\r\n\r\n.as-message-input.as-has-attachment .as-message-quote-box {\r\n    margin-bottom: 5px;\r\n}\r\n\r\n.as-message-quote-remove-btn {\r\n    position: absolute;\r\n    color: rgb(43, 44, 51);\r\n    right: -7px;\r\n    top: 5px;\r\n    width: 20px;\r\n    height: 20px;\r\n    padding: 0;\r\n    background: transparent;\r\n    border: none;\r\n    border-radius: 50%;\r\n    font-size: 16px;\r\n    outline: none;\r\n}\r\n\r\n.as-message-quote-remove-btn:hover {\r\n    color: rgb(143, 144, 151);\r\n}\r\n\r\n.as-message-quote-box {\r\n    user-select: none;\r\n    -webkit-user-select: none;\r\n}\r\n\r\n.as-message-quote-box:not(.as-removable) .as-message-quote-remove-btn {\r\n    display: none;\r\n}\r\n\r\n\r\n.as-message-quote-box > div {\r\n    display: inline-block;\r\n    vertical-align: top;\r\n}\r\n\r\n.as-message-quote-box:not(.as-has-img):not(.as-has-file) .as-message-quote-img {\r\n    display: none;\r\n}\r\n\r\n.as-message-quote-img {\r\n    width: 40px;\r\n    height: 40px;\r\n    padding: 5px;\r\n    box-sizing: border-box;\r\n    background-size: cover;\r\n    background-origin: border-box;\r\n    background-position: center;\r\n    background-repeat: no-repeat;\r\n}\r\n\r\n.as-message-quote-sym {\r\n    width: 25px;\r\n}\r\n\r\n.as-message-quote-sym > span {\r\n    font-size: 25px;\r\n    color: rgb(169, 169, 172);\r\n}\r\n\r\n.as-message-quote-content {\r\n    font-family: \"Helvetica Neue\", Arial, Helvetica, sans-serif;\r\n    width: calc(100% - 26px);\r\n    box-sizing: border-box;\r\n    padding-left: 20px;\r\n}\r\n\r\n.as-message-quote-box.as-has-img .as-message-quote-content,\r\n.as-message-quote-box.as-has-file .as-message-quote-content {\r\n    width: calc(100% - 66px);\r\n    padding-left: 5px;\r\n}\r\n\r\n.as-message-quote-box.as-has-file .as-message-quote-img {\r\n    background-origin: padding-box;\r\n    background-size: contain;\r\n}\r\n\r\n.as-message-quote-text {\r\n    font-size: 1.14em;\r\n    line-height: 1.75;\r\n    font-style: italic;\r\n    color: rgb(43, 44, 51);\r\n    max-width: 100%;\r\n    word-break: break-word;\r\n    white-space: pre-wrap;\r\n}\r\n\r\n.as-message-quote-box.as-shorten-text .as-message-quote-text {\r\n    word-break: normal;\r\n\r\n    overflow: hidden;\r\n    white-space: nowrap;\r\n    text-overflow: ellipsis;\r\n}\r\n\r\n.as-message-quote-text .as-emoji {\r\n    width: 20px;\r\n    height: 20px;\r\n}\r\n\r\n.as-message-quote-desc {\r\n    font-size: 0.85em;\r\n    color: rgb(80, 80, 88);\r\n}\r\n\r\n.as-message-input-attachment-ctn {\r\n    border-bottom: 1px solid #ddd;\r\n    max-height: 170px;\r\n    overflow-y: auto;\r\n}\r\n\r\n\r\n.as-message-input-attach-preview {\r\n    display: inline-block;\r\n    position: relative;\r\n    width: 135px;\r\n    height: 135px;\r\n    vertical-align: middle;\r\n    margin-right: 5px;\r\n    margin-bottom: 5px;\r\n    border-radius: 10px;\r\n    background-color: white;\r\n    overflow: hidden;\r\n}\r\n\r\n.as-message-input-attach-preview-image {\r\n    min-width: 20px;\r\n    image-orientation: from-image;\r\n    width: 100%;\r\n    height: 100%;\r\n    background-size: cover;\r\n    background-position: center center;\r\n    background-repeat: no-repeat;\r\n}\r\n\r\n\r\n.as-message-input-attach-preview-file {\r\n    max-width: 50%;\r\n    max-height: 50%;\r\n    margin-left: 10px;\r\n    margin-top: 10px;\r\n}\r\n\r\n.as-message-input-attach-preview-close-btn {\r\n    position: absolute;\r\n    right: 10px;\r\n    top: 10px;\r\n    width: 18px;\r\n    height: 18px;\r\n    border-radius: 50%;\r\n    text-align: center;\r\n    border: 1px solid white;\r\n    outline: none;\r\n    padding: 0;\r\n    color: white;\r\n    -webkit-box-shadow: 0px 0px 3px 0px rgba(0, 0, 0, 0.64);\r\n    -moz-box-shadow: 0px 0px 3px 0px rgba(0, 0, 0, 0.64);\r\n    box-shadow: 0px 0px 3px 0px rgba(0, 0, 0, 0.64);\r\n    background-color: rgba(100, 100, 100, 0.5);\r\n}\r\n\r\n.as-message-input-attach-preview-close-btn span {\r\n    font-size: 14px;\r\n}\r\n\r\n.as-message-input-attach-preview-close-btn:hover {\r\n    background-color: rgba(255, 255, 255, 0.5);\r\n    color: rgb(200, 200, 200);\r\n}\r\n\r\n.as-message-input-attach-preview-close-btn:active {\r\n    background-color: rgba(255, 255, 255, 0.7);\r\n    color: rgb(255, 255, 255);\r\n}\r\n\r\n\r\n.as-message-input:not(.as-drag-hover) .as-message-input-attachment-add-btn-drop,\r\n.as-message-input.as-drag-hover .as-message-input-attachment-add-btn-plus {\r\n    display: none;\r\n}\r\n\r\n.as-message-input-attach-preview-name {\r\n    position: absolute;\r\n    left: 10px;\r\n    bottom: 10px;\r\n    right: 10px;\r\n    text-shadow: 0px 1px 3px white;\r\n    color: black;\r\n    font-size: 14px;\r\n    font-family: Arial, Helvetica, sans-serif;\r\n    overflow: hidden;\r\n    text-overflow: ellipsis;\r\n}\r\n\r\n.as-message-input-attachment-add-btn {\r\n    display: inline-block;\r\n    vertical-align: middle;\r\n    height: 135px;\r\n    width: 60px;\r\n    border: none;\r\n    border-radius: 10px;\r\n    padding: 0;\r\n    background-color: rgb(196, 196, 200);\r\n    color: white;\r\n    font-size: 50px;\r\n    outline: none;\r\n    margin-bottom: 10px;\r\n}\r\n\r\n.as-message-input-attachment-add-btn:hover {\r\n    background-color: rgb(169, 169, 169)\r\n\r\n}\r\n\r\n.as-message-input-attachment-add-btn:active {\r\n    background-color: rgb(138, 141, 145)\r\n}\r\n\r\n.as-message-input-external-tools-popup {\r\n    position: absolute;\r\n    left: 0;\r\n    max-width: 100%;\r\n    bottom: 100%;\r\n    background-color: white;\r\n}\r\n\r\nimg.as-emoji {\r\n    vertical-align: bottom;\r\n}\r\n\r\nspan.as-emoji-text {\r\n    position: absolute;\r\n    color: transparent;\r\n    width: 20px;\r\n    opacity: 0;\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-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}", ""]);



/***/ }),
/* 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, ".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}", ""]);



/***/ }),
/* 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-page-selector{\r\n    white-space: normal;\r\n    user-select: none;\r\n    -webkit-user-select: none;\r\n    -moz-user-select: none;\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.absol-page-number-buttons{\r\n    display: inline-block;\r\n    vertical-align: middle;\r\n}\r\n\r\n.absol-page-number-input > label{\r\n    font-weight: 100;\r\n}\r\n\r\n.absol-page-number-buttons > li.page-previous, \r\n.absol-page-number-buttons > li.page-next,\r\n.absol-page-number-buttons > li.page-first,\r\n.absol-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.absol-page-number-buttons > li.absol-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.absol-page-number-buttons > li.absol-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.absol-page-number-buttons > li.absol-page-number.active > a{\r\n\tcolor: white;\r\n    \r\n}\r\n\r\n.absol-page-number-buttons > li> a{\r\n    line-height: 30px;\r\n    text-decoration:none;\r\n    outline: none;\r\n}\r\n\r\n.absol-page-number-buttons > li:not(.active):hover{\r\n    background-color: #eee;\r\n\r\n}\r\n\r\n.absol-page-selector .absol-page-number-input{\r\n    display: inline-block;\r\n    vertical-align: middle;\r\n}\r\n\r\n.absol-page-selector .absol-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}\r\n\r\n.absol-page-link {\r\n    color: #147af6;\r\n    cursor: pointer;\r\n    text-decoration: underline;\r\n}\r\n\r\n.absol-page-number {\r\n    color: #147af6;\r\n    cursor: pointer;\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, ".as-preinput {\r\n    margin: 0;\r\n    padding: 0;\r\n    white-space: pre-wrap;\r\n    -moz-user-modify: read-write;\r\n    -webkit-user-modify: read-write;\r\n    word-break: normal;\r\n}\r\npre.as-preinput{\r\n    word-break: normal;\r\n}\r\n\r\n\r\n.as-preinput img {\r\n    display: none;\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, ".as-progress-bar {\r\n    height: 1em;\r\n    background-color: #e9ecef;\r\n    border-radius: .25em;\r\n    box-sizing: border-box;\r\n    overflow: hidden;\r\n}\r\n\r\n\r\n.as-progress-bar-value {\r\n    height: 100%;\r\n    width: 0;\r\n    color: #fff;\r\n    text-align: center;\r\n    white-space: nowrap;\r\n    background-color: #007bff;\r\n    transition: width .6s ease;\r\n}\r\n\r\n.as-progress-bar.as-variant-success .as-progress-bar-value {\r\n    background-color: #28a745;\r\n}\r\n\r\n.as-progress-bar.as-variant-info .as-progress-bar-value {\r\n    background-color: #17a2b8;\r\n}\r\n\r\n.as-progress-bar.as-variant-warning .as-progress-bar-value {\r\n    background-color: #ffc107;\r\n}\r\n\r\n.as-progress-bar.as-variant-danger .as-progress-bar-value {\r\n    background-color: #dc3545;\r\n}\r\n\r\n\r\n.as-progress-bar.as-striped .as-progress-bar-value,\r\n.as-progress-bar.as-animated .as-progress-bar-value {\r\n    background-image: linear-gradient(45deg, hsla(0, 0%, 100%, .15) 25%, transparent 0, transparent 50%, hsla(0, 0%, 100%, .15) 0, hsla(0, 0%, 100%, .15) 75%, transparent 0, transparent);\r\n    background-size: 1.33333em 1.33333em;\r\n}\r\n\r\n@keyframes as-progress-bar-stripes {\r\n    0% {\r\n        background-position: 1.33333em 0\r\n    }\r\n\r\n    to {\r\n        background-position: 0 0\r\n    }\r\n}\r\n\r\n.as-progress-bar.as-animated .as-progress-bar-value {\r\n    animation: as-progress-bar-stripes 1s linear infinite;\r\n}", ""]);



/***/ }),
/* 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, ".as-quick-list-button {\r\n    box-sizing: border-box;\r\n    height: calc(2em + 2px);\r\n    font-size: 14px;\r\n}\r\n\r\n.as-quick-list-button .as-flexicon-button-text-container {\r\n    border-right: solid 1px #bfbfbf;\r\n}\r\n\r\n\r\n.as-quick-list-button-follower .absol-selectlist {\r\n    max-height: calc(100vh - 20px);\r\n    overflow-y: auto;\r\n    border: solid 1px rgb(100, 100, 255);\r\n    box-sizing: border-box;\r\n    background-color: white;\r\n    display: inline-block;\r\n    vertical-align: top;\r\n    -webkit-box-shadow: 2px 2px 6px 0px rgba(0, 0, 90, 0.55);\r\n    -moz-box-shadow: 2px 2px 6px 0px rgba(0, 0, 90, 0.55);\r\n    box-shadow: 2px 2px 6px 0px rgba(0, 0, 90, 0.55);\r\n}", ""]);



/***/ }),
/* 167 */
/***/ (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 * {\r\n    box-sizing: border-box;\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.as-selected {\r\n    background-color: #dfdfdf;\r\n}\r\n\r\n\r\n.absol-selectlist:not(.as-searching)>.absol-selectlist-item.as-last-in-group:not(:last-child) {\r\n    border-bottom: 1px solid #dddddd;\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    box-sizing: border-box;\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}\r\n\r\n\r\n", ""]);



/***/ }),
/* 168 */
/***/ (function(module, exports, __webpack_require__) {


var content = __webpack_require__(169);

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) {}

/***/ }),
/* 169 */
/***/ (function(module, exports, __webpack_require__) {

exports = module.exports = __webpack_require__(4)(false);
// Module
exports.push([module.i, ".absol-quick-path {\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    min-height: 1.5em;\r\n}\r\n\r\n.absol-quick-path button {\r\n    outline: none;\r\n    color: rgb(69, 69, 69);\r\n    height: 1.5em;\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\r\n.absol-quick-path-btn:focus span {\r\n    text-decoration: underline;\r\n}\r\n\r\n/* \r\n.absol-quick-path-btn .toggler-ico path {\r\n    fill: rgb(104, 104, 104);\r\n} */\r\n", ""]);



/***/ }),
/* 170 */
/***/ (function(module, exports, __webpack_require__) {


var content = __webpack_require__(171);

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) {}

/***/ }),
/* 171 */
/***/ (function(module, exports, __webpack_require__) {

exports = module.exports = __webpack_require__(4)(false);
// Module
exports.push([module.i, ".absol-radio-button {\r\n    display: inline;\r\n    cursor: pointer;\r\n    white-space: nowrap;\r\n}\r\n\r\n.absol-radio-button input {\r\n    display: none;\r\n}\r\n\r\n\r\n.absol-radio-button > svg {\r\n    display: inline-block;\r\n    vertical-align: middle;\r\n    width: calc(1em + 4px);\r\n    height: calc(1em + 4px);\r\n}\r\n\r\n.absol-radio-button > svg .bound {\r\n    stroke: #929292;\r\n    fill: white;\r\n}\r\n\r\n.absol-radio-button:hover > svg .bound {\r\n    fill: #d6d6d6;\r\n    stroke: black;\r\n}\r\n\r\n.absol-radio-icon .border {\r\n}\r\n\r\n.absol-radio-button .dot {\r\n    transition: opacity 0.07s;\r\n    opacity: 0;\r\n    fill: #606060;\r\n}\r\n\r\n.absol-radio-button:hover .dot {\r\n    transition: opacity 0.07s;\r\n    opacity: 0;\r\n    fill: black;\r\n}\r\n\r\n.absol-radio-button.checked .dot {\r\n    opacity: 1;\r\n    transition: opacity 0.1s;\r\n}\r\n\r\n\r\n\r\n.absol-radio-button > span:last-child {\r\n    display: none;\r\n}\r\n\r\n\r\n.absol-radio-button.disabled {\r\n    cursor: default;\r\n}\r\n\r\n.absol-radio-button.disabled:hover .dot,\r\n.absol-radio-button.disabled .dot {\r\n    fill: #929292;\r\n}\r\n\r\n.absol-radio-button.disabled .bound,\r\n.absol-radio-button.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}\r\n\r\n.absol-radio > span:not(:last-child) {\r\n    padding-right: 0.3em;\r\n}\r\n\r\n.absol-radio span:last-child {\r\n    padding-left: 0.3em;\r\n}\r\n\r\ninput:checked ~ .absol-radio-icon .dot {\r\n    opacity: 1;\r\n}", ""]);



/***/ }),
/* 172 */
/***/ (function(module, exports, __webpack_require__) {


var content = __webpack_require__(173);

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) {}

/***/ }),
/* 173 */
/***/ (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    white-space: nowrap;\r\n}\r\n\r\n.absol-radio input {\r\n    display: none;\r\n}\r\n\r\n.absol-radio > span {\r\n    white-space: pre;\r\n    cursor: inherit;\r\n    vertical-align: middle;\r\n    margin: 0;\r\n    font-size: inherit;\r\n}\r\n\r\n.absol-radio > span:empty {\r\n    display: none;\r\n}\r\n\r\n.absol-radio > svg {\r\n    display: inline-block;\r\n    vertical-align: middle;\r\n    width: calc(1em + 4px);\r\n    height: calc(1em + 4px);\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\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) > span.absol-radio-left-label {\r\n    display: none;\r\n}\r\n\r\n.absol-radio.right > span.absol-radio-right-label {\r\n    display: none;\r\n}\r\n\r\nspan.absol-radio-left-label {\r\n    padding-right: 0.3em;\r\n}\r\n\r\nspan.absol-radio-right-label {\r\n    padding-left: 0.3em;\r\n}\r\n\r\n\r\n\r\n\r\n.absol-radio.disabled {\r\n    cursor: default;\r\n}\r\n\r\n.absol-radio.disabled{\r\n    color: #777;\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}\r\n\r\ninput:checked ~ .absol-radio-icon .dot {\r\n    opacity: 1;\r\n}", ""]);



/***/ }),
/* 174 */
/***/ (function(module, exports, __webpack_require__) {


var content = __webpack_require__(175);

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) {}

/***/ }),
/* 175 */
/***/ (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 !important;\r\n}\r\n\r\n\r\n.as-resize-box-overiding.left-top {\r\n    cursor: nw-resize !important;\r\n}\r\n\r\n.as-resize-box-overiding.left-bottom {\r\n    cursor: sw-resize !important;\r\n}\r\n\r\n.as-resize-box-overiding.left {\r\n    cursor: w-resize !important;\r\n}\r\n\r\n.as-resize-box-overiding.top {\r\n    cursor: n-resize !important;\r\n}\r\n\r\n.as-resize-box-overiding.bottom {\r\n    cursor: s-resize !important;\r\n}\r\n\r\n.as-resize-box-overiding.right-top {\r\n    cursor: ne-resize !important;\r\n}\r\n\r\n.as-resize-box-overiding.right-bottom {\r\n    cursor: se-resize !important;\r\n}\r\n\r\n\r\n.as-resize-box-overiding.right {\r\n    cursor: e-resize !important;\r\n}", ""]);



/***/ }),
/* 176 */
/***/ (function(module, exports, __webpack_require__) {


var content = __webpack_require__(177);

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) {}

/***/ }),
/* 177 */
/***/ (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    background-color: white;\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}\r\n\r\n.absol-search-text-input-container input::-webkit-search-cancel-button{\r\n    display: none;\r\n}", ""]);



/***/ }),
/* 178 */
/***/ (function(module, exports, __webpack_require__) {


var content = __webpack_require__(179);

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) {}

/***/ }),
/* 179 */
/***/ (function(module, exports, __webpack_require__) {

exports = module.exports = __webpack_require__(4)(false);
// Module
exports.push([module.i, ":root {\r\n    --select-box-item-height: 20px;\r\n    --select-box-item-font-size: 14px;\r\n    --select-box-item-border-radius: 9px;\r\n    --select-box-item-close-opacity: 0;\r\n    --select-box-min-height: 30px;\r\n    --select-box-focus-item-color: rgb(208, 145, 239);\r\n}\r\n\r\n.absol-selectbox {\r\n    --list-min-width: 40px;\r\n    display: inline-block;\r\n    vertical-align: middle;\r\n    position: relative;\r\n    min-height: var(--select-box-min-height);\r\n    min-width: var(--list-min-width);\r\n    border: solid 1px #d6d6d6;\r\n    border-radius: 3px;\r\n    box-sizing: border-box;\r\n    padding-right: 20px;\r\n    overflow-y: auto;\r\n    outline: none;\r\n    background-color: white;\r\n}\r\n\r\n.absol-selectbox:not(.as-disable-click-to-focus) {\r\n    cursor: copy;\r\n}\r\n\r\n.absol-selectbox.as-disabled {\r\n    pointer-events: none;\r\n    background-color: #ebebe4;\r\n}\r\n\r\n.absol-selectbox.as-disabled .absol-selectbox-item {\r\n    opacity: 0.7;\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: calc((var(--select-box-min-height) - 2px - var(--select-box-item-height)) / 2) 2px;\r\n}\r\n\r\n.absol-selectbox-item {\r\n    font-family: Arial, Helvetica, sans-serif;\r\n    display: inline-block;\r\n    position: relative;\r\n    font-size: var(--select-box-item-font-size);\r\n    height: var(--select-box-item-height);\r\n    box-sizing: border-box;\r\n    border-radius: var(--select-box-item-border-radius);\r\n    overflow: hidden;\r\n    background-color: #5bc0de;\r\n    border-color: #46b8da;\r\n    vertical-align: top;\r\n    white-space: normal;\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    color: black;\r\n    cursor: pointer;\r\n}\r\n\r\n\r\n.absol-selectbox-item.as-theme-confirmed {\r\n    background-color: rgb(145, 228, 251);\r\n}\r\n\r\n.absol-selectbox-item.as-theme-declined {\r\n    background-color: rgb(255, 138, 138)\r\n}\r\n\r\n.absol-selectbox-item.as-theme-waiting {\r\n    background-color: rgb(255, 227, 174);\r\n    color: black;\r\n}\r\n\r\n.absol-selectbox-item-text {\r\n    height: var(--select-box-item-height);\r\n    padding-right: calc(var(--select-box-item-height) + 5px);\r\n    padding-left: 5px;\r\n    font-size: inherit;\r\n    white-space: nowrap;\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    display: inline-block;\r\n    vertical-align: middle;\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: var(--select-box-item-height);\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, var(--select-box-item-close-opacity));\r\n    white-space: nowrap;\r\n}\r\n\r\n.absol-selectbox-item-close::after,\r\n.absol-selectbox-item-text::before {\r\n    content: \"\";\r\n    display: inline-block;\r\n    vertical-align: middle;\r\n    height: 100%;\r\n}\r\n\r\n.absol-selectbox-item-close span {\r\n    font-size: 1.25em;\r\n    display: inline-block;\r\n    vertical-align: middle;\r\n}\r\n\r\n\r\n.absol-selectbox.as-item-focusable .absol-selectbox-item.as-active {\r\n    background-color: var(--select-box-focus-item-color);\r\n}", ""]);



/***/ }),
/* 180 */
/***/ (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(100, 100, 255);\r\n    box-sizing: border-box;\r\n    background-color: white;\r\n    display: inline-block;\r\n    vertical-align: top;\r\n    -webkit-box-shadow: 2px 2px 6px 0px rgba(0, 0, 90, 0.55);\r\n    -moz-box-shadow: 2px 2px 6px 0px rgba(0, 0, 90, 0.55);\r\n    box-shadow: 2px 2px 6px 0px rgba(0, 0, 90, 0.55);\r\n}\r\n\r\n.absol-selectmenu-dropdown-box > .as-bscroller {\r\n    overflow-y: auto;\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.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.absol-selectmenu.as-disabled,\r\n.as-select-menu.as-disabled\r\n{\r\n    pointer-events: none;\r\n    background-color: #ebebe4;\r\n\r\n}\r\n\r\n.absol-selectmenu {\r\n    display: inline-block;\r\n    vertical-align: middle;\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.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.absol-selectmenu .absol-selectlist-item-desc-container {\r\n    right: 30px;\r\n}\r\n\r\n\r\n.absol-selectmenu-dropdown-box .absol-bscroller {\r\n    overflow-y: auto;\r\n}\r\n\r\n\r\n.as-select-anchor {\r\n    position: fixed;\r\n    z-index: 1000001;\r\n}\r\n\r\n\r\n.as-select-anchor.as-hidden {\r\n    left: 0;\r\n    top: 0;\r\n    z-index: -1000;\r\n    visibility: hidden;\r\n    opacity: 0;\r\n}\r\n\r\n\r\n.as-select-menu {\r\n    --select-list-estimate-width: 0;\r\n    --select-list-desc-width: 0;\r\n    width: calc(var( --select-list-estimate-width) + 32px);\r\n    min-width: calc(var( --select-list-estimate-width) + 32px);\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, ".as-select-list-box {\r\n    --select-list-estimate-width: 0;\r\n    --max-height: calc(100vh - 80px);\r\n    position: fixed;\r\n    top: 10px;\r\n    left: 10px;\r\n    width: calc(var(--select-list-estimate-width) + 2px + 5px);\r\n    font-size: 14px;\r\n    font-family: Arial, Helvetica, sans-serif;\r\n    border: solid 1px rgb(100, 100, 255);\r\n    box-sizing: border-box;\r\n    background-color: white;\r\n    display: inline-block;\r\n    vertical-align: top;\r\n    -webkit-box-shadow: 2px 2px 6px 0px rgba(0, 0, 90, 0.55);\r\n    -moz-box-shadow: 2px 2px 6px 0px rgba(0, 0, 90, 0.55);\r\n    box-shadow: 2px 2px 6px 0px rgba(0, 0, 90, 0.55);\r\n    outline: none;\r\n}\r\n\r\n.absol-follower.as-select-list-box{\r\n    z-index: 1000000;\r\n}\r\n\r\n.as-select-list-box .as-select-list-box {\r\n    min-width: 100%;\r\n}\r\n\r\n.as-select-list-box-search-ctn {\r\n    position: absolute;\r\n    left: 0;\r\n    right: 0;\r\n}\r\n\r\n.as-select-list-box.as-enable-search.as-anchor-6 .as-select-list-box-search-ctn,\r\n.as-select-list-box.as-enable-search.as-anchor-5 .as-select-list-box-search-ctn {\r\n    bottom: 0;\r\n}\r\n\r\n.as-select-list-box.as-enable-search.as-anchor-6,\r\n.as-select-list-box.as-enable-search.as-anchor-5 {\r\n    padding-bottom: 38px;\r\n}\r\n\r\n.as-select-list-box.as-enable-search.as-anchor-1,\r\n.as-select-list-box.as-enable-search.as-anchor-2 {\r\n    padding-top: 38px;\r\n}\r\n\r\n.as-select-list-box.as-enable-search.as-anchor-1 .as-select-list-box-search-ctn,\r\n.as-select-list-box.as-enable-search.as-anchor-2 .as-select-list-box-search-ctn {\r\n    top: 0;\r\n}\r\n\r\n.as-select-list-box-scroller {\r\n    overflow-y: auto;\r\n    overflow-x: visible;\r\n}\r\n\r\n.as-select-list-box .as-select-list-box-scroller {\r\n    max-height: var(--max-height);\r\n}\r\n\r\n.as-select-list-box.as-enable-search .as-select-list-box-scroller {\r\n    max-height: calc(var(--max-height) - 38px);\r\n}\r\n\r\n.as-select-list-box-content {\r\n    position: relative;\r\n}\r\n\r\n.as-select-list-box-page {\r\n    position: absolute;\r\n    left: 0;\r\n    right: 0;\r\n    top: 0;\r\n}\r\n\r\n.as-select-list-box .absol-selectlist-item{\r\n    cursor: default;\r\n}\r\n\r\n.as-select-list-box-search-ctn {\r\n    display: none;\r\n    padding: 5px;\r\n}\r\n\r\n\r\n.as-select-list-box.as-enable-search .as-select-list-box-search-ctn {\r\n    display: block;\r\n}\r\n\r\n.as-select-list-box:not(.as-searching) .as-last-in-group {\r\n    border-bottom: 1px solid #dddddd;\r\n}\r\n\r\n.as-select-list-box .as-last-in-group span {\r\n    line-height: 19px;\r\n}\r\n\r\n\r\n.as-select-list-box .absol-selectlist-item:hover {\r\n    background-color: #efefef;\r\n}\r\n\r\n.as-select-list-box.as-value-hidden .absol-selectlist-item.as-selected{\r\n    color: #aaaaaa;\r\n}\r\n\r\n.as-select-list-box.as-value-hidden .absol-selectlist-item.as-selected.as-is-leaft{\r\n    display: none;\r\n}", ""]);



/***/ }),
/* 183 */
/***/ (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    overflow-y: auto;\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 {}", ""]);



/***/ }),
/* 184 */
/***/ (function(module, exports, __webpack_require__) {


var content = __webpack_require__(185);

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) {}

/***/ }),
/* 185 */
/***/ (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}", ""]);



/***/ }),
/* 186 */
/***/ (function(module, exports, __webpack_require__) {


var content = __webpack_require__(187);

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) {}

/***/ }),
/* 187 */
/***/ (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}", ""]);



/***/ }),
/* 188 */
/***/ (function(module, exports, __webpack_require__) {


var content = __webpack_require__(189);

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) {}

/***/ }),
/* 189 */
/***/ (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", ""]);



/***/ }),
/* 190 */
/***/ (function(module, exports, __webpack_require__) {


var content = __webpack_require__(191);

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) {}

/***/ }),
/* 191 */
/***/ (function(module, exports, __webpack_require__) {

exports = module.exports = __webpack_require__(4)(false);
// Module
exports.push([module.i, ".as-checkbox-button{\r\n    display: inline-block;\r\n    vertical-align: middle;\r\n}\r\n\r\n.as-checkbox-button .absol-checkbox-icon{\r\n    display: block;\r\n}", ""]);



/***/ }),
/* 192 */
/***/ (function(module, exports, __webpack_require__) {


var content = __webpack_require__(193);

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) {}

/***/ }),
/* 193 */
/***/ (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}\r\n\r\n.absol-table-scroller-fixed-table{\r\n    table-layout: fixed;\r\n    box-sizing: border-box;\r\n\r\n}\r\n\r\n.absol-table-scroller-fixed-table *,\r\n.absol-table-scroller-header-hscroller *{\r\n    box-sizing: border-box;\r\n}", ""]);



/***/ }),
/* 194 */
/***/ (function(module, exports, __webpack_require__) {


var content = __webpack_require__(195);

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) {}

/***/ }),
/* 195 */
/***/ (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    overflow-y: auto;\r\n}\r\n\r\n.absol-table-vscroller-viewport > table{\r\n    box-sizing: border-box;\r\n    width: 100%;\r\n}", ""]);



/***/ }),
/* 196 */
/***/ (function(module, exports, __webpack_require__) {


var content = __webpack_require__(197);

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) {}

/***/ }),
/* 197 */
/***/ (function(module, exports, __webpack_require__) {

exports = module.exports = __webpack_require__(4)(false);
// Module
exports.push([module.i, ".absol-textarea2{\r\n    overflow: hidden;\r\n    resize: none;\r\n    box-sizing: border-box;\r\n    height: 1.425em;\r\n} ", ""]);



/***/ }),
/* 198 */
/***/ (function(module, exports, __webpack_require__) {


var content = __webpack_require__(199);

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) {}

/***/ }),
/* 199 */
/***/ (function(module, exports, __webpack_require__) {

exports = module.exports = __webpack_require__(4)(false);
// Module
exports.push([module.i, ".absol-text-clipboard {\r\n    opacity: 0;\r\n    font-size: 1px;\r\n    height: 1px;\r\n    width: 1px;\r\n}", ""]);



/***/ }),
/* 200 */
/***/ (function(module, exports, __webpack_require__) {


var content = __webpack_require__(201);

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) {}

/***/ }),
/* 201 */
/***/ (function(module, exports, __webpack_require__) {

exports = module.exports = __webpack_require__(4)(false);
// Module
exports.push([module.i, ".ac-time-input {\r\n    box-sizing: border-box;\r\n    height: calc(2em + 2px);\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    display: inline-block;\r\n    vertical-align: middle;\r\n    padding-left: 0.35714285714em;\r\n    padding-right: 0.35714285714em;\r\n    background-color: white;\r\n}\r\n\r\n.ac-time-input-picker-ctn {\r\n    position: fixed;\r\n}\r\n\r\n.ac-time-input>span {\r\n    font-size: 1em;\r\n    line-height: 2em;\r\n}\r\n\r\n.ac-time-input-picker-ctn-hidden {\r\n    z-index: -1000;\r\n    opacity: 0;\r\n    visibility: hidden;\r\n}\r\n\r\n.ac-time-input-picker-ctn-hidden:not(.absol-follower) {\r\n    transition: all 0.1s;\r\n}\r\n\r\n.ac-time-input.as-disabled {\r\n    color: rgb(102, 102, 102);\r\n    pointer-events: none;\r\n}", ""]);



/***/ }),
/* 202 */
/***/ (function(module, exports, __webpack_require__) {


var content = __webpack_require__(203);

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) {}

/***/ }),
/* 203 */
/***/ (function(module, exports, __webpack_require__) {

exports = module.exports = __webpack_require__(4)(false);
// Module
exports.push([module.i, ".ac-time-picker {\r\n    /*like chrome-calender*/\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@media screen and (orientation: portrait) {\r\n    .ac-time-picker.ac-time-picker-touch {\r\n        font-size: 5vw;\r\n    }\r\n}\r\n\r\n@media screen and (orientation: landscape) {\r\n    .ac-time-picker.ac-time-picker-touch {\r\n        font-size: 4vh;\r\n    }\r\n}\r\n\r\n\r\n.ac-time-picker:not(.ac-time-picker-clock-mode) .ac-time-picker-set-clock,\r\n.ac-time-picker:not(.ac-time-picker-clock-mode) .ac-time-picker-keyboard-btn,\r\n.ac-time-picker:not(.ac-time-picker-touch) .ac-time-picker-keyboard-btn,\r\n.ac-time-picker:not(.ac-time-picker-time-mode) .ac-time-picker-set-time,\r\n.ac-time-picker:not(.ac-time-picker-time-mode) .ac-time-picker-clock-btn {\r\n    display: none;\r\n}\r\n\r\n.ac-time-picker-set-clock-header {\r\n    font-size: 2.8em;\r\n    text-align: center;\r\n    min-width: 4.28571428571em;\r\n    font-weight: bold;\r\n\r\n}\r\n\r\n.ac-time-picker-set-clock-header > span {\r\n    font-size: inherit;\r\n}\r\n\r\n.ac-time-picker-clock {\r\n    width: 12em;\r\n    height: 12em;\r\n}\r\n\r\n.ac-time-picker-clock-hour-pm {\r\n    fill: rgb(20, 20, 20);\r\n    font-size: 0.7em;\r\n}\r\n\r\n\r\n.ac-time-picker-clock-hour-am {\r\n    fill: black;\r\n    font-size: 0.8em;\r\n}\r\n\r\n.ac-time-picker-clock-minute {\r\n    fill: black;\r\n    font-size: 0.8em;\r\n}\r\n\r\n\r\n.ac-time-picker-clock-center,\r\n.ac-time-picker-clock-select-circle {\r\n    fill: rgb(115, 166, 248);\r\n}\r\n\r\n.ac-time-picker-clock-select-center {\r\n    fill: white;\r\n}\r\n\r\n.ac-time-picker-clock-select-line {\r\n    stroke-width: 1;\r\n    stroke: rgb(115, 166, 248);\r\n}\r\n\r\n\r\n.ac-time-picker-hour,\r\n.ac-time-picker-minute {\r\n    outline: none;\r\n}\r\n\r\n.ac-time-picker-edit-hour .ac-time-picker-hour,\r\n.ac-time-picker-edit-minute .ac-time-picker-minute {\r\n    color: rgb(62, 125, 189);\r\n}\r\n\r\n.ac-time-picker:not(.ac-time-picker-edit-hour) .ac-time-picker-clock-hour-ctn,\r\n.ac-time-picker:not(.ac-time-picker-edit-minute) .ac-time-picker-clock-minute-ctn {\r\n    visibility: hidden;\r\n}\r\n\r\n.ac-time-picker:not(.ac-time-picker-edit-hour):not(.ac-time-picker-edit-minute) .ac-time-picker-clock {\r\n    display: none;\r\n}\r\n\r\n.ac-time-picker-hour:empty::before,\r\n.ac-time-picker-minute:empty::before {\r\n    content: \"0\";\r\n    display: inline;\r\n}\r\n\r\n.ac-time-picker-footer {\r\n    display: block;\r\n    position: relative;\r\n    min-height: 1.5em;\r\n    min-width: 12em;\r\n}\r\n\r\n.ac-time-picker-footer-right {\r\n    position: absolute;\r\n    right: 0;\r\n    top: 0;\r\n}\r\n\r\n.ac-time-picker-footer button {\r\n    font-size: 1em;\r\n    height: 1.5em;\r\n    padding-top: 0;\r\n    padding-bottom: 0;\r\n    border: none;\r\n    background-color: transparent;\r\n    outline: none;\r\n    padding-left: 0.3em;\r\n    padding-right: 0.3em;\r\n}\r\n\r\n.ac-time-picker-footer button:hover,\r\n.ac-time-picker-footer button:focus {\r\n    background-color: rgba(170, 170, 170, 0.3);\r\n}\r\n\r\n.ac-time-picker-footer > button {\r\n    margin-right: 1em;\r\n}\r\n\r\n.ac-time-picker-footer-right > button {\r\n    margin-left: 1em;\r\n}\r\n\r\n\r\n.ac-time-picker-footer button .mdi {\r\n    font-size: 1.3em;\r\n}\r\n\r\n\r\n/* .ac-time-picker:not(.ac-time-picker-touch) .ac-time-picker-keyboard-btn {\r\n    display: none;\r\n} */\r\n\r\n/* keyboard-outline */\r\n\r\n.ac-time-picker-set-time-header {\r\n    font-size: 1.4em;\r\n    font-weight: bold;\r\n    margin-bottom: 1em;\r\n}\r\n\r\n.ac-time-picker-set-time-label {\r\n    font-size: 1em;\r\n    font-weight: bold;\r\n    margin-bottom: 0.3em;\r\n}\r\n\r\n.ac-time-picker-set-time-input-group {\r\n    margin-bottom: 0.3em;\r\n    font-size: 1em;\r\n    white-space: nowrap;\r\n}\r\n\r\n.ac-time-picker-set-time-input-hm > input {\r\n    height: 1.2em;\r\n    line-height: 1.2em;\r\n    width: 2em;\r\n    text-align: center;\r\n    font-size: 1em;\r\n    border-top: none;\r\n    border-left: none;\r\n    border-right: none;\r\n    border-bottom: 1px solid rgb(70, 70, 72);\r\n    outline: none;\r\n}\r\n\r\n.ac-time-picker-set-time-input-label-hm {\r\n    font-size: 1em;\r\n    white-space: nowrap;\r\n\r\n}\r\n\r\n.ac-time-picker-set-time-input-label-hm span {\r\n    display: inline-block;\r\n    vertical-align: middle;\r\n    font-size: 1em;\r\n\r\n}\r\n\r\n\r\n.ac-time-picker-set-time-input-label-hm > span:first-child {\r\n    width: 2em;\r\n}", ""]);



/***/ }),
/* 204 */
/***/ (function(module, exports, __webpack_require__) {


var content = __webpack_require__(205);

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) {}

/***/ }),
/* 205 */
/***/ (function(module, exports, __webpack_require__) {

exports = module.exports = __webpack_require__(4)(false);
// Module
exports.push([module.i, ":root {\r\n    --tool-tip-arrow-pos: 50%;\r\n    --tool-tip-background-color: gray;\r\n    --tool-tip-text-color: white;\r\n}\r\n\r\n.absol-tooltip {\r\n    margin: 0;\r\n    position: relative;\r\n    box-sizing: border-box;\r\n    display: inline-block;\r\n    color: var(--tool-tip-text-color);\r\n}\r\n\r\n.absol-tooltip-content {\r\n    display: block;\r\n    border-radius: 0.25em;\r\n    background-color: var(--tool-tip-background-color);\r\n    padding: 0.25em 0.5em;\r\n    font-size: inherit;\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    font-size: inherit;\r\n}\r\n\r\n.absol-tooltip.top .absol-tooltip-arrow {\r\n    border-left: 0.4em solid transparent;\r\n    border-right: 0.3em solid transparent;\r\n\r\n    border-top: 0.3em solid var(--tool-tip-background-color);\r\n    bottom: 0;\r\n    left: calc(var(--tool-tip-arrow-pos) - 0.3em);\r\n}\r\n\r\n\r\n.absol-tooltip.top {\r\n    padding-bottom: 0.3em;\r\n}\r\n\r\n\r\n.absol-tooltip.bottom .absol-tooltip-arrow {\r\n    border-left: 0.3em solid transparent;\r\n    border-right: 0.4em solid transparent;\r\n    border-bottom: 0.3em solid var(--tool-tip-background-color);\r\n\r\n    top: 0;\r\n    left: calc(var(--tool-tip-arrow-pos) - 0.3em);\r\n}\r\n\r\n.absol-tooltip.bottom {\r\n    padding-top: 0.3em;\r\n}\r\n\r\n\r\n.absol-tooltip.left .absol-tooltip-arrow {\r\n    border-top: 0.3em solid transparent;\r\n    border-bottom: 0.4em solid transparent;\r\n    border-left: 0.4em solid var(--tool-tip-background-color);\r\n\r\n    right: 0;\r\n    top: calc(var(--tool-tip-arrow-pos) - 0.3em);\r\n}\r\n\r\n.absol-tooltip.left {\r\n    padding-right: 0.4em;\r\n}\r\n\r\n\r\n.absol-tooltip.right .absol-tooltip-arrow {\r\n    border-top: 0.4em solid transparent;\r\n    border-bottom: 0.4em solid transparent;\r\n    border-right: 0.4em solid var(--tool-tip-background-color);\r\n\r\n    left: 0;\r\n    top: calc(var(--tool-tip-arrow-pos) - 0.3em);\r\n}\r\n\r\n.absol-tooltip.ne .absol-tooltip-arrow {\r\n    border-top: 0.3em solid transparent;\r\n    border-bottom: 0.4em solid transparent;\r\n    border-left: 0.4em solid var(--tool-tip-background-color);\r\n    bottom: -0.3em;\r\n    left: 0;\r\n}\r\n\r\n.absol-tooltip.nw .absol-tooltip-arrow {\r\n    border-top: 0.3em solid transparent;\r\n    border-bottom: 0.4em solid transparent;\r\n    border-right: 0.4em solid var(--tool-tip-background-color);\r\n    bottom: -0.3em;\r\n    right: 0;\r\n}\r\n\r\n.absol-tooltip.se .absol-tooltip-arrow {\r\n    border-top: 0.3em solid transparent;\r\n    border-bottom: 0.4em solid transparent;\r\n    border-left: 0.4em solid var(--tool-tip-background-color);\r\n    top: -0.3em;\r\n    left: 0;\r\n}\r\n\r\n.absol-tooltip.sw .absol-tooltip-arrow {\r\n    border-top: 0.3em solid transparent;\r\n    border-bottom: 0.4em solid transparent;\r\n    border-right: 0.4em solid var(--tool-tip-background-color);\r\n    top: -0.25em;\r\n    right: 0;\r\n}\r\n\r\n.absol-tooltip.right {\r\n    padding-left: 0.4em;\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: fixed;\r\n    z-index: 100000000;\r\n    left: 0;\r\n    top: 0;\r\n}", ""]);



/***/ }),
/* 206 */
/***/ (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}", ""]);



/***/ }),
/* 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, ".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}", ""]);



/***/ }),
/* 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-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 */", ""]);



/***/ }),
/* 211 */
/***/ (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) {}

/***/ }),
/* 212 */
/***/ (function(module, exports, __webpack_require__) {

exports = module.exports = __webpack_require__(4)(false);
// Module
exports.push([module.i, ".as-modal {\r\n    position: fixed;\r\n    left: 0;\r\n    right: 0;\r\n    top: 0;\r\n    bottom: 0;\r\n    z-index: 1000;\r\n    white-space: nowrap;\r\n}\r\n\r\n.as-modal.as-hidden{\r\n    z-index: -1000;\r\n    visibility: hidden;\r\n    opacity: 0;\r\n}\r\n\r\n.as-modal.as-center {\r\n    text-align: center;\r\n}\r\n\r\n\r\n.as-modal.as-middle::before {\r\n    content: \"\";\r\n    display: inline-block;\r\n    vertical-align: middle;\r\n    height: 100%;\r\n    width: 0;\r\n}\r\n\r\n.as-modal > .as-modal-content {\r\n    display: inline-block;\r\n    text-align: initial;\r\n    white-space: initial;\r\n}\r\n\r\n/*for content*/\r\n.as-modal.as-middle > .as-modal-content {\r\n    vertical-align: middle;\r\n}\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, ".absol-trackbar {\r\n    height: 1.2em;\r\n    min-width: 7em;\r\n    display: inline-block;\r\n    vertical-align: middle;\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    padding: 0 0.6em;\r\n    box-sizing: border-box;\r\n}\r\n\r\n.absol-trackbar-line {\r\n    display: block;\r\n    position: relative;\r\n    margin-top: 0.4em;\r\n    height: 0.4em;\r\n    background-color: rgb(200, 200, 200);\r\n    -webkit-box-shadow: 0 0 0.2em 0.1em rgb(160, 160, 160) inset;\r\n    -moz-box-shadow: 0 0 0.2em 0.1em rgb(160, 160, 160) inset;\r\n    box-shadow: 0 0 0.2em 0.1em rgb(160, 160, 160) inset;\r\n    border-radius: 0.15em;\r\n    cursor: pointer;\r\n}\r\n\r\n.absol-trackbar-button {\r\n    position: absolute;\r\n    z-index: 1;\r\n    top: -0.4em;\r\n    /* bottom: -0.4em; */\r\n    height: 1.2em;\r\n    left: 0;\r\n    margin-left: -0.6em;\r\n    width: 1.2em;\r\n    background: rgb(245, 245, 245);\r\n    cursor: pointer;\r\n    border-radius: 50%;\r\n    border: solid 1px rgb(139, 139, 139);\r\n}\r\n\r\n.absol-trackbar.as-disabled {\r\n    pointer-events: none;\r\n}\r\n\r\n.absol-trackbar.as-disabled .absol-trackbar-button {\r\n    background: rgb(225, 225, 225);\r\n    border: solid 1px rgb(200, 200, 200);\r\n}\r\n\r\n.absol-trackbar.as-disabled .absol-trackbar-line {\r\n    background-color: rgb(220, 220, 220);\r\n    -webkit-box-shadow: 0 0 0.2em 0.1em rgb(200, 200, 200) inset;\r\n    -moz-box-shadow: 0 0 0.2em 0.1em rgb(200, 200, 200) inset;\r\n    box-shadow: 0 0 0.2em 0.1em rgb(200, 200, 200) inset;\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, ".absol-trackbar-input {\r\n    box-sizing: border-box;\r\n    display: inline-block;\r\n    white-space: nowrap;\r\n    position: relative;\r\n    min-width: 13.5em;\r\n    height: 2em;\r\n}\r\n\r\n.absol-trackbar-input-trackbar-container {\r\n    position: absolute;\r\n    left: 0;\r\n    right: 3.5em;\r\n    top: 0.4em;\r\n    bottom: 0.4em;\r\n}\r\n\r\n.absol-trackbar-input-trackbar-container .absol-trackbar {\r\n    width: 100%;\r\n}\r\n\r\n.absol-trackbar-input-unit-input-container {\r\n    position: absolute;\r\n    width: 3em;\r\n    right: 0;\r\n    top: 0;\r\n    bottom: 0;\r\n}\r\n\r\n.absol-trackbar-input-unit-input-container::before{\r\n    content: \"\";\r\n    display: inline-block;\r\n    white-space: nowrap;\r\n    height: 100%;\r\n    vertical-align: middle;\r\n}\r\n\r\n\r\n.absol-trackbar-input-unit-input-container .as-flexicon-input {\r\n    width: 100%;\r\n    vertical-align: middle;\r\n    height: 2em;\r\n}\r\n\r\n.absol-trackbar-input.as-disabled {\r\n    pointer-events: none;\r\n    color: #777777;\r\n\r\n}\r\n\r\n.absol-trackbar-input input{\r\n    color: inherit;\r\n}\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-button-range-wrapper {\r\n    border-top: 1px solid rgb(209, 209, 213);\r\n    border-bottom: 1px solid rgb(209, 209, 213);\r\n}\r\n\r\n.as-button-range {\r\n    position: relative;\r\n    overflow-y: hidden;\r\n    height: var(--height);\r\n    box-sizing: border-box;\r\n    font-family: Arial, Helvetica, sans-serif;\r\n    --underline-left: 0;\r\n    --underline-width: 0;\r\n    --height: 2em;\r\n}\r\n\r\n.as-button-range-scroller {\r\n    font-size: inherit;\r\n    height: calc(var(--height) + 17px);\r\n    box-sizing: border-box;\r\n    overflow-x: scroll;\r\n    position: absolute;\r\n    top: 0;\r\n    left: 0.5em;\r\n    right: 0.5em;\r\n    white-space: nowrap;\r\n}\r\n\r\n.as-button-range-scroller::after {\r\n    content: \"\";\r\n    position: absolute;\r\n    left: var(--underline-left);\r\n    width: var(--underline-width);\r\n    height: 0.2em;\r\n    top: calc(var(--height) - 0.2em);\r\n    background-color: rgb(0, 106, 255);\r\n    transition: left 0.2s, width 0.2s;\r\n}\r\n\r\n.as-button-range-left-ctn,\r\n.as-button-range-right-ctn {\r\n    position: absolute;\r\n    top: 0;\r\n    bottom: 0;\r\n}\r\n\r\n.as-button-range-right-ctn::after,\r\n.as-button-range-left-ctn::before {\r\n    content: \"\";\r\n    height: 100%;\r\n    display: inline-block;\r\n    vertical-align: middle;\r\n}\r\n\r\n.as-button-range-left-ctn {\r\n    left: 0;\r\n}\r\n\r\n.as-button-range-right-ctn {\r\n    right: 0;\r\n}\r\n\r\n.as-button-range-right-btn,\r\n.as-button-range-left-btn {\r\n    font-size: inherit;\r\n    padding: 0;\r\n    margin: 0;\r\n    display: inline-block;\r\n    vertical-align: middle;\r\n    border: none;\r\n    outline: none;\r\n    color: rgb(0, 106, 266);\r\n    background-color: rgba(255, 255, 255, 0.5);\r\n    border-radius: 0.5em;\r\n    overflow: hidden;\r\n}\r\n\r\n.as-button-range-left-btn {\r\n    -webkit-box-shadow: 1em 2px 1.5em -1em rgba(255, 255, 255, 0.62);\r\n    -moz-box-shadow: 1em 2px 1.5em -1em rgba(255, 255, 255, 0.62);\r\n    box-shadow: 1em 2px 1.5em -1em rgba(255, 255, 255, 0.62);\r\n}\r\n\r\n.as-button-range-right-btn {\r\n    -webkit-box-shadow: -1em 2px 1.5em -1em rgba(255, 255, 255, 0.62);\r\n    -moz-box-shadow: -1em 2px 1.5em -1em rgba(255, 255, 255, 0.62);\r\n    box-shadow: -1em 2px 1.5em -1em rgba(255, 255, 255, 0.62);\r\n}\r\n\r\n.as-button-range-right-btn polygon,\r\n.as-button-range-left-btn polygon {\r\n    fill: #2488FF;\r\n}\r\n\r\n.as-button-range-right-btn:disabled,\r\n.as-button-range-left-btn:disabled {\r\n    display: none;\r\n}\r\n\r\n.as-button-range-left-btn > svg,\r\n.as-button-range-right-btn > svg {\r\n    width: 1.25em;\r\n    height: 1.25em;\r\n    margin-left: -0.25em;\r\n    margin-right: -0.25em;\r\n    vertical-align: middle;\r\n}\r\n\r\n\r\n.as-button-range-item {\r\n    outline: none;\r\n    font-size: inherit;\r\n    padding: 0 0.5em;\r\n    margin: 0;\r\n    height: var(--height);\r\n    border: none;\r\n    background-color: transparent;\r\n    color: black;\r\n}\r\n\r\n.as-button-range-item.as-active {\r\n    color: rgb(87, 157, 255);\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-drop-zone {\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, "label.as-radio-input {\r\n    display: inline-block;\r\n    position: relative;\r\n    width: calc(1em + 2px);\r\n    height: calc(1em + 2px);\r\n    cursor: pointer;\r\n    font-size: inherit;\r\n    box-sizing: border-box;\r\n    overflow: hidden;\r\n    vertical-align: middle;\r\n    border-radius: 50%;\r\n    border: 1px solid var(--candy-border-color);\r\n    text-align: center;\r\n    background-color: white;\r\n    text-align: center;\r\n    white-space: nowrap;\r\n}\r\n\r\nlabel.as-radio-input:hover {\r\n    background-color: var(--candy-hover-background-color);\r\n}\r\n\r\nlabel.as-radio-input::after{\r\n    content: \"\";\r\n    display: inline-block;\r\n    vertical-align: middle;\r\n    height: 100%;\r\n}\r\n\r\n.as-radio-input .as-radio-input-check-mark {\r\n    display: inline-block;\r\n    vertical-align: middle;\r\n    width: 0.5em;\r\n    height: 0.5em;\r\n    background-color: #606060;\r\n    font-size: inherit;\r\n    border-radius: 50%;\r\n}\r\n\r\n.as-radio-input input.as-radio-input-value {\r\n    font-size: inherit;\r\n    position: absolute;\r\n    right: 100%;\r\n    top: 0;\r\n    opacity: 0.0;\r\n}\r\n\r\ninput.as-radio-input-value:not(:checked) ~ .as-radio-input-check-mark {\r\n    display: none;\r\n}\r\n\r\n\r\nlabel.as-radio-input.as-disabled,\r\nlabel.as-radio-input.as-disabled:hover {\r\n    border-color: #929292;\r\n    background-color: #ebebe4;\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-onscreen-widget {\r\n    --client-width: 0px;\r\n    --client-height: 0px;\r\n    --cx: 0.9;\r\n    --cy: 0.9;\r\n    position: fixed;\r\n    z-index: 1000000;\r\n    left: calc((100vw - var(--client-width) - 4px) * var(--cx) + 2px);\r\n    top: calc((100vh - var(--client-height) - 4px) * var(--cy) + 2px);\r\n    touch-action: none;\r\n    user-select: none;\r\n}\r\n\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-ribbon-split-button {\r\n    display: inline-block;\r\n    vertical-align: middle;\r\n    height: 30px;\r\n    font-family: Arial, Helvetica, sans-serif;\r\n    box-sizing: border-box;\r\n}\r\n\r\n.as-ribbon-split-button div,\r\n.as-ribbon-split-button span,\r\n.as-ribbon-split-button button {\r\n    font-weight: inherit;\r\n    font-size: inherit;\r\n}\r\n\r\n\r\n.as-ribbon-split-button-content {\r\n    height: 100%;\r\n}\r\n\r\n.as-ribbon-split-button-content > button {\r\n    font-family: inherit;\r\n    border-radius: 0;\r\n    background-color: transparent;\r\n    height: 100%;\r\n    margin-right: 0;\r\n    outline: none;\r\n    box-sizing: border-box;\r\n    border-style: solid;\r\n    border-color: transparent;\r\n    vertical-align: middle;\r\n}\r\n\r\n\r\n.as-ribbon-split-button-content > button:hover {\r\n    background-color: rgba(169, 168, 169, 0.15);\r\n}\r\n\r\n.as-ribbon-split-button-content > button:active {\r\n    background-color: rgba(169, 168, 169, 0.3);\r\n}\r\n\r\n\r\n.as-ribbon-split-button-primary {\r\n    font-size: inherit;\r\n    padding-left: 0.5em;\r\n    padding-right: 0;\r\n    border-width: 1px 0px 1px 1px;\r\n}\r\n\r\n.as-ribbon-split-button-extend {\r\n    color: rgb(37, 36, 35);\r\n    width: 16px;\r\n    padding: 0;\r\n    text-align: center;\r\n    font-size: 20px;\r\n    border-width: 1px 1px 1px 0px;\r\n}\r\n\r\n.as-ribbon-split-button-extend span:before {\r\n    margin-left: -3px;\r\n}\r\n\r\n\r\n.as-ribbon-split-button:active:hover .as-ribbon-split-button-content > button,\r\n.as-ribbon-split-button:active .as-ribbon-split-button-content > button {\r\n    border-color: rgba(169, 168, 169, 0.3);\r\n}\r\n\r\n.as-ribbon-split-button:hover .as-ribbon-split-button-content > button {\r\n    border-color: rgba(169, 168, 169, 0.15);\r\n}\r\n\r\n.as-ribbon-split-button-icon {\r\n    font-size: 1.2em;\r\n    margin-right: 0.5em;\r\n    display: inline-block;\r\n    vertical-align: middle;\r\n}\r\n\r\nimg.as-ribbon-split-button-icon,\r\nsvg.as-ribbon-split-button-icon {\r\n    width: 1.2em;\r\n    height: 1.2em;\r\n}\r\n\r\n.as-ribbon-split-button-text {\r\n    vertical-align: middle;\r\n    font-size: inherit;\r\n}\r\n\r\n.as-ribbon-split-button.as-no-dropdown .as-ribbon-split-button-extend {\r\n    display: none;\r\n}\r\n\r\n.as-ribbon-split-button.as-no-dropdown .as-ribbon-split-button-primary {\r\n    padding-right: 5px;\r\n    border-width: 1px 1px 1px 1px;\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-ribbon-button {\r\n    display: inline-block;\r\n    vertical-align: middle;\r\n    height: 30px;\r\n    padding-left: 0.5em;\r\n    padding-right: 0.5em;\r\n\r\n    font-family: Arial, Helvetica, sans-serif;\r\n    box-sizing: border-box;\r\n    border-radius: 0;\r\n    outline: none;\r\n    border-style: solid;\r\n    border-color: transparent;\r\n    border-width: 1px 1px 1px 1px;\r\n    background-color: transparent;\r\n}\r\n\r\n.as-ribbon-button div,\r\n.as-ribbon-button span {\r\n    font-weight: inherit;\r\n    font-size: inherit;\r\n}\r\n\r\n.as-ribbon-button:hover {\r\n    background-color: rgba(169, 168, 169, 0.15);\r\n}\r\n\r\n.as-ribbon-button:active {\r\n    background-color: rgba(169, 168, 169, 0.3);\r\n}\r\n\r\n\r\n\r\n.as-ribbon-split-button:active:hover .as-ribbon-split-button-content > button,\r\n.as-ribbon-split-button:active .as-ribbon-split-button-content > button {\r\n    border-color: rgba(169, 168, 169, 0.3);\r\n}\r\n\r\n.as-ribbon-split-button:hover .as-ribbon-split-button-content > button {\r\n    border-color: rgba(169, 168, 169, 0.15);\r\n}\r\n\r\n.as-ribbon-button-icon {\r\n    font-size: 1.2em;\r\n    margin-right: 0.5em;\r\n    display: inline-block;\r\n    vertical-align: middle;\r\n}\r\n\r\nimg.as-ribbon-button-icon,\r\nsvg.as-ribbon-button-icon {\r\n    width: 1.2em;\r\n    height: 1.2em;\r\n}\r\n\r\n.as-ribbon-button-text {\r\n    display: inline-block;\r\n    vertical-align: middle;\r\n    font-size: inherit;\r\n}\r\n\r\n.as-ribbon-button.as-no-dropdown .mdi.mdi-chevron-down {\r\n    display: none;\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-time-select-input {\r\n    display: inline-block;\r\n    position: relative;\r\n    height: 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    white-space: nowrap;\r\n    padding-right: 30px;\r\n    --list-min-width: unset;\r\n    width: calc(var(--list-min-width) + 30px);\r\n    min-width: calc(var(--list-min-width) + 30px);\r\n}\r\n\r\n.as-time-select-input.as-disabled {\r\n    pointer-events: none;\r\n    background-color: #ebebe4;\r\n}\r\n\r\n.as-time-select-input-text {\r\n    display: inline-block;\r\n    vertical-align: middle;\r\n    height: 100%;\r\n    width: 100%;\r\n    outline: none;\r\n    border: none;\r\n    box-sizing: border-box;\r\n    padding-left: 10px;\r\n    padding-right: 0;\r\n    background-color: transparent;\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-snackbar {\r\n    visibility: hidden;\r\n    min-width: 250px;\r\n    margin-left: -125px;\r\n    background-color: #333;\r\n    color: #fff;\r\n    text-align: center;\r\n    border-radius: 2px;\r\n    padding: 16px;\r\n    position: fixed;\r\n    z-index: 1;\r\n    left: 50%;\r\n    bottom: 0;\r\n    font-size: 17px;\r\n    opacity: 0;\r\n    transition: opacity 0.25s ease-in, bottom 0.25s ease-in;\r\n\r\n}\r\n\r\n.as-snackbar.as-show {\r\n    visibility: visible;\r\n    bottom: 30px;\r\n    opacity: 1;\r\n}\r\n\r\n.as-snackbar.as-hiding{\r\n    transition: opacity 0.5s ease-out, bottom 0.5s ease-out;\r\n    visibility: visible;\r\n    bottom: 0;\r\n    opacity: 0;\r\n}\r\n\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, ":root {\r\n    --multi-select-menu-max-height: none;\r\n}\r\n\r\n.as-multi-select-menu {\r\n    --list-min-width: 40px;\r\n    display: inline-block;\r\n    vertical-align: middle;\r\n    position: relative;\r\n    min-height: var(--select-box-min-height);\r\n    min-width: var(--list-min-width);\r\n    border: solid 1px #d6d6d6;\r\n    border-radius: 3px;\r\n    box-sizing: border-box;\r\n    outline: none;\r\n    background-color: white;\r\n    padding-right: 45px;\r\n}\r\n\r\n.as-multi-select-menu-item-ctn {\r\n    display: block;\r\n    max-height: var(--multi-select-menu-max-height);\r\n    overflow-y: auto;\r\n}\r\n\r\n\r\n.as-multi-select-menu-toggle-btn {\r\n    position: absolute;\r\n    right: 0;\r\n    top: 0;\r\n    bottom: 0;\r\n    width: 30px;\r\n    pointer-events: none;\r\n    border: none;\r\n    background-color: transparent;\r\n}\r\n\r\n.as-multi-select-menu-toggle-btn svg.dropdown {\r\n    width: 10px;\r\n    height: 10px;\r\n    fill: #929292;\r\n}\r\n\r\n.as-multi-select-menu:hover svg.dropdown {\r\n    fill: black;\r\n}\r\n\r\n.as-multi-select-menu.as-disable-click-to-focus .as-multi-select-menu-toggle-btn{\r\n    display: none;\r\n}\r\n\r\n.as-multi-select-menu .absol-selectbox-item {\r\n    margin: calc((var(--select-box-min-height) - 2px - var(--select-box-item-height)) / 2) 2px;\r\n}\r\n\r\n\r\n.as-multi-select-menu.as-item-focusable .absol-selectbox-item.as-active{\r\n    background-color: var(--select-box-focus-item-color);\r\n}\r\n\r\n.as-multi-select-menu.as-disabled {\r\n    pointer-events: none;\r\n    background-color: #ebebe4;\r\n}", ""]);



/***/ }),
/* 235 */
/***/ (function(module, exports, __webpack_require__) {


var content = __webpack_require__(236);

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) {}

/***/ }),
/* 236 */
/***/ (function(module, exports, __webpack_require__) {

exports = module.exports = __webpack_require__(4)(false);
// Module
exports.push([module.i, ".as-countdown-clock {\r\n    width: 7em;\r\n    height: 7em;\r\n    border-radius: 50%;\r\n    position: relative;\r\n    display:inline-block;\r\n    font-family: Consolas;\r\n}\r\n\r\n.as-countdown-clock-border-wrapper{\r\n    pointer-events:none;\r\n    position: absolute;\r\n    box-sizing: border-box;\r\n    left: 0.2em;\r\n    right: 0.2em;\r\n    top: 0.2em;\r\n    bottom: 0.2em;\r\n    filter: drop-shadow(0 0px 1px rgb(100, 200, 255));\r\n}\r\n\r\n.as-countdown-clock-border {\r\n    width: 100%;\r\n    height: 100%;\r\n    border: solid 0.2em rgb(100, 200, 255);\r\n    border-radius: 50%;\r\n    object-fit: cover;\r\n}\r\n\r\n.as-countdown-clock-text {\r\n    position: absolute;\r\n    left: 50%;\r\n    top: 50%;\r\n    transform:translate(-50%, -50%);\r\n    font-size: 2em;\r\n}\r\n\r\n.as-countdown-clock div,\r\n.as-countdown-clock span\r\n{\r\n    font-family: inherit;\r\n}", ""]);



/***/ }),
/* 237 */
/***/ (function(module, exports, __webpack_require__) {


var content = __webpack_require__(238);

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) {}

/***/ }),
/* 238 */
/***/ (function(module, exports, __webpack_require__) {

exports = module.exports = __webpack_require__(4)(false);
// Module
exports.push([module.i, ".as-toast-list {\r\n    position: fixed;\r\n    z-index: 1100000000;\r\n    width: 355px;\r\n    max-height: calc(100vh - 20px);\r\n    overflow-y: auto;\r\n}\r\n\r\n.as-toast-list > .as-toast {\r\n    box-shadow: 1px 1px 3px 1px rgba(0, 0, 0, 0.35);\r\n}\r\n\r\n\r\n.as-toast-list.as-se {\r\n    bottom: 10px;\r\n    right: 10px;\r\n}\r\n\r\n.as-toast-list.as-sw {\r\n    bottom: 10px;\r\n    left: 10px;\r\n}\r\n\r\n.as-toast-list.as-ne {\r\n    top: 10px;\r\n    right: 10px;\r\n}\r\n\r\n.as-toast-list.as-nw {\r\n    top: 10px;\r\n    left: 10px;\r\n}\r\n\r\n\r\n.as-toast-list:empty {\r\n    visibility: hidden;\r\n}\r\n\r\n.as-toast-list.as-ne > .as-toast,\r\n.as-toast-list.as-nw > .as-toast {\r\n    margin-bottom: 5px;\r\n}\r\n\r\n.as-toast-list.as-se > .as-toast,\r\n.as-toast-list.as-sw > .as-toast {\r\n    margin-top: 5px;\r\n}\r\n\r\n\r\n.as-toast {\r\n    display: block;\r\n    max-width: 350px;\r\n    overflow: hidden;\r\n    background-color: white;\r\n    background-clip: padding-box;\r\n    border: 1px solid rgba(0, 0, 0, 0.1);\r\n    font-family: Roboto, sans-serif;\r\n    font-size: 14px;\r\n}\r\n\r\n.as-toast-header {\r\n    display: flex;\r\n    display: -ms-flex;\r\n    -ms-flex-align: center;\r\n    align-items: center;\r\n    padding: 0.25em 0.75em;\r\n    color: #6c757d;\r\n    background-clip: padding-box;\r\n    border-bottom: 1px solid rgba(0, 0, 0, 0.05);\r\n}\r\n\r\n.as-toast-header strong {\r\n    text-align: left;\r\n    margin-right: auto;\r\n}\r\n\r\n.as-toast-variant-color {\r\n    margin-right: 0.5em;\r\n    display: inline-block;\r\n    vertical-align: middle;\r\n    background-color: var(--variant-color-primary);\r\n    width: 1.25em;\r\n    height: 1.25em;\r\n}\r\n\r\n\r\n.as-toast-close-btn {\r\n    padding: 0;\r\n    background-color: transparent;\r\n    border: none;\r\n    outline: none;\r\n    color: inherit;\r\n    margin-left: 0.25em;\r\n    margin-bottom: 0.25em;\r\n}\r\n\r\n.as-toast-close-btn:hover {\r\n    color: black;\r\n}\r\n\r\n.as-toast-close-btn span {\r\n    font-size: 1.5em;\r\n    text-shadow: 0 1px 0 currentColor;\r\n}\r\n\r\n.as-toast-body {\r\n\r\n}\r\n\r\n.as-toast-message {\r\n    padding: 0.75em;\r\n}\r\n\r\n\r\n.as-toast.as-not-appeared {\r\n    opacity: 0;\r\n    transition: opacity 0.2s;\r\n}\r\n\r\n.as-toast.as-not-appeared.as-appearing {\r\n    opacity: 1;\r\n}\r\n\r\n.as-toast.as-appeared {\r\n    transition: opacity 0.5s;\r\n    opacity: 1;\r\n}\r\n\r\n.as-toast.as-disappearing {\r\n    opacity: 0;\r\n}\r\n\r\n.as-toast.as-variant-sticky-note {\r\n    background-color: #ffff88;\r\n}\r\n\r\n\r\n.as-toast.as-variant-sticky-note .as-toast-variant-color,\r\n.as-toast.as-variant-background .as-toast-variant-color {\r\n    display: none;\r\n}\r\n\r\n.as-toast.as-variant-sticky-note .as-toast-title {\r\n    color: #1e1ec8;\r\n}", ""]);



/***/ }),
/* 239 */
/***/ (function(module, exports, __webpack_require__) {


var content = __webpack_require__(240);

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) {}

/***/ }),
/* 240 */
/***/ (function(module, exports, __webpack_require__) {

exports = module.exports = __webpack_require__(4)(false);
// Module
exports.push([module.i, ":root {\r\n    --variant-color-primary: #007bff;\r\n    --variant-color-secondary: #6c757d;\r\n    --variant-color-success: #28a745;\r\n    --variant-color-warning: #ffc107;\r\n    --variant-color-danger: #dc3545;\r\n    --variant-color-info: #17a2b8;\r\n    --variant-color-light: #f8f9fa;\r\n    --variant-color-dark: #343a40;\r\n    --variant-color-error: #ff4052;\r\n    --variant-color-link: #007bff;\r\n    --variant-color-note: #ffff88;\r\n\r\n\r\n    --variant-medium-contract-color-primary: #e2edd5;\r\n    --variant-medium-contract-color-secondary: #fca75b;\r\n    --variant-medium-contract-color-success: #fce8e8;\r\n    --variant-medium-contract-color-info: #fcf5e8;\r\n    --variant-medium-contract-color-warning: #5e5a75;\r\n    --variant-medium-contract-color-error:#e0dfce;\r\n    --variant-medium-contract-color-danger: #e5e8d5;\r\n    --variant-medium-contract-color-light: #7a5b3c;\r\n    --variant-medium-contract-color-dark: #bf7d3b;\r\n    --variant-medium-contract-color-link: #dde8c9;\r\n    --variant-medium-contract-color-note: #1e1ec8;\r\n}", ""]);



/***/ }),
/* 241 */
/***/ (function(module, exports, __webpack_require__) {


var content = __webpack_require__(242);

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) {}

/***/ }),
/* 242 */
/***/ (function(module, exports, __webpack_require__) {

exports = module.exports = __webpack_require__(4)(false);
// Module
exports.push([module.i, ".as-emoji-picker-tooltip {\r\n    --tool-tip-background-color: white;\r\n    filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.5));\r\n}\r\n\r\n.as-emoji-picker-tooltip .absol-tooltip-content {\r\n    display: block;\r\n    padding: 0;\r\n    box-sizing: border-box;\r\n    position: relative;\r\n    white-space: nowrap;\r\n    overflow: hidden;\r\n}\r\n\r\n.as-emoji-picker-tooltip-left-btn,\r\n.as-emoji-picker-tooltip-right-btn {\r\n    display: inline-block;\r\n    vertical-align: middle;\r\n    height: 60px;\r\n    width: 40px;\r\n    font-size: 25px;\r\n    padding: 0;\r\n    background-color: transparent;\r\n    border: none;\r\n    color: rgb(155, 155, 175);\r\n    outline: none;\r\n}\r\n\r\n.as-emoji-picker-tooltip-left-btn:hover,\r\n.as-emoji-picker-tooltip-right-btn:hover {\r\n    background-color: rgba(156, 156, 156, 0.15);\r\n}\r\n\r\n.as-emoji-picker-tooltip-left-btn:active,\r\n.as-emoji-picker-tooltip-right-btn:active {\r\n    background-color: rgba(0, 0, 0, 0.15);\r\n}\r\n\r\n.as-emoji-picker-tooltip-left-btn:disabled,\r\n.as-emoji-picker-tooltip-right-btn:disabled {\r\n    pointer-events: none;\r\n    color: rgb(230, 230, 235);\r\n}\r\n\r\n.as-emoji-picker-tooltip-scroller {\r\n    display: inline-block;\r\n    vertical-align: middle;\r\n    position: relative;\r\n    width: 360px;\r\n    height: 60px;\r\n    overflow: hidden;\r\n}\r\n\r\n.as-emoji-picker-tooltip-icon-list {\r\n    position: absolute;\r\n    top: 0;\r\n    bottom: 0;\r\n    left: 0;\r\n    white-space: nowrap;\r\n}\r\n\r\n\r\n.as-emoji-picker-tooltip:not(.as-scrolling) .as-emoji-picker-tooltip-icon-list {\r\n    transition: left 0.5s;\r\n}\r\n\r\n.as-emoji-picker-tooltip-icon-btn {\r\n    display: inline-block;\r\n    vertical-align: middle;\r\n    height: 60px;\r\n    width: 60px;\r\n    padding: 0;\r\n    border: none;\r\n    outline: none;\r\n    background-color: transparent;\r\n}\r\n\r\n\r\n.as-emoji-picker-tooltip-icon {\r\n    transition: width 0.3s, height 0.3s;\r\n    width: 35px;\r\n    height: 35px;\r\n}\r\n\r\n.as-emoji-picker-tooltip-icon-btn:hover .as-emoji-picker-tooltip-icon {\r\n    width: 45px;\r\n    height: 45px;\r\n}\r\n\r\n.as-emoji-picker-tooltip-remove-btn {\r\n    display: inline-block;\r\n    vertical-align: middle;\r\n    height: 60px;\r\n    width: 60px;\r\n    padding: 0;\r\n    border: none;\r\n    outline: none;\r\n    background-color: transparent;\r\n    font-size: 40px;\r\n    color: rgb(185, 185, 185);\r\n}\r\n\r\n.as-emoji-picker-tooltip-remove-btn:hover {\r\n    color: rgb(255, 30, 30);\r\n}\r\n\r\n\r\n.as-emoji-picker-tooltip:not(.as-mobile) .as-emoji-picker-tooltip-page-indicator {\r\n    display: none;\r\n}\r\n\r\n.as-emoji-picker-tooltip.as-mobile .as-emoji-picker-tooltip-right-btn,\r\n.as-emoji-picker-tooltip.as-mobile .as-emoji-picker-tooltip-left-btn {\r\n    display: none;\r\n}\r\n\r\n\r\n@media (max-width: 410px) and (min-width: 310px) {\r\n    .as-emoji-picker-tooltip-left-btn,\r\n    .as-emoji-picker-tooltip-right-btn {\r\n        height: 36px;\r\n        width: 24px;\r\n        font-size: 15px;\r\n    }\r\n\r\n    .as-emoji-picker-tooltip-scroller {\r\n        width: 216px;\r\n        height: 36px;\r\n    }\r\n\r\n    .as-emoji-picker-tooltip-icon-btn {\r\n        height: 36px;\r\n        width: 36px;\r\n    }\r\n\r\n\r\n    .as-emoji-picker-tooltip-icon {\r\n        width: 21px;\r\n        height: 21px;\r\n    }\r\n\r\n    .as-emoji-picker-tooltip-icon-btn:hover .as-emoji-picker-tooltip-icon {\r\n        width: 27px;\r\n        height: 27px;\r\n    }\r\n\r\n    .as-emoji-picker-tooltip-remove-btn {\r\n        height: 36px;\r\n        width: 36px;\r\n        font-size: 24px;\r\n    }\r\n}\r\n\r\n@media (max-width: 510px) and (min-width: 410px) {\r\n    .as-emoji-picker-tooltip-left-btn,\r\n    .as-emoji-picker-tooltip-right-btn {\r\n        height: 48px;\r\n        width: 32px;\r\n        font-size: 20px;\r\n    }\r\n\r\n\r\n    .as-emoji-picker-tooltip-scroller {\r\n        width: 288px;\r\n        height: 48px;\r\n    }\r\n\r\n\r\n    .as-emoji-picker-tooltip-icon-btn {\r\n        height: 48px;\r\n        width: 48px;\r\n    }\r\n\r\n\r\n    .as-emoji-picker-tooltip-icon {\r\n        width: 28px;\r\n        height: 28px;\r\n    }\r\n\r\n    .as-emoji-picker-tooltip-icon-btn:hover .as-emoji-picker-tooltip-icon {\r\n        width: 36px;\r\n        height: 36px;\r\n    }\r\n\r\n    .as-emoji-picker-tooltip-remove-btn {\r\n        height: 48px;\r\n        width: 48px;\r\n        font-size: 32px;\r\n    }\r\n}", ""]);



/***/ }),
/* 243 */
/***/ (function(module, exports, __webpack_require__) {


var content = __webpack_require__(244);

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) {}

/***/ }),
/* 244 */
/***/ (function(module, exports, __webpack_require__) {

exports = module.exports = __webpack_require__(4)(false);
// Module
exports.push([module.i, ".as-page-indicator {\r\n    text-align: center;\r\n    white-space: nowrap;\r\n}\r\n\r\n.as-page-indicator::before{\r\n    content: \"\";\r\n    display: inline-block;\r\n    vertical-align: middle;\r\n    height: 100%;\r\n}\r\n\r\n.as-page-indicator-item {\r\n    display: inline-block;\r\n    vertical-align: middle;\r\n    text-align: center;\r\n    font-size: inherit;\r\n    width: 1.5em;\r\n    padding: 0;\r\n    border: 0;\r\n    background-color: transparent;\r\n}\r\n\r\n\r\n\r\n.as-page-indicator-item::before {\r\n    content: \"\";\r\n    display: inline-block;\r\n    height: 0.5em;\r\n    width: 0.5em;\r\n    transition: width 0.25s, height 0.25s, color 0.25s;\r\n    border-radius: 50%;\r\n    background-color: rgb(196, 196, 196);\r\n    font-size: inherit;\r\n    vertical-align: middle;\r\n}\r\n\r\n.as-page-indicator-item.as-active::before{\r\n    width: 0.75em;\r\n    height: 0.75em;\r\n    background-color: var(--variant-color-primary);\r\n\r\n}", ""]);



/***/ }),
/* 245 */
/***/ (function(module, exports, __webpack_require__) {


var content = __webpack_require__(246);

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) {}

/***/ }),
/* 246 */
/***/ (function(module, exports, __webpack_require__) {

exports = module.exports = __webpack_require__(4)(false);
// Module
exports.push([module.i, ".as-emoji-counter {\r\n    display: inline-block;\r\n    vertical-align: middle;\r\n    color: rgb(38, 141, 145);\r\n    box-sizing: border-box;\r\n    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.2);\r\n    height: 30px;\r\n    text-align: center;\r\n    min-height: 30px;\r\n    padding: 0 8px;\r\n    border-radius: 15px;\r\n    font-size: 14px;\r\n    background-color: white;\r\n    outline: none;\r\n}\r\n\r\n.as-emoji-counter::before {\r\n    content: \"\";\r\n    display: inline-block;\r\n    vertical-align: middle;\r\n    height: 100%;\r\n}\r\n\r\n.as-emoji-counter-sprite {\r\n    display: inline-block;\r\n    vertical-align: middle;\r\n    width: 18px;\r\n    height: 18px;\r\n}\r\n\r\n.as-emoji-counter-num {\r\n    font-family: \"Helvetica Neue\", Arial, Helvetica, sans-serif;\r\n    margin-left: 0.2em;\r\n    display: inline-block;\r\n    vertical-align: middle;\r\n    font-size: inherit;\r\n    color: inherit;\r\n    cursor: default;\r\n}\r\n\r\n.as-emoji-counter-num:empty {\r\n    display: none;\r\n}\r\n\r\n.as-emoji-counter.as-zero {\r\n    background-color: rgba(220, 220, 220);\r\n}\r\n\r\n.as-emoji-counter + .as-emoji-counter {\r\n    margin-left: 0.3em;\r\n}", ""]);



/***/ }),
/* 247 */
/***/ (function(module, exports, __webpack_require__) {


var content = __webpack_require__(248);

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) {}

/***/ }),
/* 248 */
/***/ (function(module, exports, __webpack_require__) {

exports = module.exports = __webpack_require__(4)(false);
// Module
exports.push([module.i, ".as-emoji-user-list-tooltip {\r\n    --tool-tip-background-color: white;\r\n    filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.5));\r\n    text-align: left;\r\n}\r\n\r\n\r\n.as-emoji-user-list-tooltip-emoji {\r\n    position: absolute;\r\n    width: 60px;\r\n    height: 60px;\r\n    top: -30px;\r\n    left: calc(50% - 30px);\r\n    z-index: 2;\r\n\r\n}\r\n\r\n.as-emoji-user-list-tooltip .absol-tooltip-content {\r\n    min-height: 60px;\r\n    min-width: 120px;\r\n    padding-top: 25px;\r\n}\r\n\r\n.as-emoji-user-list-tooltip-user{\r\n    padding: 3px  10px 3px 0 ;\r\n}\r\n\r\n.as-emoji-user-list-tooltip-user.as-clickable{\r\n    cursor: pointer;\r\n}\r\n\r\n.as-emoji-user-list-tooltip-avatar {\r\n    width: 30px;\r\n    height: 30px;\r\n    border-radius: 50%;\r\n    background-size: cover;\r\n    display: inline-block;\r\n    vertical-align: middle;\r\n}\r\n\r\n.as-emoji-user-list-tooltip-name {\r\n    display: inline-block;\r\n    vertical-align: middle;\r\n    margin-left: 10px;\r\n    color: rgb(70, 70, 72);\r\n    font-family: \"Helvetica Neue\", Arial, Helvetica, sans-serif;\r\n}", ""]);



/***/ }),
/* 249 */
/***/ (function(module, exports, __webpack_require__) {


var content = __webpack_require__(250);

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) {}

/***/ }),
/* 250 */
/***/ (function(module, exports, __webpack_require__) {

exports = module.exports = __webpack_require__(4)(false);
// Module
exports.push([module.i, ".am-navigator {}\r\n\r\n.am-navigator-content {\r\n    right: 100%;\r\n    top: 0;\r\n    bottom: 0;\r\n    z-index: 1001;\r\n    position: fixed;\r\n    /* touch-action: auto; */\r\n    overflow-y: scroll;\r\n}\r\n\r\n.am-navigator-content:empty {\r\n    background-color: gray;\r\n    width: 60vw;\r\n}\r\n\r\n.am-navigator-modal {\r\n    position: fixed;\r\n    left: 0;\r\n    top: 0;\r\n    bottom: 0;\r\n    width: 20px;\r\n    touch-action: none;\r\n    opacity: 0.001;\r\n}\r\n\r\n.am-navigator.am-dragging {\r\n    touch-action: none;\r\n    user-select: none;\r\n}\r\n\r\n\r\n.am-navigator.am-dragging .am-navigator-modal,\r\n.am-navigator.am-open .am-navigator-modal {\r\n    width: 100%;\r\n    background-color: rgb(169, 160, 170);\r\n    z-index: 1000;\r\n}\r\n\r\n.am-navigator.am-open .am-navigator-modal {\r\n    opacity: 0.5;\r\n}", ""]);



/***/ }),
/* 251 */
/***/ (function(module, exports, __webpack_require__) {


var content = __webpack_require__(252);

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) {}

/***/ }),
/* 252 */
/***/ (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}", ""]);



/***/ }),
/* 253 */
/***/ (function(module, exports, __webpack_require__) {


var content = __webpack_require__(254);

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) {}

/***/ }),
/* 254 */
/***/ (function(module, exports, __webpack_require__) {

exports = module.exports = __webpack_require__(4)(false);
// Module
exports.push([module.i, ".am-navigator-menu {\r\n    font-family: Arial, Helvetica, sans-serif;\r\n}\r\n\r\n.am-navigator-menu-header {\r\n    background-image: url(http://absol.cf/assets/background/188-1881044_dual-android-navigation-drawer-background.jpg);\r\n    min-width: 12em;\r\n    background-size: cover;\r\n    color: white;\r\n    box-sizing: border-box;\r\n    padding-left: 0.625em;\r\n    padding-top: 0.625em;\r\n    padding-bottom: 0.625em;\r\n    padding-right: 0.125em;\r\n}\r\n\r\n.am-navigator-menu .am-navigator-content {\r\n    background-color: white;\r\n    overflow-y: auto;\r\n}\r\n\r\n.am-navigator-menu-avatar-ctn {\r\n    padding-top: 0.625em;\r\n    padding-bottom: 0.625em;\r\n}\r\n\r\n\r\n.am-navigator-menu-avatar {\r\n    width: 5em;\r\n    height: 5em;\r\n    border-radius: 50%;\r\n    background-image: url(https://avatars2.githubusercontent.com/u/9133017?s=460&v=4);\r\n    background-size: cover;\r\n}\r\n\r\n.am-navigator-menu-full-name {\r\n    font-size: 1.14285714286em;\r\n    font-weight: bold;\r\n    white-space: nowrap;\r\n}\r\n\r\n.am-navigator-menu-email {}\r\n\r\n\r\n.am-navigator-menu-group-name {\r\n    padding-left: 0.625em;\r\n    line-height: 2.5;\r\n    color: rgb(104, 104, 105);\r\n    font-weight: bold;\r\n}\r\n\r\n\r\n\r\n.am-navigator-menu-item {\r\n    position: relative;\r\n    height: 2.5em;\r\n    padding-left: 2.92857143em;\r\n}\r\n\r\n.am-navigator-menu-item:active{\r\n    background-color: rgba(169, 169, 169, 0.3 );\r\n}\r\n\r\n\r\n\r\n\r\n .am-navigator-menu-item-icon-ctn {\r\n    position: absolute;\r\n    left: 0.625em;\r\n    top: 0.5em;\r\n    bottom: 0.5em;\r\n    width: 1.5em;\r\n    height: 1.5em;\r\n}\r\n\r\n.am-navigator-menu-item-icon-ctn span {\r\n    font-size: 1.5em;\r\n    line-height: 1;\r\n}\r\n\r\n.am-navigator-menu-item-text {\r\n    font-size: inherit;\r\n    line-height: 2.5;\r\n}\r\n\r\n.am-navigator-menu-group:not(:last-child) {\r\n    border-bottom: 1px solid #ddd;\r\n}", ""]);



/***/ }),
/* 255 */
/***/ (function(module, exports, __webpack_require__) {


var content = __webpack_require__(256);

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) {}

/***/ }),
/* 256 */
/***/ (function(module, exports, __webpack_require__) {

exports = module.exports = __webpack_require__(4)(false);
// Module
exports.push([module.i, ".am-bottom-tabbar {\r\n    position: fixed;\r\n    bottom: 0;\r\n    left: 0;\r\n    right: 0;\r\n    background-color: rgb(247, 246, 246);\r\n    -webkit-box-shadow: 0px -2px 5px 0px rgba(0, 0, 0, 0.52);\r\n    -moz-box-shadow: 0px -2px 5px 0px rgba(0, 0, 0, 0.52);\r\n    box-shadow: 0px -2px 5px 0px rgba(0, 0, 0, 0.25);\r\n    background-color: white;\r\n    z-index: 100;\r\n}\r\n\r\n.am-bottom-tabbar-line {\r\n    transition: left;\r\n    left: 40%;\r\n    width: 20%;\r\n    top: 0;\r\n    position: absolute;\r\n    border-top: 2px solid rgb(47, 147, 246);\r\n    box-sizing: border-box;\r\n    transition: left cubic-bezier(.47, 0, .4, 1) 0.2s;\r\n}\r\n\r\n.am-bottom-tabbar-content {\r\n    width: 100%;\r\n    display: table;\r\n    /* table-layout: fixed; */\r\n}\r\n\r\n.am-bottom-tabbar-content-row {\r\n    display: table-row;\r\n}\r\n\r\n\r\n.am-bottom-tabbar-item {\r\n    display: table-cell;\r\n    text-align: center;\r\n    color: rgb(96, 96, 96);\r\n    transition: color cubic-bezier(.47, 0, .4, 1) 0.2s;\r\n    position: relative;\r\n}\r\n\r\n.am-bottom-tabbar-item.am-active {\r\n    color: rgb(47, 147, 246);\r\n\r\n}\r\n\r\n\r\n.am-bottom-tabbar-item>span {\r\n    font-size: 2em;\r\n    line-height: 1.5;\r\n}\r\n\r\n.am-bottom-tabbar-item-counter {\r\n    height: 1.4em;\r\n    left: calc(50% + 0.33em);\r\n    top: calc(50% - 1em);\r\n    font-size: 0.8em;\r\n    position: absolute;\r\n    min-width: 1.0em;\r\n    border-radius: 0.7em;\r\n    z-index: 1;\r\n    background-color: black;\r\n    text-align: center;\r\n    background-color: rgb(254, 80, 81);\r\n    line-height: 1.4em;\r\n    color: white;\r\n    font-family: Arial, Helvetica, sans-serif;\r\n    padding-left: 0.2em;\r\n    padding-right: 0.2em;\r\n    box-sizing: content-box;\r\n}\r\n\r\n.am-bottom-tabbar-item-counter:empty {\r\n    display: none;\r\n}", ""]);



/***/ }),
/* 257 */
/***/ (function(module, exports, __webpack_require__) {


var content = __webpack_require__(258);

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) {}

/***/ }),
/* 258 */
/***/ (function(module, exports, __webpack_require__) {

exports = module.exports = __webpack_require__(4)(false);
// Module
exports.push([module.i, ".am-tiny-profile-block {\r\n    height: 5.42857143em;\r\n    background-color: white;\r\n    position: relative;\r\n    box-sizing: border-box;\r\n    padding-top: 0.625em;\r\n    padding-bottom: 0.625em;\r\n    padding-left: 0.125em;\r\n    font-family: Arial, Helvetica, sans-serif;\r\n}\r\n\r\n.am-tiny-profile-block-avatar {\r\n    display: inline-block;\r\n    vertical-align: middle;\r\n    width: 4em;\r\n    height: 4em;\r\n    border-radius: 50%;\r\n    background-image: url(https://avatars1.githubusercontent.com/u/32388488?s=400&v=4);\r\n    background-size: cover;\r\n}\r\n\r\n.am-tiny-profile-block-text-ctn {\r\n    display: inline-block;\r\n    vertical-align: middle;\r\n    padding-left: 0.125em;\r\n}\r\n\r\n\r\n.am-tiny-profile-block-name {\r\n    font-size: 1.5em;\r\n    font-weight: 400;\r\n}\r\n\r\n.am-tiny-profile-block-desc {\r\n    font-size: 0.8em;\r\n}", ""]);



/***/ }),
/* 259 */
/***/ (function(module, exports, __webpack_require__) {

exports = module.exports = __webpack_require__(4)(false);
// Module
exports.push([module.i, ".am-mat-menu-button {\r\n    position: relative;\r\n    display: block;\r\n    padding: 0;\r\n    padding-left: 1.07142857143em;\r\n    height: 3em;\r\n    box-sizing: border-box;\r\n    align-items: center;\r\n    border: none;\r\n    outline: none;\r\n    text-align: left;\r\n    font-family: Arial, Helvetica, sans-serif;\r\n    border-top: 1px solid #ddd;\r\n\r\n    user-select: none;\r\n    -webkit-user-select: none;\r\n    background-color: transparent;\r\n}\r\n\r\n.am-mat-menu-button-level {\r\n    display: inline-block;\r\n    vertical-align: middle;\r\n    white-space: pre;\r\n}\r\n\r\n.am-mat-menu-button:not(.am-status-close):not(.am-status-open):active {\r\n    background-color: rgb(169, 169, 169, 0.1);\r\n}\r\n\r\n\r\n\r\n.am-mat-menu-button .am-mat-menu-button-toggle-icon-ctn {\r\n    visibility: hidden;\r\n}\r\n\r\n.am-mat-menu-button.am-status-close .am-mat-menu-button-toggle-icon-ctn,\r\n.am-mat-menu-button.am-status-open .am-mat-menu-button-toggle-icon-ctn {\r\n    visibility: visible;\r\n}\r\n\r\n.am-mat-menu-button-icon-ctn {\r\n    height: 2em;\r\n    width: 2em;\r\n    text-align: center;\r\n    display: inline-block;\r\n    vertical-align: middle;\r\n}\r\n\r\n.am-mat-menu-button-icon-ctn>img {\r\n    display: inline-block;\r\n    font-size: inherit;\r\n    width: 2em;\r\n    height: 2em;\r\n}\r\n\r\n.am-mat-menu-button-icon-ctn>span {\r\n    font-size: 2em;\r\n    line-height: 1;\r\n}\r\n\r\n.am-mat-menu-button-text {\r\n    vertical-align: middle;\r\n    display: inline-block;\r\n    margin-left: 1.07142857143em;\r\n    font-size: inherit;\r\n}\r\n\r\n.am-mat-menu-button-toggle-icon-ctn {\r\n    position: absolute;\r\n    right: 1.07142857143em;\r\n    top: 0.5em;\r\n    bottom: 0.5em;\r\n    width: 2em;\r\n    text-align: center;\r\n}\r\n\r\n.am-mat-menu-button-toggle-icon-ctn>span {\r\n    font-size: 1.5em;\r\n    line-height: 1.3333333;\r\n    color: rgb(191, 191, 191);\r\n}\r\n\r\n.am-mat-menu-button-toggle-icon-ctn>span:before {\r\n    transition: transform 0.2s;\r\n}\r\n\r\n.am-mat-menu-item>.am-mat-menu-button {\r\n    width: 100%;\r\n}\r\n\r\n.am-mat-menu-dropdown:empty {\r\n    display: none;\r\n}\r\n\r\n.am-mat-menu-dropdown {\r\n    overflow-y: hidden;\r\n    transition: max-height 0.2s ease-out;\r\n    max-height: 0;\r\n}\r\n\r\n\r\n\r\n.am-mat-menu {\r\n    background-color: white;\r\n    -webkit-box-shadow: 0px 1px 1px 0px #ddd;\r\n    -moz-box-shadow: 0px 1px 1px 0px #ddd;\r\n    box-shadow: 0px 1px 1px 0px #ddd;\r\n}", ""]);



/***/ }),
/* 260 */
/***/ (function(module, exports, __webpack_require__) {


var content = __webpack_require__(261);

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) {}

/***/ }),
/* 261 */
/***/ (function(module, exports, __webpack_require__) {

exports = module.exports = __webpack_require__(4)(false);
// Module
exports.push([module.i, ".am-mdi-rect {\r\n    border-radius: 0.2em;\r\n    font-size: inherit;\r\n    height: 2em;\r\n    width: 2em;\r\n    text-align: center;\r\n    background-color: rgb(2, 121, 251);\r\n    vertical-align: middle;\r\n    display: inline-block;\r\n}\r\n\r\n.am-mdi-rect-icon{\r\n    font-size: 1.5em;\r\n    line-height: 1.333333;\r\n    color: white;\r\n    display: inline-block;\r\n}\r\n", ""]);



/***/ }),
/* 262 */
/***/ (function(module, exports, __webpack_require__) {


var content = __webpack_require__(263);

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) {}

/***/ }),
/* 263 */
/***/ (function(module, exports, __webpack_require__) {

exports = module.exports = __webpack_require__(4)(false);
// Module
exports.push([module.i, ".am-header-bar {\r\n    background-color: rgb(29, 138, 241);\r\n    -webkit-box-shadow: 0px 1px 10px 2px rgba(0, 0, 0, 0.5);\r\n    -moz-box-shadow: 0px 1px 10px 2px rgba(0, 0, 0, 0.5);\r\n    box-shadow: 0px 1px 5px 1px rgba(0, 0, 0, 0.5);\r\n    box-sizing: border-box;\r\n    position: relative;\r\n    font-family: Arial, Helvetica, sans-serif;\r\n    color: white;\r\n}\r\n\r\n.am-header-bar::before {\r\n    content: \"\";\r\n    height: 3em;\r\n    display: inline-block;\r\n    vertical-align: middle;\r\n}\r\n\r\n\r\n.am-header-bar-left-btn,\r\nbutton.am-header-bar-command {\r\n    display: inline-block;\r\n    text-align: center;\r\n    border: none;\r\n    background-color: transparent;\r\n    height: 3em;\r\n    width: 3em;\r\n    padding: 0;\r\n    margin: 0;\r\n    vertical-align: middle;\r\n    color: white;\r\n    outline: none;\r\n    font-size: inherit;\r\n}\r\n\r\n.am-header-bar-left-btn span,\r\nbutton.am-header-bar-command span {\r\n    font-size: 2em;\r\n}\r\n\r\nbutton.am-header-bar-command:not(:last-child){\r\n    margin-right: 0.6256em;\r\n}\r\n\r\n\r\n\r\n .am-header-bar-left-btn:active,\r\nbutton.am-header-bar-action:active,\r\nbutton.am-header-bar-command:active {\r\n    color: rgb(220, 220, 222);\r\n}\r\n\r\n.am-header-bar-title-ctn {\r\n    display: inline-block;\r\n    vertical-align: middle;\r\n}\r\n\r\n.am-header-bar-title-ctn:first-child {\r\n    padding-left: 1.25em;\r\n    box-sizing: border-box;\r\n}\r\n\r\n\r\n.am-header-bar-title {\r\n    font-size: 1.2em;\r\n    color: white;\r\n}\r\n\r\n.am-header-bar-title-desc {\r\n    font-size: 0.8em;\r\n    line-height: 2;\r\n}\r\n\r\n.am-header-bar-title-desc:empty {\r\n    display: none;\r\n}\r\n\r\n\r\n.am-header-bar-right {\r\n    position: absolute;\r\n    right: 0;\r\n    top: 0;\r\n    bottom: 0;\r\n}\r\n\r\n.am-header-bar-right::after {\r\n    content: \"\";\r\n    height: 100%;\r\n    vertical-align: middle;\r\n    display: inline-block;\r\n    width: 0.357142857em;\r\n}\r\n\r\n\r\n.am-header-bar-right-item-ctn {\r\n    vertical-align: middle;\r\n    display: inline-block;\r\n}\r\n\r\n\r\nbutton.am-header-bar-action {\r\n    height: 3em;\r\n    width: 3em;\r\n    background-color: transparent;\r\n    color: white;\r\n    border: none;\r\n    font-size: inherit;\r\n    outline: none;\r\n    vertical-align: middle;\r\n}\r\n\r\n.am-header-bar-quickmenu-btn.am-status-active .am-header-bar-quickmenu-btn-circle {\r\n    background-color: rgba(169, 169, 169, 0.5);\r\n}\r\n\r\n\r\n.am-header-bar-quickmenu-btn-circle {\r\n    height: 2em;\r\n    width: 2em;\r\n    border-radius: 50%;\r\n    text-align: center;\r\n}\r\n\r\n.am-header-bar-quickmenu-btn-circle span {\r\n    font-size: 1.6em;\r\n    line-height: 1.25em;\r\n}", ""]);



/***/ }),
/* 264 */
/***/ (function(module, exports, __webpack_require__) {


var content = __webpack_require__(265);

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) {}

/***/ }),
/* 265 */
/***/ (function(module, exports, __webpack_require__) {

exports = module.exports = __webpack_require__(4)(false);
// Module
exports.push([module.i, ".am-conversation {\r\n    position: relative;\r\n    height: 5em;\r\n    font-family: Arial, Helvetica, sans-serif;\r\n}\r\n\r\n.am-conversation-avatar-ctn {\r\n    position: absolute;\r\n    left: 0.625em;\r\n    top: calc(50% - 1.725em);\r\n    height: 3.5em;\r\n    width: 3.5em;\r\n}\r\n\r\n.am-conversation-avatar-ctn .am-conversation-avatar{\r\n    width: 100%;\r\n    height: 100%;\r\n} \r\n\r\n.am-conversation-bottom-line {\r\n    position: absolute;\r\n    bottom: 0;\r\n    right: 0;\r\n    left: 5em;\r\n    border-bottom: 0.5px solid #dddddd;\r\n}\r\n\r\n.am-conversation-body {\r\n    position: absolute;\r\n    left: 5em;\r\n    overflow: hidden;\r\n    right: 3em;\r\n    padding-top: 0.5em;\r\n}\r\n\r\n.am-conversation-name {\r\n    line-height: 2;\r\n}\r\n\r\n.am-conversation-short-content {\r\n    text-overflow: ellipsis;\r\n    max-width: 100%;\r\n    height: 2em;\r\n    line-height: 2;\r\n    white-space: nowrap;\r\n    overflow: hidden;\r\n    font-size: 0.825em;\r\n}\r\n\r\n.am-conversation-time-ctn {\r\n    position: absolute;\r\n    right: 0.625em;\r\n    top: 0.825em;\r\n}\r\n\r\n.am-conversation-time {\r\n    font-size: 0.75em;\r\n}\r\n\r\n\r\n\r\n.am-conversation-counter {\r\n    height: 1.4em;\r\n    right: 0.78125em;\r\n    top: 3.3em;\r\n    font-size: 0.8em;\r\n    position: absolute;\r\n    min-width: 1.0em;\r\n    border-radius: 0.7em;\r\n    z-index: 1;\r\n    background-color: black;\r\n    text-align: center;\r\n    background-color: rgb(254, 80, 81);\r\n    line-height: 1.4em;\r\n    color: white;\r\n    font-family: Arial, Helvetica, sans-serif;\r\n    padding-left: 0.2em;\r\n    padding-right: 0.2em;\r\n    box-sizing: content-box;\r\n}\r\n\r\n\r\n.am-conversation-counter:empty {\r\n    display: none;\r\n}\r\n\r\n.am-conversation.am-status-unread .am-conversation-name,\r\n.am-conversation.am-status-unread .am-conversation-short-content {\r\n    font-weight: bold;\r\n}", ""]);



/***/ }),
/* 266 */
/***/ (function(module, exports, __webpack_require__) {


var content = __webpack_require__(267);

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) {}

/***/ }),
/* 267 */
/***/ (function(module, exports, __webpack_require__) {

exports = module.exports = __webpack_require__(4)(false);
// Module
exports.push([module.i, ".am-message-input-left {\r\n    position: absolute;\r\n    left: 10px;\r\n    bottom: 13px;\r\n}\r\n\r\n.am-message-input.as-message-input {\r\n    padding-left: 50px;\r\n}\r\n\r\n.am-message-input .as-message-input-emoji-btn-ctn {\r\n    left: unset;\r\n    right: 6px;\r\n}\r\n\r\n.am-message-input .as-message-input-pre-ctn::after {\r\n    height: 24px;\r\n}\r\n\r\n\r\n.am-message-input .as-message-input-plugin-file {\r\n    display: none;\r\n}\r\n\r\n.am-message-input .as-message-input-pre-ctn {\r\n    padding-left: 15px;\r\n    padding-right: 38px;\r\n    width: calc(100% - 49px);\r\n}\r\n\r\n.am-message-input .as-message-input-right {\r\n    bottom: 13px;\r\n}\r\n\r\n\r\n.as-message-input.as-mode-edit .am-message-input-plugin-camera,\r\n.as-message-input.as-has-text .am-message-input-plugin-camera {\r\n    display: none;\r\n}\r\n\r\n\r\n.am-message-input .as-message-input-plugin-btn {\r\n    width: 34px;\r\n    height: 34px;\r\n}\r\n\r\n\r\n.am-message-input:not(.as-has-text):not(.as-focus) .am-message-input-plugin-more {\r\n    background: linear-gradient(135deg, rgb(0, 120, 212), rgb(0, 188, 242));\r\n    color: white;\r\n}", ""]);



/***/ }),
/* 268 */
/***/ (function(module, exports, __webpack_require__) {


var content = __webpack_require__(269);

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) {}

/***/ }),
/* 269 */
/***/ (function(module, exports, __webpack_require__) {

exports = module.exports = __webpack_require__(4)(false);
// Module
exports.push([module.i, ".am-message-tool {\r\n    position: fixed;\r\n    top: 0;\r\n    left: 0;\r\n    right: 0;\r\n    bottom: 0;\r\n    z-index: 100000;\r\n    background-color: rgba(0, 0, 0, 0.5);\r\n    font-size: 14px;\r\n    font-family: \"Helvetica Neue\", Arial, Helvetica, sans-serif;\r\n    --box-height: 272px;\r\n    transition: background-color 0.25s;\r\n}\r\n\r\n.am-message-tool.am-hiding .am-message-tool-box {\r\n    bottom: calc(0px - var(--box-height));\r\n}\r\n\r\n.am-message-tool.am-hiding {\r\n    background-color: rgba(0, 0, 0, 0.0);\r\n}\r\n\r\n.am-message-tool-box {\r\n    position: fixed;\r\n    left: 0;\r\n    right: 0;\r\n    bottom: 0;\r\n    background-color: white;\r\n    padding-bottom: 10px;\r\n    transition: bottom 0.25s;\r\n}\r\n\r\n.am-message-tool-header {\r\n    position: relative;\r\n    height: calc(3em + 10px);\r\n    box-sizing: border-box;\r\n    text-align: center;\r\n}\r\n\r\n.am-message-tool-header::before {\r\n    content: \"\";\r\n    display: inline-block;\r\n    height: 100%;\r\n    vertical-align: middle;\r\n}\r\n\r\n\r\n.am-message-tool-header-close-btn-ctn {\r\n    position: absolute;\r\n    left: 5px;\r\n    top: calc(50% - 1.5em);\r\n}\r\n\r\n.am-message-tool-header-close-btn {\r\n    height: 3em;\r\n    width: 3em;\r\n    border-radius: 50%;\r\n    border: none;\r\n    color: black;\r\n    background-color: transparent;\r\n    outline: none;\r\n}\r\n\r\n.am-message-tool-header-close-btn:active {\r\n    background-color: rgba(169, 169, 169, 0.3);\r\n}\r\n\r\n.am-message-tool-header-close-btn span {\r\n    font-size: 2em;\r\n}\r\n\r\n.am-message-tool-title {\r\n    font-size: 1.5em;\r\n    display: inline-block;\r\n    vertical-align: middle;\r\n    font-weight: bolder;\r\n}\r\n\r\n.am-message-tool-body {\r\n    overflow-y: auto;\r\n    max-height: 60vh;\r\n}\r\n\r\n.am-message-tool-plugin {\r\n    display: flex;\r\n    height: 5em;\r\n}\r\n\r\n.am-message-tool-plugin-icon-ctn {\r\n    width: 5em;\r\n    text-align: center;\r\n    padding: 0.8em;\r\n    box-sizing: border-box;\r\n}\r\n\r\n.am-message-tool-plugin-icon-ctn > span {\r\n    display: block;\r\n    width: 100%;\r\n    height: 100%;\r\n    font-size: 2em;\r\n    line-height: 1.7;\r\n    background-color: rgb(241, 241, 243);\r\n    border-radius: 0.3em;\r\n}\r\n\r\n.am-message-tool-plugin-content {\r\n    flex-grow: 1;\r\n    padding: 5px;\r\n    box-sizing: border-box;\r\n}\r\n\r\n\r\n.am-message-tool-plugin:not(:last-child) .am-message-tool-plugin-content {\r\n    border-bottom: 1px solid #dddddd;\r\n}\r\n\r\n.am-message-tool-plugin-name {\r\n    font-size: 1.5em;\r\n    font-weight: bold;\r\n    margin-bottom: 0.3em;\r\n}\r\n\r\n.am-message-tool-plugin-desc {\r\n    color: rgb(79, 79, 80);\r\n}", ""]);



/***/ }),
/* 270 */
/***/ (function(module, exports, __webpack_require__) {


var content = __webpack_require__(271);

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) {}

/***/ }),
/* 271 */
/***/ (function(module, exports, __webpack_require__) {

exports = module.exports = __webpack_require__(4)(false);
// Module
exports.push([module.i, ".am-selectlist-item {\r\n}\r\n\r\n.am-selectlist-item-text-ctn {\r\n    display: inline-block;\r\n    vertical-align: middle;\r\n}\r\n\r\n.am-selectlist-item-desc-ctn {\r\n    display: inline-block;\r\n    vertical-align: middle;\r\n}\r\n\r\n\r\n\r\n.am-selectlist-item-desc {\r\n    font-style: italic;\r\n    line-height: 20px;\r\n    color: rgb(80, 80, 82);\r\n}\r\n", ""]);



/***/ }),
/* 272 */
/***/ (function(module, exports, __webpack_require__) {


var content = __webpack_require__(273);

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) {}

/***/ }),
/* 273 */
/***/ (function(module, exports, __webpack_require__) {

exports = module.exports = __webpack_require__(4)(false);
// Module
exports.push([module.i, ".am-selectlist{\r\n    display: table;\r\n    border-collapse: collapse;\r\n    border-spacing: 0;\r\n}\r\n\r\n.am-selectlist>.am-selectlist-item{\r\n    display: table-row;\r\n\r\n}\r\n.am-selectlist>.am-selectlist-item:active {\r\n    background-color: rgba(169, 169, 169, 0.4);\r\n}\r\n\r\n.am-selectlist>.am-selectlist-item.selected{\r\n    background-color: #dfdfdf;\r\n}\r\n\r\n\r\n.am-selectlist>.am-selectlist-item{\r\n    border-bottom: 0.5px solid #dddddd;\r\n}\r\n\r\n.am-selectlist>.am-selectlist-item>.am-selectlist-item-text-ctn,\r\n.am-selectlist>.am-selectlist-item>.am-selectlist-item-desc-ctn{\r\n    display: table-cell;\r\n    padding-top: 0.5em;\r\n    padding-bottom: 0.5em;\r\n}\r\n\r\n.am-selectlist>.am-selectlist-item>.am-selectlist-item-text-ctn{\r\n    padding-right: 5px;\r\n    padding-left: 10px;\r\n}\r\n\r\n.am-selectlist>.am-selectlist-item>.am-selectlist-item-desc-ctn{\r\n    padding-left: 5px;\r\n    padding-right: 10px;\r\n}\r\n\r\n\r\n.am-selectlist {\r\n    --desc-width: auto;\r\n}\r\n\r\n.am-selectlist .am-selectlist-item-desc-ctn{\r\n    width: var(--desc-width);\r\n}\r\n", ""]);



/***/ }),
/* 274 */
/***/ (function(module, exports, __webpack_require__) {


var content = __webpack_require__(275);

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) {}

/***/ }),
/* 275 */
/***/ (function(module, exports, __webpack_require__) {

exports = module.exports = __webpack_require__(4)(false);
// Module
exports.push([module.i, ".am-selectmenu-modal {\r\n    z-index: 100005;\r\n    position: fixed;\r\n    left: 0;\r\n    right: 0;\r\n    top: 0;\r\n    bottom: 0;\r\n    text-align: center;\r\n    box-sizing: border-box;\r\n}\r\n\r\n.am-selectmenu-modal>div{\r\n    display: inline-block;\r\n    text-align: initial;\r\n}\r\n\r\n.am-selectmenu-popup-box {\r\n    max-width: calc(100vw - 60px);\r\n    -webkit-box-shadow: 2px 2px 6px 0px rgba(0, 0, 90, 0.55);\r\n    -moz-box-shadow: 2px 2px 6px 0px rgba(0, 0, 90, 0.55);\r\n    box-shadow: 2px 2px 6px 0px rgba(0, 0, 90, 0.55);\r\n    background-color: #ffffff;\r\n    border-radius: 0.5em;\r\n    font-family: Arial, Helvetica, sans-serif;\r\n}\r\n\r\n.am-selectmenu-popup-box-header{\r\n    height: calc(2em + 10px);\r\n    display: block;\r\n    white-space: nowrap;\r\n    box-sizing: border-box;\r\n    padding-top: 5px;\r\n    padding-bottom: 5px;\r\n    padding-left: 10px;\r\n    border-bottom: solid 1px #dddddd;\r\n    background-color: rgba(169, 169, 169,0.2);\r\n}\r\n\r\n.am-selectmenu-popup-box-header .absol-search-text-input{\r\n    display: inline-block;\r\n    width: calc(100% - 2em - 25px);\r\n    vertical-align: middle;\r\n    box-sizing: border-box;\r\n    background-color: white;\r\n}\r\n\r\n.am-selectmenu-popup-box-close-btn{\r\n    display: inline-block;\r\n    vertical-align: middle;\r\n    border-radius:50%;\r\n    padding: 0;\r\n    height: 2em;\r\n    width: 2em;\r\n    font-size: inherit;\r\n    border: none;\r\n    outline: none;\r\n    margin-right: 10px;\r\n    background-color: rgb(255, 255, 255);\r\n    color: rgb(190, 30, 30);\r\n}\r\n\r\n.am-selectmenu-popup-box-close-btn:active{\r\n    color: red;\r\n}\r\n\r\n\r\n.am-selectmenu-popup-box-close-btn:before{\r\n    content: \"\";\r\n    display: inline-block;\r\n    height: 2em;\r\n    vertical-align: middle;\r\n}\r\n\r\n.am-selectmenu-popup-box-close-btn span{\r\n    font-size: 1.5em;\r\n    display: inline-block;\r\n    vertical-align: middle;\r\n    line-height: 1;\r\n}\r\n\r\n.am-selectmenu-scroller {\r\n    max-height: calc(100vh - 140px);\r\n    overflow-y: auto;\r\n    box-sizing: border-box;\r\n}\r\n\r\n.am-selectlist.am-selectmeu-list{\r\n    min-width: 30vw;\r\n}\r\n\r\n.am-selectlist.am-selectmeu-list.as-searching{\r\n     width: 100%;\r\n }\r\n\r\n.am-selectmenu-popup-box .absol-search-text-input{\r\n    display: none;\r\n}\r\n\r\n\r\n.am-selectmenu-popup-box.am-enable-search .absol-search-text-input{\r\n    display: inline-block;\r\n    vertical-align: middle;\r\n}\r\n\r\n.am-selectmenu{\r\n    white-space: nowrap;\r\n    background: white;\r\n    overflow: hidden;\r\n    box-sizing: border-box;\r\n    padding-right: 35px;\r\n}\r\n\r\n.am-selectmenu.disabled .absol-selectmenu-btn{\r\n   background-color: #ebebe4;\r\n}\r\n\r\n.am-selectmenu .absol-selectmenu-btn{\r\n    background: white;\r\n}\r\n\r\n.am-selectmenu::before{\r\n    content: \"\";\r\n    height: 100%;\r\n    vertical-align: middle;\r\n    display: inline-block;\r\n}\r\n\r\n\r\n.am-selectmenu-holder-item{\r\n    display: inline-table;\r\n    vertical-align: middle;\r\n    width: 100%;\r\n    table-layout: auto;\r\n}\r\n\r\n.am-selectmenu-holder-item>.am-selectlist-item{\r\n    display: table-row;\r\n}\r\n\r\n.am-selectmenu-holder-item .am-selectlist-item-text-ctn,\r\n.am-selectmenu-holder-item .am-selectlist-item-desc-ctn{\r\n    display: table-cell;\r\n    padding-left: 10px;\r\n    white-space: nowrap;\r\n    overflow: hidden;\r\n    text-overflow: ellipsis;\r\n    width: auto;\r\n}\r\n\r\n\r\n.am-selectmenu.disabled {\r\n    pointer-events: none;\r\n    background-color: #ebebe4;\r\n}", ""]);



/***/ }),
/* 276 */
/***/ (function(module, exports, __webpack_require__) {


var content = __webpack_require__(277);

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) {}

/***/ }),
/* 277 */
/***/ (function(module, exports, __webpack_require__) {

exports = module.exports = __webpack_require__(4)(false);
// Module
exports.push([module.i, ":root {\r\n    --modal-margin-top: 80px;\r\n    --modal-margin-bottom: 80px;\r\n    --modal-max-width: 500px;\r\n    --modal-width: calc(100vw - 80px);\r\n    --modal-border-radius: 8px;\r\n}\r\n\r\n.am-list-modal {\r\n    z-index: 100005;\r\n    position: fixed;\r\n    left: 0;\r\n    right: 0;\r\n    top: 0;\r\n    bottom: 0;\r\n    text-align: center;\r\n    box-sizing: border-box;\r\n    padding-top: var(--modal-margin-top);\r\n}\r\n\r\n.am-list-modal > div {\r\n    display: inline-block;\r\n    text-align: initial;\r\n}\r\n\r\n\r\n.am-list-popup-box {\r\n    max-width: var(--modal-max-width);\r\n    width: var(--modal-width);\r\n    -webkit-box-shadow: 2px 2px 6px 0px rgba(0, 0, 90, 0.55);\r\n    -moz-box-shadow: 2px 2px 6px 0px rgba(0, 0, 90, 0.55);\r\n    box-shadow: 2px 2px 6px 0px rgba(0, 0, 90, 0.55);\r\n    background-color: #ffffff;\r\n    border-radius: var(--modal-border-radius);\r\n    font-family: Arial, Helvetica, sans-serif;\r\n}\r\n\r\n.am-list-popup-box.am-enable-search .absol-search-text-input {\r\n    display: inline-block;\r\n    vertical-align: middle;\r\n}\r\n\r\n\r\n.am-list-popup-header {\r\n    height: calc(2em + 10px);\r\n    display: block;\r\n    white-space: nowrap;\r\n    box-sizing: border-box;\r\n    padding-top: 5px;\r\n    padding-bottom: 5px;\r\n    padding-left: 10px;\r\n    border-bottom: solid 1px #dddddd;\r\n    background-color: rgba(169, 169, 169, 0.2);\r\n}\r\n\r\n.am-list-popup-header .absol-search-text-input {\r\n    display: inline-block;\r\n    width: calc(100% - 2em - 25px);\r\n    vertical-align: middle;\r\n    box-sizing: border-box;\r\n    background-color: white;\r\n}\r\n\r\n.am-list-popup-close-btn {\r\n    display: inline-block;\r\n    vertical-align: middle;\r\n    border-radius: 50%;\r\n    padding: 0;\r\n    height: 2em;\r\n    width: 2em;\r\n    font-size: inherit;\r\n    border: none;\r\n    outline: none;\r\n    margin-right: 10px;\r\n    background-color: rgb(255, 255, 255);\r\n    color: rgb(190, 30, 30);\r\n}\r\n\r\n.am-list-popup-close-btn:active {\r\n    color: red;\r\n}\r\n\r\n\r\n.am-list-popup-close-btn:before {\r\n    content: \"\";\r\n    display: inline-block;\r\n    height: 2em;\r\n    vertical-align: middle;\r\n}\r\n\r\n.am-list-popup-close-btn span {\r\n    font-size: 1.5em;\r\n    display: inline-block;\r\n    vertical-align: middle;\r\n    line-height: 1;\r\n}\r\n\r\n.am-list-popup-box .absol-search-text-input {\r\n    display: none;\r\n}\r\n\r\n.am-list-popup-paging {\r\n    display: block;\r\n    height: 2em;\r\n    text-align: center;\r\n    box-sizing: border-box;\r\n    border-bottom: 1px solid #dddddd;\r\n}\r\n\r\n.am-list-popup-paging::before {\r\n    content: \"\";\r\n    height: 100%;\r\n    display: inline-block;\r\n    vertical-align: middle;\r\n}\r\n\r\n.am-list-popup-paging-content {\r\n    padding-left: 0.5em;\r\n    padding-right: 0.5em;\r\n}\r\n\r\n.am-list-popup-paging > * {\r\n    display: inline-block;\r\n    vertical-align: middle;\r\n}\r\n\r\n.am-list-popup-paging > button {\r\n    padding: 0;\r\n    margin-left: 0.25em;\r\n    margin-right: 0.25em;\r\n    width: 1.75em;\r\n    height: 1.75em;\r\n    display: inline-block;\r\n    background-color: transparent;\r\n    border: none;\r\n    box-sizing: border-box;\r\n    outline: none;\r\n}\r\n\r\n.am-list-popup-paging > button:active {\r\n    background-color: rgba(169, 169, 169, 0.3);\r\n}\r\n\r\n\r\ninput[type=\"number\"].am-list-popup-paging-offset {\r\n    width: 4em;\r\n    outline: none;\r\n    margin-right: 0.2em;\r\n    /*border: solid 1px #a9a9a9;*/\r\n    /*border-radius: 0.3em;*/\r\n    border:none;\r\n    text-align: right;\r\n    font-size: inherit;\r\n    height: 1.25em;\r\n    box-sizing: border-box;\r\n\r\n}\r\n\r\n.am-list-popup-list-scroller {\r\n    width: 100%;\r\n    overflow: auto;\r\n    --content-height: calc(100vh - 200px);\r\n    -ms-overflow-style: none;  /* IE and Edge */\r\n    scrollbar-width: none;  /* Firefox */\r\n}\r\n\r\n\r\n.am-list-popup-list-scroller::-webkit-scrollbar {\r\n    display: none;\r\n}\r\n\r\n.am-list-popup-content {\r\n    display: block;\r\n    position: relative;\r\n}\r\n\r\n.am-list-popup-list-page{\r\n    position: absolute;\r\n    left: 0;\r\n    right: 0;\r\n    top: -200vh;\r\n    box-sizing: border-box;\r\n}\r\n\r\n\r\n.am-list-modal .am-selectlist {\r\n    width: 100%;\r\n}\r\n\r\n.am-list-popup-list-page.am-selectlist{\r\n    --desc-width: inherit;\r\n}\r\n\r\n.am-value-hidden .am-selectlist-item.selected{\r\n    display: none;\r\n}", ""]);



/***/ }),
/* 278 */
/***/ (function(module, exports, __webpack_require__) {


var content = __webpack_require__(279);

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) {}

/***/ }),
/* 279 */
/***/ (function(module, exports, __webpack_require__) {

exports = module.exports = __webpack_require__(4)(false);
// Module
exports.push([module.i, ".am-select-tree-menu {\r\n\r\n}", ""]);



/***/ }),
/* 280 */
/***/ (function(module, exports, __webpack_require__) {


var content = __webpack_require__(281);

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) {}

/***/ }),
/* 281 */
/***/ (function(module, exports, __webpack_require__) {

exports = module.exports = __webpack_require__(4)(false);
// Module
exports.push([module.i, ".am-select-box{\r\n\r\n}\r\n\r\n.am-select-box-modal .am-selectlist-item.selected{\r\n    display: none;\r\n}\r\n\r\n.am-select-box.disabled,\r\n.am-select-box.as-disabled\r\n{\r\n    pointer-events: none;\r\n    background-color: #ebebe4;\r\n}", ""]);



/***/ }),
/* 282 */
/***/ (function(module, exports, __webpack_require__) {


var content = __webpack_require__(283);

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) {}

/***/ }),
/* 283 */
/***/ (function(module, exports, __webpack_require__) {

exports = module.exports = __webpack_require__(4)(false);
// Module
exports.push([module.i, ".am-blink-modal {\r\n    left: 10px;\r\n    right: 10px;\r\n    position: fixed;\r\n    --hide-top: -1000px;\r\n    --show-top: 10px;\r\n    top: var(--hide-top);\r\n    z-index: -10000000;\r\n    border-radius: 10px;\r\n    overflow: hidden;\r\n    backdrop-filter: blur(1.5rem);\r\n    -webkit-backdrop-filter: blur(1.5rem);\r\n    background-color: rgba(228, 228, 228, 0.6);\r\n    -webkit-box-shadow: 10px 9px 29px -2px rgba(0,0,0,0.3);\r\n    -moz-box-shadow: 10px 9px 29px -2px rgba(0,0,0,0.3);\r\n    box-shadow: 10px 9px 29px -2px rgba(0,0,0,0.3);\r\n    padding: 25px;\r\n    visibility: hidden;\r\n    opacity: 0;\r\n}\r\n\r\n.am-blink-modal.am-animation {\r\n    z-index: 10000000;\r\n    visibility: visible;\r\n    opacity: 1;\r\n    transition: top cubic-bezier(.59, .01, .2, .99) 0.2s;\r\n}\r\n\r\n\r\n.am-blink-modal.am-show {\r\n    top: var(--show-top);\r\n}\r\n\r\n\r\n\r\n\r\n\r\n\r\n", ""]);



/***/ }),
/* 284 */
/***/ (function(module, exports, __webpack_require__) {


var content = __webpack_require__(285);

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) {}

/***/ }),
/* 285 */
/***/ (function(module, exports, __webpack_require__) {

exports = module.exports = __webpack_require__(4)(false);
// Module
exports.push([module.i, ".am-h-snap-scroller {\r\n    overflow-x: auto;\r\n}\r\n", ""]);



/***/ }),
/* 286 */
/***/ (function(module, exports, __webpack_require__) {


var content = __webpack_require__(287);

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) {}

/***/ }),
/* 287 */
/***/ (function(module, exports, __webpack_require__) {

exports = module.exports = __webpack_require__(4)(false);
// Module
exports.push([module.i, ".gdv-login-frag {\r\n    white-space: nowrap;\r\n    text-align: center;\r\n}\r\n\r\n.gdv-login-frag::before {\r\n    content: \"\";\r\n    height: 100%;\r\n}\r\n\r\n.gdv-login-frag::before,\r\n.gdv-login-frag-content {\r\n    display: inline-block;\r\n    vertical-align: middle;\r\n}\r\n\r\n.gdv-login-frag-content {\r\n    text-align: left;\r\n    padding: 10px;\r\n    border: 1px solid #ddd;\r\n    border-radius: 5px;\r\n    max-width: 500px;\r\n    width: 65%;\r\n    max-height: 80%;\r\n    overflow: auto;\r\n}\r\n\r\n\r\n.gdv-login-frag input[type=\"text\"],\r\n.gdv-login-frag input[type=\"password\"]\r\n{\r\n    height: 2em;\r\n    padding-left: 10px;\r\n    outline: none;\r\n    width: 80%;\r\n    margin-left: 10%;\r\n    border: #3c9ef5 1px solid;\r\n}\r\n\r\n.gdv-login-frag-button-ctn{\r\n    text-align: center;\r\n    padding-top: 5px;\r\n}\r\n\r\n.gdv-login-frag-button{\r\n    height: 2em;\r\n}\r\n\r\n.as-flexicon-button:disabled{\r\n    pointer-events: none;\r\n}", ""]);



/***/ }),
/* 288 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.url = void 0;
const parseuri = __webpack_require__(55);
const debug = __webpack_require__(8)("socket.io-client:url");
/**
 * URL parser.
 *
 * @param uri - url
 * @param loc - An object meant to mimic window.location.
 *        Defaults to window.location.
 * @public
 */
function url(uri, loc) {
    let obj = uri;
    // default to window.location
    loc = loc || (typeof location !== "undefined" && location);
    if (null == uri)
        uri = loc.protocol + "//" + loc.host;
    // relative path support
    if (typeof uri === "string") {
        if ("/" === uri.charAt(0)) {
            if ("/" === uri.charAt(1)) {
                uri = loc.protocol + uri;
            }
            else {
                uri = loc.host + uri;
            }
        }
        if (!/^(https?|wss?):\/\//.test(uri)) {
            debug("protocol-less url %s", uri);
            if ("undefined" !== typeof loc) {
                uri = loc.protocol + "//" + uri;
            }
            else {
                uri = "https://" + uri;
            }
        }
        // parse
        debug("parse %s", uri);
        obj = parseuri(uri);
    }
    // make sure we treat `localhost:80` and `localhost` equally
    if (!obj.port) {
        if (/^(http|ws)$/.test(obj.protocol)) {
            obj.port = "80";
        }
        else if (/^(http|ws)s$/.test(obj.protocol)) {
            obj.port = "443";
        }
    }
    obj.path = obj.path || "/";
    const ipv6 = obj.host.indexOf(":") !== -1;
    const host = ipv6 ? "[" + obj.host + "]" : obj.host;
    // define unique id
    obj.id = obj.protocol + "://" + host + ":" + obj.port;
    // define href
    obj.href =
        obj.protocol +
            "://" +
            host +
            (loc && loc.port === obj.port ? "" : ":" + obj.port);
    return obj;
}
exports.url = url;


/***/ }),
/* 289 */
/***/ (function(module, exports, __webpack_require__) {


/**
 * This is the common logic for both the Node.js and web browser
 * implementations of `debug()`.
 */

function setup(env) {
	createDebug.debug = createDebug;
	createDebug.default = createDebug;
	createDebug.coerce = coerce;
	createDebug.disable = disable;
	createDebug.enable = enable;
	createDebug.enabled = enabled;
	createDebug.humanize = __webpack_require__(290);
	createDebug.destroy = destroy;

	Object.keys(env).forEach(key => {
		createDebug[key] = env[key];
	});

	/**
	* The currently active debug mode names, and names to skip.
	*/

	createDebug.names = [];
	createDebug.skips = [];

	/**
	* Map of special "%n" handling functions, for the debug "format" argument.
	*
	* Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
	*/
	createDebug.formatters = {};

	/**
	* Selects a color for a debug namespace
	* @param {String} namespace The namespace string for the for the debug instance to be colored
	* @return {Number|String} An ANSI color code for the given namespace
	* @api private
	*/
	function selectColor(namespace) {
		let hash = 0;

		for (let i = 0; i < namespace.length; i++) {
			hash = ((hash << 5) - hash) + namespace.charCodeAt(i);
			hash |= 0; // Convert to 32bit integer
		}

		return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
	}
	createDebug.selectColor = selectColor;

	/**
	* Create a debugger with the given `namespace`.
	*
	* @param {String} namespace
	* @return {Function}
	* @api public
	*/
	function createDebug(namespace) {
		let prevTime;
		let enableOverride = null;

		function debug(...args) {
			// Disabled?
			if (!debug.enabled) {
				return;
			}

			const self = debug;

			// Set `diff` timestamp
			const curr = Number(new Date());
			const ms = curr - (prevTime || curr);
			self.diff = ms;
			self.prev = prevTime;
			self.curr = curr;
			prevTime = curr;

			args[0] = createDebug.coerce(args[0]);

			if (typeof args[0] !== 'string') {
				// Anything else let's inspect with %O
				args.unshift('%O');
			}

			// Apply any `formatters` transformations
			let index = 0;
			args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
				// If we encounter an escaped % then don't increase the array index
				if (match === '%%') {
					return '%';
				}
				index++;
				const formatter = createDebug.formatters[format];
				if (typeof formatter === 'function') {
					const val = args[index];
					match = formatter.call(self, val);

					// Now we need to remove `args[index]` since it's inlined in the `format`
					args.splice(index, 1);
					index--;
				}
				return match;
			});

			// Apply env-specific formatting (colors, etc.)
			createDebug.formatArgs.call(self, args);

			const logFn = self.log || createDebug.log;
			logFn.apply(self, args);
		}

		debug.namespace = namespace;
		debug.useColors = createDebug.useColors();
		debug.color = createDebug.selectColor(namespace);
		debug.extend = extend;
		debug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release.

		Object.defineProperty(debug, 'enabled', {
			enumerable: true,
			configurable: false,
			get: () => enableOverride === null ? createDebug.enabled(namespace) : enableOverride,
			set: v => {
				enableOverride = v;
			}
		});

		// Env-specific initialization logic for debug instances
		if (typeof createDebug.init === 'function') {
			createDebug.init(debug);
		}

		return debug;
	}

	function extend(namespace, delimiter) {
		const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
		newDebug.log = this.log;
		return newDebug;
	}

	/**
	* Enables a debug mode by namespaces. This can include modes
	* separated by a colon and wildcards.
	*
	* @param {String} namespaces
	* @api public
	*/
	function enable(namespaces) {
		createDebug.save(namespaces);

		createDebug.names = [];
		createDebug.skips = [];

		let i;
		const split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
		const len = split.length;

		for (i = 0; i < len; i++) {
			if (!split[i]) {
				// ignore empty strings
				continue;
			}

			namespaces = split[i].replace(/\*/g, '.*?');

			if (namespaces[0] === '-') {
				createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
			} else {
				createDebug.names.push(new RegExp('^' + namespaces + '$'));
			}
		}
	}

	/**
	* Disable debug output.
	*
	* @return {String} namespaces
	* @api public
	*/
	function disable() {
		const namespaces = [
			...createDebug.names.map(toNamespace),
			...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace)
		].join(',');
		createDebug.enable('');
		return namespaces;
	}

	/**
	* Returns true if the given mode name is enabled, false otherwise.
	*
	* @param {String} name
	* @return {Boolean}
	* @api public
	*/
	function enabled(name) {
		if (name[name.length - 1] === '*') {
			return true;
		}

		let i;
		let len;

		for (i = 0, len = createDebug.skips.length; i < len; i++) {
			if (createDebug.skips[i].test(name)) {
				return false;
			}
		}

		for (i = 0, len = createDebug.names.length; i < len; i++) {
			if (createDebug.names[i].test(name)) {
				return true;
			}
		}

		return false;
	}

	/**
	* Convert regexp to namespace
	*
	* @param {RegExp} regxep
	* @return {String} namespace
	* @api private
	*/
	function toNamespace(regexp) {
		return regexp.toString()
			.substring(2, regexp.toString().length - 2)
			.replace(/\.\*\?$/, '*');
	}

	/**
	* Coerce `val`.
	*
	* @param {Mixed} val
	* @return {Mixed}
	* @api private
	*/
	function coerce(val) {
		if (val instanceof Error) {
			return val.stack || val.message;
		}
		return val;
	}

	/**
	* XXX DO NOT USE. This is a temporary stub function.
	* XXX It WILL be removed in the next major release.
	*/
	function destroy() {
		console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
	}

	createDebug.enable(createDebug.load());

	return createDebug;
}

module.exports = setup;


/***/ }),
/* 290 */
/***/ (function(module, exports) {

/**
 * Helpers.
 */

var s = 1000;
var m = s * 60;
var h = m * 60;
var d = h * 24;
var w = d * 7;
var y = d * 365.25;

/**
 * Parse or format the given `val`.
 *
 * Options:
 *
 *  - `long` verbose formatting [false]
 *
 * @param {String|Number} val
 * @param {Object} [options]
 * @throws {Error} throw an error if val is not a non-empty string or a number
 * @return {String|Number}
 * @api public
 */

module.exports = function(val, options) {
  options = options || {};
  var type = typeof val;
  if (type === 'string' && val.length > 0) {
    return parse(val);
  } else if (type === 'number' && isFinite(val)) {
    return options.long ? fmtLong(val) : fmtShort(val);
  }
  throw new Error(
    'val is not a non-empty string or a valid number. val=' +
      JSON.stringify(val)
  );
};

/**
 * Parse the given `str` and return milliseconds.
 *
 * @param {String} str
 * @return {Number}
 * @api private
 */

function parse(str) {
  str = String(str);
  if (str.length > 100) {
    return;
  }
  var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
    str
  );
  if (!match) {
    return;
  }
  var n = parseFloat(match[1]);
  var type = (match[2] || 'ms').toLowerCase();
  switch (type) {
    case 'years':
    case 'year':
    case 'yrs':
    case 'yr':
    case 'y':
      return n * y;
    case 'weeks':
    case 'week':
    case 'w':
      return n * w;
    case 'days':
    case 'day':
    case 'd':
      return n * d;
    case 'hours':
    case 'hour':
    case 'hrs':
    case 'hr':
    case 'h':
      return n * h;
    case 'minutes':
    case 'minute':
    case 'mins':
    case 'min':
    case 'm':
      return n * m;
    case 'seconds':
    case 'second':
    case 'secs':
    case 'sec':
    case 's':
      return n * s;
    case 'milliseconds':
    case 'millisecond':
    case 'msecs':
    case 'msec':
    case 'ms':
      return n;
    default:
      return undefined;
  }
}

/**
 * Short format for `ms`.
 *
 * @param {Number} ms
 * @return {String}
 * @api private
 */

function fmtShort(ms) {
  var msAbs = Math.abs(ms);
  if (msAbs >= d) {
    return Math.round(ms / d) + 'd';
  }
  if (msAbs >= h) {
    return Math.round(ms / h) + 'h';
  }
  if (msAbs >= m) {
    return Math.round(ms / m) + 'm';
  }
  if (msAbs >= s) {
    return Math.round(ms / s) + 's';
  }
  return ms + 'ms';
}

/**
 * Long format for `ms`.
 *
 * @param {Number} ms
 * @return {String}
 * @api private
 */

function fmtLong(ms) {
  var msAbs = Math.abs(ms);
  if (msAbs >= d) {
    return plural(ms, msAbs, d, 'day');
  }
  if (msAbs >= h) {
    return plural(ms, msAbs, h, 'hour');
  }
  if (msAbs >= m) {
    return plural(ms, msAbs, m, 'minute');
  }
  if (msAbs >= s) {
    return plural(ms, msAbs, s, 'second');
  }
  return ms + ' ms';
}

/**
 * Pluralization helper.
 */

function plural(ms, msAbs, n, name) {
  var isPlural = msAbs >= n * 1.5;
  return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
}


/***/ }),
/* 291 */
/***/ (function(module, exports, __webpack_require__) {

const Socket = __webpack_require__(292);

module.exports = (uri, opts) => new Socket(uri, opts);

/**
 * Expose deps for legacy compatibility
 * and standalone browser access.
 */

module.exports.Socket = Socket;
module.exports.protocol = Socket.protocol; // this is an int
module.exports.Transport = __webpack_require__(40);
module.exports.transports = __webpack_require__(57);
module.exports.parser = __webpack_require__(29);


/***/ }),
/* 292 */
/***/ (function(module, exports, __webpack_require__) {

const transports = __webpack_require__(57);
const Emitter = __webpack_require__(24);
const debug = __webpack_require__(8)("engine.io-client:socket");
const parser = __webpack_require__(29);
const parseuri = __webpack_require__(55);
const parseqs = __webpack_require__(41);

class Socket extends Emitter {
  /**
   * Socket constructor.
   *
   * @param {String|Object} uri or options
   * @param {Object} options
   * @api public
   */
  constructor(uri, opts = {}) {
    super();

    if (uri && "object" === typeof uri) {
      opts = uri;
      uri = null;
    }

    if (uri) {
      uri = parseuri(uri);
      opts.hostname = uri.host;
      opts.secure = uri.protocol === "https" || uri.protocol === "wss";
      opts.port = uri.port;
      if (uri.query) opts.query = uri.query;
    } else if (opts.host) {
      opts.hostname = parseuri(opts.host).host;
    }

    this.secure =
      null != opts.secure
        ? opts.secure
        : typeof location !== "undefined" && "https:" === location.protocol;

    if (opts.hostname && !opts.port) {
      // if no port is specified manually, use the protocol default
      opts.port = this.secure ? "443" : "80";
    }

    this.hostname =
      opts.hostname ||
      (typeof location !== "undefined" ? location.hostname : "localhost");
    this.port =
      opts.port ||
      (typeof location !== "undefined" && location.port
        ? location.port
        : this.secure
        ? 443
        : 80);

    this.transports = opts.transports || ["polling", "websocket"];
    this.readyState = "";
    this.writeBuffer = [];
    this.prevBufferLen = 0;

    this.opts = Object.assign(
      {
        path: "/engine.io",
        agent: false,
        withCredentials: false,
        upgrade: true,
        jsonp: true,
        timestampParam: "t",
        rememberUpgrade: false,
        rejectUnauthorized: true,
        perMessageDeflate: {
          threshold: 1024
        },
        transportOptions: {}
      },
      opts
    );

    this.opts.path = this.opts.path.replace(/\/$/, "") + "/";

    if (typeof this.opts.query === "string") {
      this.opts.query = parseqs.decode(this.opts.query);
    }

    // set on handshake
    this.id = null;
    this.upgrades = null;
    this.pingInterval = null;
    this.pingTimeout = null;

    // set on heartbeat
    this.pingTimeoutTimer = null;

    this.open();
  }

  /**
   * Creates transport of the given type.
   *
   * @param {String} transport name
   * @return {Transport}
   * @api private
   */
  createTransport(name) {
    debug('creating transport "%s"', name);
    const query = clone(this.opts.query);

    // append engine.io protocol identifier
    query.EIO = parser.protocol;

    // transport name
    query.transport = name;

    // session id if we already have one
    if (this.id) query.sid = this.id;

    const opts = Object.assign(
      {},
      this.opts.transportOptions[name],
      this.opts,
      {
        query,
        socket: this,
        hostname: this.hostname,
        secure: this.secure,
        port: this.port
      }
    );

    debug("options: %j", opts);

    return new transports[name](opts);
  }

  /**
   * Initializes transport to use and starts probe.
   *
   * @api private
   */
  open() {
    let transport;
    if (
      this.opts.rememberUpgrade &&
      Socket.priorWebsocketSuccess &&
      this.transports.indexOf("websocket") !== -1
    ) {
      transport = "websocket";
    } else if (0 === this.transports.length) {
      // Emit error on next tick so it can be listened to
      const self = this;
      setTimeout(function() {
        self.emit("error", "No transports available");
      }, 0);
      return;
    } else {
      transport = this.transports[0];
    }
    this.readyState = "opening";

    // Retry with the next transport if the transport is disabled (jsonp: false)
    try {
      transport = this.createTransport(transport);
    } catch (e) {
      debug("error while creating transport: %s", e);
      this.transports.shift();
      this.open();
      return;
    }

    transport.open();
    this.setTransport(transport);
  }

  /**
   * Sets the current transport. Disables the existing one (if any).
   *
   * @api private
   */
  setTransport(transport) {
    debug("setting transport %s", transport.name);
    const self = this;

    if (this.transport) {
      debug("clearing existing transport %s", this.transport.name);
      this.transport.removeAllListeners();
    }

    // set up transport
    this.transport = transport;

    // set up transport listeners
    transport
      .on("drain", function() {
        self.onDrain();
      })
      .on("packet", function(packet) {
        self.onPacket(packet);
      })
      .on("error", function(e) {
        self.onError(e);
      })
      .on("close", function() {
        self.onClose("transport close");
      });
  }

  /**
   * Probes a transport.
   *
   * @param {String} transport name
   * @api private
   */
  probe(name) {
    debug('probing transport "%s"', name);
    let transport = this.createTransport(name, { probe: 1 });
    let failed = false;
    const self = this;

    Socket.priorWebsocketSuccess = false;

    function onTransportOpen() {
      if (self.onlyBinaryUpgrades) {
        const upgradeLosesBinary =
          !this.supportsBinary && self.transport.supportsBinary;
        failed = failed || upgradeLosesBinary;
      }
      if (failed) return;

      debug('probe transport "%s" opened', name);
      transport.send([{ type: "ping", data: "probe" }]);
      transport.once("packet", function(msg) {
        if (failed) return;
        if ("pong" === msg.type && "probe" === msg.data) {
          debug('probe transport "%s" pong', name);
          self.upgrading = true;
          self.emit("upgrading", transport);
          if (!transport) return;
          Socket.priorWebsocketSuccess = "websocket" === transport.name;

          debug('pausing current transport "%s"', self.transport.name);
          self.transport.pause(function() {
            if (failed) return;
            if ("closed" === self.readyState) return;
            debug("changing transport and sending upgrade packet");

            cleanup();

            self.setTransport(transport);
            transport.send([{ type: "upgrade" }]);
            self.emit("upgrade", transport);
            transport = null;
            self.upgrading = false;
            self.flush();
          });
        } else {
          debug('probe transport "%s" failed', name);
          const err = new Error("probe error");
          err.transport = transport.name;
          self.emit("upgradeError", err);
        }
      });
    }

    function freezeTransport() {
      if (failed) return;

      // Any callback called by transport should be ignored since now
      failed = true;

      cleanup();

      transport.close();
      transport = null;
    }

    // Handle any error that happens while probing
    function onerror(err) {
      const error = new Error("probe error: " + err);
      error.transport = transport.name;

      freezeTransport();

      debug('probe transport "%s" failed because of error: %s', name, err);

      self.emit("upgradeError", error);
    }

    function onTransportClose() {
      onerror("transport closed");
    }

    // When the socket is closed while we're probing
    function onclose() {
      onerror("socket closed");
    }

    // When the socket is upgraded while we're probing
    function onupgrade(to) {
      if (transport && to.name !== transport.name) {
        debug('"%s" works - aborting "%s"', to.name, transport.name);
        freezeTransport();
      }
    }

    // Remove all listeners on the transport and on self
    function cleanup() {
      transport.removeListener("open", onTransportOpen);
      transport.removeListener("error", onerror);
      transport.removeListener("close", onTransportClose);
      self.removeListener("close", onclose);
      self.removeListener("upgrading", onupgrade);
    }

    transport.once("open", onTransportOpen);
    transport.once("error", onerror);
    transport.once("close", onTransportClose);

    this.once("close", onclose);
    this.once("upgrading", onupgrade);

    transport.open();
  }

  /**
   * Called when connection is deemed open.
   *
   * @api public
   */
  onOpen() {
    debug("socket open");
    this.readyState = "open";
    Socket.priorWebsocketSuccess = "websocket" === this.transport.name;
    this.emit("open");
    this.flush();

    // we check for `readyState` in case an `open`
    // listener already closed the socket
    if (
      "open" === this.readyState &&
      this.opts.upgrade &&
      this.transport.pause
    ) {
      debug("starting upgrade probes");
      let i = 0;
      const l = this.upgrades.length;
      for (; i < l; i++) {
        this.probe(this.upgrades[i]);
      }
    }
  }

  /**
   * Handles a packet.
   *
   * @api private
   */
  onPacket(packet) {
    if (
      "opening" === this.readyState ||
      "open" === this.readyState ||
      "closing" === this.readyState
    ) {
      debug('socket receive: type "%s", data "%s"', packet.type, packet.data);

      this.emit("packet", packet);

      // Socket is live - any packet counts
      this.emit("heartbeat");

      switch (packet.type) {
        case "open":
          this.onHandshake(JSON.parse(packet.data));
          break;

        case "ping":
          this.resetPingTimeout();
          this.sendPacket("pong");
          this.emit("pong");
          break;

        case "error":
          const err = new Error("server error");
          err.code = packet.data;
          this.onError(err);
          break;

        case "message":
          this.emit("data", packet.data);
          this.emit("message", packet.data);
          break;
      }
    } else {
      debug('packet received with socket readyState "%s"', this.readyState);
    }
  }

  /**
   * Called upon handshake completion.
   *
   * @param {Object} handshake obj
   * @api private
   */
  onHandshake(data) {
    this.emit("handshake", data);
    this.id = data.sid;
    this.transport.query.sid = data.sid;
    this.upgrades = this.filterUpgrades(data.upgrades);
    this.pingInterval = data.pingInterval;
    this.pingTimeout = data.pingTimeout;
    this.onOpen();
    // In case open handler closes socket
    if ("closed" === this.readyState) return;
    this.resetPingTimeout();
  }

  /**
   * Sets and resets ping timeout timer based on server pings.
   *
   * @api private
   */
  resetPingTimeout() {
    clearTimeout(this.pingTimeoutTimer);
    this.pingTimeoutTimer = setTimeout(() => {
      this.onClose("ping timeout");
    }, this.pingInterval + this.pingTimeout);
  }

  /**
   * Called on `drain` event
   *
   * @api private
   */
  onDrain() {
    this.writeBuffer.splice(0, this.prevBufferLen);

    // setting prevBufferLen = 0 is very important
    // for example, when upgrading, upgrade packet is sent over,
    // and a nonzero prevBufferLen could cause problems on `drain`
    this.prevBufferLen = 0;

    if (0 === this.writeBuffer.length) {
      this.emit("drain");
    } else {
      this.flush();
    }
  }

  /**
   * Flush write buffers.
   *
   * @api private
   */
  flush() {
    if (
      "closed" !== this.readyState &&
      this.transport.writable &&
      !this.upgrading &&
      this.writeBuffer.length
    ) {
      debug("flushing %d packets in socket", this.writeBuffer.length);
      this.transport.send(this.writeBuffer);
      // keep track of current length of writeBuffer
      // splice writeBuffer and callbackBuffer on `drain`
      this.prevBufferLen = this.writeBuffer.length;
      this.emit("flush");
    }
  }

  /**
   * Sends a message.
   *
   * @param {String} message.
   * @param {Function} callback function.
   * @param {Object} options.
   * @return {Socket} for chaining.
   * @api public
   */
  write(msg, options, fn) {
    this.sendPacket("message", msg, options, fn);
    return this;
  }

  send(msg, options, fn) {
    this.sendPacket("message", msg, options, fn);
    return this;
  }

  /**
   * Sends a packet.
   *
   * @param {String} packet type.
   * @param {String} data.
   * @param {Object} options.
   * @param {Function} callback function.
   * @api private
   */
  sendPacket(type, data, options, fn) {
    if ("function" === typeof data) {
      fn = data;
      data = undefined;
    }

    if ("function" === typeof options) {
      fn = options;
      options = null;
    }

    if ("closing" === this.readyState || "closed" === this.readyState) {
      return;
    }

    options = options || {};
    options.compress = false !== options.compress;

    const packet = {
      type: type,
      data: data,
      options: options
    };
    this.emit("packetCreate", packet);
    this.writeBuffer.push(packet);
    if (fn) this.once("flush", fn);
    this.flush();
  }

  /**
   * Closes the connection.
   *
   * @api private
   */
  close() {
    const self = this;

    if ("opening" === this.readyState || "open" === this.readyState) {
      this.readyState = "closing";

      if (this.writeBuffer.length) {
        this.once("drain", function() {
          if (this.upgrading) {
            waitForUpgrade();
          } else {
            close();
          }
        });
      } else if (this.upgrading) {
        waitForUpgrade();
      } else {
        close();
      }
    }

    function close() {
      self.onClose("forced close");
      debug("socket closing - telling transport to close");
      self.transport.close();
    }

    function cleanupAndClose() {
      self.removeListener("upgrade", cleanupAndClose);
      self.removeListener("upgradeError", cleanupAndClose);
      close();
    }

    function waitForUpgrade() {
      // wait for upgrade to finish since we can't send packets while pausing a transport
      self.once("upgrade", cleanupAndClose);
      self.once("upgradeError", cleanupAndClose);
    }

    return this;
  }

  /**
   * Called upon transport error
   *
   * @api private
   */
  onError(err) {
    debug("socket error %j", err);
    Socket.priorWebsocketSuccess = false;
    this.emit("error", err);
    this.onClose("transport error", err);
  }

  /**
   * Called upon transport close.
   *
   * @api private
   */
  onClose(reason, desc) {
    if (
      "opening" === this.readyState ||
      "open" === this.readyState ||
      "closing" === this.readyState
    ) {
      debug('socket close with reason: "%s"', reason);
      const self = this;

      // clear timers
      clearTimeout(this.pingIntervalTimer);
      clearTimeout(this.pingTimeoutTimer);

      // stop event from firing again for transport
      this.transport.removeAllListeners("close");

      // ensure transport won't stay open
      this.transport.close();

      // ignore further transport communication
      this.transport.removeAllListeners();

      // set ready state
      this.readyState = "closed";

      // clear session id
      this.id = null;

      // emit close event
      this.emit("close", reason, desc);

      // clean buffers after, so users can still
      // grab the buffers on `close` event
      self.writeBuffer = [];
      self.prevBufferLen = 0;
    }
  }

  /**
   * Filters upgrades, returning only those matching client transports.
   *
   * @param {Array} server upgrades
   * @api private
   *
   */
  filterUpgrades(upgrades) {
    const filteredUpgrades = [];
    let i = 0;
    const j = upgrades.length;
    for (; i < j; i++) {
      if (~this.transports.indexOf(upgrades[i]))
        filteredUpgrades.push(upgrades[i]);
    }
    return filteredUpgrades;
  }
}

Socket.priorWebsocketSuccess = false;

/**
 * Protocol version.
 *
 * @api public
 */

Socket.protocol = parser.protocol; // this is an int

function clone(obj) {
  const o = {};
  for (let i in obj) {
    if (obj.hasOwnProperty(i)) {
      o[i] = obj[i];
    }
  }
  return o;
}

module.exports = Socket;


/***/ }),
/* 293 */
/***/ (function(module, exports) {


/**
 * Module exports.
 *
 * Logic borrowed from Modernizr:
 *
 *   - https://github.com/Modernizr/Modernizr/blob/master/feature-detects/cors.js
 */

try {
  module.exports = typeof XMLHttpRequest !== 'undefined' &&
    'withCredentials' in new XMLHttpRequest();
} catch (err) {
  // if XMLHttp support is disabled in IE then it will throw
  // when trying to create
  module.exports = false;
}


/***/ }),
/* 294 */
/***/ (function(module, exports, __webpack_require__) {

/* global attachEvent */

const XMLHttpRequest = __webpack_require__(58);
const Polling = __webpack_require__(59);
const Emitter = __webpack_require__(24);
const { pick } = __webpack_require__(62);
const globalThis = __webpack_require__(34);

const debug = __webpack_require__(8)("engine.io-client:polling-xhr");

/**
 * Empty function
 */

function empty() {}

const hasXHR2 = (function() {
  const xhr = new XMLHttpRequest({ xdomain: false });
  return null != xhr.responseType;
})();

class XHR extends Polling {
  /**
   * XHR Polling constructor.
   *
   * @param {Object} opts
   * @api public
   */
  constructor(opts) {
    super(opts);

    if (typeof location !== "undefined") {
      const isSSL = "https:" === location.protocol;
      let port = location.port;

      // some user agents have empty `location.port`
      if (!port) {
        port = isSSL ? 443 : 80;
      }

      this.xd =
        (typeof location !== "undefined" &&
          opts.hostname !== location.hostname) ||
        port !== opts.port;
      this.xs = opts.secure !== isSSL;
    }
    /**
     * XHR supports binary
     */
    const forceBase64 = opts && opts.forceBase64;
    this.supportsBinary = hasXHR2 && !forceBase64;
  }

  /**
   * Creates a request.
   *
   * @param {String} method
   * @api private
   */
  request(opts = {}) {
    Object.assign(opts, { xd: this.xd, xs: this.xs }, this.opts);
    return new Request(this.uri(), opts);
  }

  /**
   * Sends data.
   *
   * @param {String} data to send.
   * @param {Function} called upon flush.
   * @api private
   */
  doWrite(data, fn) {
    const req = this.request({
      method: "POST",
      data: data
    });
    const self = this;
    req.on("success", fn);
    req.on("error", function(err) {
      self.onError("xhr post error", err);
    });
  }

  /**
   * Starts a poll cycle.
   *
   * @api private
   */
  doPoll() {
    debug("xhr poll");
    const req = this.request();
    const self = this;
    req.on("data", function(data) {
      self.onData(data);
    });
    req.on("error", function(err) {
      self.onError("xhr poll error", err);
    });
    this.pollXhr = req;
  }
}

class Request extends Emitter {
  /**
   * Request constructor
   *
   * @param {Object} options
   * @api public
   */
  constructor(uri, opts) {
    super();
    this.opts = opts;

    this.method = opts.method || "GET";
    this.uri = uri;
    this.async = false !== opts.async;
    this.data = undefined !== opts.data ? opts.data : null;

    this.create();
  }

  /**
   * Creates the XHR object and sends the request.
   *
   * @api private
   */
  create() {
    const opts = pick(
      this.opts,
      "agent",
      "enablesXDR",
      "pfx",
      "key",
      "passphrase",
      "cert",
      "ca",
      "ciphers",
      "rejectUnauthorized"
    );
    opts.xdomain = !!this.opts.xd;
    opts.xscheme = !!this.opts.xs;

    const xhr = (this.xhr = new XMLHttpRequest(opts));
    const self = this;

    try {
      debug("xhr open %s: %s", this.method, this.uri);
      xhr.open(this.method, this.uri, this.async);
      try {
        if (this.opts.extraHeaders) {
          xhr.setDisableHeaderCheck && xhr.setDisableHeaderCheck(true);
          for (let i in this.opts.extraHeaders) {
            if (this.opts.extraHeaders.hasOwnProperty(i)) {
              xhr.setRequestHeader(i, this.opts.extraHeaders[i]);
            }
          }
        }
      } catch (e) {}

      if ("POST" === this.method) {
        try {
          xhr.setRequestHeader("Content-type", "text/plain;charset=UTF-8");
        } catch (e) {}
      }

      try {
        xhr.setRequestHeader("Accept", "*/*");
      } catch (e) {}

      // ie6 check
      if ("withCredentials" in xhr) {
        xhr.withCredentials = this.opts.withCredentials;
      }

      if (this.opts.requestTimeout) {
        xhr.timeout = this.opts.requestTimeout;
      }

      if (this.hasXDR()) {
        xhr.onload = function() {
          self.onLoad();
        };
        xhr.onerror = function() {
          self.onError(xhr.responseText);
        };
      } else {
        xhr.onreadystatechange = function() {
          if (4 !== xhr.readyState) return;
          if (200 === xhr.status || 1223 === xhr.status) {
            self.onLoad();
          } else {
            // make sure the `error` event handler that's user-set
            // does not throw in the same tick and gets caught here
            setTimeout(function() {
              self.onError(typeof xhr.status === "number" ? xhr.status : 0);
            }, 0);
          }
        };
      }

      debug("xhr data %s", this.data);
      xhr.send(this.data);
    } catch (e) {
      // Need to defer since .create() is called directly from the constructor
      // and thus the 'error' event can only be only bound *after* this exception
      // occurs.  Therefore, also, we cannot throw here at all.
      setTimeout(function() {
        self.onError(e);
      }, 0);
      return;
    }

    if (typeof document !== "undefined") {
      this.index = Request.requestsCount++;
      Request.requests[this.index] = this;
    }
  }

  /**
   * Called upon successful response.
   *
   * @api private
   */
  onSuccess() {
    this.emit("success");
    this.cleanup();
  }

  /**
   * Called if we have data.
   *
   * @api private
   */
  onData(data) {
    this.emit("data", data);
    this.onSuccess();
  }

  /**
   * Called upon error.
   *
   * @api private
   */
  onError(err) {
    this.emit("error", err);
    this.cleanup(true);
  }

  /**
   * Cleans up house.
   *
   * @api private
   */
  cleanup(fromError) {
    if ("undefined" === typeof this.xhr || null === this.xhr) {
      return;
    }
    // xmlhttprequest
    if (this.hasXDR()) {
      this.xhr.onload = this.xhr.onerror = empty;
    } else {
      this.xhr.onreadystatechange = empty;
    }

    if (fromError) {
      try {
        this.xhr.abort();
      } catch (e) {}
    }

    if (typeof document !== "undefined") {
      delete Request.requests[this.index];
    }

    this.xhr = null;
  }

  /**
   * Called upon load.
   *
   * @api private
   */
  onLoad() {
    const data = this.xhr.responseText;
    if (data !== null) {
      this.onData(data);
    }
  }

  /**
   * Check if it has XDomainRequest.
   *
   * @api private
   */
  hasXDR() {
    return typeof XDomainRequest !== "undefined" && !this.xs && this.enablesXDR;
  }

  /**
   * Aborts the request.
   *
   * @api public
   */
  abort() {
    this.cleanup();
  }
}

/**
 * Aborts pending requests when unloading the window. This is needed to prevent
 * memory leaks (e.g. when using IE) and to ensure that no spurious error is
 * emitted.
 */

Request.requestsCount = 0;
Request.requests = {};

if (typeof document !== "undefined") {
  if (typeof attachEvent === "function") {
    attachEvent("onunload", unloadHandler);
  } else if (typeof addEventListener === "function") {
    const terminationEvent = "onpagehide" in globalThis ? "pagehide" : "unload";
    addEventListener(terminationEvent, unloadHandler, false);
  }
}

function unloadHandler() {
  for (let i in Request.requests) {
    if (Request.requests.hasOwnProperty(i)) {
      Request.requests[i].abort();
    }
  }
}

module.exports = XHR;
module.exports.Request = Request;


/***/ }),
/* 295 */
/***/ (function(module, exports, __webpack_require__) {

const { PACKET_TYPES } = __webpack_require__(60);

const withNativeBlob =
  typeof Blob === "function" ||
  (typeof Blob !== "undefined" &&
    Object.prototype.toString.call(Blob) === "[object BlobConstructor]");
const withNativeArrayBuffer = typeof ArrayBuffer === "function";

// ArrayBuffer.isView method is not defined in IE10
const isView = obj => {
  return typeof ArrayBuffer.isView === "function"
    ? ArrayBuffer.isView(obj)
    : obj && obj.buffer instanceof ArrayBuffer;
};

const encodePacket = ({ type, data }, supportsBinary, callback) => {
  if (withNativeBlob && data instanceof Blob) {
    if (supportsBinary) {
      return callback(data);
    } else {
      return encodeBlobAsBase64(data, callback);
    }
  } else if (
    withNativeArrayBuffer &&
    (data instanceof ArrayBuffer || isView(data))
  ) {
    if (supportsBinary) {
      return callback(data instanceof ArrayBuffer ? data : data.buffer);
    } else {
      return encodeBlobAsBase64(new Blob([data]), callback);
    }
  }
  // plain string
  return callback(PACKET_TYPES[type] + (data || ""));
};

const encodeBlobAsBase64 = (data, callback) => {
  const fileReader = new FileReader();
  fileReader.onload = function() {
    const content = fileReader.result.split(",")[1];
    callback("b" + content);
  };
  return fileReader.readAsDataURL(data);
};

module.exports = encodePacket;


/***/ }),
/* 296 */
/***/ (function(module, exports, __webpack_require__) {

const { PACKET_TYPES_REVERSE, ERROR_PACKET } = __webpack_require__(60);

const withNativeArrayBuffer = typeof ArrayBuffer === "function";

let base64decoder;
if (withNativeArrayBuffer) {
  base64decoder = __webpack_require__(297);
}

const decodePacket = (encodedPacket, binaryType) => {
  if (typeof encodedPacket !== "string") {
    return {
      type: "message",
      data: mapBinary(encodedPacket, binaryType)
    };
  }
  const type = encodedPacket.charAt(0);
  if (type === "b") {
    return {
      type: "message",
      data: decodeBase64Packet(encodedPacket.substring(1), binaryType)
    };
  }
  const packetType = PACKET_TYPES_REVERSE[type];
  if (!packetType) {
    return ERROR_PACKET;
  }
  return encodedPacket.length > 1
    ? {
        type: PACKET_TYPES_REVERSE[type],
        data: encodedPacket.substring(1)
      }
    : {
        type: PACKET_TYPES_REVERSE[type]
      };
};

const decodeBase64Packet = (data, binaryType) => {
  if (base64decoder) {
    const decoded = base64decoder.decode(data);
    return mapBinary(decoded, binaryType);
  } else {
    return { base64: true, data }; // fallback for old browsers
  }
};

const mapBinary = (data, binaryType) => {
  switch (binaryType) {
    case "blob":
      return data instanceof ArrayBuffer ? new Blob([data]) : data;
    case "arraybuffer":
    default:
      return data; // assuming the data is already an ArrayBuffer
  }
};

module.exports = decodePacket;


/***/ }),
/* 297 */
/***/ (function(module, exports) {

/*
 * base64-arraybuffer
 * https://github.com/niklasvh/base64-arraybuffer
 *
 * Copyright (c) 2012 Niklas von Hertzen
 * Licensed under the MIT license.
 */
(function(chars){
  "use strict";

  exports.encode = function(arraybuffer) {
    var bytes = new Uint8Array(arraybuffer),
    i, len = bytes.length, base64 = "";

    for (i = 0; i < len; i+=3) {
      base64 += chars[bytes[i] >> 2];
      base64 += chars[((bytes[i] & 3) << 4) | (bytes[i + 1] >> 4)];
      base64 += chars[((bytes[i + 1] & 15) << 2) | (bytes[i + 2] >> 6)];
      base64 += chars[bytes[i + 2] & 63];
    }

    if ((len % 3) === 2) {
      base64 = base64.substring(0, base64.length - 1) + "=";
    } else if (len % 3 === 1) {
      base64 = base64.substring(0, base64.length - 2) + "==";
    }

    return base64;
  };

  exports.decode =  function(base64) {
    var bufferLength = base64.length * 0.75,
    len = base64.length, i, p = 0,
    encoded1, encoded2, encoded3, encoded4;

    if (base64[base64.length - 1] === "=") {
      bufferLength--;
      if (base64[base64.length - 2] === "=") {
        bufferLength--;
      }
    }

    var arraybuffer = new ArrayBuffer(bufferLength),
    bytes = new Uint8Array(arraybuffer);

    for (i = 0; i < len; i+=4) {
      encoded1 = chars.indexOf(base64[i]);
      encoded2 = chars.indexOf(base64[i+1]);
      encoded3 = chars.indexOf(base64[i+2]);
      encoded4 = chars.indexOf(base64[i+3]);

      bytes[p++] = (encoded1 << 2) | (encoded2 >> 4);
      bytes[p++] = ((encoded2 & 15) << 4) | (encoded3 >> 2);
      bytes[p++] = ((encoded3 & 3) << 6) | (encoded4 & 63);
    }

    return arraybuffer;
  };
})("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/");


/***/ }),
/* 298 */
/***/ (function(module, exports, __webpack_require__) {

const Polling = __webpack_require__(59);
const globalThis = __webpack_require__(34);

const rNewline = /\n/g;
const rEscapedNewline = /\\n/g;

/**
 * Global JSONP callbacks.
 */

let callbacks;

/**
 * Noop.
 */

function empty() {}

class JSONPPolling extends Polling {
  /**
   * JSONP Polling constructor.
   *
   * @param {Object} opts.
   * @api public
   */
  constructor(opts) {
    super(opts);

    this.query = this.query || {};

    // define global callbacks array if not present
    // we do this here (lazily) to avoid unneeded global pollution
    if (!callbacks) {
      // we need to consider multiple engines in the same page
      callbacks = globalThis.___eio = globalThis.___eio || [];
    }

    // callback identifier
    this.index = callbacks.length;

    // add callback to jsonp global
    const self = this;
    callbacks.push(function(msg) {
      self.onData(msg);
    });

    // append to query string
    this.query.j = this.index;

    // prevent spurious errors from being emitted when the window is unloaded
    if (typeof addEventListener === "function") {
      addEventListener(
        "beforeunload",
        function() {
          if (self.script) self.script.onerror = empty;
        },
        false
      );
    }
  }

  /**
   * JSONP only supports binary as base64 encoded strings
   */
  get supportsBinary() {
    return false;
  }

  /**
   * Closes the socket.
   *
   * @api private
   */
  doClose() {
    if (this.script) {
      this.script.parentNode.removeChild(this.script);
      this.script = null;
    }

    if (this.form) {
      this.form.parentNode.removeChild(this.form);
      this.form = null;
      this.iframe = null;
    }

    super.doClose();
  }

  /**
   * Starts a poll cycle.
   *
   * @api private
   */
  doPoll() {
    const self = this;
    const script = document.createElement("script");

    if (this.script) {
      this.script.parentNode.removeChild(this.script);
      this.script = null;
    }

    script.async = true;
    script.src = this.uri();
    script.onerror = function(e) {
      self.onError("jsonp poll error", e);
    };

    const insertAt = document.getElementsByTagName("script")[0];
    if (insertAt) {
      insertAt.parentNode.insertBefore(script, insertAt);
    } else {
      (document.head || document.body).appendChild(script);
    }
    this.script = script;

    const isUAgecko =
      "undefined" !== typeof navigator && /gecko/i.test(navigator.userAgent);

    if (isUAgecko) {
      setTimeout(function() {
        const iframe = document.createElement("iframe");
        document.body.appendChild(iframe);
        document.body.removeChild(iframe);
      }, 100);
    }
  }

  /**
   * Writes with a hidden iframe.
   *
   * @param {String} data to send
   * @param {Function} called upon flush.
   * @api private
   */
  doWrite(data, fn) {
    const self = this;
    let iframe;

    if (!this.form) {
      const form = document.createElement("form");
      const area = document.createElement("textarea");
      const id = (this.iframeId = "eio_iframe_" + this.index);

      form.className = "socketio";
      form.style.position = "absolute";
      form.style.top = "-1000px";
      form.style.left = "-1000px";
      form.target = id;
      form.method = "POST";
      form.setAttribute("accept-charset", "utf-8");
      area.name = "d";
      form.appendChild(area);
      document.body.appendChild(form);

      this.form = form;
      this.area = area;
    }

    this.form.action = this.uri();

    function complete() {
      initIframe();
      fn();
    }

    function initIframe() {
      if (self.iframe) {
        try {
          self.form.removeChild(self.iframe);
        } catch (e) {
          self.onError("jsonp polling iframe removal error", e);
        }
      }

      try {
        // ie6 dynamic iframes with target="" support (thanks Chris Lambacher)
        const html = '<iframe src="javascript:0" name="' + self.iframeId + '">';
        iframe = document.createElement(html);
      } catch (e) {
        iframe = document.createElement("iframe");
        iframe.name = self.iframeId;
        iframe.src = "javascript:0";
      }

      iframe.id = self.iframeId;

      self.form.appendChild(iframe);
      self.iframe = iframe;
    }

    initIframe();

    // escape \n to prevent it from being converted into \r\n by some UAs
    // double escaping is required for escaped new lines because unescaping of new lines can be done safely on server-side
    data = data.replace(rEscapedNewline, "\\\n");
    this.area.value = data.replace(rNewline, "\\n");

    try {
      this.form.submit();
    } catch (e) {}

    if (this.iframe.attachEvent) {
      this.iframe.onreadystatechange = function() {
        if (self.iframe.readyState === "complete") {
          complete();
        }
      };
    } else {
      this.iframe.onload = complete;
    }
  }
}

module.exports = JSONPPolling;


/***/ }),
/* 299 */
/***/ (function(module, exports, __webpack_require__) {

/* WEBPACK VAR INJECTION */(function(Buffer) {const Transport = __webpack_require__(40);
const parser = __webpack_require__(29);
const parseqs = __webpack_require__(41);
const yeast = __webpack_require__(61);
const { pick } = __webpack_require__(62);
const {
  WebSocket,
  usingBrowserWebSocket,
  defaultBinaryType
} = __webpack_require__(302);

const debug = __webpack_require__(8)("engine.io-client:websocket");

// detect ReactNative environment
const isReactNative =
  typeof navigator !== "undefined" &&
  typeof navigator.product === "string" &&
  navigator.product.toLowerCase() === "reactnative";

class WS extends Transport {
  /**
   * WebSocket transport constructor.
   *
   * @api {Object} connection options
   * @api public
   */
  constructor(opts) {
    super(opts);

    this.supportsBinary = !opts.forceBase64;
  }

  /**
   * Transport name.
   *
   * @api public
   */
  get name() {
    return "websocket";
  }

  /**
   * Opens socket.
   *
   * @api private
   */
  doOpen() {
    if (!this.check()) {
      // let probe timeout
      return;
    }

    const uri = this.uri();
    const protocols = this.opts.protocols;

    // React Native only supports the 'headers' option, and will print a warning if anything else is passed
    const opts = isReactNative
      ? {}
      : pick(
          this.opts,
          "agent",
          "perMessageDeflate",
          "pfx",
          "key",
          "passphrase",
          "cert",
          "ca",
          "ciphers",
          "rejectUnauthorized",
          "localAddress",
          "protocolVersion",
          "origin",
          "maxPayload",
          "family",
          "checkServerIdentity"
        );

    if (this.opts.extraHeaders) {
      opts.headers = this.opts.extraHeaders;
    }

    try {
      this.ws =
        usingBrowserWebSocket && !isReactNative
          ? protocols
            ? new WebSocket(uri, protocols)
            : new WebSocket(uri)
          : new WebSocket(uri, protocols, opts);
    } catch (err) {
      return this.emit("error", err);
    }

    this.ws.binaryType = this.socket.binaryType || defaultBinaryType;

    this.addEventListeners();
  }

  /**
   * Adds event listeners to the socket
   *
   * @api private
   */
  addEventListeners() {
    const self = this;

    this.ws.onopen = function() {
      self.onOpen();
    };
    this.ws.onclose = function() {
      self.onClose();
    };
    this.ws.onmessage = function(ev) {
      self.onData(ev.data);
    };
    this.ws.onerror = function(e) {
      self.onError("websocket error", e);
    };
  }

  /**
   * Writes data to socket.
   *
   * @param {Array} array of packets.
   * @api private
   */
  write(packets) {
    const self = this;
    this.writable = false;

    // encodePacket efficient as it uses WS framing
    // no need for encodePayload
    let total = packets.length;
    let i = 0;
    const l = total;
    for (; i < l; i++) {
      (function(packet) {
        parser.encodePacket(packet, self.supportsBinary, function(data) {
          // always create a new object (GH-437)
          const opts = {};
          if (!usingBrowserWebSocket) {
            if (packet.options) {
              opts.compress = packet.options.compress;
            }

            if (self.opts.perMessageDeflate) {
              const len =
                "string" === typeof data
                  ? Buffer.byteLength(data)
                  : data.length;
              if (len < self.opts.perMessageDeflate.threshold) {
                opts.compress = false;
              }
            }
          }

          // Sometimes the websocket has already been closed but the browser didn't
          // have a chance of informing us about it yet, in that case send will
          // throw an error
          try {
            if (usingBrowserWebSocket) {
              // TypeError is thrown when passing the second argument on Safari
              self.ws.send(data);
            } else {
              self.ws.send(data, opts);
            }
          } catch (e) {
            debug("websocket closed before onclose event");
          }

          --total || done();
        });
      })(packets[i]);
    }

    function done() {
      self.emit("flush");

      // fake drain
      // defer to next tick to allow Socket to clear writeBuffer
      setTimeout(function() {
        self.writable = true;
        self.emit("drain");
      }, 0);
    }
  }

  /**
   * Called upon close
   *
   * @api private
   */
  onClose() {
    Transport.prototype.onClose.call(this);
  }

  /**
   * Closes socket.
   *
   * @api private
   */
  doClose() {
    if (typeof this.ws !== "undefined") {
      this.ws.close();
    }
  }

  /**
   * Generates uri for connection.
   *
   * @api private
   */
  uri() {
    let query = this.query || {};
    const schema = this.opts.secure ? "wss" : "ws";
    let port = "";

    // avoid port if default for schema
    if (
      this.opts.port &&
      (("wss" === schema && Number(this.opts.port) !== 443) ||
        ("ws" === schema && Number(this.opts.port) !== 80))
    ) {
      port = ":" + this.opts.port;
    }

    // append timestamp to URI
    if (this.opts.timestampRequests) {
      query[this.opts.timestampParam] = yeast();
    }

    // communicate binary support capabilities
    if (!this.supportsBinary) {
      query.b64 = 1;
    }

    query = parseqs.encode(query);

    // prepend ? to query
    if (query.length) {
      query = "?" + query;
    }

    const ipv6 = this.opts.hostname.indexOf(":") !== -1;
    return (
      schema +
      "://" +
      (ipv6 ? "[" + this.opts.hostname + "]" : this.opts.hostname) +
      port +
      this.opts.path +
      query
    );
  }

  /**
   * Feature detection for WebSocket.
   *
   * @return {Boolean} whether this transport is available.
   * @api public
   */
  check() {
    return (
      !!WebSocket &&
      !("__initialize" in WebSocket && this.name === WS.prototype.name)
    );
  }
}

module.exports = WS;

/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(11).Buffer))

/***/ }),
/* 300 */
/***/ (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('')
}


/***/ }),
/* 301 */
/***/ (function(module, exports) {

/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
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
}


/***/ }),
/* 302 */
/***/ (function(module, exports, __webpack_require__) {

const globalThis = __webpack_require__(34);

module.exports = {
  WebSocket: globalThis.WebSocket || globalThis.MozWebSocket,
  usingBrowserWebSocket: true,
  defaultBinaryType: "arraybuffer"
};


/***/ }),
/* 303 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.reconstructPacket = exports.deconstructPacket = void 0;
const is_binary_1 = __webpack_require__(65);
/**
 * Replaces every Buffer | ArrayBuffer | Blob | File in packet with a numbered placeholder.
 *
 * @param {Object} packet - socket.io event packet
 * @return {Object} with deconstructed packet and list of buffers
 * @public
 */
function deconstructPacket(packet) {
    const buffers = [];
    const packetData = packet.data;
    const pack = packet;
    pack.data = _deconstructPacket(packetData, buffers);
    pack.attachments = buffers.length; // number of binary 'attachments'
    return { packet: pack, buffers: buffers };
}
exports.deconstructPacket = deconstructPacket;
function _deconstructPacket(data, buffers) {
    if (!data)
        return data;
    if (is_binary_1.isBinary(data)) {
        const placeholder = { _placeholder: true, num: buffers.length };
        buffers.push(data);
        return placeholder;
    }
    else if (Array.isArray(data)) {
        const newData = new Array(data.length);
        for (let i = 0; i < data.length; i++) {
            newData[i] = _deconstructPacket(data[i], buffers);
        }
        return newData;
    }
    else if (typeof data === "object" && !(data instanceof Date)) {
        const newData = {};
        for (const key in data) {
            if (data.hasOwnProperty(key)) {
                newData[key] = _deconstructPacket(data[key], buffers);
            }
        }
        return newData;
    }
    return data;
}
/**
 * Reconstructs a binary packet from its placeholder packet and buffers
 *
 * @param {Object} packet - event packet with placeholders
 * @param {Array} buffers - binary buffers to put in placeholder positions
 * @return {Object} reconstructed packet
 * @public
 */
function reconstructPacket(packet, buffers) {
    packet.data = _reconstructPacket(packet.data, buffers);
    packet.attachments = undefined; // no longer useful
    return packet;
}
exports.reconstructPacket = reconstructPacket;
function _reconstructPacket(data, buffers) {
    if (!data)
        return data;
    if (data && data._placeholder) {
        return buffers[data.num]; // appropriate buffer (should be natural order anyway)
    }
    else if (Array.isArray(data)) {
        for (let i = 0; i < data.length; i++) {
            data[i] = _reconstructPacket(data[i], buffers);
        }
    }
    else if (typeof data === "object") {
        for (const key in data) {
            if (data.hasOwnProperty(key)) {
                data[key] = _reconstructPacket(data[key], buffers);
            }
        }
    }
    return data;
}


/***/ }),
/* 304 */
/***/ (function(module, exports) {


/**
 * Expose `Backoff`.
 */

module.exports = Backoff;

/**
 * Initialize backoff timer with `opts`.
 *
 * - `min` initial timeout in milliseconds [100]
 * - `max` max timeout [10000]
 * - `jitter` [0]
 * - `factor` [2]
 *
 * @param {Object} opts
 * @api public
 */

function Backoff(opts) {
  opts = opts || {};
  this.ms = opts.min || 100;
  this.max = opts.max || 10000;
  this.factor = opts.factor || 2;
  this.jitter = opts.jitter > 0 && opts.jitter <= 1 ? opts.jitter : 0;
  this.attempts = 0;
}

/**
 * Return the backoff duration.
 *
 * @return {Number}
 * @api public
 */

Backoff.prototype.duration = function(){
  var ms = this.ms * Math.pow(this.factor, this.attempts++);
  if (this.jitter) {
    var rand =  Math.random();
    var deviation = Math.floor(rand * this.jitter * ms);
    ms = (Math.floor(rand * 10) & 1) == 0  ? ms - deviation : ms + deviation;
  }
  return Math.min(ms, this.max) | 0;
};

/**
 * Reset the number of attempts.
 *
 * @api public
 */

Backoff.prototype.reset = function(){
  this.attempts = 0;
};

/**
 * Set the minimum duration
 *
 * @api public
 */

Backoff.prototype.setMin = function(min){
  this.ms = min;
};

/**
 * Set the maximum duration
 *
 * @api public
 */

Backoff.prototype.setMax = function(max){
  this.max = max;
};

/**
 * Set the jitter
 *
 * @api public
 */

Backoff.prototype.setJitter = function(jitter){
  this.jitter = jitter;
};



/***/ }),
/* 305 */
/***/ (function(module, exports, __webpack_require__) {

!function(e,t){ true?module.exports=t():undefined}(this,(function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=90)}({17:function(e,t,r){"use strict";t.__esModule=!0,t.default=void 0;var n=r(18),i=function(){function e(){}return e.getFirstMatch=function(e,t){var r=t.match(e);return r&&r.length>0&&r[1]||""},e.getSecondMatch=function(e,t){var r=t.match(e);return r&&r.length>1&&r[2]||""},e.matchAndReturnConst=function(e,t,r){if(e.test(t))return r},e.getWindowsVersionName=function(e){switch(e){case"NT":return"NT";case"XP":return"XP";case"NT 5.0":return"2000";case"NT 5.1":return"XP";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}},e.getMacOSVersionName=function(e){var t=e.split(".").splice(0,2).map((function(e){return parseInt(e,10)||0}));if(t.push(0),10===t[0])switch(t[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}},e.getAndroidVersionName=function(e){var t=e.split(".").splice(0,2).map((function(e){return parseInt(e,10)||0}));if(t.push(0),!(1===t[0]&&t[1]<5))return 1===t[0]&&t[1]<6?"Cupcake":1===t[0]&&t[1]>=6?"Donut":2===t[0]&&t[1]<2?"Eclair":2===t[0]&&2===t[1]?"Froyo":2===t[0]&&t[1]>2?"Gingerbread":3===t[0]?"Honeycomb":4===t[0]&&t[1]<1?"Ice Cream Sandwich":4===t[0]&&t[1]<4?"Jelly Bean":4===t[0]&&t[1]>=4?"KitKat":5===t[0]?"Lollipop":6===t[0]?"Marshmallow":7===t[0]?"Nougat":8===t[0]?"Oreo":9===t[0]?"Pie":void 0},e.getVersionPrecision=function(e){return e.split(".").length},e.compareVersions=function(t,r,n){void 0===n&&(n=!1);var i=e.getVersionPrecision(t),s=e.getVersionPrecision(r),a=Math.max(i,s),o=0,u=e.map([t,r],(function(t){var r=a-e.getVersionPrecision(t),n=t+new Array(r+1).join(".0");return e.map(n.split("."),(function(e){return new Array(20-e.length).join("0")+e})).reverse()}));for(n&&(o=a-Math.min(i,s)),a-=1;a>=o;){if(u[0][a]>u[1][a])return 1;if(u[0][a]===u[1][a]){if(a===o)return 0;a-=1}else if(u[0][a]<u[1][a])return-1}},e.map=function(e,t){var r,n=[];if(Array.prototype.map)return Array.prototype.map.call(e,t);for(r=0;r<e.length;r+=1)n.push(t(e[r]));return n},e.find=function(e,t){var r,n;if(Array.prototype.find)return Array.prototype.find.call(e,t);for(r=0,n=e.length;r<n;r+=1){var i=e[r];if(t(i,r))return i}},e.assign=function(e){for(var t,r,n=e,i=arguments.length,s=new Array(i>1?i-1:0),a=1;a<i;a++)s[a-1]=arguments[a];if(Object.assign)return Object.assign.apply(Object,[e].concat(s));var o=function(){var e=s[t];"object"==typeof e&&null!==e&&Object.keys(e).forEach((function(t){n[t]=e[t]}))};for(t=0,r=s.length;t<r;t+=1)o();return e},e.getBrowserAlias=function(e){return n.BROWSER_ALIASES_MAP[e]},e.getBrowserTypeByAlias=function(e){return n.BROWSER_MAP[e]||""},e}();t.default=i,e.exports=t.default},18:function(e,t,r){"use strict";t.__esModule=!0,t.ENGINE_MAP=t.OS_MAP=t.PLATFORMS_MAP=t.BROWSER_MAP=t.BROWSER_ALIASES_MAP=void 0;t.BROWSER_ALIASES_MAP={"Amazon Silk":"amazon_silk","Android Browser":"android",Bada:"bada",BlackBerry:"blackberry",Chrome:"chrome",Chromium:"chromium",Electron:"electron",Epiphany:"epiphany",Firefox:"firefox",Focus:"focus",Generic:"generic","Google Search":"google_search",Googlebot:"googlebot","Internet Explorer":"ie","K-Meleon":"k_meleon",Maxthon:"maxthon","Microsoft Edge":"edge","MZ Browser":"mz","NAVER Whale Browser":"naver",Opera:"opera","Opera Coast":"opera_coast",PhantomJS:"phantomjs",Puffin:"puffin",QupZilla:"qupzilla",QQ:"qq",QQLite:"qqlite",Safari:"safari",Sailfish:"sailfish","Samsung Internet for Android":"samsung_internet",SeaMonkey:"seamonkey",Sleipnir:"sleipnir",Swing:"swing",Tizen:"tizen","UC Browser":"uc",Vivaldi:"vivaldi","WebOS Browser":"webos",WeChat:"wechat","Yandex Browser":"yandex",Roku:"roku"};t.BROWSER_MAP={amazon_silk:"Amazon Silk",android:"Android Browser",bada:"Bada",blackberry:"BlackBerry",chrome:"Chrome",chromium:"Chromium",electron:"Electron",epiphany:"Epiphany",firefox:"Firefox",focus:"Focus",generic:"Generic",googlebot:"Googlebot",google_search:"Google Search",ie:"Internet Explorer",k_meleon:"K-Meleon",maxthon:"Maxthon",edge:"Microsoft Edge",mz:"MZ Browser",naver:"NAVER Whale Browser",opera:"Opera",opera_coast:"Opera Coast",phantomjs:"PhantomJS",puffin:"Puffin",qupzilla:"QupZilla",qq:"QQ Browser",qqlite:"QQ Browser Lite",safari:"Safari",sailfish:"Sailfish",samsung_internet:"Samsung Internet for Android",seamonkey:"SeaMonkey",sleipnir:"Sleipnir",swing:"Swing",tizen:"Tizen",uc:"UC Browser",vivaldi:"Vivaldi",webos:"WebOS Browser",wechat:"WeChat",yandex:"Yandex Browser"};t.PLATFORMS_MAP={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv"};t.OS_MAP={WindowsPhone:"Windows Phone",Windows:"Windows",MacOS:"macOS",iOS:"iOS",Android:"Android",WebOS:"WebOS",BlackBerry:"BlackBerry",Bada:"Bada",Tizen:"Tizen",Linux:"Linux",ChromeOS:"Chrome OS",PlayStation4:"PlayStation 4",Roku:"Roku"};t.ENGINE_MAP={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"}},90:function(e,t,r){"use strict";t.__esModule=!0,t.default=void 0;var n,i=(n=r(91))&&n.__esModule?n:{default:n},s=r(18);function a(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var o=function(){function e(){}var t,r,n;return e.getParser=function(e,t){if(void 0===t&&(t=!1),"string"!=typeof e)throw new Error("UserAgent should be a string");return new i.default(e,t)},e.parse=function(e){return new i.default(e).getResult()},t=e,n=[{key:"BROWSER_MAP",get:function(){return s.BROWSER_MAP}},{key:"ENGINE_MAP",get:function(){return s.ENGINE_MAP}},{key:"OS_MAP",get:function(){return s.OS_MAP}},{key:"PLATFORMS_MAP",get:function(){return s.PLATFORMS_MAP}}],(r=null)&&a(t.prototype,r),n&&a(t,n),e}();t.default=o,e.exports=t.default},91:function(e,t,r){"use strict";t.__esModule=!0,t.default=void 0;var n=u(r(92)),i=u(r(93)),s=u(r(94)),a=u(r(95)),o=u(r(17));function u(e){return e&&e.__esModule?e:{default:e}}var d=function(){function e(e,t){if(void 0===t&&(t=!1),null==e||""===e)throw new Error("UserAgent parameter can't be empty");this._ua=e,this.parsedResult={},!0!==t&&this.parse()}var t=e.prototype;return t.getUA=function(){return this._ua},t.test=function(e){return e.test(this._ua)},t.parseBrowser=function(){var e=this;this.parsedResult.browser={};var t=o.default.find(n.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.browser=t.describe(this.getUA())),this.parsedResult.browser},t.getBrowser=function(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()},t.getBrowserName=function(e){return e?String(this.getBrowser().name).toLowerCase()||"":this.getBrowser().name||""},t.getBrowserVersion=function(){return this.getBrowser().version},t.getOS=function(){return this.parsedResult.os?this.parsedResult.os:this.parseOS()},t.parseOS=function(){var e=this;this.parsedResult.os={};var t=o.default.find(i.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.os=t.describe(this.getUA())),this.parsedResult.os},t.getOSName=function(e){var t=this.getOS().name;return e?String(t).toLowerCase()||"":t||""},t.getOSVersion=function(){return this.getOS().version},t.getPlatform=function(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()},t.getPlatformType=function(e){void 0===e&&(e=!1);var t=this.getPlatform().type;return e?String(t).toLowerCase()||"":t||""},t.parsePlatform=function(){var e=this;this.parsedResult.platform={};var t=o.default.find(s.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.platform=t.describe(this.getUA())),this.parsedResult.platform},t.getEngine=function(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()},t.getEngineName=function(e){return e?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""},t.parseEngine=function(){var e=this;this.parsedResult.engine={};var t=o.default.find(a.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.engine=t.describe(this.getUA())),this.parsedResult.engine},t.parse=function(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this},t.getResult=function(){return o.default.assign({},this.parsedResult)},t.satisfies=function(e){var t=this,r={},n=0,i={},s=0;if(Object.keys(e).forEach((function(t){var a=e[t];"string"==typeof a?(i[t]=a,s+=1):"object"==typeof a&&(r[t]=a,n+=1)})),n>0){var a=Object.keys(r),u=o.default.find(a,(function(e){return t.isOS(e)}));if(u){var d=this.satisfies(r[u]);if(void 0!==d)return d}var c=o.default.find(a,(function(e){return t.isPlatform(e)}));if(c){var f=this.satisfies(r[c]);if(void 0!==f)return f}}if(s>0){var l=Object.keys(i),h=o.default.find(l,(function(e){return t.isBrowser(e,!0)}));if(void 0!==h)return this.compareVersion(i[h])}},t.isBrowser=function(e,t){void 0===t&&(t=!1);var r=this.getBrowserName().toLowerCase(),n=e.toLowerCase(),i=o.default.getBrowserTypeByAlias(n);return t&&i&&(n=i.toLowerCase()),n===r},t.compareVersion=function(e){var t=[0],r=e,n=!1,i=this.getBrowserVersion();if("string"==typeof i)return">"===e[0]||"<"===e[0]?(r=e.substr(1),"="===e[1]?(n=!0,r=e.substr(2)):t=[],">"===e[0]?t.push(1):t.push(-1)):"="===e[0]?r=e.substr(1):"~"===e[0]&&(n=!0,r=e.substr(1)),t.indexOf(o.default.compareVersions(i,r,n))>-1},t.isOS=function(e){return this.getOSName(!0)===String(e).toLowerCase()},t.isPlatform=function(e){return this.getPlatformType(!0)===String(e).toLowerCase()},t.isEngine=function(e){return this.getEngineName(!0)===String(e).toLowerCase()},t.is=function(e,t){return void 0===t&&(t=!1),this.isBrowser(e,t)||this.isOS(e)||this.isPlatform(e)},t.some=function(e){var t=this;return void 0===e&&(e=[]),e.some((function(e){return t.is(e)}))},e}();t.default=d,e.exports=t.default},92:function(e,t,r){"use strict";t.__esModule=!0,t.default=void 0;var n,i=(n=r(17))&&n.__esModule?n:{default:n};var s=/version\/(\d+(\.?_?\d+)+)/i,a=[{test:[/googlebot/i],describe:function(e){var t={name:"Googlebot"},r=i.default.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,e)||i.default.getFirstMatch(s,e);return r&&(t.version=r),t}},{test:[/opera/i],describe:function(e){var t={name:"Opera"},r=i.default.getFirstMatch(s,e)||i.default.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/opr\/|opios/i],describe:function(e){var t={name:"Opera"},r=i.default.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,e)||i.default.getFirstMatch(s,e);return r&&(t.version=r),t}},{test:[/SamsungBrowser/i],describe:function(e){var t={name:"Samsung Internet for Android"},r=i.default.getFirstMatch(s,e)||i.default.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/Whale/i],describe:function(e){var t={name:"NAVER Whale Browser"},r=i.default.getFirstMatch(s,e)||i.default.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/MZBrowser/i],describe:function(e){var t={name:"MZ Browser"},r=i.default.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(s,e);return r&&(t.version=r),t}},{test:[/focus/i],describe:function(e){var t={name:"Focus"},r=i.default.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(s,e);return r&&(t.version=r),t}},{test:[/swing/i],describe:function(e){var t={name:"Swing"},r=i.default.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(s,e);return r&&(t.version=r),t}},{test:[/coast/i],describe:function(e){var t={name:"Opera Coast"},r=i.default.getFirstMatch(s,e)||i.default.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe:function(e){var t={name:"Opera Touch"},r=i.default.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(s,e);return r&&(t.version=r),t}},{test:[/yabrowser/i],describe:function(e){var t={name:"Yandex Browser"},r=i.default.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(s,e);return r&&(t.version=r),t}},{test:[/ucbrowser/i],describe:function(e){var t={name:"UC Browser"},r=i.default.getFirstMatch(s,e)||i.default.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/Maxthon|mxios/i],describe:function(e){var t={name:"Maxthon"},r=i.default.getFirstMatch(s,e)||i.default.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/epiphany/i],describe:function(e){var t={name:"Epiphany"},r=i.default.getFirstMatch(s,e)||i.default.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/puffin/i],describe:function(e){var t={name:"Puffin"},r=i.default.getFirstMatch(s,e)||i.default.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/sleipnir/i],describe:function(e){var t={name:"Sleipnir"},r=i.default.getFirstMatch(s,e)||i.default.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/k-meleon/i],describe:function(e){var t={name:"K-Meleon"},r=i.default.getFirstMatch(s,e)||i.default.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/micromessenger/i],describe:function(e){var t={name:"WeChat"},r=i.default.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(s,e);return r&&(t.version=r),t}},{test:[/qqbrowser/i],describe:function(e){var t={name:/qqbrowserlite/i.test(e)?"QQ Browser Lite":"QQ Browser"},r=i.default.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(s,e);return r&&(t.version=r),t}},{test:[/msie|trident/i],describe:function(e){var t={name:"Internet Explorer"},r=i.default.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/\sedg\//i],describe:function(e){var t={name:"Microsoft Edge"},r=i.default.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/edg([ea]|ios)/i],describe:function(e){var t={name:"Microsoft Edge"},r=i.default.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/vivaldi/i],describe:function(e){var t={name:"Vivaldi"},r=i.default.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/seamonkey/i],describe:function(e){var t={name:"SeaMonkey"},r=i.default.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/sailfish/i],describe:function(e){var t={name:"Sailfish"},r=i.default.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,e);return r&&(t.version=r),t}},{test:[/silk/i],describe:function(e){var t={name:"Amazon Silk"},r=i.default.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/phantom/i],describe:function(e){var t={name:"PhantomJS"},r=i.default.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/slimerjs/i],describe:function(e){var t={name:"SlimerJS"},r=i.default.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t={name:"BlackBerry"},r=i.default.getFirstMatch(s,e)||i.default.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t={name:"WebOS Browser"},r=i.default.getFirstMatch(s,e)||i.default.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/bada/i],describe:function(e){var t={name:"Bada"},r=i.default.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/tizen/i],describe:function(e){var t={name:"Tizen"},r=i.default.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(s,e);return r&&(t.version=r),t}},{test:[/qupzilla/i],describe:function(e){var t={name:"QupZilla"},r=i.default.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(s,e);return r&&(t.version=r),t}},{test:[/firefox|iceweasel|fxios/i],describe:function(e){var t={name:"Firefox"},r=i.default.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/electron/i],describe:function(e){var t={name:"Electron"},r=i.default.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/MiuiBrowser/i],describe:function(e){var t={name:"Miui"},r=i.default.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/chromium/i],describe:function(e){var t={name:"Chromium"},r=i.default.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(s,e);return r&&(t.version=r),t}},{test:[/chrome|crios|crmo/i],describe:function(e){var t={name:"Chrome"},r=i.default.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/GSA/i],describe:function(e){var t={name:"Google Search"},r=i.default.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:function(e){var t=!e.test(/like android/i),r=e.test(/android/i);return t&&r},describe:function(e){var t={name:"Android Browser"},r=i.default.getFirstMatch(s,e);return r&&(t.version=r),t}},{test:[/playstation 4/i],describe:function(e){var t={name:"PlayStation 4"},r=i.default.getFirstMatch(s,e);return r&&(t.version=r),t}},{test:[/safari|applewebkit/i],describe:function(e){var t={name:"Safari"},r=i.default.getFirstMatch(s,e);return r&&(t.version=r),t}},{test:[/.*/i],describe:function(e){var t=-1!==e.search("\\(")?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:i.default.getFirstMatch(t,e),version:i.default.getSecondMatch(t,e)}}}];t.default=a,e.exports=t.default},93:function(e,t,r){"use strict";t.__esModule=!0,t.default=void 0;var n,i=(n=r(17))&&n.__esModule?n:{default:n},s=r(18);var a=[{test:[/Roku\/DVP/],describe:function(e){var t=i.default.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,e);return{name:s.OS_MAP.Roku,version:t}}},{test:[/windows phone/i],describe:function(e){var t=i.default.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,e);return{name:s.OS_MAP.WindowsPhone,version:t}}},{test:[/windows /i],describe:function(e){var t=i.default.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,e),r=i.default.getWindowsVersionName(t);return{name:s.OS_MAP.Windows,version:t,versionName:r}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(e){var t={name:s.OS_MAP.iOS},r=i.default.getSecondMatch(/(Version\/)(\d[\d.]+)/,e);return r&&(t.version=r),t}},{test:[/macintosh/i],describe:function(e){var t=i.default.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,e).replace(/[_\s]/g,"."),r=i.default.getMacOSVersionName(t),n={name:s.OS_MAP.MacOS,version:t};return r&&(n.versionName=r),n}},{test:[/(ipod|iphone|ipad)/i],describe:function(e){var t=i.default.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,e).replace(/[_\s]/g,".");return{name:s.OS_MAP.iOS,version:t}}},{test:function(e){var t=!e.test(/like android/i),r=e.test(/android/i);return t&&r},describe:function(e){var t=i.default.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,e),r=i.default.getAndroidVersionName(t),n={name:s.OS_MAP.Android,version:t};return r&&(n.versionName=r),n}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t=i.default.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,e),r={name:s.OS_MAP.WebOS};return t&&t.length&&(r.version=t),r}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t=i.default.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,e)||i.default.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,e)||i.default.getFirstMatch(/\bbb(\d+)/i,e);return{name:s.OS_MAP.BlackBerry,version:t}}},{test:[/bada/i],describe:function(e){var t=i.default.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,e);return{name:s.OS_MAP.Bada,version:t}}},{test:[/tizen/i],describe:function(e){var t=i.default.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,e);return{name:s.OS_MAP.Tizen,version:t}}},{test:[/linux/i],describe:function(){return{name:s.OS_MAP.Linux}}},{test:[/CrOS/],describe:function(){return{name:s.OS_MAP.ChromeOS}}},{test:[/PlayStation 4/],describe:function(e){var t=i.default.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,e);return{name:s.OS_MAP.PlayStation4,version:t}}}];t.default=a,e.exports=t.default},94:function(e,t,r){"use strict";t.__esModule=!0,t.default=void 0;var n,i=(n=r(17))&&n.__esModule?n:{default:n},s=r(18);var a=[{test:[/googlebot/i],describe:function(){return{type:"bot",vendor:"Google"}}},{test:[/huawei/i],describe:function(e){var t=i.default.getFirstMatch(/(can-l01)/i,e)&&"Nova",r={type:s.PLATFORMS_MAP.mobile,vendor:"Huawei"};return t&&(r.model=t),r}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:function(){return{type:s.PLATFORMS_MAP.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe:function(){return{type:s.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(){return{type:s.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe:function(){return{type:s.PLATFORMS_MAP.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe:function(){return{type:s.PLATFORMS_MAP.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe:function(){return{type:s.PLATFORMS_MAP.tablet}}},{test:function(e){var t=e.test(/ipod|iphone/i),r=e.test(/like (ipod|iphone)/i);return t&&!r},describe:function(e){var t=i.default.getFirstMatch(/(ipod|iphone)/i,e);return{type:s.PLATFORMS_MAP.mobile,vendor:"Apple",model:t}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:function(){return{type:s.PLATFORMS_MAP.mobile,vendor:"Nexus"}}},{test:[/[^-]mobi/i],describe:function(){return{type:s.PLATFORMS_MAP.mobile}}},{test:function(e){return"blackberry"===e.getBrowserName(!0)},describe:function(){return{type:s.PLATFORMS_MAP.mobile,vendor:"BlackBerry"}}},{test:function(e){return"bada"===e.getBrowserName(!0)},describe:function(){return{type:s.PLATFORMS_MAP.mobile}}},{test:function(e){return"windows phone"===e.getBrowserName()},describe:function(){return{type:s.PLATFORMS_MAP.mobile,vendor:"Microsoft"}}},{test:function(e){var t=Number(String(e.getOSVersion()).split(".")[0]);return"android"===e.getOSName(!0)&&t>=3},describe:function(){return{type:s.PLATFORMS_MAP.tablet}}},{test:function(e){return"android"===e.getOSName(!0)},describe:function(){return{type:s.PLATFORMS_MAP.mobile}}},{test:function(e){return"macos"===e.getOSName(!0)},describe:function(){return{type:s.PLATFORMS_MAP.desktop,vendor:"Apple"}}},{test:function(e){return"windows"===e.getOSName(!0)},describe:function(){return{type:s.PLATFORMS_MAP.desktop}}},{test:function(e){return"linux"===e.getOSName(!0)},describe:function(){return{type:s.PLATFORMS_MAP.desktop}}},{test:function(e){return"playstation 4"===e.getOSName(!0)},describe:function(){return{type:s.PLATFORMS_MAP.tv}}},{test:function(e){return"roku"===e.getOSName(!0)},describe:function(){return{type:s.PLATFORMS_MAP.tv}}}];t.default=a,e.exports=t.default},95:function(e,t,r){"use strict";t.__esModule=!0,t.default=void 0;var n,i=(n=r(17))&&n.__esModule?n:{default:n},s=r(18);var a=[{test:function(e){return"microsoft edge"===e.getBrowserName(!0)},describe:function(e){if(/\sedg\//i.test(e))return{name:s.ENGINE_MAP.Blink};var t=i.default.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,e);return{name:s.ENGINE_MAP.EdgeHTML,version:t}}},{test:[/trident/i],describe:function(e){var t={name:s.ENGINE_MAP.Trident},r=i.default.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:function(e){return e.test(/presto/i)},describe:function(e){var t={name:s.ENGINE_MAP.Presto},r=i.default.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:function(e){var t=e.test(/gecko/i),r=e.test(/like gecko/i);return t&&!r},describe:function(e){var t={name:s.ENGINE_MAP.Gecko},r=i.default.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/(apple)?webkit\/537\.36/i],describe:function(){return{name:s.ENGINE_MAP.Blink}}},{test:[/(apple)?webkit/i],describe:function(e){var t={name:s.ENGINE_MAP.WebKit},r=i.default.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}}];t.default=a,e.exports=t.default}})}));

/***/ }),
/* 306 */
/***/ (function(module, exports, __webpack_require__) {

const debug = __webpack_require__(8)('h264-profile-level-id');

/* eslint-disable no-console */
debug.log = console.info.bind(console);
/* eslint-enable no-console */

const ProfileConstrainedBaseline = 1;
const ProfileBaseline = 2;
const ProfileMain = 3;
const ProfileConstrainedHigh = 4;
const ProfileHigh = 5;

exports.ProfileConstrainedBaseline = ProfileConstrainedBaseline;
exports.ProfileBaseline = ProfileBaseline;
exports.ProfileMain = ProfileMain;
exports.ProfileConstrainedHigh = ProfileConstrainedHigh;
exports.ProfileHigh = ProfileHigh;

// All values are equal to ten times the level number, except level 1b which is
// special.
const Level1_b = 0;
const Level1 = 10;
const Level1_1 = 11;
const Level1_2 = 12;
const Level1_3 = 13;
const Level2 = 20;
const Level2_1 = 21;
const Level2_2 = 22;
const Level3 = 30;
const Level3_1 = 31;
const Level3_2 = 32;
const Level4 = 40;
const Level4_1 = 41;
const Level4_2 = 42;
const Level5 = 50;
const Level5_1 = 51;
const Level5_2 = 52;

exports.Level1_b = Level1_b;
exports.Level1 = Level1;
exports.Level1_1 = Level1_1;
exports.Level1_2 = Level1_2;
exports.Level1_3 = Level1_3;
exports.Level2 = Level2;
exports.Level2_1 = Level2_1;
exports.Level2_2 = Level2_2;
exports.Level3 = Level3;
exports.Level3_1 = Level3_1;
exports.Level3_2 = Level3_2;
exports.Level4 = Level4;
exports.Level4_1 = Level4_1;
exports.Level4_2 = Level4_2;
exports.Level5 = Level5;
exports.Level5_1 = Level5_1;
exports.Level5_2 = Level5_2;

class ProfileLevelId
{
	constructor(profile, level)
	{
		this.profile = profile;
		this.level = level;
	}
}

exports.ProfileLevelId = ProfileLevelId;

// Default ProfileLevelId.
//
// TODO: The default should really be profile Baseline and level 1 according to
// the spec: https://tools.ietf.org/html/rfc6184#section-8.1. In order to not
// break backwards compatibility with older versions of WebRTC where external
// codecs don't have any parameters, use profile ConstrainedBaseline level 3_1
// instead. This workaround will only be done in an interim period to allow
// external clients to update their code.
//
// http://crbug/webrtc/6337.
const DefaultProfileLevelId =
	new ProfileLevelId(ProfileConstrainedBaseline, Level3_1);

// For level_idc=11 and profile_idc=0x42, 0x4D, or 0x58, the constraint set3
// flag specifies if level 1b or level 1.1 is used.
const ConstraintSet3Flag = 0x10;

// Class for matching bit patterns such as "x1xx0000" where 'x' is allowed to be
// either 0 or 1.
class BitPattern
{
	constructor(str)
	{
		this._mask = ~byteMaskString('x', str);
		this._maskedValue = byteMaskString('1', str);
	}

	isMatch(value)
	{
		return this._maskedValue === (value & this._mask);
	}
}

// Class for converting between profile_idc/profile_iop to Profile.
class ProfilePattern
{
	constructor(profile_idc, profile_iop, profile)
	{
		this.profile_idc = profile_idc;
		this.profile_iop = profile_iop;
		this.profile = profile;
	}
}

// This is from https://tools.ietf.org/html/rfc6184#section-8.1.
const ProfilePatterns =
[
	new ProfilePattern(0x42, new BitPattern('x1xx0000'), ProfileConstrainedBaseline),
	new ProfilePattern(0x4D, new BitPattern('1xxx0000'), ProfileConstrainedBaseline),
	new ProfilePattern(0x58, new BitPattern('11xx0000'), ProfileConstrainedBaseline),
	new ProfilePattern(0x42, new BitPattern('x0xx0000'), ProfileBaseline),
	new ProfilePattern(0x58, new BitPattern('10xx0000'), ProfileBaseline),
	new ProfilePattern(0x4D, new BitPattern('0x0x0000'), ProfileMain),
	new ProfilePattern(0x64, new BitPattern('00000000'), ProfileHigh),
	new ProfilePattern(0x64, new BitPattern('00001100'), ProfileConstrainedHigh)
];

/**
 * Parse profile level id that is represented as a string of 3 hex bytes.
 * Nothing will be returned if the string is not a recognized H264 profile
 * level id.
 *
 * @param {String} str - profile-level-id value as a string of 3 hex bytes.
 *
 * @returns {ProfileLevelId}
 */
exports.parseProfileLevelId = function(str)
{
	// The string should consist of 3 bytes in hexadecimal format.
	if (typeof str !== 'string' || str.length !== 6)
		return null;

	const profile_level_id_numeric = parseInt(str, 16);

	if (profile_level_id_numeric === 0)
		return null;

	// Separate into three bytes.
	const level_idc = profile_level_id_numeric & 0xFF;
	const profile_iop = (profile_level_id_numeric >> 8) & 0xFF;
	const profile_idc = (profile_level_id_numeric >> 16) & 0xFF;

	// Parse level based on level_idc and constraint set 3 flag.
	let level;

	switch (level_idc)
	{
		case Level1_1:
		{
			level = (profile_iop & ConstraintSet3Flag) !== 0 ? Level1_b : Level1_1;
			break;
		}
		case Level1:
		case Level1_2:
		case Level1_3:
		case Level2:
		case Level2_1:
		case Level2_2:
		case Level3:
		case Level3_1:
		case Level3_2:
		case Level4:
		case Level4_1:
		case Level4_2:
		case Level5:
		case Level5_1:
		case Level5_2:
		{
			level = level_idc;
			break;
		}
		// Unrecognized level_idc.
		default:
		{
			debug('parseProfileLevelId() | unrecognized level_idc:%s', level_idc);

			return null;
		}
	}

	// Parse profile_idc/profile_iop into a Profile enum.
	for (const pattern of ProfilePatterns)
	{
		if (
			profile_idc === pattern.profile_idc &&
			pattern.profile_iop.isMatch(profile_iop)
		)
		{
			return new ProfileLevelId(pattern.profile, level);
		}
	}

	debug('parseProfileLevelId() | unrecognized profile_idc/profile_iop combination');

	return null;
};

/**
 * Returns canonical string representation as three hex bytes of the profile
 * level id, or returns nothing for invalid profile level ids.
 *
 * @param {ProfileLevelId} profile_level_id
 *
 * @returns {String}
 */
exports.profileLevelIdToString = function(profile_level_id)
{
	// Handle special case level == 1b.
	if (profile_level_id.level == Level1_b)
	{
		switch (profile_level_id.profile)
		{
			case ProfileConstrainedBaseline:
			{
				return '42f00b';
			}
			case ProfileBaseline:
			{
				return '42100b';
			}
			case ProfileMain:
			{
				return '4d100b';
			}
			// Level 1_b is not allowed for other profiles.
			default:
			{
				debug(
					'profileLevelIdToString() | Level 1_b not is allowed for profile:%s',
					profile_level_id.profile);

				return null;
			}
		}
	}

	let profile_idc_iop_string;

	switch (profile_level_id.profile)
	{
		case ProfileConstrainedBaseline:
		{
			profile_idc_iop_string = '42e0';
			break;
		}
		case ProfileBaseline:
		{
			profile_idc_iop_string = '4200';
			break;
		}
		case ProfileMain:
		{
			profile_idc_iop_string = '4d00';
			break;
		}
		case ProfileConstrainedHigh:
		{
			profile_idc_iop_string = '640c';
			break;
		}
		case ProfileHigh:
		{
			profile_idc_iop_string = '6400';
			break;
		}
		default:
		{
			debug(
				'profileLevelIdToString() | unrecognized profile:%s',
				profile_level_id.profile);

			return null;
		}
	}

	let levelStr = (profile_level_id.level).toString(16);

	if (levelStr.length === 1)
		levelStr = `0${levelStr}`;

	return `${profile_idc_iop_string}${levelStr}`;
};

/**
 * Parse profile level id that is represented as a string of 3 hex bytes
 * contained in an SDP key-value map. A default profile level id will be
 * returned if the profile-level-id key is missing. Nothing will be returned if
 * the key is present but the string is invalid.
 *
 * @param {Object} [params={}] - Codec parameters object.
 *
 * @returns {ProfileLevelId}
 */
exports.parseSdpProfileLevelId = function(params = {})
{
	const profile_level_id = params['profile-level-id'];

	return !profile_level_id
		? DefaultProfileLevelId
		: exports.parseProfileLevelId(profile_level_id);
};

/**
 * Returns true if the parameters have the same H264 profile, i.e. the same
 * H264 profile (Baseline, High, etc).
 *
 * @param {Object} [params1={}] - Codec parameters object.
 * @param {Object} [params2={}] - Codec parameters object.
 *
 * @returns {Boolean}
 */
exports.isSameProfile = function(params1 = {}, params2 = {})
{
	const profile_level_id_1 = exports.parseSdpProfileLevelId(params1);
	const profile_level_id_2 = exports.parseSdpProfileLevelId(params2);

	// Compare H264 profiles, but not levels.
	return Boolean(
		profile_level_id_1 &&
		profile_level_id_2 &&
		profile_level_id_1.profile === profile_level_id_2.profile
	);
};

/**
 * Generate codec parameters that will be used as answer in an SDP negotiation
 * based on local supported parameters and remote offered parameters. Both
 * local_supported_params and remote_offered_params represent sendrecv media
 * descriptions, i.e they are a mix of both encode and decode capabilities. In
 * theory, when the profile in local_supported_params represent a strict superset
 * of the profile in remote_offered_params, we could limit the profile in the
 * answer to the profile in remote_offered_params.
 *
 * However, to simplify the code, each supported H264 profile should be listed
 * explicitly in the list of local supported codecs, even if they are redundant.
 * Then each local codec in the list should be tested one at a time against the
 * remote codec, and only when the profiles are equal should this function be
 * called. Therefore, this function does not need to handle profile intersection,
 * and the profile of local_supported_params and remote_offered_params must be
 * equal before calling this function. The parameters that are used when
 * negotiating are the level part of profile-level-id and level-asymmetry-allowed.
 *
 * @param {Object} [local_supported_params={}]
 * @param {Object} [remote_offered_params={}]
 *
 * @returns {String} Canonical string representation as three hex bytes of the
 *   profile level id, or null if no one of the params have profile-level-id.
 *
 * @throws {TypeError} If Profile mismatch or invalid params.
 */
exports.generateProfileLevelIdForAnswer = function(
	local_supported_params = {},
	remote_offered_params = {}
)
{
	// If both local and remote params do not contain profile-level-id, they are
	// both using the default profile. In this case, don't return anything.
	if (
		!local_supported_params['profile-level-id'] &&
		!remote_offered_params['profile-level-id']
	)
	{
		debug(
			'generateProfileLevelIdForAnswer() | no profile-level-id in local and remote params');

		return null;
	}

	// Parse profile-level-ids.
	const local_profile_level_id =
		exports.parseSdpProfileLevelId(local_supported_params);
	const remote_profile_level_id =
		exports.parseSdpProfileLevelId(remote_offered_params);

	// The local and remote codec must have valid and equal H264 Profiles.
	if (!local_profile_level_id)
		throw new TypeError('invalid local_profile_level_id');

	if (!remote_profile_level_id)
		throw new TypeError('invalid remote_profile_level_id');

	if (local_profile_level_id.profile !== remote_profile_level_id.profile)
		throw new TypeError('H264 Profile mismatch');

	// Parse level information.
	const level_asymmetry_allowed = (
		isLevelAsymmetryAllowed(local_supported_params) &&
		isLevelAsymmetryAllowed(remote_offered_params)
	);

	const local_level = local_profile_level_id.level;
	const remote_level = remote_profile_level_id.level;
	const min_level = minLevel(local_level, remote_level);

	// Determine answer level. When level asymmetry is not allowed, level upgrade
	// is not allowed, i.e., the level in the answer must be equal to or lower
	// than the level in the offer.
	const answer_level = level_asymmetry_allowed ? local_level : min_level;

	debug(
		'generateProfileLevelIdForAnswer() | result: [profile:%s, level:%s]',
		local_profile_level_id.profile, answer_level);

	// Return the resulting profile-level-id for the answer parameters.
	return exports.profileLevelIdToString(
		new ProfileLevelId(local_profile_level_id.profile, answer_level));
};

// Convert a string of 8 characters into a byte where the positions containing
// character c will have their bit set. For example, c = 'x', str = "x1xx0000"
// will return 0b10110000.
function byteMaskString(c, str)
{
	return (
		((str[0] === c) << 7) | ((str[1] === c) << 6) | ((str[2] === c) << 5) |
		((str[3] === c) << 4)	| ((str[4] === c) << 3)	| ((str[5] === c) << 2)	|
		((str[6] === c) << 1)	| ((str[7] === c) << 0)
	);
}

// Compare H264 levels and handle the level 1b case.
function isLessLevel(a, b)
{
	if (a === Level1_b)
		return b !== Level1 && b !== Level1_b;

	if (b === Level1_b)
		return a !== Level1;

	return a < b;
}

function minLevel(a, b)
{
	return isLessLevel(a, b) ? a : b;
}

function isLevelAsymmetryAllowed(params = {})
{
	const level_asymmetry_allowed = params['level-asymmetry-allowed'];

	return (
		level_asymmetry_allowed === 1 ||
		level_asymmetry_allowed === '1'
	);
}


/***/ }),
/* 307 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
Object.defineProperty(exports, "__esModule", { value: true });
class AwaitQueue {
    constructor({ ClosedErrorClass = Error, StoppedErrorClass = Error } = {
        ClosedErrorClass: Error,
        StoppedErrorClass: Error
    }) {
        // Closed flag.
        this.closed = false;
        // Queue of pending tasks.
        this.pendingTasks = [];
        // Error class used when rejecting a task due to AwaitQueue being closed.
        this.ClosedErrorClass = Error;
        // Error class used when rejecting a task due to AwaitQueue being stopped.
        this.StoppedErrorClass = Error;
        this.ClosedErrorClass = ClosedErrorClass;
        this.StoppedErrorClass = StoppedErrorClass;
    }
    /**
     * The number of ongoing enqueued tasks.
     */
    get size() {
        return this.pendingTasks.length;
    }
    /**
     * Closes the AwaitQueue. Pending tasks will be rejected with ClosedErrorClass
     * error.
     */
    close() {
        if (this.closed)
            return;
        this.closed = true;
        for (const pendingTask of this.pendingTasks) {
            pendingTask.stopped = true;
            pendingTask.reject(new this.ClosedErrorClass('AwaitQueue closed'));
        }
        // Enpty the pending tasks array.
        this.pendingTasks.length = 0;
    }
    /**
     * Accepts a task as argument (and an optional task name) and enqueues it after
     * pending tasks. Once processed, the push() method resolves (or rejects) with
     * the result returned by the given task.
     *
     * The given task must return a Promise or directly a value.
     */
    push(task, name) {
        return __awaiter(this, void 0, void 0, function* () {
            if (this.closed)
                throw new this.ClosedErrorClass('AwaitQueue closed');
            if (typeof task !== 'function')
                throw new TypeError('given task is not a function');
            if (!task.name && name) {
                try {
                    Object.defineProperty(task, 'name', { value: name });
                }
                catch (error) { }
            }
            return new Promise((resolve, reject) => {
                const pendingTask = {
                    task,
                    name,
                    resolve,
                    reject,
                    stopped: false,
                    enqueuedAt: new Date(),
                    executedAt: undefined
                };
                // Append task to the queue.
                this.pendingTasks.push(pendingTask);
                // And run it if this is the only task in the queue.
                if (this.pendingTasks.length === 1)
                    this.next();
            });
        });
    }
    /**
     * Make ongoing pending tasks reject with the given StoppedErrorClass error.
     * The AwaitQueue instance is still usable for future tasks added via push()
     * method.
     */
    stop() {
        if (this.closed)
            return;
        for (const pendingTask of this.pendingTasks) {
            pendingTask.stopped = true;
            pendingTask.reject(new this.StoppedErrorClass('AwaitQueue stopped'));
        }
        // Enpty the pending tasks array.
        this.pendingTasks.length = 0;
    }
    dump() {
        const now = new Date();
        return this.pendingTasks.map((pendingTask) => {
            return {
                task: pendingTask.task,
                name: pendingTask.name,
                enqueuedTime: pendingTask.executedAt
                    ? pendingTask.executedAt.getTime() - pendingTask.enqueuedAt.getTime()
                    : now.getTime() - pendingTask.enqueuedAt.getTime(),
                executingTime: pendingTask.executedAt
                    ? now.getTime() - pendingTask.executedAt.getTime()
                    : 0
            };
        });
    }
    next() {
        return __awaiter(this, void 0, void 0, function* () {
            // Take the first pending task.
            const pendingTask = this.pendingTasks[0];
            if (!pendingTask)
                return;
            // Execute it.
            yield this.executeTask(pendingTask);
            // Remove the first pending task (the completed one) from the queue.
            this.pendingTasks.shift();
            // And continue.
            this.next();
        });
    }
    executeTask(pendingTask) {
        return __awaiter(this, void 0, void 0, function* () {
            // If the task is stopped, ignore it.
            if (pendingTask.stopped)
                return;
            pendingTask.executedAt = new Date();
            try {
                const result = yield pendingTask.task();
                // If the task is stopped, ignore it.
                if (pendingTask.stopped)
                    return;
                // Resolve the task with the returned result (if any).
                pendingTask.resolve(result);
            }
            catch (error) {
                // If the task is stopped, ignore it.
                if (pendingTask.stopped)
                    return;
                // Reject the task with its own error.
                pendingTask.reject(error);
            }
        });
    }
}
exports.AwaitQueue = AwaitQueue;


/***/ }),
/* 308 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
const sdpTransform = __webpack_require__(17);
const Logger_1 = __webpack_require__(9);
const utils = __webpack_require__(10);
const ortc = __webpack_require__(14);
const sdpCommonUtils = __webpack_require__(19);
const sdpUnifiedPlanUtils = __webpack_require__(35);
const HandlerInterface_1 = __webpack_require__(18);
const RemoteSdp_1 = __webpack_require__(20);
const scalabilityModes_1 = __webpack_require__(43);
const logger = new Logger_1.Logger('Chrome74');
const SCTP_NUM_STREAMS = { OS: 1024, MIS: 1024 };
class Chrome74 extends HandlerInterface_1.HandlerInterface {
    constructor() {
        super();
        // Map of RTCTransceivers indexed by MID.
        this._mapMidTransceiver = new Map();
        // Local stream for sending.
        this._sendStream = new MediaStream();
        // Whether a DataChannel m=application section has been created.
        this._hasDataChannelMediaSection = false;
        // Sending DataChannel id value counter. Incremented for each new DataChannel.
        this._nextSendSctpStreamId = 0;
        // Got transport local and remote parameters.
        this._transportReady = false;
    }
    /**
     * Creates a factory function.
     */
    static createFactory() {
        return () => new Chrome74();
    }
    get name() {
        return 'Chrome74';
    }
    close() {
        logger.debug('close()');
        // Close RTCPeerConnection.
        if (this._pc) {
            try {
                this._pc.close();
            }
            catch (error) { }
        }
    }
    async getNativeRtpCapabilities() {
        logger.debug('getNativeRtpCapabilities()');
        const pc = new RTCPeerConnection({
            iceServers: [],
            iceTransportPolicy: 'all',
            bundlePolicy: 'max-bundle',
            rtcpMuxPolicy: 'require',
            sdpSemantics: 'unified-plan'
        });
        try {
            pc.addTransceiver('audio');
            pc.addTransceiver('video');
            const offer = await pc.createOffer();
            try {
                pc.close();
            }
            catch (error) { }
            const sdpObject = sdpTransform.parse(offer.sdp);
            const nativeRtpCapabilities = sdpCommonUtils.extractRtpCapabilities({ sdpObject });
            return nativeRtpCapabilities;
        }
        catch (error) {
            try {
                pc.close();
            }
            catch (error2) { }
            throw error;
        }
    }
    async getNativeSctpCapabilities() {
        logger.debug('getNativeSctpCapabilities()');
        return {
            numStreams: SCTP_NUM_STREAMS
        };
    }
    run({ direction, iceParameters, iceCandidates, dtlsParameters, sctpParameters, iceServers, iceTransportPolicy, additionalSettings, proprietaryConstraints, extendedRtpCapabilities }) {
        logger.debug('run()');
        this._direction = direction;
        this._remoteSdp = new RemoteSdp_1.RemoteSdp({
            iceParameters,
            iceCandidates,
            dtlsParameters,
            sctpParameters
        });
        this._sendingRtpParametersByKind =
            {
                audio: ortc.getSendingRtpParameters('audio', extendedRtpCapabilities),
                video: ortc.getSendingRtpParameters('video', extendedRtpCapabilities)
            };
        this._sendingRemoteRtpParametersByKind =
            {
                audio: ortc.getSendingRemoteRtpParameters('audio', extendedRtpCapabilities),
                video: ortc.getSendingRemoteRtpParameters('video', extendedRtpCapabilities)
            };
        this._pc = new RTCPeerConnection(Object.assign({ iceServers: iceServers || [], iceTransportPolicy: iceTransportPolicy || 'all', bundlePolicy: 'max-bundle', rtcpMuxPolicy: 'require', sdpSemantics: 'unified-plan' }, additionalSettings), proprietaryConstraints);
        // Handle RTCPeerConnection connection status.
        this._pc.addEventListener('iceconnectionstatechange', () => {
            switch (this._pc.iceConnectionState) {
                case 'checking':
                    this.emit('@connectionstatechange', 'connecting');
                    break;
                case 'connected':
                case 'completed':
                    this.emit('@connectionstatechange', 'connected');
                    break;
                case 'failed':
                    this.emit('@connectionstatechange', 'failed');
                    break;
                case 'disconnected':
                    this.emit('@connectionstatechange', 'disconnected');
                    break;
                case 'closed':
                    this.emit('@connectionstatechange', 'closed');
                    break;
            }
        });
    }
    async updateIceServers(iceServers) {
        logger.debug('updateIceServers()');
        const configuration = this._pc.getConfiguration();
        configuration.iceServers = iceServers;
        this._pc.setConfiguration(configuration);
    }
    async restartIce(iceParameters) {
        logger.debug('restartIce()');
        // Provide the remote SDP handler with new remote ICE parameters.
        this._remoteSdp.updateIceParameters(iceParameters);
        if (!this._transportReady)
            return;
        if (this._direction === 'send') {
            const offer = await this._pc.createOffer({ iceRestart: true });
            logger.debug('restartIce() | calling pc.setLocalDescription() [offer:%o]', offer);
            await this._pc.setLocalDescription(offer);
            const answer = { type: 'answer', sdp: this._remoteSdp.getSdp() };
            logger.debug('restartIce() | calling pc.setRemoteDescription() [answer:%o]', answer);
            await this._pc.setRemoteDescription(answer);
        }
        else {
            const offer = { type: 'offer', sdp: this._remoteSdp.getSdp() };
            logger.debug('restartIce() | calling pc.setRemoteDescription() [offer:%o]', offer);
            await this._pc.setRemoteDescription(offer);
            const answer = await this._pc.createAnswer();
            logger.debug('restartIce() | calling pc.setLocalDescription() [answer:%o]', answer);
            await this._pc.setLocalDescription(answer);
        }
    }
    async getTransportStats() {
        return this._pc.getStats();
    }
    async send({ track, encodings, codecOptions, codec }) {
        this._assertSendDirection();
        logger.debug('send() [kind:%s, track.id:%s]', track.kind, track.id);
        if (encodings && encodings.length > 1) {
            encodings.forEach((encoding, idx) => {
                encoding.rid = `r${idx}`;
            });
        }
        const sendingRtpParameters = utils.clone(this._sendingRtpParametersByKind[track.kind], {});
        // This may throw.
        sendingRtpParameters.codecs =
            ortc.reduceCodecs(sendingRtpParameters.codecs, codec);
        const sendingRemoteRtpParameters = utils.clone(this._sendingRemoteRtpParametersByKind[track.kind], {});
        // This may throw.
        sendingRemoteRtpParameters.codecs =
            ortc.reduceCodecs(sendingRemoteRtpParameters.codecs, codec);
        const mediaSectionIdx = this._remoteSdp.getNextMediaSectionIdx();
        const transceiver = this._pc.addTransceiver(track, {
            direction: 'sendonly',
            streams: [this._sendStream],
            sendEncodings: encodings
        });
        let offer = await this._pc.createOffer();
        let localSdpObject = sdpTransform.parse(offer.sdp);
        let offerMediaObject;
        if (!this._transportReady)
            await this._setupTransport({ localDtlsRole: 'server', localSdpObject });
        // Special case for VP9 with SVC.
        let hackVp9Svc = false;
        const layers = scalabilityModes_1.parse((encodings || [{}])[0].scalabilityMode);
        if (encodings &&
            encodings.length === 1 &&
            layers.spatialLayers > 1 &&
            sendingRtpParameters.codecs[0].mimeType.toLowerCase() === 'video/vp9') {
            logger.debug('send() | enabling legacy simulcast for VP9 SVC');
            hackVp9Svc = true;
            localSdpObject = sdpTransform.parse(offer.sdp);
            offerMediaObject = localSdpObject.media[mediaSectionIdx.idx];
            sdpUnifiedPlanUtils.addLegacySimulcast({
                offerMediaObject,
                numStreams: layers.spatialLayers
            });
            offer = { type: 'offer', sdp: sdpTransform.write(localSdpObject) };
        }
        logger.debug('send() | calling pc.setLocalDescription() [offer:%o]', offer);
        await this._pc.setLocalDescription(offer);
        // We can now get the transceiver.mid.
        const localId = transceiver.mid;
        // Set MID.
        sendingRtpParameters.mid = localId;
        localSdpObject = sdpTransform.parse(this._pc.localDescription.sdp);
        offerMediaObject = localSdpObject.media[mediaSectionIdx.idx];
        // Set RTCP CNAME.
        sendingRtpParameters.rtcp.cname =
            sdpCommonUtils.getCname({ offerMediaObject });
        // Set RTP encodings by parsing the SDP offer if no encodings are given.
        if (!encodings) {
            sendingRtpParameters.encodings =
                sdpUnifiedPlanUtils.getRtpEncodings({ offerMediaObject });
        }
        // Set RTP encodings by parsing the SDP offer and complete them with given
        // one if just a single encoding has been given.
        else if (encodings.length === 1) {
            let newEncodings = sdpUnifiedPlanUtils.getRtpEncodings({ offerMediaObject });
            Object.assign(newEncodings[0], encodings[0]);
            // Hack for VP9 SVC.
            if (hackVp9Svc)
                newEncodings = [newEncodings[0]];
            sendingRtpParameters.encodings = newEncodings;
        }
        // Otherwise if more than 1 encoding are given use them verbatim.
        else {
            sendingRtpParameters.encodings = encodings;
        }
        // If VP8 or H264 and there is effective simulcast, add scalabilityMode to
        // each encoding.
        if (sendingRtpParameters.encodings.length > 1 &&
            (sendingRtpParameters.codecs[0].mimeType.toLowerCase() === 'video/vp8' ||
                sendingRtpParameters.codecs[0].mimeType.toLowerCase() === 'video/h264')) {
            for (const encoding of sendingRtpParameters.encodings) {
                encoding.scalabilityMode = 'S1T3';
            }
        }
        this._remoteSdp.send({
            offerMediaObject,
            reuseMid: mediaSectionIdx.reuseMid,
            offerRtpParameters: sendingRtpParameters,
            answerRtpParameters: sendingRemoteRtpParameters,
            codecOptions,
            extmapAllowMixed: true
        });
        const answer = { type: 'answer', sdp: this._remoteSdp.getSdp() };
        logger.debug('send() | calling pc.setRemoteDescription() [answer:%o]', answer);
        await this._pc.setRemoteDescription(answer);
        // Store in the map.
        this._mapMidTransceiver.set(localId, transceiver);
        return {
            localId,
            rtpParameters: sendingRtpParameters,
            rtpSender: transceiver.sender
        };
    }
    async stopSending(localId) {
        this._assertSendDirection();
        logger.debug('stopSending() [localId:%s]', localId);
        const transceiver = this._mapMidTransceiver.get(localId);
        if (!transceiver)
            throw new Error('associated RTCRtpTransceiver not found');
        transceiver.sender.replaceTrack(null);
        this._pc.removeTrack(transceiver.sender);
        this._remoteSdp.closeMediaSection(transceiver.mid);
        const offer = await this._pc.createOffer();
        logger.debug('stopSending() | calling pc.setLocalDescription() [offer:%o]', offer);
        await this._pc.setLocalDescription(offer);
        const answer = { type: 'answer', sdp: this._remoteSdp.getSdp() };
        logger.debug('stopSending() | calling pc.setRemoteDescription() [answer:%o]', answer);
        await this._pc.setRemoteDescription(answer);
    }
    async replaceTrack(localId, track) {
        this._assertSendDirection();
        if (track) {
            logger.debug('replaceTrack() [localId:%s, track.id:%s]', localId, track.id);
        }
        else {
            logger.debug('replaceTrack() [localId:%s, no track]', localId);
        }
        const transceiver = this._mapMidTransceiver.get(localId);
        if (!transceiver)
            throw new Error('associated RTCRtpTransceiver not found');
        await transceiver.sender.replaceTrack(track);
    }
    async setMaxSpatialLayer(localId, spatialLayer) {
        this._assertSendDirection();
        logger.debug('setMaxSpatialLayer() [localId:%s, spatialLayer:%s]', localId, spatialLayer);
        const transceiver = this._mapMidTransceiver.get(localId);
        if (!transceiver)
            throw new Error('associated RTCRtpTransceiver not found');
        const parameters = transceiver.sender.getParameters();
        parameters.encodings.forEach((encoding, idx) => {
            if (idx <= spatialLayer)
                encoding.active = true;
            else
                encoding.active = false;
        });
        await transceiver.sender.setParameters(parameters);
    }
    async setRtpEncodingParameters(localId, params) {
        this._assertSendDirection();
        logger.debug('setRtpEncodingParameters() [localId:%s, params:%o]', localId, params);
        const transceiver = this._mapMidTransceiver.get(localId);
        if (!transceiver)
            throw new Error('associated RTCRtpTransceiver not found');
        const parameters = transceiver.sender.getParameters();
        parameters.encodings.forEach((encoding, idx) => {
            parameters.encodings[idx] = Object.assign(Object.assign({}, encoding), params);
        });
        await transceiver.sender.setParameters(parameters);
    }
    async getSenderStats(localId) {
        this._assertSendDirection();
        const transceiver = this._mapMidTransceiver.get(localId);
        if (!transceiver)
            throw new Error('associated RTCRtpTransceiver not found');
        return transceiver.sender.getStats();
    }
    async sendDataChannel({ ordered, maxPacketLifeTime, maxRetransmits, label, protocol, priority }) {
        this._assertSendDirection();
        const options = {
            negotiated: true,
            id: this._nextSendSctpStreamId,
            ordered,
            maxPacketLifeTime,
            maxRetransmits,
            protocol,
            priority
        };
        logger.debug('sendDataChannel() [options:%o]', options);
        const dataChannel = this._pc.createDataChannel(label, options);
        // Increase next id.
        this._nextSendSctpStreamId =
            ++this._nextSendSctpStreamId % SCTP_NUM_STREAMS.MIS;
        // If this is the first DataChannel we need to create the SDP answer with
        // m=application section.
        if (!this._hasDataChannelMediaSection) {
            const offer = await this._pc.createOffer();
            const localSdpObject = sdpTransform.parse(offer.sdp);
            const offerMediaObject = localSdpObject.media
                .find((m) => m.type === 'application');
            if (!this._transportReady)
                await this._setupTransport({ localDtlsRole: 'server', localSdpObject });
            logger.debug('sendDataChannel() | calling pc.setLocalDescription() [offer:%o]', offer);
            await this._pc.setLocalDescription(offer);
            this._remoteSdp.sendSctpAssociation({ offerMediaObject });
            const answer = { type: 'answer', sdp: this._remoteSdp.getSdp() };
            logger.debug('sendDataChannel() | calling pc.setRemoteDescription() [answer:%o]', answer);
            await this._pc.setRemoteDescription(answer);
            this._hasDataChannelMediaSection = true;
        }
        const sctpStreamParameters = {
            streamId: options.id,
            ordered: options.ordered,
            maxPacketLifeTime: options.maxPacketLifeTime,
            maxRetransmits: options.maxRetransmits
        };
        return { dataChannel, sctpStreamParameters };
    }
    async receive({ trackId, kind, rtpParameters }) {
        this._assertRecvDirection();
        logger.debug('receive() [trackId:%s, kind:%s]', trackId, kind);
        const localId = rtpParameters.mid || String(this._mapMidTransceiver.size);
        this._remoteSdp.receive({
            mid: localId,
            kind,
            offerRtpParameters: rtpParameters,
            streamId: rtpParameters.rtcp.cname,
            trackId
        });
        const offer = { type: 'offer', sdp: this._remoteSdp.getSdp() };
        logger.debug('receive() | calling pc.setRemoteDescription() [offer:%o]', offer);
        await this._pc.setRemoteDescription(offer);
        let answer = await this._pc.createAnswer();
        const localSdpObject = sdpTransform.parse(answer.sdp);
        const answerMediaObject = localSdpObject.media
            .find((m) => String(m.mid) === localId);
        // May need to modify codec parameters in the answer based on codec
        // parameters in the offer.
        sdpCommonUtils.applyCodecParameters({
            offerRtpParameters: rtpParameters,
            answerMediaObject
        });
        answer = { type: 'answer', sdp: sdpTransform.write(localSdpObject) };
        if (!this._transportReady)
            await this._setupTransport({ localDtlsRole: 'client', localSdpObject });
        logger.debug('receive() | calling pc.setLocalDescription() [answer:%o]', answer);
        await this._pc.setLocalDescription(answer);
        const transceiver = this._pc.getTransceivers()
            .find((t) => t.mid === localId);
        if (!transceiver)
            throw new Error('new RTCRtpTransceiver not found');
        // Store in the map.
        this._mapMidTransceiver.set(localId, transceiver);
        return {
            localId,
            track: transceiver.receiver.track,
            rtpReceiver: transceiver.receiver
        };
    }
    async stopReceiving(localId) {
        this._assertRecvDirection();
        logger.debug('stopReceiving() [localId:%s]', localId);
        const transceiver = this._mapMidTransceiver.get(localId);
        if (!transceiver)
            throw new Error('associated RTCRtpTransceiver not found');
        this._remoteSdp.closeMediaSection(transceiver.mid);
        const offer = { type: 'offer', sdp: this._remoteSdp.getSdp() };
        logger.debug('stopReceiving() | calling pc.setRemoteDescription() [offer:%o]', offer);
        await this._pc.setRemoteDescription(offer);
        const answer = await this._pc.createAnswer();
        logger.debug('stopReceiving() | calling pc.setLocalDescription() [answer:%o]', answer);
        await this._pc.setLocalDescription(answer);
    }
    async getReceiverStats(localId) {
        this._assertRecvDirection();
        const transceiver = this._mapMidTransceiver.get(localId);
        if (!transceiver)
            throw new Error('associated RTCRtpTransceiver not found');
        return transceiver.receiver.getStats();
    }
    async receiveDataChannel({ sctpStreamParameters, label, protocol }) {
        this._assertRecvDirection();
        const { streamId, ordered, maxPacketLifeTime, maxRetransmits } = sctpStreamParameters;
        const options = {
            negotiated: true,
            id: streamId,
            ordered,
            maxPacketLifeTime,
            maxRetransmits,
            protocol
        };
        logger.debug('receiveDataChannel() [options:%o]', options);
        const dataChannel = this._pc.createDataChannel(label, options);
        // If this is the first DataChannel we need to create the SDP offer with
        // m=application section.
        if (!this._hasDataChannelMediaSection) {
            this._remoteSdp.receiveSctpAssociation();
            const offer = { type: 'offer', sdp: this._remoteSdp.getSdp() };
            logger.debug('receiveDataChannel() | calling pc.setRemoteDescription() [offer:%o]', offer);
            await this._pc.setRemoteDescription(offer);
            const answer = await this._pc.createAnswer();
            if (!this._transportReady) {
                const localSdpObject = sdpTransform.parse(answer.sdp);
                await this._setupTransport({ localDtlsRole: 'client', localSdpObject });
            }
            logger.debug('receiveDataChannel() | calling pc.setRemoteDescription() [answer:%o]', answer);
            await this._pc.setLocalDescription(answer);
            this._hasDataChannelMediaSection = true;
        }
        return { dataChannel };
    }
    async _setupTransport({ localDtlsRole, localSdpObject }) {
        if (!localSdpObject)
            localSdpObject = sdpTransform.parse(this._pc.localDescription.sdp);
        // Get our local DTLS parameters.
        const dtlsParameters = sdpCommonUtils.extractDtlsParameters({ sdpObject: localSdpObject });
        // Set our DTLS role.
        dtlsParameters.role = localDtlsRole;
        // Update the remote DTLS role in the SDP.
        this._remoteSdp.updateDtlsRole(localDtlsRole === 'client' ? 'server' : 'client');
        // Need to tell the remote transport about our parameters.
        await this.safeEmitAsPromise('@connect', { dtlsParameters });
        this._transportReady = true;
    }
    _assertSendDirection() {
        if (this._direction !== 'send') {
            throw new Error('method can just be called for handlers with "send" direction');
        }
    }
    _assertRecvDirection() {
        if (this._direction !== 'recv') {
            throw new Error('method can just be called for handlers with "recv" direction');
        }
    }
}
exports.Chrome74 = Chrome74;


/***/ }),
/* 309 */
/***/ (function(module, exports, __webpack_require__) {

var toIntIfInt = function (v) {
  return String(Number(v)) === v ? Number(v) : v;
};

var attachProperties = function (match, location, names, rawName) {
  if (rawName && !names) {
    location[rawName] = toIntIfInt(match[1]);
  }
  else {
    for (var i = 0; i < names.length; i += 1) {
      if (match[i+1] != null) {
        location[names[i]] = toIntIfInt(match[i+1]);
      }
    }
  }
};

var parseReg = function (obj, location, content) {
  var needsBlank = obj.name && obj.names;
  if (obj.push && !location[obj.push]) {
    location[obj.push] = [];
  }
  else if (needsBlank && !location[obj.name]) {
    location[obj.name] = {};
  }
  var keyLocation = obj.push ?
    {} :  // blank object that will be pushed
    needsBlank ? location[obj.name] : location; // otherwise, named location or root

  attachProperties(content.match(obj.reg), keyLocation, obj.names, obj.name);

  if (obj.push) {
    location[obj.push].push(keyLocation);
  }
};

var grammar = __webpack_require__(73);
var validLine = RegExp.prototype.test.bind(/^([a-z])=(.*)/);

exports.parse = function (sdp) {
  var session = {}
    , media = []
    , location = session; // points at where properties go under (one of the above)

  // parse lines we understand
  sdp.split(/(\r\n|\r|\n)/).filter(validLine).forEach(function (l) {
    var type = l[0];
    var content = l.slice(2);
    if (type === 'm') {
      media.push({rtp: [], fmtp: []});
      location = media[media.length-1]; // point at latest media line
    }

    for (var j = 0; j < (grammar[type] || []).length; j += 1) {
      var obj = grammar[type][j];
      if (obj.reg.test(content)) {
        return parseReg(obj, location, content);
      }
    }
  });

  session.media = media; // link it up
  return session;
};

var paramReducer = function (acc, expr) {
  var s = expr.split(/=(.+)/, 2);
  if (s.length === 2) {
    acc[s[0]] = toIntIfInt(s[1]);
  } else if (s.length === 1 && expr.length > 1) {
    acc[s[0]] = undefined;
  }
  return acc;
};

exports.parseParams = function (str) {
  return str.split(/;\s?/).reduce(paramReducer, {});
};

// For backward compatibility - alias will be removed in 3.0.0
exports.parseFmtpConfig = exports.parseParams;

exports.parsePayloads = function (str) {
  return str.toString().split(' ').map(Number);
};

exports.parseRemoteCandidates = function (str) {
  var candidates = [];
  var parts = str.split(' ').map(toIntIfInt);
  for (var i = 0; i < parts.length; i += 3) {
    candidates.push({
      component: parts[i],
      ip: parts[i + 1],
      port: parts[i + 2]
    });
  }
  return candidates;
};

exports.parseImageAttributes = function (str) {
  return str.split(' ').map(function (item) {
    return item.substring(1, item.length-1).split(',').reduce(paramReducer, {});
  });
};

exports.parseSimulcastStreamList = function (str) {
  return str.split(';').map(function (stream) {
    return stream.split(',').map(function (format) {
      var scid, paused = false;

      if (format[0] !== '~') {
        scid = toIntIfInt(format);
      } else {
        scid = toIntIfInt(format.substring(1, format.length));
        paused = true;
      }

      return {
        scid: scid,
        paused: paused
      };
    });
  });
};


/***/ }),
/* 310 */
/***/ (function(module, exports, __webpack_require__) {

var grammar = __webpack_require__(73);

// customized util.format - discards excess arguments and can void middle ones
var formatRegExp = /%[sdv%]/g;
var format = function (formatStr) {
  var i = 1;
  var args = arguments;
  var len = args.length;
  return formatStr.replace(formatRegExp, function (x) {
    if (i >= len) {
      return x; // missing argument
    }
    var arg = args[i];
    i += 1;
    switch (x) {
    case '%%':
      return '%';
    case '%s':
      return String(arg);
    case '%d':
      return Number(arg);
    case '%v':
      return '';
    }
  });
  // NB: we discard excess arguments - they are typically undefined from makeLine
};

var makeLine = function (type, obj, location) {
  var str = obj.format instanceof Function ?
    (obj.format(obj.push ? location : location[obj.name])) :
    obj.format;

  var args = [type + '=' + str];
  if (obj.names) {
    for (var i = 0; i < obj.names.length; i += 1) {
      var n = obj.names[i];
      if (obj.name) {
        args.push(location[obj.name][n]);
      }
      else { // for mLine and push attributes
        args.push(location[obj.names[i]]);
      }
    }
  }
  else {
    args.push(location[obj.name]);
  }
  return format.apply(null, args);
};

// RFC specified order
// TODO: extend this with all the rest
var defaultOuterOrder = [
  'v', 'o', 's', 'i',
  'u', 'e', 'p', 'c',
  'b', 't', 'r', 'z', 'a'
];
var defaultInnerOrder = ['i', 'c', 'b', 'a'];


module.exports = function (session, opts) {
  opts = opts || {};
  // ensure certain properties exist
  if (session.version == null) {
    session.version = 0; // 'v=0' must be there (only defined version atm)
  }
  if (session.name == null) {
    session.name = ' '; // 's= ' must be there if no meaningful name set
  }
  session.media.forEach(function (mLine) {
    if (mLine.payloads == null) {
      mLine.payloads = '';
    }
  });

  var outerOrder = opts.outerOrder || defaultOuterOrder;
  var innerOrder = opts.innerOrder || defaultInnerOrder;
  var sdp = [];

  // loop through outerOrder for matching properties on session
  outerOrder.forEach(function (type) {
    grammar[type].forEach(function (obj) {
      if (obj.name in session && session[obj.name] != null) {
        sdp.push(makeLine(type, obj, session));
      }
      else if (obj.push in session && session[obj.push] != null) {
        session[obj.push].forEach(function (el) {
          sdp.push(makeLine(type, obj, el));
        });
      }
    });
  });

  // then for each media line, follow the innerOrder
  session.media.forEach(function (mLine) {
    sdp.push(makeLine('m', grammar.m[0], mLine));

    innerOrder.forEach(function (type) {
      grammar[type].forEach(function (obj) {
        if (obj.name in mLine && mLine[obj.name] != null) {
          sdp.push(makeLine(type, obj, mLine));
        }
        else if (obj.push in mLine && mLine[obj.push] != null) {
          mLine[obj.push].forEach(function (el) {
            sdp.push(makeLine(type, obj, el));
          });
        }
      });
    });
  });

  return sdp.join('\r\n') + '\r\n';
};


/***/ }),
/* 311 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
const utils = __webpack_require__(10);
class MediaSection {
    constructor({ iceParameters, iceCandidates, dtlsParameters, planB = false }) {
        this._mediaObject = {};
        this._planB = planB;
        if (iceParameters) {
            this.setIceParameters(iceParameters);
        }
        if (iceCandidates) {
            this._mediaObject.candidates = [];
            for (const candidate of iceCandidates) {
                const candidateObject = {};
                // mediasoup does mandates rtcp-mux so candidates component is always
                // RTP (1).
                candidateObject.component = 1;
                candidateObject.foundation = candidate.foundation;
                candidateObject.ip = candidate.ip;
                candidateObject.port = candidate.port;
                candidateObject.priority = candidate.priority;
                candidateObject.transport = candidate.protocol;
                candidateObject.type = candidate.type;
                if (candidate.tcpType)
                    candidateObject.tcptype = candidate.tcpType;
                this._mediaObject.candidates.push(candidateObject);
            }
            this._mediaObject.endOfCandidates = 'end-of-candidates';
            this._mediaObject.iceOptions = 'renomination';
        }
        if (dtlsParameters) {
            this.setDtlsRole(dtlsParameters.role);
        }
    }
    get mid() {
        return String(this._mediaObject.mid);
    }
    get closed() {
        return this._mediaObject.port === 0;
    }
    getObject() {
        return this._mediaObject;
    }
    setIceParameters(iceParameters) {
        this._mediaObject.iceUfrag = iceParameters.usernameFragment;
        this._mediaObject.icePwd = iceParameters.password;
    }
    disable() {
        this._mediaObject.direction = 'inactive';
        delete this._mediaObject.ext;
        delete this._mediaObject.ssrcs;
        delete this._mediaObject.ssrcGroups;
        delete this._mediaObject.simulcast;
        delete this._mediaObject.simulcast_03;
        delete this._mediaObject.rids;
    }
    close() {
        this._mediaObject.direction = 'inactive';
        this._mediaObject.port = 0;
        delete this._mediaObject.ext;
        delete this._mediaObject.ssrcs;
        delete this._mediaObject.ssrcGroups;
        delete this._mediaObject.simulcast;
        delete this._mediaObject.simulcast_03;
        delete this._mediaObject.rids;
        delete this._mediaObject.extmapAllowMixed;
    }
}
exports.MediaSection = MediaSection;
class AnswerMediaSection extends MediaSection {
    constructor({ iceParameters, iceCandidates, dtlsParameters, sctpParameters, plainRtpParameters, planB = false, offerMediaObject, offerRtpParameters, answerRtpParameters, codecOptions, extmapAllowMixed = false }) {
        super({ iceParameters, iceCandidates, dtlsParameters, planB });
        this._mediaObject.mid = String(offerMediaObject.mid);
        this._mediaObject.type = offerMediaObject.type;
        this._mediaObject.protocol = offerMediaObject.protocol;
        if (!plainRtpParameters) {
            this._mediaObject.connection = { ip: '127.0.0.1', version: 4 };
            this._mediaObject.port = 7;
        }
        else {
            this._mediaObject.connection =
                {
                    ip: plainRtpParameters.ip,
                    version: plainRtpParameters.ipVersion
                };
            this._mediaObject.port = plainRtpParameters.port;
        }
        switch (offerMediaObject.type) {
            case 'audio':
            case 'video':
                {
                    this._mediaObject.direction = 'recvonly';
                    this._mediaObject.rtp = [];
                    this._mediaObject.rtcpFb = [];
                    this._mediaObject.fmtp = [];
                    for (const codec of answerRtpParameters.codecs) {
                        const rtp = {
                            payload: codec.payloadType,
                            codec: getCodecName(codec),
                            rate: codec.clockRate
                        };
                        if (codec.channels > 1)
                            rtp.encoding = codec.channels;
                        this._mediaObject.rtp.push(rtp);
                        const codecParameters = utils.clone(codec.parameters, {});
                        if (codecOptions) {
                            const { opusStereo, opusFec, opusDtx, opusMaxPlaybackRate, opusPtime, videoGoogleStartBitrate, videoGoogleMaxBitrate, videoGoogleMinBitrate } = codecOptions;
                            const offerCodec = offerRtpParameters.codecs
                                .find((c) => (c.payloadType === codec.payloadType));
                            switch (codec.mimeType.toLowerCase()) {
                                case 'audio/opus':
                                    {
                                        if (opusStereo !== undefined) {
                                            offerCodec.parameters['sprop-stereo'] = opusStereo ? 1 : 0;
                                            codecParameters.stereo = opusStereo ? 1 : 0;
                                        }
                                        if (opusFec !== undefined) {
                                            offerCodec.parameters.useinbandfec = opusFec ? 1 : 0;
                                            codecParameters.useinbandfec = opusFec ? 1 : 0;
                                        }
                                        if (opusDtx !== undefined) {
                                            offerCodec.parameters.usedtx = opusDtx ? 1 : 0;
                                            codecParameters.usedtx = opusDtx ? 1 : 0;
                                        }
                                        if (opusMaxPlaybackRate !== undefined) {
                                            codecParameters.maxplaybackrate = opusMaxPlaybackRate;
                                        }
                                        if (opusPtime !== undefined) {
                                            offerCodec.parameters.ptime = opusPtime;
                                            codecParameters.ptime = opusPtime;
                                        }
                                        break;
                                    }
                                case 'video/vp8':
                                case 'video/vp9':
                                case 'video/h264':
                                case 'video/h265':
                                    {
                                        if (videoGoogleStartBitrate !== undefined)
                                            codecParameters['x-google-start-bitrate'] = videoGoogleStartBitrate;
                                        if (videoGoogleMaxBitrate !== undefined)
                                            codecParameters['x-google-max-bitrate'] = videoGoogleMaxBitrate;
                                        if (videoGoogleMinBitrate !== undefined)
                                            codecParameters['x-google-min-bitrate'] = videoGoogleMinBitrate;
                                        break;
                                    }
                            }
                        }
                        const fmtp = {
                            payload: codec.payloadType,
                            config: ''
                        };
                        for (const key of Object.keys(codecParameters)) {
                            if (fmtp.config)
                                fmtp.config += ';';
                            fmtp.config += `${key}=${codecParameters[key]}`;
                        }
                        if (fmtp.config)
                            this._mediaObject.fmtp.push(fmtp);
                        for (const fb of codec.rtcpFeedback) {
                            this._mediaObject.rtcpFb.push({
                                payload: codec.payloadType,
                                type: fb.type,
                                subtype: fb.parameter
                            });
                        }
                    }
                    this._mediaObject.payloads = answerRtpParameters.codecs
                        .map((codec) => codec.payloadType)
                        .join(' ');
                    this._mediaObject.ext = [];
                    for (const ext of answerRtpParameters.headerExtensions) {
                        // Don't add a header extension if not present in the offer.
                        const found = (offerMediaObject.ext || [])
                            .some((localExt) => localExt.uri === ext.uri);
                        if (!found)
                            continue;
                        this._mediaObject.ext.push({
                            uri: ext.uri,
                            value: ext.id
                        });
                    }
                    // Allow both 1 byte and 2 bytes length header extensions.
                    if (extmapAllowMixed &&
                        offerMediaObject.extmapAllowMixed === 'extmap-allow-mixed') {
                        this._mediaObject.extmapAllowMixed = 'extmap-allow-mixed';
                    }
                    // Simulcast.
                    if (offerMediaObject.simulcast) {
                        this._mediaObject.simulcast =
                            {
                                dir1: 'recv',
                                list1: offerMediaObject.simulcast.list1
                            };
                        this._mediaObject.rids = [];
                        for (const rid of offerMediaObject.rids || []) {
                            if (rid.direction !== 'send')
                                continue;
                            this._mediaObject.rids.push({
                                id: rid.id,
                                direction: 'recv'
                            });
                        }
                    }
                    // Simulcast (draft version 03).
                    else if (offerMediaObject.simulcast_03) {
                        // eslint-disable-next-line camelcase
                        this._mediaObject.simulcast_03 =
                            {
                                value: offerMediaObject.simulcast_03.value.replace(/send/g, 'recv')
                            };
                        this._mediaObject.rids = [];
                        for (const rid of offerMediaObject.rids || []) {
                            if (rid.direction !== 'send')
                                continue;
                            this._mediaObject.rids.push({
                                id: rid.id,
                                direction: 'recv'
                            });
                        }
                    }
                    this._mediaObject.rtcpMux = 'rtcp-mux';
                    this._mediaObject.rtcpRsize = 'rtcp-rsize';
                    if (this._planB && this._mediaObject.type === 'video')
                        this._mediaObject.xGoogleFlag = 'conference';
                    break;
                }
            case 'application':
                {
                    // New spec.
                    if (typeof offerMediaObject.sctpPort === 'number') {
                        this._mediaObject.payloads = 'webrtc-datachannel';
                        this._mediaObject.sctpPort = sctpParameters.port;
                        this._mediaObject.maxMessageSize = sctpParameters.maxMessageSize;
                    }
                    // Old spec.
                    else if (offerMediaObject.sctpmap) {
                        this._mediaObject.payloads = sctpParameters.port;
                        this._mediaObject.sctpmap =
                            {
                                app: 'webrtc-datachannel',
                                sctpmapNumber: sctpParameters.port,
                                maxMessageSize: sctpParameters.maxMessageSize
                            };
                    }
                    break;
                }
        }
    }
    setDtlsRole(role) {
        switch (role) {
            case 'client':
                this._mediaObject.setup = 'active';
                break;
            case 'server':
                this._mediaObject.setup = 'passive';
                break;
            case 'auto':
                this._mediaObject.setup = 'actpass';
                break;
        }
    }
}
exports.AnswerMediaSection = AnswerMediaSection;
class OfferMediaSection extends MediaSection {
    constructor({ iceParameters, iceCandidates, dtlsParameters, sctpParameters, plainRtpParameters, planB = false, mid, kind, offerRtpParameters, streamId, trackId, oldDataChannelSpec = false }) {
        super({ iceParameters, iceCandidates, dtlsParameters, planB });
        this._mediaObject.mid = String(mid);
        this._mediaObject.type = kind;
        if (!plainRtpParameters) {
            this._mediaObject.connection = { ip: '127.0.0.1', version: 4 };
            if (!sctpParameters)
                this._mediaObject.protocol = 'UDP/TLS/RTP/SAVPF';
            else
                this._mediaObject.protocol = 'UDP/DTLS/SCTP';
            this._mediaObject.port = 7;
        }
        else {
            this._mediaObject.connection =
                {
                    ip: plainRtpParameters.ip,
                    version: plainRtpParameters.ipVersion
                };
            this._mediaObject.protocol = 'RTP/AVP';
            this._mediaObject.port = plainRtpParameters.port;
        }
        switch (kind) {
            case 'audio':
            case 'video':
                {
                    this._mediaObject.direction = 'sendonly';
                    this._mediaObject.rtp = [];
                    this._mediaObject.rtcpFb = [];
                    this._mediaObject.fmtp = [];
                    if (!this._planB)
                        this._mediaObject.msid = `${streamId || '-'} ${trackId}`;
                    for (const codec of offerRtpParameters.codecs) {
                        const rtp = {
                            payload: codec.payloadType,
                            codec: getCodecName(codec),
                            rate: codec.clockRate
                        };
                        if (codec.channels > 1)
                            rtp.encoding = codec.channels;
                        this._mediaObject.rtp.push(rtp);
                        const fmtp = {
                            payload: codec.payloadType,
                            config: ''
                        };
                        for (const key of Object.keys(codec.parameters)) {
                            if (fmtp.config)
                                fmtp.config += ';';
                            fmtp.config += `${key}=${codec.parameters[key]}`;
                        }
                        if (fmtp.config)
                            this._mediaObject.fmtp.push(fmtp);
                        for (const fb of codec.rtcpFeedback) {
                            this._mediaObject.rtcpFb.push({
                                payload: codec.payloadType,
                                type: fb.type,
                                subtype: fb.parameter
                            });
                        }
                    }
                    this._mediaObject.payloads = offerRtpParameters.codecs
                        .map((codec) => codec.payloadType)
                        .join(' ');
                    this._mediaObject.ext = [];
                    for (const ext of offerRtpParameters.headerExtensions) {
                        this._mediaObject.ext.push({
                            uri: ext.uri,
                            value: ext.id
                        });
                    }
                    this._mediaObject.rtcpMux = 'rtcp-mux';
                    this._mediaObject.rtcpRsize = 'rtcp-rsize';
                    const encoding = offerRtpParameters.encodings[0];
                    const ssrc = encoding.ssrc;
                    const rtxSsrc = (encoding.rtx && encoding.rtx.ssrc)
                        ? encoding.rtx.ssrc
                        : undefined;
                    this._mediaObject.ssrcs = [];
                    this._mediaObject.ssrcGroups = [];
                    if (offerRtpParameters.rtcp.cname) {
                        this._mediaObject.ssrcs.push({
                            id: ssrc,
                            attribute: 'cname',
                            value: offerRtpParameters.rtcp.cname
                        });
                    }
                    if (this._planB) {
                        this._mediaObject.ssrcs.push({
                            id: ssrc,
                            attribute: 'msid',
                            value: `${streamId || '-'} ${trackId}`
                        });
                    }
                    if (rtxSsrc) {
                        if (offerRtpParameters.rtcp.cname) {
                            this._mediaObject.ssrcs.push({
                                id: rtxSsrc,
                                attribute: 'cname',
                                value: offerRtpParameters.rtcp.cname
                            });
                        }
                        if (this._planB) {
                            this._mediaObject.ssrcs.push({
                                id: rtxSsrc,
                                attribute: 'msid',
                                value: `${streamId || '-'} ${trackId}`
                            });
                        }
                        // Associate original and retransmission SSRCs.
                        this._mediaObject.ssrcGroups.push({
                            semantics: 'FID',
                            ssrcs: `${ssrc} ${rtxSsrc}`
                        });
                    }
                    break;
                }
            case 'application':
                {
                    // New spec.
                    if (!oldDataChannelSpec) {
                        this._mediaObject.payloads = 'webrtc-datachannel';
                        this._mediaObject.sctpPort = sctpParameters.port;
                        this._mediaObject.maxMessageSize = sctpParameters.maxMessageSize;
                    }
                    // Old spec.
                    else {
                        this._mediaObject.payloads = sctpParameters.port;
                        this._mediaObject.sctpmap =
                            {
                                app: 'webrtc-datachannel',
                                sctpmapNumber: sctpParameters.port,
                                maxMessageSize: sctpParameters.maxMessageSize
                            };
                    }
                    break;
                }
        }
    }
    // eslint-disable-next-line @typescript-eslint/no-unused-vars
    setDtlsRole(role) {
        // Always 'actpass'.
        this._mediaObject.setup = 'actpass';
    }
    planBReceive({ offerRtpParameters, streamId, trackId }) {
        const encoding = offerRtpParameters.encodings[0];
        const ssrc = encoding.ssrc;
        const rtxSsrc = (encoding.rtx && encoding.rtx.ssrc)
            ? encoding.rtx.ssrc
            : undefined;
        if (offerRtpParameters.rtcp.cname) {
            this._mediaObject.ssrcs.push({
                id: ssrc,
                attribute: 'cname',
                value: offerRtpParameters.rtcp.cname
            });
        }
        this._mediaObject.ssrcs.push({
            id: ssrc,
            attribute: 'msid',
            value: `${streamId || '-'} ${trackId}`
        });
        if (rtxSsrc) {
            if (offerRtpParameters.rtcp.cname) {
                this._mediaObject.ssrcs.push({
                    id: rtxSsrc,
                    attribute: 'cname',
                    value: offerRtpParameters.rtcp.cname
                });
            }
            this._mediaObject.ssrcs.push({
                id: rtxSsrc,
                attribute: 'msid',
                value: `${streamId || '-'} ${trackId}`
            });
            // Associate original and retransmission SSRCs.
            this._mediaObject.ssrcGroups.push({
                semantics: 'FID',
                ssrcs: `${ssrc} ${rtxSsrc}`
            });
        }
    }
    planBStopReceiving({ offerRtpParameters }) {
        const encoding = offerRtpParameters.encodings[0];
        const ssrc = encoding.ssrc;
        const rtxSsrc = (encoding.rtx && encoding.rtx.ssrc)
            ? encoding.rtx.ssrc
            : undefined;
        this._mediaObject.ssrcs = this._mediaObject.ssrcs
            .filter((s) => s.id !== ssrc && s.id !== rtxSsrc);
        if (rtxSsrc) {
            this._mediaObject.ssrcGroups = this._mediaObject.ssrcGroups
                .filter((group) => group.ssrcs !== `${ssrc} ${rtxSsrc}`);
        }
    }
}
exports.OfferMediaSection = OfferMediaSection;
function getCodecName(codec) {
    const MimeTypeRegex = new RegExp('^(audio|video)/(.+)', 'i');
    const mimeTypeMatch = MimeTypeRegex.exec(codec.mimeType);
    if (!mimeTypeMatch)
        throw new TypeError('invalid codec.mimeType');
    return mimeTypeMatch[2];
}


/***/ }),
/* 312 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
const sdpTransform = __webpack_require__(17);
const Logger_1 = __webpack_require__(9);
const utils = __webpack_require__(10);
const ortc = __webpack_require__(14);
const sdpCommonUtils = __webpack_require__(19);
const sdpUnifiedPlanUtils = __webpack_require__(35);
const HandlerInterface_1 = __webpack_require__(18);
const RemoteSdp_1 = __webpack_require__(20);
const scalabilityModes_1 = __webpack_require__(43);
const logger = new Logger_1.Logger('Chrome70');
const SCTP_NUM_STREAMS = { OS: 1024, MIS: 1024 };
class Chrome70 extends HandlerInterface_1.HandlerInterface {
    constructor() {
        super();
        // Map of RTCTransceivers indexed by MID.
        this._mapMidTransceiver = new Map();
        // Local stream for sending.
        this._sendStream = new MediaStream();
        // Whether a DataChannel m=application section has been created.
        this._hasDataChannelMediaSection = false;
        // Sending DataChannel id value counter. Incremented for each new DataChannel.
        this._nextSendSctpStreamId = 0;
        // Got transport local and remote parameters.
        this._transportReady = false;
    }
    /**
     * Creates a factory function.
     */
    static createFactory() {
        return () => new Chrome70();
    }
    get name() {
        return 'Chrome70';
    }
    close() {
        logger.debug('close()');
        // Close RTCPeerConnection.
        if (this._pc) {
            try {
                this._pc.close();
            }
            catch (error) { }
        }
    }
    async getNativeRtpCapabilities() {
        logger.debug('getNativeRtpCapabilities()');
        const pc = new RTCPeerConnection({
            iceServers: [],
            iceTransportPolicy: 'all',
            bundlePolicy: 'max-bundle',
            rtcpMuxPolicy: 'require',
            sdpSemantics: 'unified-plan'
        });
        try {
            pc.addTransceiver('audio');
            pc.addTransceiver('video');
            const offer = await pc.createOffer();
            try {
                pc.close();
            }
            catch (error) { }
            const sdpObject = sdpTransform.parse(offer.sdp);
            const nativeRtpCapabilities = sdpCommonUtils.extractRtpCapabilities({ sdpObject });
            return nativeRtpCapabilities;
        }
        catch (error) {
            try {
                pc.close();
            }
            catch (error2) { }
            throw error;
        }
    }
    async getNativeSctpCapabilities() {
        logger.debug('getNativeSctpCapabilities()');
        return {
            numStreams: SCTP_NUM_STREAMS
        };
    }
    run({ direction, iceParameters, iceCandidates, dtlsParameters, sctpParameters, iceServers, iceTransportPolicy, additionalSettings, proprietaryConstraints, extendedRtpCapabilities }) {
        logger.debug('run()');
        this._direction = direction;
        this._remoteSdp = new RemoteSdp_1.RemoteSdp({
            iceParameters,
            iceCandidates,
            dtlsParameters,
            sctpParameters
        });
        this._sendingRtpParametersByKind =
            {
                audio: ortc.getSendingRtpParameters('audio', extendedRtpCapabilities),
                video: ortc.getSendingRtpParameters('video', extendedRtpCapabilities)
            };
        this._sendingRemoteRtpParametersByKind =
            {
                audio: ortc.getSendingRemoteRtpParameters('audio', extendedRtpCapabilities),
                video: ortc.getSendingRemoteRtpParameters('video', extendedRtpCapabilities)
            };
        this._pc = new RTCPeerConnection(Object.assign({ iceServers: iceServers || [], iceTransportPolicy: iceTransportPolicy || 'all', bundlePolicy: 'max-bundle', rtcpMuxPolicy: 'require', sdpSemantics: 'unified-plan' }, additionalSettings), proprietaryConstraints);
        // Handle RTCPeerConnection connection status.
        this._pc.addEventListener('iceconnectionstatechange', () => {
            switch (this._pc.iceConnectionState) {
                case 'checking':
                    this.emit('@connectionstatechange', 'connecting');
                    break;
                case 'connected':
                case 'completed':
                    this.emit('@connectionstatechange', 'connected');
                    break;
                case 'failed':
                    this.emit('@connectionstatechange', 'failed');
                    break;
                case 'disconnected':
                    this.emit('@connectionstatechange', 'disconnected');
                    break;
                case 'closed':
                    this.emit('@connectionstatechange', 'closed');
                    break;
            }
        });
    }
    async updateIceServers(iceServers) {
        logger.debug('updateIceServers()');
        const configuration = this._pc.getConfiguration();
        configuration.iceServers = iceServers;
        this._pc.setConfiguration(configuration);
    }
    async restartIce(iceParameters) {
        logger.debug('restartIce()');
        // Provide the remote SDP handler with new remote ICE parameters.
        this._remoteSdp.updateIceParameters(iceParameters);
        if (!this._transportReady)
            return;
        if (this._direction === 'send') {
            const offer = await this._pc.createOffer({ iceRestart: true });
            logger.debug('restartIce() | calling pc.setLocalDescription() [offer:%o]', offer);
            await this._pc.setLocalDescription(offer);
            const answer = { type: 'answer', sdp: this._remoteSdp.getSdp() };
            logger.debug('restartIce() | calling pc.setRemoteDescription() [answer:%o]', answer);
            await this._pc.setRemoteDescription(answer);
        }
        else {
            const offer = { type: 'offer', sdp: this._remoteSdp.getSdp() };
            logger.debug('restartIce() | calling pc.setRemoteDescription() [offer:%o]', offer);
            await this._pc.setRemoteDescription(offer);
            const answer = await this._pc.createAnswer();
            logger.debug('restartIce() | calling pc.setLocalDescription() [answer:%o]', answer);
            await this._pc.setLocalDescription(answer);
        }
    }
    async getTransportStats() {
        return this._pc.getStats();
    }
    async send({ track, encodings, codecOptions, codec }) {
        this._assertSendDirection();
        logger.debug('send() [kind:%s, track.id:%s]', track.kind, track.id);
        const sendingRtpParameters = utils.clone(this._sendingRtpParametersByKind[track.kind], {});
        // This may throw.
        sendingRtpParameters.codecs =
            ortc.reduceCodecs(sendingRtpParameters.codecs, codec);
        const sendingRemoteRtpParameters = utils.clone(this._sendingRemoteRtpParametersByKind[track.kind], {});
        // This may throw.
        sendingRemoteRtpParameters.codecs =
            ortc.reduceCodecs(sendingRemoteRtpParameters.codecs, codec);
        const mediaSectionIdx = this._remoteSdp.getNextMediaSectionIdx();
        const transceiver = this._pc.addTransceiver(track, { direction: 'sendonly', streams: [this._sendStream] });
        let offer = await this._pc.createOffer();
        let localSdpObject = sdpTransform.parse(offer.sdp);
        let offerMediaObject;
        if (!this._transportReady)
            await this._setupTransport({ localDtlsRole: 'server', localSdpObject });
        if (encodings && encodings.length > 1) {
            logger.debug('send() | enabling legacy simulcast');
            localSdpObject = sdpTransform.parse(offer.sdp);
            offerMediaObject = localSdpObject.media[mediaSectionIdx.idx];
            sdpUnifiedPlanUtils.addLegacySimulcast({
                offerMediaObject,
                numStreams: encodings.length
            });
            offer = { type: 'offer', sdp: sdpTransform.write(localSdpObject) };
        }
        // Special case for VP9 with SVC.
        let hackVp9Svc = false;
        const layers = scalabilityModes_1.parse((encodings || [{}])[0].scalabilityMode);
        if (encodings &&
            encodings.length === 1 &&
            layers.spatialLayers > 1 &&
            sendingRtpParameters.codecs[0].mimeType.toLowerCase() === 'video/vp9') {
            logger.debug('send() | enabling legacy simulcast for VP9 SVC');
            hackVp9Svc = true;
            localSdpObject = sdpTransform.parse(offer.sdp);
            offerMediaObject = localSdpObject.media[mediaSectionIdx.idx];
            sdpUnifiedPlanUtils.addLegacySimulcast({
                offerMediaObject,
                numStreams: layers.spatialLayers
            });
            offer = { type: 'offer', sdp: sdpTransform.write(localSdpObject) };
        }
        logger.debug('send() | calling pc.setLocalDescription() [offer:%o]', offer);
        await this._pc.setLocalDescription(offer);
        // If encodings are given, apply them now.
        if (encodings) {
            logger.debug('send() | applying given encodings');
            const parameters = transceiver.sender.getParameters();
            for (let idx = 0; idx < (parameters.encodings || []).length; ++idx) {
                const encoding = parameters.encodings[idx];
                const desiredEncoding = encodings[idx];
                // Should not happen but just in case.
                if (!desiredEncoding)
                    break;
                parameters.encodings[idx] = Object.assign(encoding, desiredEncoding);
            }
            await transceiver.sender.setParameters(parameters);
        }
        // We can now get the transceiver.mid.
        const localId = transceiver.mid;
        // Set MID.
        sendingRtpParameters.mid = localId;
        localSdpObject = sdpTransform.parse(this._pc.localDescription.sdp);
        offerMediaObject = localSdpObject.media[mediaSectionIdx.idx];
        // Set RTCP CNAME.
        sendingRtpParameters.rtcp.cname =
            sdpCommonUtils.getCname({ offerMediaObject });
        // Set RTP encodings.
        sendingRtpParameters.encodings =
            sdpUnifiedPlanUtils.getRtpEncodings({ offerMediaObject });
        // Complete encodings with given values.
        if (encodings) {
            for (let idx = 0; idx < sendingRtpParameters.encodings.length; ++idx) {
                if (encodings[idx])
                    Object.assign(sendingRtpParameters.encodings[idx], encodings[idx]);
            }
        }
        // Hack for VP9 SVC.
        if (hackVp9Svc) {
            sendingRtpParameters.encodings = [sendingRtpParameters.encodings[0]];
        }
        // If VP8 or H264 and there is effective simulcast, add scalabilityMode to
        // each encoding.
        if (sendingRtpParameters.encodings.length > 1 &&
            (sendingRtpParameters.codecs[0].mimeType.toLowerCase() === 'video/vp8' ||
                sendingRtpParameters.codecs[0].mimeType.toLowerCase() === 'video/h264')) {
            for (const encoding of sendingRtpParameters.encodings) {
                encoding.scalabilityMode = 'S1T3';
            }
        }
        this._remoteSdp.send({
            offerMediaObject,
            reuseMid: mediaSectionIdx.reuseMid,
            offerRtpParameters: sendingRtpParameters,
            answerRtpParameters: sendingRemoteRtpParameters,
            codecOptions
        });
        const answer = { type: 'answer', sdp: this._remoteSdp.getSdp() };
        logger.debug('send() | calling pc.setRemoteDescription() [answer:%o]', answer);
        await this._pc.setRemoteDescription(answer);
        // Store in the map.
        this._mapMidTransceiver.set(localId, transceiver);
        return {
            localId,
            rtpParameters: sendingRtpParameters,
            rtpSender: transceiver.sender
        };
    }
    async stopSending(localId) {
        this._assertSendDirection();
        logger.debug('stopSending() [localId:%s]', localId);
        const transceiver = this._mapMidTransceiver.get(localId);
        if (!transceiver)
            throw new Error('associated RTCRtpTransceiver not found');
        transceiver.sender.replaceTrack(null);
        this._pc.removeTrack(transceiver.sender);
        this._remoteSdp.closeMediaSection(transceiver.mid);
        const offer = await this._pc.createOffer();
        logger.debug('stopSending() | calling pc.setLocalDescription() [offer:%o]', offer);
        await this._pc.setLocalDescription(offer);
        const answer = { type: 'answer', sdp: this._remoteSdp.getSdp() };
        logger.debug('stopSending() | calling pc.setRemoteDescription() [answer:%o]', answer);
        await this._pc.setRemoteDescription(answer);
    }
    async replaceTrack(localId, track) {
        this._assertSendDirection();
        if (track) {
            logger.debug('replaceTrack() [localId:%s, track.id:%s]', localId, track.id);
        }
        else {
            logger.debug('replaceTrack() [localId:%s, no track]', localId);
        }
        const transceiver = this._mapMidTransceiver.get(localId);
        if (!transceiver)
            throw new Error('associated RTCRtpTransceiver not found');
        await transceiver.sender.replaceTrack(track);
    }
    async setMaxSpatialLayer(localId, spatialLayer) {
        this._assertSendDirection();
        logger.debug('setMaxSpatialLayer() [localId:%s, spatialLayer:%s]', localId, spatialLayer);
        const transceiver = this._mapMidTransceiver.get(localId);
        if (!transceiver)
            throw new Error('associated RTCRtpTransceiver not found');
        const parameters = transceiver.sender.getParameters();
        parameters.encodings.forEach((encoding, idx) => {
            if (idx <= spatialLayer)
                encoding.active = true;
            else
                encoding.active = false;
        });
        await transceiver.sender.setParameters(parameters);
    }
    async setRtpEncodingParameters(localId, params) {
        this._assertSendDirection();
        logger.debug('setRtpEncodingParameters() [localId:%s, params:%o]', localId, params);
        const transceiver = this._mapMidTransceiver.get(localId);
        if (!transceiver)
            throw new Error('associated RTCRtpTransceiver not found');
        const parameters = transceiver.sender.getParameters();
        parameters.encodings.forEach((encoding, idx) => {
            parameters.encodings[idx] = Object.assign(Object.assign({}, encoding), params);
        });
        await transceiver.sender.setParameters(parameters);
    }
    async getSenderStats(localId) {
        this._assertSendDirection();
        const transceiver = this._mapMidTransceiver.get(localId);
        if (!transceiver)
            throw new Error('associated RTCRtpTransceiver not found');
        return transceiver.sender.getStats();
    }
    async sendDataChannel({ ordered, maxPacketLifeTime, maxRetransmits, label, protocol, priority }) {
        this._assertSendDirection();
        const options = {
            negotiated: true,
            id: this._nextSendSctpStreamId,
            ordered,
            maxPacketLifeTime,
            maxRetransmitTime: maxPacketLifeTime,
            maxRetransmits,
            protocol,
            priority
        };
        logger.debug('sendDataChannel() [options:%o]', options);
        const dataChannel = this._pc.createDataChannel(label, options);
        // Increase next id.
        this._nextSendSctpStreamId =
            ++this._nextSendSctpStreamId % SCTP_NUM_STREAMS.MIS;
        // If this is the first DataChannel we need to create the SDP answer with
        // m=application section.
        if (!this._hasDataChannelMediaSection) {
            const offer = await this._pc.createOffer();
            const localSdpObject = sdpTransform.parse(offer.sdp);
            const offerMediaObject = localSdpObject.media
                .find((m) => m.type === 'application');
            if (!this._transportReady)
                await this._setupTransport({ localDtlsRole: 'server', localSdpObject });
            logger.debug('sendDataChannel() | calling pc.setLocalDescription() [offer:%o]', offer);
            await this._pc.setLocalDescription(offer);
            this._remoteSdp.sendSctpAssociation({ offerMediaObject });
            const answer = { type: 'answer', sdp: this._remoteSdp.getSdp() };
            logger.debug('sendDataChannel() | calling pc.setRemoteDescription() [answer:%o]', answer);
            await this._pc.setRemoteDescription(answer);
            this._hasDataChannelMediaSection = true;
        }
        const sctpStreamParameters = {
            streamId: options.id,
            ordered: options.ordered,
            maxPacketLifeTime: options.maxPacketLifeTime,
            maxRetransmits: options.maxRetransmits
        };
        return { dataChannel, sctpStreamParameters };
    }
    async receive({ trackId, kind, rtpParameters }) {
        this._assertRecvDirection();
        logger.debug('receive() [trackId:%s, kind:%s]', trackId, kind);
        const localId = rtpParameters.mid || String(this._mapMidTransceiver.size);
        this._remoteSdp.receive({
            mid: localId,
            kind,
            offerRtpParameters: rtpParameters,
            streamId: rtpParameters.rtcp.cname,
            trackId
        });
        const offer = { type: 'offer', sdp: this._remoteSdp.getSdp() };
        logger.debug('receive() | calling pc.setRemoteDescription() [offer:%o]', offer);
        await this._pc.setRemoteDescription(offer);
        let answer = await this._pc.createAnswer();
        const localSdpObject = sdpTransform.parse(answer.sdp);
        const answerMediaObject = localSdpObject.media
            .find((m) => String(m.mid) === localId);
        // May need to modify codec parameters in the answer based on codec
        // parameters in the offer.
        sdpCommonUtils.applyCodecParameters({
            offerRtpParameters: rtpParameters,
            answerMediaObject
        });
        answer = { type: 'answer', sdp: sdpTransform.write(localSdpObject) };
        if (!this._transportReady)
            await this._setupTransport({ localDtlsRole: 'client', localSdpObject });
        logger.debug('receive() | calling pc.setLocalDescription() [answer:%o]', answer);
        await this._pc.setLocalDescription(answer);
        const transceiver = this._pc.getTransceivers()
            .find((t) => t.mid === localId);
        if (!transceiver)
            throw new Error('new RTCRtpTransceiver not found');
        // Store in the map.
        this._mapMidTransceiver.set(localId, transceiver);
        return {
            localId,
            track: transceiver.receiver.track,
            rtpReceiver: transceiver.receiver
        };
    }
    async stopReceiving(localId) {
        this._assertRecvDirection();
        logger.debug('stopReceiving() [localId:%s]', localId);
        const transceiver = this._mapMidTransceiver.get(localId);
        if (!transceiver)
            throw new Error('associated RTCRtpTransceiver not found');
        this._remoteSdp.closeMediaSection(transceiver.mid);
        const offer = { type: 'offer', sdp: this._remoteSdp.getSdp() };
        logger.debug('stopReceiving() | calling pc.setRemoteDescription() [offer:%o]', offer);
        await this._pc.setRemoteDescription(offer);
        const answer = await this._pc.createAnswer();
        logger.debug('stopReceiving() | calling pc.setLocalDescription() [answer:%o]', answer);
        await this._pc.setLocalDescription(answer);
    }
    async getReceiverStats(localId) {
        this._assertRecvDirection();
        const transceiver = this._mapMidTransceiver.get(localId);
        if (!transceiver)
            throw new Error('associated RTCRtpTransceiver not found');
        return transceiver.receiver.getStats();
    }
    async receiveDataChannel({ sctpStreamParameters, label, protocol }) {
        this._assertRecvDirection();
        const { streamId, ordered, maxPacketLifeTime, maxRetransmits } = sctpStreamParameters;
        const options = {
            negotiated: true,
            id: streamId,
            ordered,
            maxPacketLifeTime,
            maxRetransmitTime: maxPacketLifeTime,
            maxRetransmits,
            protocol
        };
        logger.debug('receiveDataChannel() [options:%o]', options);
        const dataChannel = this._pc.createDataChannel(label, options);
        // If this is the first DataChannel we need to create the SDP offer with
        // m=application section.
        if (!this._hasDataChannelMediaSection) {
            this._remoteSdp.receiveSctpAssociation();
            const offer = { type: 'offer', sdp: this._remoteSdp.getSdp() };
            logger.debug('receiveDataChannel() | calling pc.setRemoteDescription() [offer:%o]', offer);
            await this._pc.setRemoteDescription(offer);
            const answer = await this._pc.createAnswer();
            if (!this._transportReady) {
                const localSdpObject = sdpTransform.parse(answer.sdp);
                await this._setupTransport({ localDtlsRole: 'client', localSdpObject });
            }
            logger.debug('receiveDataChannel() | calling pc.setRemoteDescription() [answer:%o]', answer);
            await this._pc.setLocalDescription(answer);
            this._hasDataChannelMediaSection = true;
        }
        return { dataChannel };
    }
    async _setupTransport({ localDtlsRole, localSdpObject }) {
        if (!localSdpObject)
            localSdpObject = sdpTransform.parse(this._pc.localDescription.sdp);
        // Get our local DTLS parameters.
        const dtlsParameters = sdpCommonUtils.extractDtlsParameters({ sdpObject: localSdpObject });
        // Set our DTLS role.
        dtlsParameters.role = localDtlsRole;
        // Update the remote DTLS role in the SDP.
        this._remoteSdp.updateDtlsRole(localDtlsRole === 'client' ? 'server' : 'client');
        // Need to tell the remote transport about our parameters.
        await this.safeEmitAsPromise('@connect', { dtlsParameters });
        this._transportReady = true;
    }
    _assertSendDirection() {
        if (this._direction !== 'send') {
            throw new Error('method can just be called for handlers with "send" direction');
        }
    }
    _assertRecvDirection() {
        if (this._direction !== 'recv') {
            throw new Error('method can just be called for handlers with "recv" direction');
        }
    }
}
exports.Chrome70 = Chrome70;


/***/ }),
/* 313 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
const sdpTransform = __webpack_require__(17);
const Logger_1 = __webpack_require__(9);
const utils = __webpack_require__(10);
const ortc = __webpack_require__(14);
const sdpCommonUtils = __webpack_require__(19);
const sdpPlanBUtils = __webpack_require__(36);
const HandlerInterface_1 = __webpack_require__(18);
const RemoteSdp_1 = __webpack_require__(20);
const logger = new Logger_1.Logger('Chrome67');
const SCTP_NUM_STREAMS = { OS: 1024, MIS: 1024 };
class Chrome67 extends HandlerInterface_1.HandlerInterface {
    constructor() {
        super();
        // Local stream for sending.
        this._sendStream = new MediaStream();
        // Map of RTCRtpSender indexed by localId.
        this._mapSendLocalIdRtpSender = new Map();
        // Next sending localId.
        this._nextSendLocalId = 0;
        // Map of MID, RTP parameters and RTCRtpReceiver indexed by local id.
        // Value is an Object with mid, rtpParameters and rtpReceiver.
        this._mapRecvLocalIdInfo = new Map();
        // Whether a DataChannel m=application section has been created.
        this._hasDataChannelMediaSection = false;
        // Sending DataChannel id value counter. Incremented for each new DataChannel.
        this._nextSendSctpStreamId = 0;
        // Got transport local and remote parameters.
        this._transportReady = false;
    }
    /**
     * Creates a factory function.
     */
    static createFactory() {
        return () => new Chrome67();
    }
    get name() {
        return 'Chrome67';
    }
    close() {
        logger.debug('close()');
        // Close RTCPeerConnection.
        if (this._pc) {
            try {
                this._pc.close();
            }
            catch (error) { }
        }
    }
    async getNativeRtpCapabilities() {
        logger.debug('getNativeRtpCapabilities()');
        const pc = new RTCPeerConnection({
            iceServers: [],
            iceTransportPolicy: 'all',
            bundlePolicy: 'max-bundle',
            rtcpMuxPolicy: 'require',
            sdpSemantics: 'plan-b'
        });
        try {
            const offer = await pc.createOffer({
                offerToReceiveAudio: true,
                offerToReceiveVideo: true
            });
            try {
                pc.close();
            }
            catch (error) { }
            const sdpObject = sdpTransform.parse(offer.sdp);
            const nativeRtpCapabilities = sdpCommonUtils.extractRtpCapabilities({ sdpObject });
            return nativeRtpCapabilities;
        }
        catch (error) {
            try {
                pc.close();
            }
            catch (error2) { }
            throw error;
        }
    }
    async getNativeSctpCapabilities() {
        logger.debug('getNativeSctpCapabilities()');
        return {
            numStreams: SCTP_NUM_STREAMS
        };
    }
    run({ direction, iceParameters, iceCandidates, dtlsParameters, sctpParameters, iceServers, iceTransportPolicy, additionalSettings, proprietaryConstraints, extendedRtpCapabilities }) {
        logger.debug('run()');
        this._direction = direction;
        this._remoteSdp = new RemoteSdp_1.RemoteSdp({
            iceParameters,
            iceCandidates,
            dtlsParameters,
            sctpParameters,
            planB: true
        });
        this._sendingRtpParametersByKind =
            {
                audio: ortc.getSendingRtpParameters('audio', extendedRtpCapabilities),
                video: ortc.getSendingRtpParameters('video', extendedRtpCapabilities)
            };
        this._sendingRemoteRtpParametersByKind =
            {
                audio: ortc.getSendingRemoteRtpParameters('audio', extendedRtpCapabilities),
                video: ortc.getSendingRemoteRtpParameters('video', extendedRtpCapabilities)
            };
        this._pc = new RTCPeerConnection(Object.assign({ iceServers: iceServers || [], iceTransportPolicy: iceTransportPolicy || 'all', bundlePolicy: 'max-bundle', rtcpMuxPolicy: 'require', sdpSemantics: 'plan-b' }, additionalSettings), proprietaryConstraints);
        // Handle RTCPeerConnection connection status.
        this._pc.addEventListener('iceconnectionstatechange', () => {
            switch (this._pc.iceConnectionState) {
                case 'checking':
                    this.emit('@connectionstatechange', 'connecting');
                    break;
                case 'connected':
                case 'completed':
                    this.emit('@connectionstatechange', 'connected');
                    break;
                case 'failed':
                    this.emit('@connectionstatechange', 'failed');
                    break;
                case 'disconnected':
                    this.emit('@connectionstatechange', 'disconnected');
                    break;
                case 'closed':
                    this.emit('@connectionstatechange', 'closed');
                    break;
            }
        });
    }
    async updateIceServers(iceServers) {
        logger.debug('updateIceServers()');
        const configuration = this._pc.getConfiguration();
        configuration.iceServers = iceServers;
        this._pc.setConfiguration(configuration);
    }
    async restartIce(iceParameters) {
        logger.debug('restartIce()');
        // Provide the remote SDP handler with new remote ICE parameters.
        this._remoteSdp.updateIceParameters(iceParameters);
        if (!this._transportReady)
            return;
        if (this._direction === 'send') {
            const offer = await this._pc.createOffer({ iceRestart: true });
            logger.debug('restartIce() | calling pc.setLocalDescription() [offer:%o]', offer);
            await this._pc.setLocalDescription(offer);
            const answer = { type: 'answer', sdp: this._remoteSdp.getSdp() };
            logger.debug('restartIce() | calling pc.setRemoteDescription() [answer:%o]', answer);
            await this._pc.setRemoteDescription(answer);
        }
        else {
            const offer = { type: 'offer', sdp: this._remoteSdp.getSdp() };
            logger.debug('restartIce() | calling pc.setRemoteDescription() [offer:%o]', offer);
            await this._pc.setRemoteDescription(offer);
            const answer = await this._pc.createAnswer();
            logger.debug('restartIce() | calling pc.setLocalDescription() [answer:%o]', answer);
            await this._pc.setLocalDescription(answer);
        }
    }
    async getTransportStats() {
        return this._pc.getStats();
    }
    async send({ track, encodings, codecOptions, codec }) {
        this._assertSendDirection();
        logger.debug('send() [kind:%s, track.id:%s]', track.kind, track.id);
        if (codec) {
            logger.warn('send() | codec selection is not available in %s handler', this.name);
        }
        this._sendStream.addTrack(track);
        this._pc.addTrack(track, this._sendStream);
        let offer = await this._pc.createOffer();
        let localSdpObject = sdpTransform.parse(offer.sdp);
        let offerMediaObject;
        const sendingRtpParameters = utils.clone(this._sendingRtpParametersByKind[track.kind], {});
        sendingRtpParameters.codecs =
            ortc.reduceCodecs(sendingRtpParameters.codecs);
        const sendingRemoteRtpParameters = utils.clone(this._sendingRemoteRtpParametersByKind[track.kind], {});
        sendingRemoteRtpParameters.codecs =
            ortc.reduceCodecs(sendingRemoteRtpParameters.codecs);
        if (!this._transportReady)
            await this._setupTransport({ localDtlsRole: 'server', localSdpObject });
        if (track.kind === 'video' && encodings && encodings.length > 1) {
            logger.debug('send() | enabling simulcast');
            localSdpObject = sdpTransform.parse(offer.sdp);
            offerMediaObject = localSdpObject.media
                .find((m) => m.type === 'video');
            sdpPlanBUtils.addLegacySimulcast({
                offerMediaObject,
                track,
                numStreams: encodings.length
            });
            offer = { type: 'offer', sdp: sdpTransform.write(localSdpObject) };
        }
        logger.debug('send() | calling pc.setLocalDescription() [offer:%o]', offer);
        await this._pc.setLocalDescription(offer);
        localSdpObject = sdpTransform.parse(this._pc.localDescription.sdp);
        offerMediaObject = localSdpObject.media
            .find((m) => m.type === track.kind);
        // Set RTCP CNAME.
        sendingRtpParameters.rtcp.cname =
            sdpCommonUtils.getCname({ offerMediaObject });
        // Set RTP encodings.
        sendingRtpParameters.encodings =
            sdpPlanBUtils.getRtpEncodings({ offerMediaObject, track });
        // Complete encodings with given values.
        if (encodings) {
            for (let idx = 0; idx < sendingRtpParameters.encodings.length; ++idx) {
                if (encodings[idx])
                    Object.assign(sendingRtpParameters.encodings[idx], encodings[idx]);
            }
        }
        // If VP8 and there is effective simulcast, add scalabilityMode to each
        // encoding.
        if (sendingRtpParameters.encodings.length > 1 &&
            sendingRtpParameters.codecs[0].mimeType.toLowerCase() === 'video/vp8') {
            for (const encoding of sendingRtpParameters.encodings) {
                encoding.scalabilityMode = 'S1T3';
            }
        }
        this._remoteSdp.send({
            offerMediaObject,
            offerRtpParameters: sendingRtpParameters,
            answerRtpParameters: sendingRemoteRtpParameters,
            codecOptions
        });
        const answer = { type: 'answer', sdp: this._remoteSdp.getSdp() };
        logger.debug('send() | calling pc.setRemoteDescription() [answer:%o]', answer);
        await this._pc.setRemoteDescription(answer);
        const localId = String(this._nextSendLocalId);
        this._nextSendLocalId++;
        const rtpSender = this._pc.getSenders()
            .find((s) => s.track === track);
        // Insert into the map.
        this._mapSendLocalIdRtpSender.set(localId, rtpSender);
        return {
            localId: localId,
            rtpParameters: sendingRtpParameters,
            rtpSender
        };
    }
    async stopSending(localId) {
        this._assertSendDirection();
        logger.debug('stopSending() [localId:%s]', localId);
        const rtpSender = this._mapSendLocalIdRtpSender.get(localId);
        if (!rtpSender)
            throw new Error('associated RTCRtpSender not found');
        this._pc.removeTrack(rtpSender);
        if (rtpSender.track)
            this._sendStream.removeTrack(rtpSender.track);
        this._mapSendLocalIdRtpSender.delete(localId);
        const offer = await this._pc.createOffer();
        logger.debug('stopSending() | calling pc.setLocalDescription() [offer:%o]', offer);
        try {
            await this._pc.setLocalDescription(offer);
        }
        catch (error) {
            // NOTE: If there are no sending tracks, setLocalDescription() will fail with
            // "Failed to create channels". If so, ignore it.
            if (this._sendStream.getTracks().length === 0) {
                logger.warn('stopSending() | ignoring expected error due no sending tracks: %s', error.toString());
                return;
            }
            throw error;
        }
        if (this._pc.signalingState === 'stable')
            return;
        const answer = { type: 'answer', sdp: this._remoteSdp.getSdp() };
        logger.debug('stopSending() | calling pc.setRemoteDescription() [answer:%o]', answer);
        await this._pc.setRemoteDescription(answer);
    }
    async replaceTrack(localId, track) {
        this._assertSendDirection();
        if (track) {
            logger.debug('replaceTrack() [localId:%s, track.id:%s]', localId, track.id);
        }
        else {
            logger.debug('replaceTrack() [localId:%s, no track]', localId);
        }
        const rtpSender = this._mapSendLocalIdRtpSender.get(localId);
        if (!rtpSender)
            throw new Error('associated RTCRtpSender not found');
        const oldTrack = rtpSender.track;
        await rtpSender.replaceTrack(track);
        // Remove the old track from the local stream.
        if (oldTrack)
            this._sendStream.removeTrack(oldTrack);
        // Add the new track to the local stream.
        if (track)
            this._sendStream.addTrack(track);
    }
    async setMaxSpatialLayer(localId, spatialLayer) {
        this._assertSendDirection();
        logger.debug('setMaxSpatialLayer() [localId:%s, spatialLayer:%s]', localId, spatialLayer);
        const rtpSender = this._mapSendLocalIdRtpSender.get(localId);
        if (!rtpSender)
            throw new Error('associated RTCRtpSender not found');
        const parameters = rtpSender.getParameters();
        parameters.encodings.forEach((encoding, idx) => {
            if (idx <= spatialLayer)
                encoding.active = true;
            else
                encoding.active = false;
        });
        await rtpSender.setParameters(parameters);
    }
    async setRtpEncodingParameters(localId, params) {
        this._assertSendDirection();
        logger.debug('setRtpEncodingParameters() [localId:%s, params:%o]', localId, params);
        const rtpSender = this._mapSendLocalIdRtpSender.get(localId);
        if (!rtpSender)
            throw new Error('associated RTCRtpSender not found');
        const parameters = rtpSender.getParameters();
        parameters.encodings.forEach((encoding, idx) => {
            parameters.encodings[idx] = Object.assign(Object.assign({}, encoding), params);
        });
        await rtpSender.setParameters(parameters);
    }
    async getSenderStats(localId) {
        this._assertSendDirection();
        const rtpSender = this._mapSendLocalIdRtpSender.get(localId);
        if (!rtpSender)
            throw new Error('associated RTCRtpSender not found');
        return rtpSender.getStats();
    }
    async sendDataChannel({ ordered, maxPacketLifeTime, maxRetransmits, label, protocol, priority }) {
        this._assertSendDirection();
        const options = {
            negotiated: true,
            id: this._nextSendSctpStreamId,
            ordered,
            maxPacketLifeTime,
            maxRetransmitTime: maxPacketLifeTime,
            maxRetransmits,
            protocol,
            priority
        };
        logger.debug('sendDataChannel() [options:%o]', options);
        const dataChannel = this._pc.createDataChannel(label, options);
        // Increase next id.
        this._nextSendSctpStreamId =
            ++this._nextSendSctpStreamId % SCTP_NUM_STREAMS.MIS;
        // If this is the first DataChannel we need to create the SDP answer with
        // m=application section.
        if (!this._hasDataChannelMediaSection) {
            const offer = await this._pc.createOffer();
            const localSdpObject = sdpTransform.parse(offer.sdp);
            const offerMediaObject = localSdpObject.media
                .find((m) => m.type === 'application');
            if (!this._transportReady)
                await this._setupTransport({ localDtlsRole: 'server', localSdpObject });
            logger.debug('sendDataChannel() | calling pc.setLocalDescription() [offer:%o]', offer);
            await this._pc.setLocalDescription(offer);
            this._remoteSdp.sendSctpAssociation({ offerMediaObject });
            const answer = { type: 'answer', sdp: this._remoteSdp.getSdp() };
            logger.debug('sendDataChannel() | calling pc.setRemoteDescription() [answer:%o]', answer);
            await this._pc.setRemoteDescription(answer);
            this._hasDataChannelMediaSection = true;
        }
        const sctpStreamParameters = {
            streamId: options.id,
            ordered: options.ordered,
            maxPacketLifeTime: options.maxPacketLifeTime,
            maxRetransmits: options.maxRetransmits
        };
        return { dataChannel, sctpStreamParameters };
    }
    async receive({ trackId, kind, rtpParameters }) {
        this._assertRecvDirection();
        logger.debug('receive() [trackId:%s, kind:%s]', trackId, kind);
        const localId = trackId;
        const mid = kind;
        this._remoteSdp.receive({
            mid,
            kind,
            offerRtpParameters: rtpParameters,
            streamId: rtpParameters.rtcp.cname,
            trackId
        });
        const offer = { type: 'offer', sdp: this._remoteSdp.getSdp() };
        logger.debug('receive() | calling pc.setRemoteDescription() [offer:%o]', offer);
        await this._pc.setRemoteDescription(offer);
        let answer = await this._pc.createAnswer();
        const localSdpObject = sdpTransform.parse(answer.sdp);
        const answerMediaObject = localSdpObject.media
            .find((m) => String(m.mid) === mid);
        // May need to modify codec parameters in the answer based on codec
        // parameters in the offer.
        sdpCommonUtils.applyCodecParameters({
            offerRtpParameters: rtpParameters,
            answerMediaObject
        });
        answer = { type: 'answer', sdp: sdpTransform.write(localSdpObject) };
        if (!this._transportReady)
            await this._setupTransport({ localDtlsRole: 'client', localSdpObject });
        logger.debug('receive() | calling pc.setLocalDescription() [answer:%o]', answer);
        await this._pc.setLocalDescription(answer);
        const rtpReceiver = this._pc.getReceivers()
            .find((r) => r.track && r.track.id === localId);
        if (!rtpReceiver)
            throw new Error('new RTCRtpReceiver not');
        // Insert into the map.
        this._mapRecvLocalIdInfo.set(localId, { mid, rtpParameters, rtpReceiver });
        return {
            localId,
            track: rtpReceiver.track,
            rtpReceiver
        };
    }
    async stopReceiving(localId) {
        this._assertRecvDirection();
        logger.debug('stopReceiving() [localId:%s]', localId);
        const { mid, rtpParameters } = this._mapRecvLocalIdInfo.get(localId) || {};
        // Remove from the map.
        this._mapRecvLocalIdInfo.delete(localId);
        this._remoteSdp.planBStopReceiving({ mid: mid, offerRtpParameters: rtpParameters });
        const offer = { type: 'offer', sdp: this._remoteSdp.getSdp() };
        logger.debug('stopReceiving() | calling pc.setRemoteDescription() [offer:%o]', offer);
        await this._pc.setRemoteDescription(offer);
        const answer = await this._pc.createAnswer();
        logger.debug('stopReceiving() | calling pc.setLocalDescription() [answer:%o]', answer);
        await this._pc.setLocalDescription(answer);
    }
    async getReceiverStats(localId) {
        this._assertRecvDirection();
        const { rtpReceiver } = this._mapRecvLocalIdInfo.get(localId) || {};
        if (!rtpReceiver)
            throw new Error('associated RTCRtpReceiver not found');
        return rtpReceiver.getStats();
    }
    async receiveDataChannel({ sctpStreamParameters, label, protocol }) {
        this._assertRecvDirection();
        const { streamId, ordered, maxPacketLifeTime, maxRetransmits } = sctpStreamParameters;
        const options = {
            negotiated: true,
            id: streamId,
            ordered,
            maxPacketLifeTime,
            maxRetransmitTime: maxPacketLifeTime,
            maxRetransmits,
            protocol
        };
        logger.debug('receiveDataChannel() [options:%o]', options);
        const dataChannel = this._pc.createDataChannel(label, options);
        // If this is the first DataChannel we need to create the SDP offer with
        // m=application section.
        if (!this._hasDataChannelMediaSection) {
            this._remoteSdp.receiveSctpAssociation({ oldDataChannelSpec: true });
            const offer = { type: 'offer', sdp: this._remoteSdp.getSdp() };
            logger.debug('receiveDataChannel() | calling pc.setRemoteDescription() [offer:%o]', offer);
            await this._pc.setRemoteDescription(offer);
            const answer = await this._pc.createAnswer();
            if (!this._transportReady) {
                const localSdpObject = sdpTransform.parse(answer.sdp);
                await this._setupTransport({ localDtlsRole: 'client', localSdpObject });
            }
            logger.debug('receiveDataChannel() | calling pc.setRemoteDescription() [answer:%o]', answer);
            await this._pc.setLocalDescription(answer);
            this._hasDataChannelMediaSection = true;
        }
        return { dataChannel };
    }
    async _setupTransport({ localDtlsRole, localSdpObject }) {
        if (!localSdpObject)
            localSdpObject = sdpTransform.parse(this._pc.localDescription.sdp);
        // Get our local DTLS parameters.
        const dtlsParameters = sdpCommonUtils.extractDtlsParameters({ sdpObject: localSdpObject });
        // Set our DTLS role.
        dtlsParameters.role = localDtlsRole;
        // Update the remote DTLS role in the SDP.
        this._remoteSdp.updateDtlsRole(localDtlsRole === 'client' ? 'server' : 'client');
        // Need to tell the remote transport about our parameters.
        await this.safeEmitAsPromise('@connect', { dtlsParameters });
        this._transportReady = true;
    }
    _assertSendDirection() {
        if (this._direction !== 'send') {
            throw new Error('method can just be called for handlers with "send" direction');
        }
    }
    _assertRecvDirection() {
        if (this._direction !== 'recv') {
            throw new Error('method can just be called for handlers with "recv" direction');
        }
    }
}
exports.Chrome67 = Chrome67;


/***/ }),
/* 314 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
const sdpTransform = __webpack_require__(17);
const Logger_1 = __webpack_require__(9);
const errors_1 = __webpack_require__(16);
const utils = __webpack_require__(10);
const ortc = __webpack_require__(14);
const sdpCommonUtils = __webpack_require__(19);
const sdpPlanBUtils = __webpack_require__(36);
const HandlerInterface_1 = __webpack_require__(18);
const RemoteSdp_1 = __webpack_require__(20);
const logger = new Logger_1.Logger('Chrome55');
const SCTP_NUM_STREAMS = { OS: 1024, MIS: 1024 };
class Chrome55 extends HandlerInterface_1.HandlerInterface {
    constructor() {
        super();
        // Local stream for sending.
        this._sendStream = new MediaStream();
        // Map of sending MediaStreamTracks indexed by localId.
        this._mapSendLocalIdTrack = new Map();
        // Next sending localId.
        this._nextSendLocalId = 0;
        // Map of MID, RTP parameters and RTCRtpReceiver indexed by local id.
        // Value is an Object with mid, rtpParameters and rtpReceiver.
        this._mapRecvLocalIdInfo = new Map();
        // Whether a DataChannel m=application section has been created.
        this._hasDataChannelMediaSection = false;
        // Sending DataChannel id value counter. Incremented for each new DataChannel.
        this._nextSendSctpStreamId = 0;
        // Got transport local and remote parameters.
        this._transportReady = false;
    }
    /**
     * Creates a factory function.
     */
    static createFactory() {
        return () => new Chrome55();
    }
    get name() {
        return 'Chrome55';
    }
    close() {
        logger.debug('close()');
        // Close RTCPeerConnection.
        if (this._pc) {
            try {
                this._pc.close();
            }
            catch (error) { }
        }
    }
    async getNativeRtpCapabilities() {
        logger.debug('getNativeRtpCapabilities()');
        const pc = new RTCPeerConnection({
            iceServers: [],
            iceTransportPolicy: 'all',
            bundlePolicy: 'max-bundle',
            rtcpMuxPolicy: 'require',
            sdpSemantics: 'plan-b'
        });
        try {
            const offer = await pc.createOffer({
                offerToReceiveAudio: true,
                offerToReceiveVideo: true
            });
            try {
                pc.close();
            }
            catch (error) { }
            const sdpObject = sdpTransform.parse(offer.sdp);
            const nativeRtpCapabilities = sdpCommonUtils.extractRtpCapabilities({ sdpObject });
            return nativeRtpCapabilities;
        }
        catch (error) {
            try {
                pc.close();
            }
            catch (error2) { }
            throw error;
        }
    }
    async getNativeSctpCapabilities() {
        logger.debug('getNativeSctpCapabilities()');
        return {
            numStreams: SCTP_NUM_STREAMS
        };
    }
    run({ direction, iceParameters, iceCandidates, dtlsParameters, sctpParameters, iceServers, iceTransportPolicy, additionalSettings, proprietaryConstraints, extendedRtpCapabilities }) {
        logger.debug('run()');
        this._direction = direction;
        this._remoteSdp = new RemoteSdp_1.RemoteSdp({
            iceParameters,
            iceCandidates,
            dtlsParameters,
            sctpParameters,
            planB: true
        });
        this._sendingRtpParametersByKind =
            {
                audio: ortc.getSendingRtpParameters('audio', extendedRtpCapabilities),
                video: ortc.getSendingRtpParameters('video', extendedRtpCapabilities)
            };
        this._sendingRemoteRtpParametersByKind =
            {
                audio: ortc.getSendingRemoteRtpParameters('audio', extendedRtpCapabilities),
                video: ortc.getSendingRemoteRtpParameters('video', extendedRtpCapabilities)
            };
        this._pc = new RTCPeerConnection(Object.assign({ iceServers: iceServers || [], iceTransportPolicy: iceTransportPolicy || 'all', bundlePolicy: 'max-bundle', rtcpMuxPolicy: 'require', sdpSemantics: 'plan-b' }, additionalSettings), proprietaryConstraints);
        // Handle RTCPeerConnection connection status.
        this._pc.addEventListener('iceconnectionstatechange', () => {
            switch (this._pc.iceConnectionState) {
                case 'checking':
                    this.emit('@connectionstatechange', 'connecting');
                    break;
                case 'connected':
                case 'completed':
                    this.emit('@connectionstatechange', 'connected');
                    break;
                case 'failed':
                    this.emit('@connectionstatechange', 'failed');
                    break;
                case 'disconnected':
                    this.emit('@connectionstatechange', 'disconnected');
                    break;
                case 'closed':
                    this.emit('@connectionstatechange', 'closed');
                    break;
            }
        });
    }
    async updateIceServers(iceServers) {
        logger.debug('updateIceServers()');
        const configuration = this._pc.getConfiguration();
        configuration.iceServers = iceServers;
        this._pc.setConfiguration(configuration);
    }
    async restartIce(iceParameters) {
        logger.debug('restartIce()');
        // Provide the remote SDP handler with new remote ICE parameters.
        this._remoteSdp.updateIceParameters(iceParameters);
        if (!this._transportReady)
            return;
        if (this._direction === 'send') {
            const offer = await this._pc.createOffer({ iceRestart: true });
            logger.debug('restartIce() | calling pc.setLocalDescription() [offer:%o]', offer);
            await this._pc.setLocalDescription(offer);
            const answer = { type: 'answer', sdp: this._remoteSdp.getSdp() };
            logger.debug('restartIce() | calling pc.setRemoteDescription() [answer:%o]', answer);
            await this._pc.setRemoteDescription(answer);
        }
        else {
            const offer = { type: 'offer', sdp: this._remoteSdp.getSdp() };
            logger.debug('restartIce() | calling pc.setRemoteDescription() [offer:%o]', offer);
            await this._pc.setRemoteDescription(offer);
            const answer = await this._pc.createAnswer();
            logger.debug('restartIce() | calling pc.setLocalDescription() [answer:%o]', answer);
            await this._pc.setLocalDescription(answer);
        }
    }
    async getTransportStats() {
        return this._pc.getStats();
    }
    async send({ track, encodings, codecOptions, codec }) {
        this._assertSendDirection();
        logger.debug('send() [kind:%s, track.id:%s]', track.kind, track.id);
        if (codec) {
            logger.warn('send() | codec selection is not available in %s handler', this.name);
        }
        this._sendStream.addTrack(track);
        this._pc.addStream(this._sendStream);
        let offer = await this._pc.createOffer();
        let localSdpObject = sdpTransform.parse(offer.sdp);
        let offerMediaObject;
        const sendingRtpParameters = utils.clone(this._sendingRtpParametersByKind[track.kind], {});
        sendingRtpParameters.codecs =
            ortc.reduceCodecs(sendingRtpParameters.codecs);
        const sendingRemoteRtpParameters = utils.clone(this._sendingRemoteRtpParametersByKind[track.kind], {});
        sendingRemoteRtpParameters.codecs =
            ortc.reduceCodecs(sendingRemoteRtpParameters.codecs);
        if (!this._transportReady)
            await this._setupTransport({ localDtlsRole: 'server', localSdpObject });
        if (track.kind === 'video' && encodings && encodings.length > 1) {
            logger.debug('send() | enabling simulcast');
            localSdpObject = sdpTransform.parse(offer.sdp);
            offerMediaObject = localSdpObject.media.find((m) => m.type === 'video');
            sdpPlanBUtils.addLegacySimulcast({
                offerMediaObject,
                track,
                numStreams: encodings.length
            });
            offer = { type: 'offer', sdp: sdpTransform.write(localSdpObject) };
        }
        logger.debug('send() | calling pc.setLocalDescription() [offer:%o]', offer);
        await this._pc.setLocalDescription(offer);
        localSdpObject = sdpTransform.parse(this._pc.localDescription.sdp);
        offerMediaObject = localSdpObject.media
            .find((m) => m.type === track.kind);
        // Set RTCP CNAME.
        sendingRtpParameters.rtcp.cname =
            sdpCommonUtils.getCname({ offerMediaObject });
        // Set RTP encodings.
        sendingRtpParameters.encodings =
            sdpPlanBUtils.getRtpEncodings({ offerMediaObject, track });
        // Complete encodings with given values.
        if (encodings) {
            for (let idx = 0; idx < sendingRtpParameters.encodings.length; ++idx) {
                if (encodings[idx])
                    Object.assign(sendingRtpParameters.encodings[idx], encodings[idx]);
            }
        }
        // If VP8 and there is effective simulcast, add scalabilityMode to each
        // encoding.
        if (sendingRtpParameters.encodings.length > 1 &&
            sendingRtpParameters.codecs[0].mimeType.toLowerCase() === 'video/vp8') {
            for (const encoding of sendingRtpParameters.encodings) {
                encoding.scalabilityMode = 'S1T3';
            }
        }
        this._remoteSdp.send({
            offerMediaObject,
            offerRtpParameters: sendingRtpParameters,
            answerRtpParameters: sendingRemoteRtpParameters,
            codecOptions
        });
        const answer = { type: 'answer', sdp: this._remoteSdp.getSdp() };
        logger.debug('send() | calling pc.setRemoteDescription() [answer:%o]', answer);
        await this._pc.setRemoteDescription(answer);
        const localId = String(this._nextSendLocalId);
        this._nextSendLocalId++;
        // Insert into the map.
        this._mapSendLocalIdTrack.set(localId, track);
        return {
            localId: localId,
            rtpParameters: sendingRtpParameters
        };
    }
    async stopSending(localId) {
        this._assertSendDirection();
        logger.debug('stopSending() [localId:%s]', localId);
        const track = this._mapSendLocalIdTrack.get(localId);
        if (!track)
            throw new Error('track not found');
        this._mapSendLocalIdTrack.delete(localId);
        this._sendStream.removeTrack(track);
        this._pc.addStream(this._sendStream);
        const offer = await this._pc.createOffer();
        logger.debug('stopSending() | calling pc.setLocalDescription() [offer:%o]', offer);
        try {
            await this._pc.setLocalDescription(offer);
        }
        catch (error) {
            // NOTE: If there are no sending tracks, setLocalDescription() will fail with
            // "Failed to create channels". If so, ignore it.
            if (this._sendStream.getTracks().length === 0) {
                logger.warn('stopSending() | ignoring expected error due no sending tracks: %s', error.toString());
                return;
            }
            throw error;
        }
        if (this._pc.signalingState === 'stable')
            return;
        const answer = { type: 'answer', sdp: this._remoteSdp.getSdp() };
        logger.debug('stopSending() | calling pc.setRemoteDescription() [answer:%o]', answer);
        await this._pc.setRemoteDescription(answer);
    }
    async replaceTrack(
    // eslint-disable-next-line @typescript-eslint/no-unused-vars
    localId, track) {
        throw new errors_1.UnsupportedError('not implemented');
    }
    // eslint-disable-next-line @typescript-eslint/no-unused-vars
    async setMaxSpatialLayer(localId, spatialLayer) {
        throw new errors_1.UnsupportedError(' not implemented');
    }
    // eslint-disable-next-line @typescript-eslint/no-unused-vars
    async setRtpEncodingParameters(localId, params) {
        throw new errors_1.UnsupportedError('not supported');
    }
    // eslint-disable-next-line @typescript-eslint/no-unused-vars
    async getSenderStats(localId) {
        throw new errors_1.UnsupportedError('not implemented');
    }
    async sendDataChannel({ ordered, maxPacketLifeTime, maxRetransmits, label, protocol, priority }) {
        this._assertSendDirection();
        const options = {
            negotiated: true,
            id: this._nextSendSctpStreamId,
            ordered,
            maxPacketLifeTime,
            maxRetransmitTime: maxPacketLifeTime,
            maxRetransmits,
            protocol,
            priority
        };
        logger.debug('sendDataChannel() [options:%o]', options);
        const dataChannel = this._pc.createDataChannel(label, options);
        // Increase next id.
        this._nextSendSctpStreamId =
            ++this._nextSendSctpStreamId % SCTP_NUM_STREAMS.MIS;
        // If this is the first DataChannel we need to create the SDP answer with
        // m=application section.
        if (!this._hasDataChannelMediaSection) {
            const offer = await this._pc.createOffer();
            const localSdpObject = sdpTransform.parse(offer.sdp);
            const offerMediaObject = localSdpObject.media
                .find((m) => m.type === 'application');
            if (!this._transportReady)
                await this._setupTransport({ localDtlsRole: 'server', localSdpObject });
            logger.debug('sendDataChannel() | calling pc.setLocalDescription() [offer:%o]', offer);
            await this._pc.setLocalDescription(offer);
            this._remoteSdp.sendSctpAssociation({ offerMediaObject });
            const answer = { type: 'answer', sdp: this._remoteSdp.getSdp() };
            logger.debug('sendDataChannel() | calling pc.setRemoteDescription() [answer:%o]', answer);
            await this._pc.setRemoteDescription(answer);
            this._hasDataChannelMediaSection = true;
        }
        const sctpStreamParameters = {
            streamId: options.id,
            ordered: options.ordered,
            maxPacketLifeTime: options.maxPacketLifeTime,
            maxRetransmits: options.maxRetransmits
        };
        return { dataChannel, sctpStreamParameters };
    }
    async receive({ trackId, kind, rtpParameters }) {
        this._assertRecvDirection();
        logger.debug('receive() [trackId:%s, kind:%s]', trackId, kind);
        const localId = trackId;
        const mid = kind;
        const streamId = rtpParameters.rtcp.cname;
        this._remoteSdp.receive({
            mid,
            kind,
            offerRtpParameters: rtpParameters,
            streamId,
            trackId
        });
        const offer = { type: 'offer', sdp: this._remoteSdp.getSdp() };
        logger.debug('receive() | calling pc.setRemoteDescription() [offer:%o]', offer);
        await this._pc.setRemoteDescription(offer);
        let answer = await this._pc.createAnswer();
        const localSdpObject = sdpTransform.parse(answer.sdp);
        const answerMediaObject = localSdpObject.media
            .find((m) => String(m.mid) === mid);
        // May need to modify codec parameters in the answer based on codec
        // parameters in the offer.
        sdpCommonUtils.applyCodecParameters({
            offerRtpParameters: rtpParameters,
            answerMediaObject
        });
        answer = { type: 'answer', sdp: sdpTransform.write(localSdpObject) };
        if (!this._transportReady)
            await this._setupTransport({ localDtlsRole: 'client', localSdpObject });
        logger.debug('receive() | calling pc.setLocalDescription() [answer:%o]', answer);
        await this._pc.setLocalDescription(answer);
        const stream = this._pc.getRemoteStreams()
            .find((s) => s.id === streamId);
        const track = stream.getTrackById(localId);
        if (!track)
            throw new Error('remote track not found');
        // Insert into the map.
        this._mapRecvLocalIdInfo.set(localId, { mid, rtpParameters });
        return { localId, track };
    }
    async stopReceiving(localId) {
        this._assertRecvDirection();
        logger.debug('stopReceiving() [localId:%s]', localId);
        const { mid, rtpParameters } = this._mapRecvLocalIdInfo.get(localId) || {};
        // Remove from the map.
        this._mapRecvLocalIdInfo.delete(localId);
        this._remoteSdp.planBStopReceiving({ mid: mid, offerRtpParameters: rtpParameters });
        const offer = { type: 'offer', sdp: this._remoteSdp.getSdp() };
        logger.debug('stopReceiving() | calling pc.setRemoteDescription() [offer:%o]', offer);
        await this._pc.setRemoteDescription(offer);
        const answer = await this._pc.createAnswer();
        logger.debug('stopReceiving() | calling pc.setLocalDescription() [answer:%o]', answer);
        await this._pc.setLocalDescription(answer);
    }
    // eslint-disable-next-line @typescript-eslint/no-unused-vars
    async getReceiverStats(localId) {
        throw new errors_1.UnsupportedError('not implemented');
    }
    async receiveDataChannel({ sctpStreamParameters, label, protocol }) {
        this._assertRecvDirection();
        const { streamId, ordered, maxPacketLifeTime, maxRetransmits } = sctpStreamParameters;
        const options = {
            negotiated: true,
            id: streamId,
            ordered,
            maxPacketLifeTime,
            maxRetransmitTime: maxPacketLifeTime,
            maxRetransmits,
            protocol
        };
        logger.debug('receiveDataChannel() [options:%o]', options);
        const dataChannel = this._pc.createDataChannel(label, options);
        // If this is the first DataChannel we need to create the SDP offer with
        // m=application section.
        if (!this._hasDataChannelMediaSection) {
            this._remoteSdp.receiveSctpAssociation({ oldDataChannelSpec: true });
            const offer = { type: 'offer', sdp: this._remoteSdp.getSdp() };
            logger.debug('receiveDataChannel() | calling pc.setRemoteDescription() [offer:%o]', offer);
            await this._pc.setRemoteDescription(offer);
            const answer = await this._pc.createAnswer();
            if (!this._transportReady) {
                const localSdpObject = sdpTransform.parse(answer.sdp);
                await this._setupTransport({ localDtlsRole: 'client', localSdpObject });
            }
            logger.debug('receiveDataChannel() | calling pc.setRemoteDescription() [answer:%o]', answer);
            await this._pc.setLocalDescription(answer);
            this._hasDataChannelMediaSection = true;
        }
        return { dataChannel };
    }
    async _setupTransport({ localDtlsRole, localSdpObject }) {
        if (!localSdpObject)
            localSdpObject = sdpTransform.parse(this._pc.localDescription.sdp);
        // Get our local DTLS parameters.
        const dtlsParameters = sdpCommonUtils.extractDtlsParameters({ sdpObject: localSdpObject });
        // Set our DTLS role.
        dtlsParameters.role = localDtlsRole;
        // Update the remote DTLS role in the SDP.
        this._remoteSdp.updateDtlsRole(localDtlsRole === 'client' ? 'server' : 'client');
        // Need to tell the remote transport about our parameters.
        await this.safeEmitAsPromise('@connect', { dtlsParameters });
        this._transportReady = true;
    }
    _assertSendDirection() {
        if (this._direction !== 'send') {
            throw new Error('method can just be called for handlers with "send" direction');
        }
    }
    _assertRecvDirection() {
        if (this._direction !== 'recv') {
            throw new Error('method can just be called for handlers with "recv" direction');
        }
    }
}
exports.Chrome55 = Chrome55;


/***/ }),
/* 315 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
const sdpTransform = __webpack_require__(17);
const Logger_1 = __webpack_require__(9);
const errors_1 = __webpack_require__(16);
const utils = __webpack_require__(10);
const ortc = __webpack_require__(14);
const sdpCommonUtils = __webpack_require__(19);
const sdpUnifiedPlanUtils = __webpack_require__(35);
const HandlerInterface_1 = __webpack_require__(18);
const RemoteSdp_1 = __webpack_require__(20);
const logger = new Logger_1.Logger('Firefox60');
const SCTP_NUM_STREAMS = { OS: 16, MIS: 2048 };
class Firefox60 extends HandlerInterface_1.HandlerInterface {
    constructor() {
        super();
        // Map of RTCTransceivers indexed by MID.
        this._mapMidTransceiver = new Map();
        // Local stream for sending.
        this._sendStream = new MediaStream();
        // Whether a DataChannel m=application section has been created.
        this._hasDataChannelMediaSection = false;
        // Sending DataChannel id value counter. Incremented for each new DataChannel.
        this._nextSendSctpStreamId = 0;
        // Got transport local and remote parameters.
        this._transportReady = false;
    }
    /**
     * Creates a factory function.
     */
    static createFactory() {
        return () => new Firefox60();
    }
    get name() {
        return 'Firefox60';
    }
    close() {
        logger.debug('close()');
        // Close RTCPeerConnection.
        if (this._pc) {
            try {
                this._pc.close();
            }
            catch (error) { }
        }
    }
    async getNativeRtpCapabilities() {
        logger.debug('getNativeRtpCapabilities()');
        const pc = new RTCPeerConnection({
            iceServers: [],
            iceTransportPolicy: 'all',
            bundlePolicy: 'max-bundle',
            rtcpMuxPolicy: 'require'
        });
        // NOTE: We need to add a real video track to get the RID extension mapping.
        const canvas = document.createElement('canvas');
        // NOTE: Otherwise Firefox fails in next line.
        canvas.getContext('2d');
        const fakeStream = canvas.captureStream();
        const fakeVideoTrack = fakeStream.getVideoTracks()[0];
        try {
            pc.addTransceiver('audio', { direction: 'sendrecv' });
            const videoTransceiver = pc.addTransceiver(fakeVideoTrack, { direction: 'sendrecv' });
            const parameters = videoTransceiver.sender.getParameters();
            const encodings = [
                { rid: 'r0', maxBitrate: 100000 },
                { rid: 'r1', maxBitrate: 500000 }
            ];
            parameters.encodings = encodings;
            await videoTransceiver.sender.setParameters(parameters);
            const offer = await pc.createOffer();
            try {
                canvas.remove();
            }
            catch (error) { }
            try {
                fakeVideoTrack.stop();
            }
            catch (error) { }
            try {
                pc.close();
            }
            catch (error) { }
            const sdpObject = sdpTransform.parse(offer.sdp);
            const nativeRtpCapabilities = sdpCommonUtils.extractRtpCapabilities({ sdpObject });
            return nativeRtpCapabilities;
        }
        catch (error) {
            try {
                canvas.remove();
            }
            catch (error2) { }
            try {
                fakeVideoTrack.stop();
            }
            catch (error2) { }
            try {
                pc.close();
            }
            catch (error2) { }
            throw error;
        }
    }
    async getNativeSctpCapabilities() {
        logger.debug('getNativeSctpCapabilities()');
        return {
            numStreams: SCTP_NUM_STREAMS
        };
    }
    run({ direction, iceParameters, iceCandidates, dtlsParameters, sctpParameters, iceServers, iceTransportPolicy, additionalSettings, proprietaryConstraints, extendedRtpCapabilities }) {
        logger.debug('run()');
        this._direction = direction;
        this._remoteSdp = new RemoteSdp_1.RemoteSdp({
            iceParameters,
            iceCandidates,
            dtlsParameters,
            sctpParameters
        });
        this._sendingRtpParametersByKind =
            {
                audio: ortc.getSendingRtpParameters('audio', extendedRtpCapabilities),
                video: ortc.getSendingRtpParameters('video', extendedRtpCapabilities)
            };
        this._sendingRemoteRtpParametersByKind =
            {
                audio: ortc.getSendingRemoteRtpParameters('audio', extendedRtpCapabilities),
                video: ortc.getSendingRemoteRtpParameters('video', extendedRtpCapabilities)
            };
        this._pc = new RTCPeerConnection(Object.assign({ iceServers: iceServers || [], iceTransportPolicy: iceTransportPolicy || 'all', bundlePolicy: 'max-bundle', rtcpMuxPolicy: 'require' }, additionalSettings), proprietaryConstraints);
        // Handle RTCPeerConnection connection status.
        this._pc.addEventListener('iceconnectionstatechange', () => {
            switch (this._pc.iceConnectionState) {
                case 'checking':
                    this.emit('@connectionstatechange', 'connecting');
                    break;
                case 'connected':
                case 'completed':
                    this.emit('@connectionstatechange', 'connected');
                    break;
                case 'failed':
                    this.emit('@connectionstatechange', 'failed');
                    break;
                case 'disconnected':
                    this.emit('@connectionstatechange', 'disconnected');
                    break;
                case 'closed':
                    this.emit('@connectionstatechange', 'closed');
                    break;
            }
        });
    }
    // eslint-disable-next-line @typescript-eslint/no-unused-vars
    async updateIceServers(iceServers) {
        // NOTE: Firefox does not implement pc.setConfiguration().
        throw new errors_1.UnsupportedError('not supported');
    }
    async restartIce(iceParameters) {
        logger.debug('restartIce()');
        // Provide the remote SDP handler with new remote ICE parameters.
        this._remoteSdp.updateIceParameters(iceParameters);
        if (!this._transportReady)
            return;
        if (this._direction === 'send') {
            const offer = await this._pc.createOffer({ iceRestart: true });
            logger.debug('restartIce() | calling pc.setLocalDescription() [offer:%o]', offer);
            await this._pc.setLocalDescription(offer);
            const answer = { type: 'answer', sdp: this._remoteSdp.getSdp() };
            logger.debug('restartIce() | calling pc.setRemoteDescription() [answer:%o]', answer);
            await this._pc.setRemoteDescription(answer);
        }
        else {
            const offer = { type: 'offer', sdp: this._remoteSdp.getSdp() };
            logger.debug('restartIce() | calling pc.setRemoteDescription() [offer:%o]', offer);
            await this._pc.setRemoteDescription(offer);
            const answer = await this._pc.createAnswer();
            logger.debug('restartIce() | calling pc.setLocalDescription() [answer:%o]', answer);
            await this._pc.setLocalDescription(answer);
        }
    }
    async getTransportStats() {
        return this._pc.getStats();
    }
    async send({ track, encodings, codecOptions, codec }) {
        this._assertSendDirection();
        logger.debug('send() [kind:%s, track.id:%s]', track.kind, track.id);
        if (encodings) {
            encodings = utils.clone(encodings, []);
            if (encodings.length > 1) {
                encodings.forEach((encoding, idx) => {
                    encoding.rid = `r${idx}`;
                });
                // Clone the encodings and reverse them because Firefox likes them
                // from high to low.
                encodings.reverse();
            }
        }
        const sendingRtpParameters = utils.clone(this._sendingRtpParametersByKind[track.kind], {});
        // This may throw.
        sendingRtpParameters.codecs =
            ortc.reduceCodecs(sendingRtpParameters.codecs, codec);
        const sendingRemoteRtpParameters = utils.clone(this._sendingRemoteRtpParametersByKind[track.kind], {});
        // This may throw.
        sendingRemoteRtpParameters.codecs =
            ortc.reduceCodecs(sendingRemoteRtpParameters.codecs, codec);
        // NOTE: Firefox fails sometimes to properly anticipate the closed media
        // section that it should use, so don't reuse closed media sections.
        //   https://github.com/versatica/mediasoup-client/issues/104
        //
        // const mediaSectionIdx = this._remoteSdp!.getNextMediaSectionIdx();
        const transceiver = this._pc.addTransceiver(track, { direction: 'sendonly', streams: [this._sendStream] });
        // NOTE: This is not spec compliants. Encodings should be given in addTransceiver
        // second argument, but Firefox does not support it.
        if (encodings) {
            const parameters = transceiver.sender.getParameters();
            parameters.encodings = encodings;
            await transceiver.sender.setParameters(parameters);
        }
        const offer = await this._pc.createOffer();
        let localSdpObject = sdpTransform.parse(offer.sdp);
        // In Firefox use DTLS role client even if we are the "offerer" since
        // Firefox does not respect ICE-Lite.
        if (!this._transportReady)
            await this._setupTransport({ localDtlsRole: 'client', localSdpObject });
        logger.debug('send() | calling pc.setLocalDescription() [offer:%o]', offer);
        await this._pc.setLocalDescription(offer);
        // We can now get the transceiver.mid.
        const localId = transceiver.mid;
        // Set MID.
        sendingRtpParameters.mid = localId;
        localSdpObject = sdpTransform.parse(this._pc.localDescription.sdp);
        const offerMediaObject = localSdpObject.media[localSdpObject.media.length - 1];
        // Set RTCP CNAME.
        sendingRtpParameters.rtcp.cname =
            sdpCommonUtils.getCname({ offerMediaObject });
        // Set RTP encodings by parsing the SDP offer if no encodings are given.
        if (!encodings) {
            sendingRtpParameters.encodings =
                sdpUnifiedPlanUtils.getRtpEncodings({ offerMediaObject });
        }
        // Set RTP encodings by parsing the SDP offer and complete them with given
        // one if just a single encoding has been given.
        else if (encodings.length === 1) {
            const newEncodings = sdpUnifiedPlanUtils.getRtpEncodings({ offerMediaObject });
            Object.assign(newEncodings[0], encodings[0]);
            sendingRtpParameters.encodings = newEncodings;
        }
        // Otherwise if more than 1 encoding are given use them verbatim (but
        // reverse them back since we reversed them above to satisfy Firefox).
        else {
            sendingRtpParameters.encodings = encodings.reverse();
        }
        // If VP8 or H264 and there is effective simulcast, add scalabilityMode to
        // each encoding.
        if (sendingRtpParameters.encodings.length > 1 &&
            (sendingRtpParameters.codecs[0].mimeType.toLowerCase() === 'video/vp8' ||
                sendingRtpParameters.codecs[0].mimeType.toLowerCase() === 'video/h264')) {
            for (const encoding of sendingRtpParameters.encodings) {
                encoding.scalabilityMode = 'S1T3';
            }
        }
        this._remoteSdp.send({
            offerMediaObject,
            offerRtpParameters: sendingRtpParameters,
            answerRtpParameters: sendingRemoteRtpParameters,
            codecOptions,
            extmapAllowMixed: true
        });
        const answer = { type: 'answer', sdp: this._remoteSdp.getSdp() };
        logger.debug('send() | calling pc.setRemoteDescription() [answer:%o]', answer);
        await this._pc.setRemoteDescription(answer);
        // Store in the map.
        this._mapMidTransceiver.set(localId, transceiver);
        return {
            localId,
            rtpParameters: sendingRtpParameters,
            rtpSender: transceiver.sender
        };
    }
    async stopSending(localId) {
        logger.debug('stopSending() [localId:%s]', localId);
        const transceiver = this._mapMidTransceiver.get(localId);
        if (!transceiver)
            throw new Error('associated transceiver not found');
        transceiver.sender.replaceTrack(null);
        this._pc.removeTrack(transceiver.sender);
        // NOTE: Cannot use closeMediaSection() due to the the note above in send()
        // method.
        // this._remoteSdp!.closeMediaSection(transceiver.mid);
        this._remoteSdp.disableMediaSection(transceiver.mid);
        const offer = await this._pc.createOffer();
        logger.debug('stopSending() | calling pc.setLocalDescription() [offer:%o]', offer);
        await this._pc.setLocalDescription(offer);
        const answer = { type: 'answer', sdp: this._remoteSdp.getSdp() };
        logger.debug('stopSending() | calling pc.setRemoteDescription() [answer:%o]', answer);
        await this._pc.setRemoteDescription(answer);
    }
    async replaceTrack(localId, track) {
        this._assertSendDirection();
        if (track) {
            logger.debug('replaceTrack() [localId:%s, track.id:%s]', localId, track.id);
        }
        else {
            logger.debug('replaceTrack() [localId:%s, no track]', localId);
        }
        const transceiver = this._mapMidTransceiver.get(localId);
        if (!transceiver)
            throw new Error('associated RTCRtpTransceiver not found');
        await transceiver.sender.replaceTrack(track);
    }
    async setMaxSpatialLayer(localId, spatialLayer) {
        this._assertSendDirection();
        logger.debug('setMaxSpatialLayer() [localId:%s, spatialLayer:%s]', localId, spatialLayer);
        const transceiver = this._mapMidTransceiver.get(localId);
        if (!transceiver)
            throw new Error('associated transceiver not found');
        const parameters = transceiver.sender.getParameters();
        // NOTE: We require encodings given from low to high, however Firefox
        // requires them in reverse order, so do magic here.
        spatialLayer = parameters.encodings.length - 1 - spatialLayer;
        parameters.encodings.forEach((encoding, idx) => {
            if (idx >= spatialLayer)
                encoding.active = true;
            else
                encoding.active = false;
        });
        await transceiver.sender.setParameters(parameters);
    }
    async setRtpEncodingParameters(localId, params) {
        this._assertSendDirection();
        logger.debug('setRtpEncodingParameters() [localId:%s, params:%o]', localId, params);
        const transceiver = this._mapMidTransceiver.get(localId);
        if (!transceiver)
            throw new Error('associated RTCRtpTransceiver not found');
        const parameters = transceiver.sender.getParameters();
        parameters.encodings.forEach((encoding, idx) => {
            parameters.encodings[idx] = Object.assign(Object.assign({}, encoding), params);
        });
        await transceiver.sender.setParameters(parameters);
    }
    async getSenderStats(localId) {
        this._assertSendDirection();
        const transceiver = this._mapMidTransceiver.get(localId);
        if (!transceiver)
            throw new Error('associated RTCRtpTransceiver not found');
        return transceiver.sender.getStats();
    }
    async sendDataChannel({ ordered, maxPacketLifeTime, maxRetransmits, label, protocol, priority }) {
        this._assertSendDirection();
        const options = {
            negotiated: true,
            id: this._nextSendSctpStreamId,
            ordered,
            maxPacketLifeTime,
            maxRetransmits,
            protocol,
            priority
        };
        logger.debug('sendDataChannel() [options:%o]', options);
        const dataChannel = this._pc.createDataChannel(label, options);
        // Increase next id.
        this._nextSendSctpStreamId =
            ++this._nextSendSctpStreamId % SCTP_NUM_STREAMS.MIS;
        // If this is the first DataChannel we need to create the SDP answer with
        // m=application section.
        if (!this._hasDataChannelMediaSection) {
            const offer = await this._pc.createOffer();
            const localSdpObject = sdpTransform.parse(offer.sdp);
            const offerMediaObject = localSdpObject.media
                .find((m) => m.type === 'application');
            if (!this._transportReady)
                await this._setupTransport({ localDtlsRole: 'server', localSdpObject });
            logger.debug('sendDataChannel() | calling pc.setLocalDescription() [offer:%o]', offer);
            await this._pc.setLocalDescription(offer);
            this._remoteSdp.sendSctpAssociation({ offerMediaObject });
            const answer = { type: 'answer', sdp: this._remoteSdp.getSdp() };
            logger.debug('sendDataChannel() | calling pc.setRemoteDescription() [answer:%o]', answer);
            await this._pc.setRemoteDescription(answer);
            this._hasDataChannelMediaSection = true;
        }
        const sctpStreamParameters = {
            streamId: options.id,
            ordered: options.ordered,
            maxPacketLifeTime: options.maxPacketLifeTime,
            maxRetransmits: options.maxRetransmits
        };
        return { dataChannel, sctpStreamParameters };
    }
    async receive({ trackId, kind, rtpParameters }) {
        this._assertRecvDirection();
        logger.debug('receive() [trackId:%s, kind:%s]', trackId, kind);
        const localId = rtpParameters.mid || String(this._mapMidTransceiver.size);
        this._remoteSdp.receive({
            mid: localId,
            kind,
            offerRtpParameters: rtpParameters,
            streamId: rtpParameters.rtcp.cname,
            trackId
        });
        const offer = { type: 'offer', sdp: this._remoteSdp.getSdp() };
        logger.debug('receive() | calling pc.setRemoteDescription() [offer:%o]', offer);
        await this._pc.setRemoteDescription(offer);
        let answer = await this._pc.createAnswer();
        const localSdpObject = sdpTransform.parse(answer.sdp);
        const answerMediaObject = localSdpObject.media
            .find((m) => String(m.mid) === localId);
        // May need to modify codec parameters in the answer based on codec
        // parameters in the offer.
        sdpCommonUtils.applyCodecParameters({
            offerRtpParameters: rtpParameters,
            answerMediaObject
        });
        answer = { type: 'answer', sdp: sdpTransform.write(localSdpObject) };
        if (!this._transportReady)
            await this._setupTransport({ localDtlsRole: 'client', localSdpObject });
        logger.debug('receive() | calling pc.setLocalDescription() [answer:%o]', answer);
        await this._pc.setLocalDescription(answer);
        const transceiver = this._pc.getTransceivers()
            .find((t) => t.mid === localId);
        if (!transceiver)
            throw new Error('new RTCRtpTransceiver not found');
        // Store in the map.
        this._mapMidTransceiver.set(localId, transceiver);
        return {
            localId,
            track: transceiver.receiver.track,
            rtpReceiver: transceiver.receiver
        };
    }
    async stopReceiving(localId) {
        this._assertRecvDirection();
        logger.debug('stopReceiving() [localId:%s]', localId);
        const transceiver = this._mapMidTransceiver.get(localId);
        if (!transceiver)
            throw new Error('associated RTCRtpTransceiver not found');
        this._remoteSdp.closeMediaSection(transceiver.mid);
        const offer = { type: 'offer', sdp: this._remoteSdp.getSdp() };
        logger.debug('stopReceiving() | calling pc.setRemoteDescription() [offer:%o]', offer);
        await this._pc.setRemoteDescription(offer);
        const answer = await this._pc.createAnswer();
        logger.debug('stopReceiving() | calling pc.setLocalDescription() [answer:%o]', answer);
        await this._pc.setLocalDescription(answer);
    }
    async getReceiverStats(localId) {
        this._assertRecvDirection();
        const transceiver = this._mapMidTransceiver.get(localId);
        if (!transceiver)
            throw new Error('associated RTCRtpTransceiver not found');
        return transceiver.receiver.getStats();
    }
    async receiveDataChannel({ sctpStreamParameters, label, protocol }) {
        this._assertRecvDirection();
        const { streamId, ordered, maxPacketLifeTime, maxRetransmits } = sctpStreamParameters;
        const options = {
            negotiated: true,
            id: streamId,
            ordered,
            maxPacketLifeTime,
            maxRetransmits,
            protocol
        };
        logger.debug('receiveDataChannel() [options:%o]', options);
        const dataChannel = this._pc.createDataChannel(label, options);
        // If this is the first DataChannel we need to create the SDP offer with
        // m=application section.
        if (!this._hasDataChannelMediaSection) {
            this._remoteSdp.receiveSctpAssociation();
            const offer = { type: 'offer', sdp: this._remoteSdp.getSdp() };
            logger.debug('receiveDataChannel() | calling pc.setRemoteDescription() [offer:%o]', offer);
            await this._pc.setRemoteDescription(offer);
            const answer = await this._pc.createAnswer();
            if (!this._transportReady) {
                const localSdpObject = sdpTransform.parse(answer.sdp);
                await this._setupTransport({ localDtlsRole: 'client', localSdpObject });
            }
            logger.debug('receiveDataChannel() | calling pc.setRemoteDescription() [answer:%o]', answer);
            await this._pc.setLocalDescription(answer);
            this._hasDataChannelMediaSection = true;
        }
        return { dataChannel };
    }
    async _setupTransport({ localDtlsRole, localSdpObject }) {
        if (!localSdpObject)
            localSdpObject = sdpTransform.parse(this._pc.localDescription.sdp);
        // Get our local DTLS parameters.
        const dtlsParameters = sdpCommonUtils.extractDtlsParameters({ sdpObject: localSdpObject });
        // Set our DTLS role.
        dtlsParameters.role = localDtlsRole;
        // Update the remote DTLS role in the SDP.
        this._remoteSdp.updateDtlsRole(localDtlsRole === 'client' ? 'server' : 'client');
        // Need to tell the remote transport about our parameters.
        await this.safeEmitAsPromise('@connect', { dtlsParameters });
        this._transportReady = true;
    }
    _assertSendDirection() {
        if (this._direction !== 'send') {
            throw new Error('method can just be called for handlers with "send" direction');
        }
    }
    _assertRecvDirection() {
        if (this._direction !== 'recv') {
            throw new Error('method can just be called for handlers with "recv" direction');
        }
    }
}
exports.Firefox60 = Firefox60;


/***/ }),
/* 316 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
const sdpTransform = __webpack_require__(17);
const Logger_1 = __webpack_require__(9);
const utils = __webpack_require__(10);
const ortc = __webpack_require__(14);
const sdpCommonUtils = __webpack_require__(19);
const sdpUnifiedPlanUtils = __webpack_require__(35);
const HandlerInterface_1 = __webpack_require__(18);
const RemoteSdp_1 = __webpack_require__(20);
const logger = new Logger_1.Logger('Safari12');
const SCTP_NUM_STREAMS = { OS: 1024, MIS: 1024 };
class Safari12 extends HandlerInterface_1.HandlerInterface {
    constructor() {
        super();
        // Map of RTCTransceivers indexed by MID.
        this._mapMidTransceiver = new Map();
        // Local stream for sending.
        this._sendStream = new MediaStream();
        // Whether a DataChannel m=application section has been created.
        this._hasDataChannelMediaSection = false;
        // Sending DataChannel id value counter. Incremented for each new DataChannel.
        this._nextSendSctpStreamId = 0;
        // Got transport local and remote parameters.
        this._transportReady = false;
    }
    /**
     * Creates a factory function.
     */
    static createFactory() {
        return () => new Safari12();
    }
    get name() {
        return 'Safari12';
    }
    close() {
        logger.debug('close()');
        // Close RTCPeerConnection.
        if (this._pc) {
            try {
                this._pc.close();
            }
            catch (error) { }
        }
    }
    async getNativeRtpCapabilities() {
        logger.debug('getNativeRtpCapabilities()');
        const pc = new RTCPeerConnection({
            iceServers: [],
            iceTransportPolicy: 'all',
            bundlePolicy: 'max-bundle',
            rtcpMuxPolicy: 'require'
        });
        try {
            pc.addTransceiver('audio');
            pc.addTransceiver('video');
            const offer = await pc.createOffer();
            try {
                pc.close();
            }
            catch (error) { }
            const sdpObject = sdpTransform.parse(offer.sdp);
            const nativeRtpCapabilities = sdpCommonUtils.extractRtpCapabilities({ sdpObject });
            return nativeRtpCapabilities;
        }
        catch (error) {
            try {
                pc.close();
            }
            catch (error2) { }
            throw error;
        }
    }
    async getNativeSctpCapabilities() {
        logger.debug('getNativeSctpCapabilities()');
        return {
            numStreams: SCTP_NUM_STREAMS
        };
    }
    run({ direction, iceParameters, iceCandidates, dtlsParameters, sctpParameters, iceServers, iceTransportPolicy, additionalSettings, proprietaryConstraints, extendedRtpCapabilities }) {
        logger.debug('run()');
        this._direction = direction;
        this._remoteSdp = new RemoteSdp_1.RemoteSdp({
            iceParameters,
            iceCandidates,
            dtlsParameters,
            sctpParameters
        });
        this._sendingRtpParametersByKind =
            {
                audio: ortc.getSendingRtpParameters('audio', extendedRtpCapabilities),
                video: ortc.getSendingRtpParameters('video', extendedRtpCapabilities)
            };
        this._sendingRemoteRtpParametersByKind =
            {
                audio: ortc.getSendingRemoteRtpParameters('audio', extendedRtpCapabilities),
                video: ortc.getSendingRemoteRtpParameters('video', extendedRtpCapabilities)
            };
        this._pc = new RTCPeerConnection(Object.assign({ iceServers: iceServers || [], iceTransportPolicy: iceTransportPolicy || 'all', bundlePolicy: 'max-bundle', rtcpMuxPolicy: 'require' }, additionalSettings), proprietaryConstraints);
        // Handle RTCPeerConnection connection status.
        this._pc.addEventListener('iceconnectionstatechange', () => {
            switch (this._pc.iceConnectionState) {
                case 'checking':
                    this.emit('@connectionstatechange', 'connecting');
                    break;
                case 'connected':
                case 'completed':
                    this.emit('@connectionstatechange', 'connected');
                    break;
                case 'failed':
                    this.emit('@connectionstatechange', 'failed');
                    break;
                case 'disconnected':
                    this.emit('@connectionstatechange', 'disconnected');
                    break;
                case 'closed':
                    this.emit('@connectionstatechange', 'closed');
                    break;
            }
        });
    }
    async updateIceServers(iceServers) {
        logger.debug('updateIceServers()');
        const configuration = this._pc.getConfiguration();
        configuration.iceServers = iceServers;
        this._pc.setConfiguration(configuration);
    }
    async restartIce(iceParameters) {
        logger.debug('restartIce()');
        // Provide the remote SDP handler with new remote ICE parameters.
        this._remoteSdp.updateIceParameters(iceParameters);
        if (!this._transportReady)
            return;
        if (this._direction === 'send') {
            const offer = await this._pc.createOffer({ iceRestart: true });
            logger.debug('restartIce() | calling pc.setLocalDescription() [offer:%o]', offer);
            await this._pc.setLocalDescription(offer);
            const answer = { type: 'answer', sdp: this._remoteSdp.getSdp() };
            logger.debug('restartIce() | calling pc.setRemoteDescription() [answer:%o]', answer);
            await this._pc.setRemoteDescription(answer);
        }
        else {
            const offer = { type: 'offer', sdp: this._remoteSdp.getSdp() };
            logger.debug('restartIce() | calling pc.setRemoteDescription() [offer:%o]', offer);
            await this._pc.setRemoteDescription(offer);
            const answer = await this._pc.createAnswer();
            logger.debug('restartIce() | calling pc.setLocalDescription() [answer:%o]', answer);
            await this._pc.setLocalDescription(answer);
        }
    }
    async getTransportStats() {
        return this._pc.getStats();
    }
    async send({ track, encodings, codecOptions, codec }) {
        this._assertSendDirection();
        logger.debug('send() [kind:%s, track.id:%s]', track.kind, track.id);
        const sendingRtpParameters = utils.clone(this._sendingRtpParametersByKind[track.kind], {});
        // This may throw.
        sendingRtpParameters.codecs =
            ortc.reduceCodecs(sendingRtpParameters.codecs, codec);
        const sendingRemoteRtpParameters = utils.clone(this._sendingRemoteRtpParametersByKind[track.kind], {});
        // This may throw.
        sendingRemoteRtpParameters.codecs =
            ortc.reduceCodecs(sendingRemoteRtpParameters.codecs, codec);
        const mediaSectionIdx = this._remoteSdp.getNextMediaSectionIdx();
        const transceiver = this._pc.addTransceiver(track, { direction: 'sendonly', streams: [this._sendStream] });
        let offer = await this._pc.createOffer();
        let localSdpObject = sdpTransform.parse(offer.sdp);
        let offerMediaObject;
        if (!this._transportReady)
            await this._setupTransport({ localDtlsRole: 'server', localSdpObject });
        if (encodings && encodings.length > 1) {
            logger.debug('send() | enabling legacy simulcast');
            localSdpObject = sdpTransform.parse(offer.sdp);
            offerMediaObject = localSdpObject.media[mediaSectionIdx.idx];
            sdpUnifiedPlanUtils.addLegacySimulcast({
                offerMediaObject,
                numStreams: encodings.length
            });
            offer = { type: 'offer', sdp: sdpTransform.write(localSdpObject) };
        }
        logger.debug('send() | calling pc.setLocalDescription() [offer:%o]', offer);
        await this._pc.setLocalDescription(offer);
        // We can now get the transceiver.mid.
        const localId = transceiver.mid;
        // Set MID.
        sendingRtpParameters.mid = localId;
        localSdpObject = sdpTransform.parse(this._pc.localDescription.sdp);
        offerMediaObject = localSdpObject.media[mediaSectionIdx.idx];
        // Set RTCP CNAME.
        sendingRtpParameters.rtcp.cname =
            sdpCommonUtils.getCname({ offerMediaObject });
        // Set RTP encodings.
        sendingRtpParameters.encodings =
            sdpUnifiedPlanUtils.getRtpEncodings({ offerMediaObject });
        // Complete encodings with given values.
        if (encodings) {
            for (let idx = 0; idx < sendingRtpParameters.encodings.length; ++idx) {
                if (encodings[idx])
                    Object.assign(sendingRtpParameters.encodings[idx], encodings[idx]);
            }
        }
        // If VP8 or H264 and there is effective simulcast, add scalabilityMode to
        // each encoding.
        if (sendingRtpParameters.encodings.length > 1 &&
            (sendingRtpParameters.codecs[0].mimeType.toLowerCase() === 'video/vp8' ||
                sendingRtpParameters.codecs[0].mimeType.toLowerCase() === 'video/h264')) {
            for (const encoding of sendingRtpParameters.encodings) {
                encoding.scalabilityMode = 'S1T3';
            }
        }
        this._remoteSdp.send({
            offerMediaObject,
            reuseMid: mediaSectionIdx.reuseMid,
            offerRtpParameters: sendingRtpParameters,
            answerRtpParameters: sendingRemoteRtpParameters,
            codecOptions
        });
        const answer = { type: 'answer', sdp: this._remoteSdp.getSdp() };
        logger.debug('send() | calling pc.setRemoteDescription() [answer:%o]', answer);
        await this._pc.setRemoteDescription(answer);
        // Store in the map.
        this._mapMidTransceiver.set(localId, transceiver);
        return {
            localId,
            rtpParameters: sendingRtpParameters,
            rtpSender: transceiver.sender
        };
    }
    async stopSending(localId) {
        this._assertSendDirection();
        logger.debug('stopSending() [localId:%s]', localId);
        const transceiver = this._mapMidTransceiver.get(localId);
        if (!transceiver)
            throw new Error('associated RTCRtpTransceiver not found');
        transceiver.sender.replaceTrack(null);
        this._pc.removeTrack(transceiver.sender);
        this._remoteSdp.closeMediaSection(transceiver.mid);
        const offer = await this._pc.createOffer();
        logger.debug('stopSending() | calling pc.setLocalDescription() [offer:%o]', offer);
        await this._pc.setLocalDescription(offer);
        const answer = { type: 'answer', sdp: this._remoteSdp.getSdp() };
        logger.debug('stopSending() | calling pc.setRemoteDescription() [answer:%o]', answer);
        await this._pc.setRemoteDescription(answer);
    }
    async replaceTrack(localId, track) {
        this._assertSendDirection();
        if (track) {
            logger.debug('replaceTrack() [localId:%s, track.id:%s]', localId, track.id);
        }
        else {
            logger.debug('replaceTrack() [localId:%s, no track]', localId);
        }
        const transceiver = this._mapMidTransceiver.get(localId);
        if (!transceiver)
            throw new Error('associated RTCRtpTransceiver not found');
        await transceiver.sender.replaceTrack(track);
    }
    async setMaxSpatialLayer(localId, spatialLayer) {
        this._assertSendDirection();
        logger.debug('setMaxSpatialLayer() [localId:%s, spatialLayer:%s]', localId, spatialLayer);
        const transceiver = this._mapMidTransceiver.get(localId);
        if (!transceiver)
            throw new Error('associated RTCRtpTransceiver not found');
        const parameters = transceiver.sender.getParameters();
        parameters.encodings.forEach((encoding, idx) => {
            if (idx <= spatialLayer)
                encoding.active = true;
            else
                encoding.active = false;
        });
        await transceiver.sender.setParameters(parameters);
    }
    async setRtpEncodingParameters(localId, params) {
        this._assertSendDirection();
        logger.debug('setRtpEncodingParameters() [localId:%s, params:%o]', localId, params);
        const transceiver = this._mapMidTransceiver.get(localId);
        if (!transceiver)
            throw new Error('associated RTCRtpTransceiver not found');
        const parameters = transceiver.sender.getParameters();
        parameters.encodings.forEach((encoding, idx) => {
            parameters.encodings[idx] = Object.assign(Object.assign({}, encoding), params);
        });
        await transceiver.sender.setParameters(parameters);
    }
    async getSenderStats(localId) {
        this._assertSendDirection();
        const transceiver = this._mapMidTransceiver.get(localId);
        if (!transceiver)
            throw new Error('associated RTCRtpTransceiver not found');
        return transceiver.sender.getStats();
    }
    async sendDataChannel({ ordered, maxPacketLifeTime, maxRetransmits, label, protocol, priority }) {
        this._assertSendDirection();
        const options = {
            negotiated: true,
            id: this._nextSendSctpStreamId,
            ordered,
            maxPacketLifeTime,
            maxRetransmits,
            protocol,
            priority
        };
        logger.debug('sendDataChannel() [options:%o]', options);
        const dataChannel = this._pc.createDataChannel(label, options);
        // Increase next id.
        this._nextSendSctpStreamId =
            ++this._nextSendSctpStreamId % SCTP_NUM_STREAMS.MIS;
        // If this is the first DataChannel we need to create the SDP answer with
        // m=application section.
        if (!this._hasDataChannelMediaSection) {
            const offer = await this._pc.createOffer();
            const localSdpObject = sdpTransform.parse(offer.sdp);
            const offerMediaObject = localSdpObject.media
                .find((m) => m.type === 'application');
            if (!this._transportReady)
                await this._setupTransport({ localDtlsRole: 'server', localSdpObject });
            logger.debug('sendDataChannel() | calling pc.setLocalDescription() [offer:%o]', offer);
            await this._pc.setLocalDescription(offer);
            this._remoteSdp.sendSctpAssociation({ offerMediaObject });
            const answer = { type: 'answer', sdp: this._remoteSdp.getSdp() };
            logger.debug('sendDataChannel() | calling pc.setRemoteDescription() [answer:%o]', answer);
            await this._pc.setRemoteDescription(answer);
            this._hasDataChannelMediaSection = true;
        }
        const sctpStreamParameters = {
            streamId: options.id,
            ordered: options.ordered,
            maxPacketLifeTime: options.maxPacketLifeTime,
            maxRetransmits: options.maxRetransmits
        };
        return { dataChannel, sctpStreamParameters };
    }
    async receive({ trackId, kind, rtpParameters }) {
        this._assertRecvDirection();
        logger.debug('receive() [trackId:%s, kind:%s]', trackId, kind);
        const localId = rtpParameters.mid || String(this._mapMidTransceiver.size);
        this._remoteSdp.receive({
            mid: localId,
            kind,
            offerRtpParameters: rtpParameters,
            streamId: rtpParameters.rtcp.cname,
            trackId
        });
        const offer = { type: 'offer', sdp: this._remoteSdp.getSdp() };
        logger.debug('receive() | calling pc.setRemoteDescription() [offer:%o]', offer);
        await this._pc.setRemoteDescription(offer);
        let answer = await this._pc.createAnswer();
        const localSdpObject = sdpTransform.parse(answer.sdp);
        const answerMediaObject = localSdpObject.media
            .find((m) => String(m.mid) === localId);
        // May need to modify codec parameters in the answer based on codec
        // parameters in the offer.
        sdpCommonUtils.applyCodecParameters({
            offerRtpParameters: rtpParameters,
            answerMediaObject
        });
        answer = { type: 'answer', sdp: sdpTransform.write(localSdpObject) };
        if (!this._transportReady)
            await this._setupTransport({ localDtlsRole: 'client', localSdpObject });
        logger.debug('receive() | calling pc.setLocalDescription() [answer:%o]', answer);
        await this._pc.setLocalDescription(answer);
        const transceiver = this._pc.getTransceivers()
            .find((t) => t.mid === localId);
        if (!transceiver)
            throw new Error('new RTCRtpTransceiver not found');
        // Store in the map.
        this._mapMidTransceiver.set(localId, transceiver);
        return {
            localId,
            track: transceiver.receiver.track,
            rtpReceiver: transceiver.receiver
        };
    }
    async stopReceiving(localId) {
        this._assertRecvDirection();
        logger.debug('stopReceiving() [localId:%s]', localId);
        const transceiver = this._mapMidTransceiver.get(localId);
        if (!transceiver)
            throw new Error('associated RTCRtpTransceiver not found');
        this._remoteSdp.closeMediaSection(transceiver.mid);
        const offer = { type: 'offer', sdp: this._remoteSdp.getSdp() };
        logger.debug('stopReceiving() | calling pc.setRemoteDescription() [offer:%o]', offer);
        await this._pc.setRemoteDescription(offer);
        const answer = await this._pc.createAnswer();
        logger.debug('stopReceiving() | calling pc.setLocalDescription() [answer:%o]', answer);
        await this._pc.setLocalDescription(answer);
    }
    async getReceiverStats(localId) {
        this._assertRecvDirection();
        const transceiver = this._mapMidTransceiver.get(localId);
        if (!transceiver)
            throw new Error('associated RTCRtpTransceiver not found');
        return transceiver.receiver.getStats();
    }
    async receiveDataChannel({ sctpStreamParameters, label, protocol }) {
        this._assertRecvDirection();
        const { streamId, ordered, maxPacketLifeTime, maxRetransmits } = sctpStreamParameters;
        const options = {
            negotiated: true,
            id: streamId,
            ordered,
            maxPacketLifeTime,
            maxRetransmits,
            protocol
        };
        logger.debug('receiveDataChannel() [options:%o]', options);
        const dataChannel = this._pc.createDataChannel(label, options);
        // If this is the first DataChannel we need to create the SDP offer with
        // m=application section.
        if (!this._hasDataChannelMediaSection) {
            this._remoteSdp.receiveSctpAssociation();
            const offer = { type: 'offer', sdp: this._remoteSdp.getSdp() };
            logger.debug('receiveDataChannel() | calling pc.setRemoteDescription() [offer:%o]', offer);
            await this._pc.setRemoteDescription(offer);
            const answer = await this._pc.createAnswer();
            if (!this._transportReady) {
                const localSdpObject = sdpTransform.parse(answer.sdp);
                await this._setupTransport({ localDtlsRole: 'client', localSdpObject });
            }
            logger.debug('receiveDataChannel() | calling pc.setRemoteDescription() [answer:%o]', answer);
            await this._pc.setLocalDescription(answer);
            this._hasDataChannelMediaSection = true;
        }
        return { dataChannel };
    }
    async _setupTransport({ localDtlsRole, localSdpObject }) {
        if (!localSdpObject)
            localSdpObject = sdpTransform.parse(this._pc.localDescription.sdp);
        // Get our local DTLS parameters.
        const dtlsParameters = sdpCommonUtils.extractDtlsParameters({ sdpObject: localSdpObject });
        // Set our DTLS role.
        dtlsParameters.role = localDtlsRole;
        // Update the remote DTLS role in the SDP.
        this._remoteSdp.updateDtlsRole(localDtlsRole === 'client' ? 'server' : 'client');
        // Need to tell the remote transport about our parameters.
        await this.safeEmitAsPromise('@connect', { dtlsParameters });
        this._transportReady = true;
    }
    _assertSendDirection() {
        if (this._direction !== 'send') {
            throw new Error('method can just be called for handlers with "send" direction');
        }
    }
    _assertRecvDirection() {
        if (this._direction !== 'recv') {
            throw new Error('method can just be called for handlers with "recv" direction');
        }
    }
}
exports.Safari12 = Safari12;


/***/ }),
/* 317 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
const sdpTransform = __webpack_require__(17);
const Logger_1 = __webpack_require__(9);
const utils = __webpack_require__(10);
const ortc = __webpack_require__(14);
const sdpCommonUtils = __webpack_require__(19);
const sdpPlanBUtils = __webpack_require__(36);
const HandlerInterface_1 = __webpack_require__(18);
const RemoteSdp_1 = __webpack_require__(20);
const logger = new Logger_1.Logger('Safari11');
const SCTP_NUM_STREAMS = { OS: 1024, MIS: 1024 };
class Safari11 extends HandlerInterface_1.HandlerInterface {
    constructor() {
        super();
        // Local stream for sending.
        this._sendStream = new MediaStream();
        // Map of RTCRtpSender indexed by localId.
        this._mapSendLocalIdRtpSender = new Map();
        // Next sending localId.
        this._nextSendLocalId = 0;
        // Map of MID, RTP parameters and RTCRtpReceiver indexed by local id.
        // Value is an Object with mid, rtpParameters and rtpReceiver.
        this._mapRecvLocalIdInfo = new Map();
        // Whether a DataChannel m=application section has been created.
        this._hasDataChannelMediaSection = false;
        // Sending DataChannel id value counter. Incremented for each new DataChannel.
        this._nextSendSctpStreamId = 0;
        // Got transport local and remote parameters.
        this._transportReady = false;
    }
    /**
     * Creates a factory function.
     */
    static createFactory() {
        return () => new Safari11();
    }
    get name() {
        return 'Safari11';
    }
    close() {
        logger.debug('close()');
        // Close RTCPeerConnection.
        if (this._pc) {
            try {
                this._pc.close();
            }
            catch (error) { }
        }
    }
    async getNativeRtpCapabilities() {
        logger.debug('getNativeRtpCapabilities()');
        const pc = new RTCPeerConnection({
            iceServers: [],
            iceTransportPolicy: 'all',
            bundlePolicy: 'max-bundle',
            rtcpMuxPolicy: 'require',
            sdpSemantics: 'plan-b'
        });
        try {
            const offer = await pc.createOffer({
                offerToReceiveAudio: true,
                offerToReceiveVideo: true
            });
            try {
                pc.close();
            }
            catch (error) { }
            const sdpObject = sdpTransform.parse(offer.sdp);
            const nativeRtpCapabilities = sdpCommonUtils.extractRtpCapabilities({ sdpObject });
            return nativeRtpCapabilities;
        }
        catch (error) {
            try {
                pc.close();
            }
            catch (error2) { }
            throw error;
        }
    }
    async getNativeSctpCapabilities() {
        logger.debug('getNativeSctpCapabilities()');
        return {
            numStreams: SCTP_NUM_STREAMS
        };
    }
    run({ direction, iceParameters, iceCandidates, dtlsParameters, sctpParameters, iceServers, iceTransportPolicy, additionalSettings, proprietaryConstraints, extendedRtpCapabilities }) {
        logger.debug('run()');
        this._direction = direction;
        this._remoteSdp = new RemoteSdp_1.RemoteSdp({
            iceParameters,
            iceCandidates,
            dtlsParameters,
            sctpParameters,
            planB: true
        });
        this._sendingRtpParametersByKind =
            {
                audio: ortc.getSendingRtpParameters('audio', extendedRtpCapabilities),
                video: ortc.getSendingRtpParameters('video', extendedRtpCapabilities)
            };
        this._sendingRemoteRtpParametersByKind =
            {
                audio: ortc.getSendingRemoteRtpParameters('audio', extendedRtpCapabilities),
                video: ortc.getSendingRemoteRtpParameters('video', extendedRtpCapabilities)
            };
        this._pc = new RTCPeerConnection(Object.assign({ iceServers: iceServers || [], iceTransportPolicy: iceTransportPolicy || 'all', bundlePolicy: 'max-bundle', rtcpMuxPolicy: 'require' }, additionalSettings), proprietaryConstraints);
        // Handle RTCPeerConnection connection status.
        this._pc.addEventListener('iceconnectionstatechange', () => {
            switch (this._pc.iceConnectionState) {
                case 'checking':
                    this.emit('@connectionstatechange', 'connecting');
                    break;
                case 'connected':
                case 'completed':
                    this.emit('@connectionstatechange', 'connected');
                    break;
                case 'failed':
                    this.emit('@connectionstatechange', 'failed');
                    break;
                case 'disconnected':
                    this.emit('@connectionstatechange', 'disconnected');
                    break;
                case 'closed':
                    this.emit('@connectionstatechange', 'closed');
                    break;
            }
        });
    }
    async updateIceServers(iceServers) {
        logger.debug('updateIceServers()');
        const configuration = this._pc.getConfiguration();
        configuration.iceServers = iceServers;
        this._pc.setConfiguration(configuration);
    }
    async restartIce(iceParameters) {
        logger.debug('restartIce()');
        // Provide the remote SDP handler with new remote ICE parameters.
        this._remoteSdp.updateIceParameters(iceParameters);
        if (!this._transportReady)
            return;
        if (this._direction === 'send') {
            const offer = await this._pc.createOffer({ iceRestart: true });
            logger.debug('restartIce() | calling pc.setLocalDescription() [offer:%o]', offer);
            await this._pc.setLocalDescription(offer);
            const answer = { type: 'answer', sdp: this._remoteSdp.getSdp() };
            logger.debug('restartIce() | calling pc.setRemoteDescription() [answer:%o]', answer);
            await this._pc.setRemoteDescription(answer);
        }
        else {
            const offer = { type: 'offer', sdp: this._remoteSdp.getSdp() };
            logger.debug('restartIce() | calling pc.setRemoteDescription() [offer:%o]', offer);
            await this._pc.setRemoteDescription(offer);
            const answer = await this._pc.createAnswer();
            logger.debug('restartIce() | calling pc.setLocalDescription() [answer:%o]', answer);
            await this._pc.setLocalDescription(answer);
        }
    }
    async getTransportStats() {
        return this._pc.getStats();
    }
    async send({ track, encodings, codecOptions, codec }) {
        this._assertSendDirection();
        logger.debug('send() [kind:%s, track.id:%s]', track.kind, track.id);
        if (codec) {
            logger.warn('send() | codec selection is not available in %s handler', this.name);
        }
        this._sendStream.addTrack(track);
        this._pc.addTrack(track, this._sendStream);
        let offer = await this._pc.createOffer();
        let localSdpObject = sdpTransform.parse(offer.sdp);
        let offerMediaObject;
        const sendingRtpParameters = utils.clone(this._sendingRtpParametersByKind[track.kind], {});
        sendingRtpParameters.codecs =
            ortc.reduceCodecs(sendingRtpParameters.codecs);
        const sendingRemoteRtpParameters = utils.clone(this._sendingRemoteRtpParametersByKind[track.kind], {});
        sendingRemoteRtpParameters.codecs =
            ortc.reduceCodecs(sendingRemoteRtpParameters.codecs);
        if (!this._transportReady)
            await this._setupTransport({ localDtlsRole: 'server', localSdpObject });
        if (track.kind === 'video' && encodings && encodings.length > 1) {
            logger.debug('send() | enabling simulcast');
            localSdpObject = sdpTransform.parse(offer.sdp);
            offerMediaObject = localSdpObject.media.find((m) => m.type === 'video');
            sdpPlanBUtils.addLegacySimulcast({
                offerMediaObject,
                track,
                numStreams: encodings.length
            });
            offer = { type: 'offer', sdp: sdpTransform.write(localSdpObject) };
        }
        logger.debug('send() | calling pc.setLocalDescription() [offer:%o]', offer);
        await this._pc.setLocalDescription(offer);
        localSdpObject = sdpTransform.parse(this._pc.localDescription.sdp);
        offerMediaObject = localSdpObject.media
            .find((m) => m.type === track.kind);
        // Set RTCP CNAME.
        sendingRtpParameters.rtcp.cname =
            sdpCommonUtils.getCname({ offerMediaObject });
        // Set RTP encodings.
        sendingRtpParameters.encodings =
            sdpPlanBUtils.getRtpEncodings({ offerMediaObject, track });
        // Complete encodings with given values.
        if (encodings) {
            for (let idx = 0; idx < sendingRtpParameters.encodings.length; ++idx) {
                if (encodings[idx])
                    Object.assign(sendingRtpParameters.encodings[idx], encodings[idx]);
            }
        }
        // If VP8 and there is effective simulcast, add scalabilityMode to each
        // encoding.
        if (sendingRtpParameters.encodings.length > 1 &&
            sendingRtpParameters.codecs[0].mimeType.toLowerCase() === 'video/vp8') {
            for (const encoding of sendingRtpParameters.encodings) {
                encoding.scalabilityMode = 'S1T3';
            }
        }
        this._remoteSdp.send({
            offerMediaObject,
            offerRtpParameters: sendingRtpParameters,
            answerRtpParameters: sendingRemoteRtpParameters,
            codecOptions
        });
        const answer = { type: 'answer', sdp: this._remoteSdp.getSdp() };
        logger.debug('send() | calling pc.setRemoteDescription() [answer:%o]', answer);
        await this._pc.setRemoteDescription(answer);
        const localId = String(this._nextSendLocalId);
        this._nextSendLocalId++;
        const rtpSender = this._pc.getSenders()
            .find((s) => s.track === track);
        // Insert into the map.
        this._mapSendLocalIdRtpSender.set(localId, rtpSender);
        return {
            localId: localId,
            rtpParameters: sendingRtpParameters,
            rtpSender
        };
    }
    async stopSending(localId) {
        this._assertSendDirection();
        const rtpSender = this._mapSendLocalIdRtpSender.get(localId);
        if (!rtpSender)
            throw new Error('associated RTCRtpSender not found');
        if (rtpSender.track)
            this._sendStream.removeTrack(rtpSender.track);
        this._mapSendLocalIdRtpSender.delete(localId);
        const offer = await this._pc.createOffer();
        logger.debug('stopSending() | calling pc.setLocalDescription() [offer:%o]', offer);
        try {
            await this._pc.setLocalDescription(offer);
        }
        catch (error) {
            // NOTE: If there are no sending tracks, setLocalDescription() will fail with
            // "Failed to create channels". If so, ignore it.
            if (this._sendStream.getTracks().length === 0) {
                logger.warn('stopSending() | ignoring expected error due no sending tracks: %s', error.toString());
                return;
            }
            throw error;
        }
        if (this._pc.signalingState === 'stable')
            return;
        const answer = { type: 'answer', sdp: this._remoteSdp.getSdp() };
        logger.debug('stopSending() | calling pc.setRemoteDescription() [answer:%o]', answer);
        await this._pc.setRemoteDescription(answer);
    }
    async replaceTrack(localId, track) {
        this._assertSendDirection();
        if (track) {
            logger.debug('replaceTrack() [localId:%s, track.id:%s]', localId, track.id);
        }
        else {
            logger.debug('replaceTrack() [localId:%s, no track]', localId);
        }
        const rtpSender = this._mapSendLocalIdRtpSender.get(localId);
        if (!rtpSender)
            throw new Error('associated RTCRtpSender not found');
        const oldTrack = rtpSender.track;
        await rtpSender.replaceTrack(track);
        // Remove the old track from the local stream.
        if (oldTrack)
            this._sendStream.removeTrack(oldTrack);
        // Add the new track to the local stream.
        if (track)
            this._sendStream.addTrack(track);
    }
    async setMaxSpatialLayer(localId, spatialLayer) {
        this._assertSendDirection();
        logger.debug('setMaxSpatialLayer() [localId:%s, spatialLayer:%s]', localId, spatialLayer);
        const rtpSender = this._mapSendLocalIdRtpSender.get(localId);
        if (!rtpSender)
            throw new Error('associated RTCRtpSender not found');
        const parameters = rtpSender.getParameters();
        parameters.encodings.forEach((encoding, idx) => {
            if (idx <= spatialLayer)
                encoding.active = true;
            else
                encoding.active = false;
        });
        await rtpSender.setParameters(parameters);
    }
    async setRtpEncodingParameters(localId, params) {
        this._assertSendDirection();
        logger.debug('setRtpEncodingParameters() [localId:%s, params:%o]', localId, params);
        const rtpSender = this._mapSendLocalIdRtpSender.get(localId);
        if (!rtpSender)
            throw new Error('associated RTCRtpSender not found');
        const parameters = rtpSender.getParameters();
        parameters.encodings.forEach((encoding, idx) => {
            parameters.encodings[idx] = Object.assign(Object.assign({}, encoding), params);
        });
        await rtpSender.setParameters(parameters);
    }
    async getSenderStats(localId) {
        this._assertSendDirection();
        const rtpSender = this._mapSendLocalIdRtpSender.get(localId);
        if (!rtpSender)
            throw new Error('associated RTCRtpSender not found');
        return rtpSender.getStats();
    }
    async sendDataChannel({ ordered, maxPacketLifeTime, maxRetransmits, label, protocol, priority }) {
        this._assertSendDirection();
        const options = {
            negotiated: true,
            id: this._nextSendSctpStreamId,
            ordered,
            maxPacketLifeTime,
            maxRetransmits,
            protocol,
            priority
        };
        logger.debug('sendDataChannel() [options:%o]', options);
        const dataChannel = this._pc.createDataChannel(label, options);
        // Increase next id.
        this._nextSendSctpStreamId =
            ++this._nextSendSctpStreamId % SCTP_NUM_STREAMS.MIS;
        // If this is the first DataChannel we need to create the SDP answer with
        // m=application section.
        if (!this._hasDataChannelMediaSection) {
            const offer = await this._pc.createOffer();
            const localSdpObject = sdpTransform.parse(offer.sdp);
            const offerMediaObject = localSdpObject.media
                .find((m) => m.type === 'application');
            if (!this._transportReady)
                await this._setupTransport({ localDtlsRole: 'server', localSdpObject });
            logger.debug('sendDataChannel() | calling pc.setLocalDescription() [offer:%o]', offer);
            await this._pc.setLocalDescription(offer);
            this._remoteSdp.sendSctpAssociation({ offerMediaObject });
            const answer = { type: 'answer', sdp: this._remoteSdp.getSdp() };
            logger.debug('sendDataChannel() | calling pc.setRemoteDescription() [answer:%o]', answer);
            await this._pc.setRemoteDescription(answer);
            this._hasDataChannelMediaSection = true;
        }
        const sctpStreamParameters = {
            streamId: options.id,
            ordered: options.ordered,
            maxPacketLifeTime: options.maxPacketLifeTime,
            maxRetransmits: options.maxRetransmits
        };
        return { dataChannel, sctpStreamParameters };
    }
    async receive({ trackId, kind, rtpParameters }) {
        this._assertRecvDirection();
        logger.debug('receive() [trackId:%s, kind:%s]', trackId, kind);
        const localId = trackId;
        const mid = kind;
        this._remoteSdp.receive({
            mid,
            kind,
            offerRtpParameters: rtpParameters,
            streamId: rtpParameters.rtcp.cname,
            trackId
        });
        const offer = { type: 'offer', sdp: this._remoteSdp.getSdp() };
        logger.debug('receive() | calling pc.setRemoteDescription() [offer:%o]', offer);
        await this._pc.setRemoteDescription(offer);
        let answer = await this._pc.createAnswer();
        const localSdpObject = sdpTransform.parse(answer.sdp);
        const answerMediaObject = localSdpObject.media
            .find((m) => String(m.mid) === mid);
        // May need to modify codec parameters in the answer based on codec
        // parameters in the offer.
        sdpCommonUtils.applyCodecParameters({
            offerRtpParameters: rtpParameters,
            answerMediaObject
        });
        answer = { type: 'answer', sdp: sdpTransform.write(localSdpObject) };
        if (!this._transportReady)
            await this._setupTransport({ localDtlsRole: 'client', localSdpObject });
        logger.debug('receive() | calling pc.setLocalDescription() [answer:%o]', answer);
        await this._pc.setLocalDescription(answer);
        const rtpReceiver = this._pc.getReceivers()
            .find((r) => r.track && r.track.id === localId);
        if (!rtpReceiver)
            throw new Error('new RTCRtpReceiver not');
        // Insert into the map.
        this._mapRecvLocalIdInfo.set(localId, { mid, rtpParameters, rtpReceiver });
        return {
            localId,
            track: rtpReceiver.track,
            rtpReceiver
        };
    }
    async stopReceiving(localId) {
        this._assertRecvDirection();
        logger.debug('stopReceiving() [localId:%s]', localId);
        const { mid, rtpParameters } = this._mapRecvLocalIdInfo.get(localId) || {};
        // Remove from the map.
        this._mapRecvLocalIdInfo.delete(localId);
        this._remoteSdp.planBStopReceiving({ mid: mid, offerRtpParameters: rtpParameters });
        const offer = { type: 'offer', sdp: this._remoteSdp.getSdp() };
        logger.debug('stopReceiving() | calling pc.setRemoteDescription() [offer:%o]', offer);
        await this._pc.setRemoteDescription(offer);
        const answer = await this._pc.createAnswer();
        logger.debug('stopReceiving() | calling pc.setLocalDescription() [answer:%o]', answer);
        await this._pc.setLocalDescription(answer);
    }
    async getReceiverStats(localId) {
        this._assertRecvDirection();
        const { rtpReceiver } = this._mapRecvLocalIdInfo.get(localId) || {};
        if (!rtpReceiver)
            throw new Error('associated RTCRtpReceiver not found');
        return rtpReceiver.getStats();
    }
    async receiveDataChannel({ sctpStreamParameters, label, protocol }) {
        this._assertRecvDirection();
        const { streamId, ordered, maxPacketLifeTime, maxRetransmits } = sctpStreamParameters;
        const options = {
            negotiated: true,
            id: streamId,
            ordered,
            maxPacketLifeTime,
            maxRetransmits,
            protocol
        };
        logger.debug('receiveDataChannel() [options:%o]', options);
        const dataChannel = this._pc.createDataChannel(label, options);
        // If this is the first DataChannel we need to create the SDP offer with
        // m=application section.
        if (!this._hasDataChannelMediaSection) {
            this._remoteSdp.receiveSctpAssociation({ oldDataChannelSpec: true });
            const offer = { type: 'offer', sdp: this._remoteSdp.getSdp() };
            logger.debug('receiveDataChannel() | calling pc.setRemoteDescription() [offer:%o]', offer);
            await this._pc.setRemoteDescription(offer);
            const answer = await this._pc.createAnswer();
            if (!this._transportReady) {
                const localSdpObject = sdpTransform.parse(answer.sdp);
                await this._setupTransport({ localDtlsRole: 'client', localSdpObject });
            }
            logger.debug('receiveDataChannel() | calling pc.setRemoteDescription() [answer:%o]', answer);
            await this._pc.setLocalDescription(answer);
            this._hasDataChannelMediaSection = true;
        }
        return { dataChannel };
    }
    async _setupTransport({ localDtlsRole, localSdpObject }) {
        if (!localSdpObject)
            localSdpObject = sdpTransform.parse(this._pc.localDescription.sdp);
        // Get our local DTLS parameters.
        const dtlsParameters = sdpCommonUtils.extractDtlsParameters({ sdpObject: localSdpObject });
        // Set our DTLS role.
        dtlsParameters.role = localDtlsRole;
        // Update the remote DTLS role in the SDP.
        this._remoteSdp.updateDtlsRole(localDtlsRole === 'client' ? 'server' : 'client');
        // Need to tell the remote transport about our parameters.
        await this.safeEmitAsPromise('@connect', { dtlsParameters });
        this._transportReady = true;
    }
    _assertSendDirection() {
        if (this._direction !== 'send') {
            throw new Error('method can just be called for handlers with "send" direction');
        }
    }
    _assertRecvDirection() {
        if (this._direction !== 'recv') {
            throw new Error('method can just be called for handlers with "recv" direction');
        }
    }
}
exports.Safari11 = Safari11;


/***/ }),
/* 318 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
const Logger_1 = __webpack_require__(9);
const errors_1 = __webpack_require__(16);
const utils = __webpack_require__(10);
const ortc = __webpack_require__(14);
const edgeUtils = __webpack_require__(319);
const HandlerInterface_1 = __webpack_require__(18);
const logger = new Logger_1.Logger('Edge11');
class Edge11 extends HandlerInterface_1.HandlerInterface {
    constructor() {
        super();
        // Map of RTCRtpSenders indexed by id.
        this._rtpSenders = new Map();
        // Map of RTCRtpReceivers indexed by id.
        this._rtpReceivers = new Map();
        // Next localId for sending tracks.
        this._nextSendLocalId = 0;
        // Got transport local and remote parameters.
        this._transportReady = false;
    }
    /**
     * Creates a factory function.
     */
    static createFactory() {
        return () => new Edge11();
    }
    get name() {
        return 'Edge11';
    }
    close() {
        logger.debug('close()');
        // Close the ICE gatherer.
        // NOTE: Not yet implemented by Edge.
        try {
            this._iceGatherer.close();
        }
        catch (error) { }
        // Close the ICE transport.
        try {
            this._iceTransport.stop();
        }
        catch (error) { }
        // Close the DTLS transport.
        try {
            this._dtlsTransport.stop();
        }
        catch (error) { }
        // Close RTCRtpSenders.
        for (const rtpSender of this._rtpSenders.values()) {
            try {
                rtpSender.stop();
            }
            catch (error) { }
        }
        // Close RTCRtpReceivers.
        for (const rtpReceiver of this._rtpReceivers.values()) {
            try {
                rtpReceiver.stop();
            }
            catch (error) { }
        }
    }
    async getNativeRtpCapabilities() {
        logger.debug('getNativeRtpCapabilities()');
        return edgeUtils.getCapabilities();
    }
    async getNativeSctpCapabilities() {
        logger.debug('getNativeSctpCapabilities()');
        return {
            numStreams: { OS: 0, MIS: 0 }
        };
    }
    run({ direction, // eslint-disable-line @typescript-eslint/no-unused-vars
    iceParameters, iceCandidates, dtlsParameters, sctpParameters, // eslint-disable-line @typescript-eslint/no-unused-vars
    iceServers, iceTransportPolicy, additionalSettings, // eslint-disable-line @typescript-eslint/no-unused-vars
    proprietaryConstraints, // eslint-disable-line @typescript-eslint/no-unused-vars
    extendedRtpCapabilities }) {
        logger.debug('run()');
        this._sendingRtpParametersByKind =
            {
                audio: ortc.getSendingRtpParameters('audio', extendedRtpCapabilities),
                video: ortc.getSendingRtpParameters('video', extendedRtpCapabilities)
            };
        this._remoteIceParameters = iceParameters;
        this._remoteIceCandidates = iceCandidates;
        this._remoteDtlsParameters = dtlsParameters;
        this._cname = `CNAME-${utils.generateRandomNumber()}`;
        this._setIceGatherer({ iceServers, iceTransportPolicy });
        this._setIceTransport();
        this._setDtlsTransport();
    }
    // eslint-disable-next-line @typescript-eslint/no-unused-vars
    async updateIceServers(iceServers) {
        // NOTE: Edge 11 does not implement iceGatherer.gater().
        throw new errors_1.UnsupportedError('not supported');
    }
    async restartIce(iceParameters) {
        logger.debug('restartIce()');
        this._remoteIceParameters = iceParameters;
        if (!this._transportReady)
            return;
        logger.debug('restartIce() | calling iceTransport.start()');
        this._iceTransport.start(this._iceGatherer, iceParameters, 'controlling');
        for (const candidate of this._remoteIceCandidates) {
            this._iceTransport.addRemoteCandidate(candidate);
        }
        this._iceTransport.addRemoteCandidate({});
    }
    async getTransportStats() {
        return this._iceTransport.getStats();
    }
    async send(
    // eslint-disable-next-line @typescript-eslint/no-unused-vars
    { track, encodings, codecOptions, codec }) {
        logger.debug('send() [kind:%s, track.id:%s]', track.kind, track.id);
        if (!this._transportReady)
            await this._setupTransport({ localDtlsRole: 'server' });
        logger.debug('send() | calling new RTCRtpSender()');
        const rtpSender = new RTCRtpSender(track, this._dtlsTransport);
        const rtpParameters = utils.clone(this._sendingRtpParametersByKind[track.kind], {});
        rtpParameters.codecs = ortc.reduceCodecs(rtpParameters.codecs, codec);
        const useRtx = rtpParameters.codecs
            .some((_codec) => /.+\/rtx$/i.test(_codec.mimeType));
        if (!encodings)
            encodings = [{}];
        for (const encoding of encodings) {
            encoding.ssrc = utils.generateRandomNumber();
            if (useRtx)
                encoding.rtx = { ssrc: utils.generateRandomNumber() };
        }
        rtpParameters.encodings = encodings;
        // Fill RTCRtpParameters.rtcp.
        rtpParameters.rtcp =
            {
                cname: this._cname,
                reducedSize: true,
                mux: true
            };
        // NOTE: Convert our standard RTCRtpParameters into those that Edge
        // expects.
        const edgeRtpParameters = edgeUtils.mangleRtpParameters(rtpParameters);
        logger.debug('send() | calling rtpSender.send() [params:%o]', edgeRtpParameters);
        await rtpSender.send(edgeRtpParameters);
        const localId = String(this._nextSendLocalId);
        this._nextSendLocalId++;
        // Store it.
        this._rtpSenders.set(localId, rtpSender);
        return { localId, rtpParameters, rtpSender };
    }
    async stopSending(localId) {
        logger.debug('stopSending() [localId:%s]', localId);
        const rtpSender = this._rtpSenders.get(localId);
        if (!rtpSender)
            throw new Error('RTCRtpSender not found');
        this._rtpSenders.delete(localId);
        try {
            logger.debug('stopSending() | calling rtpSender.stop()');
            rtpSender.stop();
        }
        catch (error) {
            logger.warn('stopSending() | rtpSender.stop() failed:%o', error);
            throw error;
        }
    }
    async replaceTrack(localId, track) {
        if (track) {
            logger.debug('replaceTrack() [localId:%s, track.id:%s]', localId, track.id);
        }
        else {
            logger.debug('replaceTrack() [localId:%s, no track]', localId);
        }
        const rtpSender = this._rtpSenders.get(localId);
        if (!rtpSender)
            throw new Error('RTCRtpSender not found');
        rtpSender.setTrack(track);
    }
    async setMaxSpatialLayer(localId, spatialLayer) {
        logger.debug('setMaxSpatialLayer() [localId:%s, spatialLayer:%s]', localId, spatialLayer);
        const rtpSender = this._rtpSenders.get(localId);
        if (!rtpSender)
            throw new Error('RTCRtpSender not found');
        const parameters = rtpSender.getParameters();
        parameters.encodings
            .forEach((encoding, idx) => {
            if (idx <= spatialLayer)
                encoding.active = true;
            else
                encoding.active = false;
        });
        await rtpSender.setParameters(parameters);
    }
    async setRtpEncodingParameters(localId, params) {
        logger.debug('setRtpEncodingParameters() [localId:%s, params:%o]', localId, params);
        const rtpSender = this._rtpSenders.get(localId);
        if (!rtpSender)
            throw new Error('RTCRtpSender not found');
        const parameters = rtpSender.getParameters();
        parameters.encodings.forEach((encoding, idx) => {
            parameters.encodings[idx] = Object.assign(Object.assign({}, encoding), params);
        });
        await rtpSender.setParameters(parameters);
    }
    async getSenderStats(localId) {
        const rtpSender = this._rtpSenders.get(localId);
        if (!rtpSender)
            throw new Error('RTCRtpSender not found');
        return rtpSender.getStats();
    }
    async sendDataChannel(
    // eslint-disable-next-line @typescript-eslint/no-unused-vars
    options) {
        throw new errors_1.UnsupportedError('not implemented');
    }
    async receive({ trackId, kind, rtpParameters }) {
        logger.debug('receive() [trackId:%s, kind:%s]', trackId, kind);
        if (!this._transportReady)
            await this._setupTransport({ localDtlsRole: 'server' });
        logger.debug('receive() | calling new RTCRtpReceiver()');
        const rtpReceiver = new RTCRtpReceiver(this._dtlsTransport, kind);
        rtpReceiver.addEventListener('error', (event) => {
            logger.error('rtpReceiver "error" event [event:%o]', event);
        });
        // NOTE: Convert our standard RTCRtpParameters into those that Edge
        // expects.
        const edgeRtpParameters = edgeUtils.mangleRtpParameters(rtpParameters);
        logger.debug('receive() | calling rtpReceiver.receive() [params:%o]', edgeRtpParameters);
        await rtpReceiver.receive(edgeRtpParameters);
        const localId = trackId;
        // Store it.
        this._rtpReceivers.set(localId, rtpReceiver);
        return {
            localId,
            track: rtpReceiver.track,
            rtpReceiver
        };
    }
    async stopReceiving(localId) {
        logger.debug('stopReceiving() [localId:%s]', localId);
        const rtpReceiver = this._rtpReceivers.get(localId);
        if (!rtpReceiver)
            throw new Error('RTCRtpReceiver not found');
        this._rtpReceivers.delete(localId);
        try {
            logger.debug('stopReceiving() | calling rtpReceiver.stop()');
            rtpReceiver.stop();
        }
        catch (error) {
            logger.warn('stopReceiving() | rtpReceiver.stop() failed:%o', error);
        }
    }
    async getReceiverStats(localId) {
        const rtpReceiver = this._rtpReceivers.get(localId);
        if (!rtpReceiver)
            throw new Error('RTCRtpReceiver not found');
        return rtpReceiver.getStats();
    }
    async receiveDataChannel(
    // eslint-disable-next-line @typescript-eslint/no-unused-vars
    options) {
        throw new errors_1.UnsupportedError('not implemented');
    }
    _setIceGatherer({ iceServers, iceTransportPolicy }) {
        const iceGatherer = new RTCIceGatherer({
            iceServers: iceServers || [],
            gatherPolicy: iceTransportPolicy || 'all'
        });
        iceGatherer.addEventListener('error', (event) => {
            logger.error('iceGatherer "error" event [event:%o]', event);
        });
        // NOTE: Not yet implemented by Edge, which starts gathering automatically.
        try {
            iceGatherer.gather();
        }
        catch (error) {
            logger.debug('_setIceGatherer() | iceGatherer.gather() failed: %s', error.toString());
        }
        this._iceGatherer = iceGatherer;
    }
    _setIceTransport() {
        const iceTransport = new RTCIceTransport(this._iceGatherer);
        // NOTE: Not yet implemented by Edge.
        iceTransport.addEventListener('statechange', () => {
            switch (iceTransport.state) {
                case 'checking':
                    this.emit('@connectionstatechange', 'connecting');
                    break;
                case 'connected':
                case 'completed':
                    this.emit('@connectionstatechange', 'connected');
                    break;
                case 'failed':
                    this.emit('@connectionstatechange', 'failed');
                    break;
                case 'disconnected':
                    this.emit('@connectionstatechange', 'disconnected');
                    break;
                case 'closed':
                    this.emit('@connectionstatechange', 'closed');
                    break;
            }
        });
        // NOTE: Not standard, but implemented by Edge.
        iceTransport.addEventListener('icestatechange', () => {
            switch (iceTransport.state) {
                case 'checking':
                    this.emit('@connectionstatechange', 'connecting');
                    break;
                case 'connected':
                case 'completed':
                    this.emit('@connectionstatechange', 'connected');
                    break;
                case 'failed':
                    this.emit('@connectionstatechange', 'failed');
                    break;
                case 'disconnected':
                    this.emit('@connectionstatechange', 'disconnected');
                    break;
                case 'closed':
                    this.emit('@connectionstatechange', 'closed');
                    break;
            }
        });
        iceTransport.addEventListener('candidatepairchange', (event) => {
            logger.debug('iceTransport "candidatepairchange" event [pair:%o]', event.pair);
        });
        this._iceTransport = iceTransport;
    }
    _setDtlsTransport() {
        const dtlsTransport = new RTCDtlsTransport(this._iceTransport);
        // NOTE: Not yet implemented by Edge.
        dtlsTransport.addEventListener('statechange', () => {
            logger.debug('dtlsTransport "statechange" event [state:%s]', dtlsTransport.state);
        });
        // NOTE: Not standard, but implemented by Edge.
        dtlsTransport.addEventListener('dtlsstatechange', () => {
            logger.debug('dtlsTransport "dtlsstatechange" event [state:%s]', dtlsTransport.state);
            if (dtlsTransport.state === 'closed')
                this.emit('@connectionstatechange', 'closed');
        });
        dtlsTransport.addEventListener('error', (event) => {
            logger.error('dtlsTransport "error" event [event:%o]', event);
        });
        this._dtlsTransport = dtlsTransport;
    }
    async _setupTransport({ localDtlsRole }) {
        logger.debug('_setupTransport()');
        // Get our local DTLS parameters.
        const dtlsParameters = this._dtlsTransport.getLocalParameters();
        dtlsParameters.role = localDtlsRole;
        // Need to tell the remote transport about our parameters.
        await this.safeEmitAsPromise('@connect', { dtlsParameters });
        // Start the RTCIceTransport.
        this._iceTransport.start(this._iceGatherer, this._remoteIceParameters, 'controlling');
        // Add remote ICE candidates.
        for (const candidate of this._remoteIceCandidates) {
            this._iceTransport.addRemoteCandidate(candidate);
        }
        // Also signal a 'complete' candidate as per spec.
        // NOTE: It should be {complete: true} but Edge prefers {}.
        // NOTE: If we don't signal end of candidates, the Edge RTCIceTransport
        // won't enter the 'completed' state.
        this._iceTransport.addRemoteCandidate({});
        // NOTE: Edge does not like SHA less than 256.
        this._remoteDtlsParameters.fingerprints = this._remoteDtlsParameters.fingerprints
            .filter((fingerprint) => {
            return (fingerprint.algorithm === 'sha-256' ||
                fingerprint.algorithm === 'sha-384' ||
                fingerprint.algorithm === 'sha-512');
        });
        // Start the RTCDtlsTransport.
        this._dtlsTransport.start(this._remoteDtlsParameters);
        this._transportReady = true;
    }
}
exports.Edge11 = Edge11;


/***/ }),
/* 319 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
const utils = __webpack_require__(10);
/**
 * Normalize ORTC based Edge's RTCRtpReceiver.getCapabilities() to produce a full
 * compliant ORTC RTCRtpCapabilities.
 */
function getCapabilities() {
    const nativeCaps = RTCRtpReceiver.getCapabilities();
    const caps = utils.clone(nativeCaps, {});
    for (const codec of caps.codecs) {
        // Rename numChannels to channels.
        codec.channels = codec.numChannels;
        delete codec.numChannels;
        // Add mimeType.
        codec.mimeType = codec.mimeType || `${codec.kind}/${codec.name}`;
        // NOTE: Edge sets some numeric parameters as string rather than number. Fix them.
        if (codec.parameters) {
            const parameters = codec.parameters;
            if (parameters.apt)
                parameters.apt = Number(parameters.apt);
            if (parameters['packetization-mode'])
                parameters['packetization-mode'] = Number(parameters['packetization-mode']);
        }
        // Delete emty parameter String in rtcpFeedback.
        for (const feedback of codec.rtcpFeedback || []) {
            if (!feedback.parameter)
                feedback.parameter = '';
        }
    }
    return caps;
}
exports.getCapabilities = getCapabilities;
/**
 * Generate RTCRtpParameters as ORTC based Edge likes.
 */
function mangleRtpParameters(rtpParameters) {
    const params = utils.clone(rtpParameters, {});
    // Rename mid to muxId.
    if (params.mid) {
        params.muxId = params.mid;
        delete params.mid;
    }
    for (const codec of params.codecs) {
        // Rename channels to numChannels.
        if (codec.channels) {
            codec.numChannels = codec.channels;
            delete codec.channels;
        }
        // Add codec.name (requried by Edge).
        if (codec.mimeType && !codec.name)
            codec.name = codec.mimeType.split('/')[1];
        // Remove mimeType.
        delete codec.mimeType;
    }
    return params;
}
exports.mangleRtpParameters = mangleRtpParameters;


/***/ }),
/* 320 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
const sdpTransform = __webpack_require__(17);
const Logger_1 = __webpack_require__(9);
const errors_1 = __webpack_require__(16);
const utils = __webpack_require__(10);
const ortc = __webpack_require__(14);
const sdpCommonUtils = __webpack_require__(19);
const sdpPlanBUtils = __webpack_require__(36);
const HandlerInterface_1 = __webpack_require__(18);
const RemoteSdp_1 = __webpack_require__(20);
const logger = new Logger_1.Logger('ReactNative');
const SCTP_NUM_STREAMS = { OS: 1024, MIS: 1024 };
class ReactNative extends HandlerInterface_1.HandlerInterface {
    constructor() {
        super();
        // Local stream for sending.
        this._sendStream = new MediaStream();
        // Map of sending MediaStreamTracks indexed by localId.
        this._mapSendLocalIdTrack = new Map();
        // Next sending localId.
        this._nextSendLocalId = 0;
        // Map of MID, RTP parameters and RTCRtpReceiver indexed by local id.
        // Value is an Object with mid, rtpParameters and rtpReceiver.
        this._mapRecvLocalIdInfo = new Map();
        // Whether a DataChannel m=application section has been created.
        this._hasDataChannelMediaSection = false;
        // Sending DataChannel id value counter. Incremented for each new DataChannel.
        this._nextSendSctpStreamId = 0;
        // Got transport local and remote parameters.
        this._transportReady = false;
    }
    /**
     * Creates a factory function.
     */
    static createFactory() {
        return () => new ReactNative();
    }
    get name() {
        return 'ReactNative';
    }
    close() {
        logger.debug('close()');
        // Close RTCPeerConnection.
        if (this._pc) {
            try {
                this._pc.close();
            }
            catch (error) { }
        }
    }
    async getNativeRtpCapabilities() {
        logger.debug('getNativeRtpCapabilities()');
        const pc = new RTCPeerConnection({
            iceServers: [],
            iceTransportPolicy: 'all',
            bundlePolicy: 'max-bundle',
            rtcpMuxPolicy: 'require',
            sdpSemantics: 'plan-b'
        });
        try {
            const offer = await pc.createOffer({
                offerToReceiveAudio: true,
                offerToReceiveVideo: true
            });
            try {
                pc.close();
            }
            catch (error) { }
            const sdpObject = sdpTransform.parse(offer.sdp);
            const nativeRtpCapabilities = sdpCommonUtils.extractRtpCapabilities({ sdpObject });
            return nativeRtpCapabilities;
        }
        catch (error) {
            try {
                pc.close();
            }
            catch (error2) { }
            throw error;
        }
    }
    async getNativeSctpCapabilities() {
        logger.debug('getNativeSctpCapabilities()');
        return {
            numStreams: SCTP_NUM_STREAMS
        };
    }
    run({ direction, iceParameters, iceCandidates, dtlsParameters, sctpParameters, iceServers, iceTransportPolicy, additionalSettings, proprietaryConstraints, extendedRtpCapabilities }) {
        logger.debug('run()');
        this._direction = direction;
        this._remoteSdp = new RemoteSdp_1.RemoteSdp({
            iceParameters,
            iceCandidates,
            dtlsParameters,
            sctpParameters,
            planB: true
        });
        this._sendingRtpParametersByKind =
            {
                audio: ortc.getSendingRtpParameters('audio', extendedRtpCapabilities),
                video: ortc.getSendingRtpParameters('video', extendedRtpCapabilities)
            };
        this._sendingRemoteRtpParametersByKind =
            {
                audio: ortc.getSendingRemoteRtpParameters('audio', extendedRtpCapabilities),
                video: ortc.getSendingRemoteRtpParameters('video', extendedRtpCapabilities)
            };
        this._pc = new RTCPeerConnection(Object.assign({ iceServers: iceServers || [], iceTransportPolicy: iceTransportPolicy || 'all', bundlePolicy: 'max-bundle', rtcpMuxPolicy: 'require', sdpSemantics: 'plan-b' }, additionalSettings), proprietaryConstraints);
        // Handle RTCPeerConnection connection status.
        this._pc.addEventListener('iceconnectionstatechange', () => {
            switch (this._pc.iceConnectionState) {
                case 'checking':
                    this.emit('@connectionstatechange', 'connecting');
                    break;
                case 'connected':
                case 'completed':
                    this.emit('@connectionstatechange', 'connected');
                    break;
                case 'failed':
                    this.emit('@connectionstatechange', 'failed');
                    break;
                case 'disconnected':
                    this.emit('@connectionstatechange', 'disconnected');
                    break;
                case 'closed':
                    this.emit('@connectionstatechange', 'closed');
                    break;
            }
        });
    }
    async updateIceServers(iceServers) {
        logger.debug('updateIceServers()');
        const configuration = this._pc.getConfiguration();
        configuration.iceServers = iceServers;
        this._pc.setConfiguration(configuration);
    }
    async restartIce(iceParameters) {
        logger.debug('restartIce()');
        // Provide the remote SDP handler with new remote ICE parameters.
        this._remoteSdp.updateIceParameters(iceParameters);
        if (!this._transportReady)
            return;
        if (this._direction === 'send') {
            const offer = await this._pc.createOffer({ iceRestart: true });
            logger.debug('restartIce() | calling pc.setLocalDescription() [offer:%o]', offer);
            await this._pc.setLocalDescription(offer);
            const answer = { type: 'answer', sdp: this._remoteSdp.getSdp() };
            logger.debug('restartIce() | calling pc.setRemoteDescription() [answer:%o]', answer);
            await this._pc.setRemoteDescription(answer);
        }
        else {
            const offer = { type: 'offer', sdp: this._remoteSdp.getSdp() };
            logger.debug('restartIce() | calling pc.setRemoteDescription() [offer:%o]', offer);
            await this._pc.setRemoteDescription(offer);
            const answer = await this._pc.createAnswer();
            logger.debug('restartIce() | calling pc.setLocalDescription() [answer:%o]', answer);
            await this._pc.setLocalDescription(answer);
        }
    }
    async getTransportStats() {
        return this._pc.getStats();
    }
    async send({ track, encodings, codecOptions, codec }) {
        this._assertSendDirection();
        logger.debug('send() [kind:%s, track.id:%s]', track.kind, track.id);
        if (codec) {
            logger.warn('send() | codec selection is not available in %s handler', this.name);
        }
        this._sendStream.addTrack(track);
        this._pc.addStream(this._sendStream);
        let offer = await this._pc.createOffer();
        let localSdpObject = sdpTransform.parse(offer.sdp);
        let offerMediaObject;
        const sendingRtpParameters = utils.clone(this._sendingRtpParametersByKind[track.kind], {});
        sendingRtpParameters.codecs =
            ortc.reduceCodecs(sendingRtpParameters.codecs);
        const sendingRemoteRtpParameters = utils.clone(this._sendingRemoteRtpParametersByKind[track.kind], {});
        sendingRemoteRtpParameters.codecs =
            ortc.reduceCodecs(sendingRemoteRtpParameters.codecs);
        if (!this._transportReady)
            await this._setupTransport({ localDtlsRole: 'server', localSdpObject });
        if (track.kind === 'video' && encodings && encodings.length > 1) {
            logger.debug('send() | enabling simulcast');
            localSdpObject = sdpTransform.parse(offer.sdp);
            offerMediaObject = localSdpObject.media
                .find((m) => m.type === 'video');
            sdpPlanBUtils.addLegacySimulcast({
                offerMediaObject,
                track,
                numStreams: encodings.length
            });
            offer = { type: 'offer', sdp: sdpTransform.write(localSdpObject) };
        }
        logger.debug('send() | calling pc.setLocalDescription() [offer:%o]', offer);
        await this._pc.setLocalDescription(offer);
        localSdpObject = sdpTransform.parse(this._pc.localDescription.sdp);
        offerMediaObject = localSdpObject.media
            .find((m) => m.type === track.kind);
        // Set RTCP CNAME.
        sendingRtpParameters.rtcp.cname =
            sdpCommonUtils.getCname({ offerMediaObject });
        // Set RTP encodings.
        sendingRtpParameters.encodings =
            sdpPlanBUtils.getRtpEncodings({ offerMediaObject, track });
        // Complete encodings with given values.
        if (encodings) {
            for (let idx = 0; idx < sendingRtpParameters.encodings.length; ++idx) {
                if (encodings[idx])
                    Object.assign(sendingRtpParameters.encodings[idx], encodings[idx]);
            }
        }
        // If VP8 or H264 and there is effective simulcast, add scalabilityMode to
        // each encoding.
        if (sendingRtpParameters.encodings.length > 1 &&
            (sendingRtpParameters.codecs[0].mimeType.toLowerCase() === 'video/vp8' ||
                sendingRtpParameters.codecs[0].mimeType.toLowerCase() === 'video/h264')) {
            for (const encoding of sendingRtpParameters.encodings) {
                encoding.scalabilityMode = 'S1T3';
            }
        }
        this._remoteSdp.send({
            offerMediaObject,
            offerRtpParameters: sendingRtpParameters,
            answerRtpParameters: sendingRemoteRtpParameters,
            codecOptions
        });
        const answer = { type: 'answer', sdp: this._remoteSdp.getSdp() };
        logger.debug('send() | calling pc.setRemoteDescription() [answer:%o]', answer);
        await this._pc.setRemoteDescription(answer);
        const localId = String(this._nextSendLocalId);
        this._nextSendLocalId++;
        // Insert into the map.
        this._mapSendLocalIdTrack.set(localId, track);
        return {
            localId: localId,
            rtpParameters: sendingRtpParameters
        };
    }
    async stopSending(localId) {
        this._assertSendDirection();
        logger.debug('stopSending() [localId:%s]', localId);
        const track = this._mapSendLocalIdTrack.get(localId);
        if (!track)
            throw new Error('track not found');
        this._mapSendLocalIdTrack.delete(localId);
        this._sendStream.removeTrack(track);
        this._pc.addStream(this._sendStream);
        const offer = await this._pc.createOffer();
        logger.debug('stopSending() | calling pc.setLocalDescription() [offer:%o]', offer);
        try {
            await this._pc.setLocalDescription(offer);
        }
        catch (error) {
            // NOTE: If there are no sending tracks, setLocalDescription() will fail with
            // "Failed to create channels". If so, ignore it.
            if (this._sendStream.getTracks().length === 0) {
                logger.warn('stopSending() | ignoring expected error due no sending tracks: %s', error.toString());
                return;
            }
            throw error;
        }
        if (this._pc.signalingState === 'stable')
            return;
        const answer = { type: 'answer', sdp: this._remoteSdp.getSdp() };
        logger.debug('stopSending() | calling pc.setRemoteDescription() [answer:%o]', answer);
        await this._pc.setRemoteDescription(answer);
    }
    async replaceTrack(
    // eslint-disable-next-line @typescript-eslint/no-unused-vars
    localId, track) {
        throw new errors_1.UnsupportedError('not implemented');
    }
    // eslint-disable-next-line @typescript-eslint/no-unused-vars
    async setMaxSpatialLayer(localId, spatialLayer) {
        throw new errors_1.UnsupportedError('not implemented');
    }
    // eslint-disable-next-line @typescript-eslint/no-unused-vars
    async setRtpEncodingParameters(localId, params) {
        throw new errors_1.UnsupportedError('not implemented');
    }
    // eslint-disable-next-line @typescript-eslint/no-unused-vars
    async getSenderStats(localId) {
        throw new errors_1.UnsupportedError('not implemented');
    }
    async sendDataChannel({ ordered, maxPacketLifeTime, maxRetransmits, label, protocol, priority }) {
        this._assertSendDirection();
        const options = {
            negotiated: true,
            id: this._nextSendSctpStreamId,
            ordered,
            maxPacketLifeTime,
            maxRetransmitTime: maxPacketLifeTime,
            maxRetransmits,
            protocol,
            priority
        };
        logger.debug('sendDataChannel() [options:%o]', options);
        const dataChannel = this._pc.createDataChannel(label, options);
        // Increase next id.
        this._nextSendSctpStreamId =
            ++this._nextSendSctpStreamId % SCTP_NUM_STREAMS.MIS;
        // If this is the first DataChannel we need to create the SDP answer with
        // m=application section.
        if (!this._hasDataChannelMediaSection) {
            const offer = await this._pc.createOffer();
            const localSdpObject = sdpTransform.parse(offer.sdp);
            const offerMediaObject = localSdpObject.media
                .find((m) => m.type === 'application');
            if (!this._transportReady)
                await this._setupTransport({ localDtlsRole: 'server', localSdpObject });
            logger.debug('sendDataChannel() | calling pc.setLocalDescription() [offer:%o]', offer);
            await this._pc.setLocalDescription(offer);
            this._remoteSdp.sendSctpAssociation({ offerMediaObject });
            const answer = { type: 'answer', sdp: this._remoteSdp.getSdp() };
            logger.debug('sendDataChannel() | calling pc.setRemoteDescription() [answer:%o]', answer);
            await this._pc.setRemoteDescription(answer);
            this._hasDataChannelMediaSection = true;
        }
        const sctpStreamParameters = {
            streamId: options.id,
            ordered: options.ordered,
            maxPacketLifeTime: options.maxPacketLifeTime,
            maxRetransmits: options.maxRetransmits
        };
        return { dataChannel, sctpStreamParameters };
    }
    async receive({ trackId, kind, rtpParameters }) {
        this._assertRecvDirection();
        logger.debug('receive() [trackId:%s, kind:%s]', trackId, kind);
        const localId = trackId;
        const mid = kind;
        let streamId = rtpParameters.rtcp.cname;
        // NOTE: In React-Native we cannot reuse the same remote MediaStream for new
        // remote tracks. This is because react-native-webrtc does not react on new
        // tracks generated within already existing streams, so force the streamId
        // to be different.
        logger.debug('receive() | forcing a random remote streamId to avoid well known bug in react-native-webrtc');
        streamId += `-hack-${utils.generateRandomNumber()}`;
        this._remoteSdp.receive({
            mid,
            kind,
            offerRtpParameters: rtpParameters,
            streamId,
            trackId
        });
        const offer = { type: 'offer', sdp: this._remoteSdp.getSdp() };
        logger.debug('receive() | calling pc.setRemoteDescription() [offer:%o]', offer);
        await this._pc.setRemoteDescription(offer);
        let answer = await this._pc.createAnswer();
        const localSdpObject = sdpTransform.parse(answer.sdp);
        const answerMediaObject = localSdpObject.media
            .find((m) => String(m.mid) === mid);
        // May need to modify codec parameters in the answer based on codec
        // parameters in the offer.
        sdpCommonUtils.applyCodecParameters({
            offerRtpParameters: rtpParameters,
            answerMediaObject
        });
        answer = { type: 'answer', sdp: sdpTransform.write(localSdpObject) };
        if (!this._transportReady)
            await this._setupTransport({ localDtlsRole: 'client', localSdpObject });
        logger.debug('receive() | calling pc.setLocalDescription() [answer:%o]', answer);
        await this._pc.setLocalDescription(answer);
        const stream = this._pc.getRemoteStreams()
            .find((s) => s.id === streamId);
        const track = stream.getTrackById(localId);
        if (!track)
            throw new Error('remote track not found');
        // Insert into the map.
        this._mapRecvLocalIdInfo.set(localId, { mid, rtpParameters });
        return { localId, track };
    }
    async stopReceiving(localId) {
        this._assertRecvDirection();
        logger.debug('stopReceiving() [localId:%s]', localId);
        const { mid, rtpParameters } = this._mapRecvLocalIdInfo.get(localId) || {};
        // Remove from the map.
        this._mapRecvLocalIdInfo.delete(localId);
        this._remoteSdp.planBStopReceiving({ mid: mid, offerRtpParameters: rtpParameters });
        const offer = { type: 'offer', sdp: this._remoteSdp.getSdp() };
        logger.debug('stopReceiving() | calling pc.setRemoteDescription() [offer:%o]', offer);
        await this._pc.setRemoteDescription(offer);
        const answer = await this._pc.createAnswer();
        logger.debug('stopReceiving() | calling pc.setLocalDescription() [answer:%o]', answer);
        await this._pc.setLocalDescription(answer);
    }
    // eslint-disable-next-line @typescript-eslint/no-unused-vars
    async getReceiverStats(localId) {
        throw new errors_1.UnsupportedError('not implemented');
    }
    async receiveDataChannel({ sctpStreamParameters, label, protocol }) {
        this._assertRecvDirection();
        const { streamId, ordered, maxPacketLifeTime, maxRetransmits } = sctpStreamParameters;
        const options = {
            negotiated: true,
            id: streamId,
            ordered,
            maxPacketLifeTime,
            maxRetransmitTime: maxPacketLifeTime,
            maxRetransmits,
            protocol
        };
        logger.debug('receiveDataChannel() [options:%o]', options);
        const dataChannel = this._pc.createDataChannel(label, options);
        // If this is the first DataChannel we need to create the SDP offer with
        // m=application section.
        if (!this._hasDataChannelMediaSection) {
            this._remoteSdp.receiveSctpAssociation({ oldDataChannelSpec: true });
            const offer = { type: 'offer', sdp: this._remoteSdp.getSdp() };
            logger.debug('receiveDataChannel() | calling pc.setRemoteDescription() [offer:%o]', offer);
            await this._pc.setRemoteDescription(offer);
            const answer = await this._pc.createAnswer();
            if (!this._transportReady) {
                const localSdpObject = sdpTransform.parse(answer.sdp);
                await this._setupTransport({ localDtlsRole: 'client', localSdpObject });
            }
            logger.debug('receiveDataChannel() | calling pc.setRemoteDescription() [answer:%o]', answer);
            await this._pc.setLocalDescription(answer);
            this._hasDataChannelMediaSection = true;
        }
        return { dataChannel };
    }
    async _setupTransport({ localDtlsRole, localSdpObject }) {
        if (!localSdpObject)
            localSdpObject = sdpTransform.parse(this._pc.localDescription.sdp);
        // Get our local DTLS parameters.
        const dtlsParameters = sdpCommonUtils.extractDtlsParameters({ sdpObject: localSdpObject });
        // Set our DTLS role.
        dtlsParameters.role = localDtlsRole;
        // Update the remote DTLS role in the SDP.
        this._remoteSdp.updateDtlsRole(localDtlsRole === 'client' ? 'server' : 'client');
        // Need to tell the remote transport about our parameters.
        await this.safeEmitAsPromise('@connect', { dtlsParameters });
        this._transportReady = true;
    }
    _assertSendDirection() {
        if (this._direction !== 'send') {
            throw new Error('method can just be called for handlers with "send" direction');
        }
    }
    _assertRecvDirection() {
        if (this._direction !== 'recv') {
            throw new Error('method can just be called for handlers with "recv" direction');
        }
    }
}
exports.ReactNative = ReactNative;


/***/ }),
/* 321 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

function __export(m) {
    for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
Object.defineProperty(exports, "__esModule", { value: true });
__export(__webpack_require__(67));
__export(__webpack_require__(68));
__export(__webpack_require__(69));
__export(__webpack_require__(70));
__export(__webpack_require__(71));
__export(__webpack_require__(72));
__export(__webpack_require__(18));
__export(__webpack_require__(16));


/***/ }),
/* 322 */
/***/ (function(module, exports, __webpack_require__) {


var content = __webpack_require__(323);

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) {}

/***/ }),
/* 323 */
/***/ (function(module, exports, __webpack_require__) {

exports = module.exports = __webpack_require__(4)(false);
// Module
exports.push([module.i, ".gdv-app {\r\n\r\n}\r\n\r\n.gdv-fragment {\r\n\r\n}\r\n\r\n.gdv-app > .gdv-app-frag-ctn,\r\n.gdv-app-frag-ctn > .gdv-fragment {\r\n    width: 100%;\r\n    height: 100%;\r\n}\r\n\r\n.gdv-app-frag-ctn.gdv-overlay {\r\n    position: fixed;\r\n    z-index: 100;\r\n    left: 0;\r\n    width: 100%;\r\n    top: 0;\r\n    bottom: 0;\r\n}\r\n", ""]);



/***/ }),
/* 324 */
/***/ (function(module, exports, __webpack_require__) {


var content = __webpack_require__(325);

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) {}

/***/ }),
/* 325 */
/***/ (function(module, exports, __webpack_require__) {

exports = module.exports = __webpack_require__(4)(false);
// Module
exports.push([module.i, ".gdv-main-frag {\r\n    position: relative;\r\n    overflow: hidden;\r\n}\r\n\r\n.gdv-main-frag-contact-list {\r\n    height: calc(100% - 3em);\r\n}", ""]);



/***/ }),
/* 326 */
/***/ (function(module, exports, __webpack_require__) {


var content = __webpack_require__(327);

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) {}

/***/ }),
/* 327 */
/***/ (function(module, exports, __webpack_require__) {

exports = module.exports = __webpack_require__(4)(false);
// Module
exports.push([module.i, ".gdv-contact-item {\r\n    position: relative;\r\n    border-bottom: solid 1px #dddddd;\r\n    padding: 0.3em 6em 0.3em 0.3em;\r\n}\r\n\r\n.gdv-contact-item-name {\r\n    font-size: 1.5em;\r\n}\r\n\r\n.gdv-contact-item-status {\r\n    color: gray;\r\n}\r\n\r\n.gdv-contact-item.gdv-online .gdv-contact-item-status {\r\n    color: #3c9ef5;\r\n}\r\n\r\n.gdv-contact-item-voice-btn,\r\n.gdv-contact-item-video-btn {\r\n    position: absolute;\r\n    width: 2.5em;\r\n    height: 2.5em;\r\n    font-size: inherit;\r\n    padding: 0;\r\n    border: none;\r\n    top: calc(50% - 1.25em);\r\n    background-color: transparent;\r\n    color: darkcyan;\r\n    outline: none;\r\n}\r\n\r\n.gdv-contact-item-voice-btn:active,\r\n.gdv-contact-item-video-btn:active{\r\n    color: #12dddd;\r\n}\r\n\r\n.gdv-contact-item-video-btn{\r\n    right: 1em;\r\n}\r\n\r\n.gdv-contact-item-voice-btn{\r\n    right: 4em;\r\n}\r\n\r\n\r\n.gdv-contact-item-voice-btn span,\r\n.gdv-contact-item-video-btn span {\r\n    font-size: 2em;\r\n}\r\n\r\n.gdv-contact-item:not(.gdv-online) .gdv-contact-item-voice-btn,\r\n.gdv-contact-item:not(.gdv-online) .gdv-contact-item-video-btn{\r\n    pointer-events: none;\r\n    color: rgb(200, 200, 200);\r\n}\r\n", ""]);



/***/ }),
/* 328 */
/***/ (function(module, exports, __webpack_require__) {

exports = module.exports = __webpack_require__(4)(false);
// Module
exports.push([module.i, ".gdv-income-frag,\r\n.gdv-outgoing-frag {\r\n    position: relative;\r\n    /*position: fixed;*/\r\n    /*z-index: 100;*/\r\n    /*left: 0;*/\r\n    /*right: 0;*/\r\n    /*top: 0;*/\r\n    /*bottom: 0;*/\r\n    font-family: \"Helvetica Neue\", Arial, Helvetica, sans-serif;\r\n    background-color: white;\r\n}\r\n\r\n.gdv-income-frag-info {\r\n    position: absolute;\r\n    left: 5%;\r\n    right: 5%;\r\n    top: 2em;\r\n}\r\n\r\n.gdv-income-frag-name {\r\n    font-size: 2.5em;\r\n}\r\n\r\n.gdv-income-frag-type {\r\n    color: rgb(120, 120, 120);\r\n}\r\n\r\n.gdv-income-frag-button-ctn {\r\n    position: absolute;\r\n    left: calc(25% - 2.5em);\r\n    right: calc(25% - 2.5em);\r\n    bottom: calc(7em - 2.5em);\r\n}\r\n\r\n.gdv-outgoing-frag-button-ctn {\r\n    position: absolute;\r\n    left: calc(50% - 2.5em);\r\n    right: calc(50% - 2.5em);\r\n    bottom: calc(7em - 2.5em);\r\n    text-align: center;\r\n}\r\n\r\n\r\n.gdv-income-frag-action-btn {\r\n    padding: 0;\r\n    font-size: inherit;\r\n    border: none;\r\n    outline: none;\r\n    border-radius: 50%;\r\n    width: 5em;\r\n    height: 5em;\r\n    color: white;\r\n    box-shadow: 2px 2px 3px rgba(0, 0, 0, 0.4);\r\n}\r\n\r\n.gdv-income-frag-action-btn:active {\r\n    box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);\r\n}\r\n\r\n.gdv-income-frag-action-btn:disabled {\r\n    background-color: darkgray;\r\n    pointer-events: none;\r\n}\r\n\r\n.gdv-income-frag-action-btn span {\r\n    font-size: 2.5em;\r\n}\r\n\r\n.gdv-income-frag-action-btn:last-child {\r\n    float: right;\r\n}\r\n\r\n.gdv-income-frag-hangup-btn,\r\n.gdv-outgoing-frag-cancel-btn {\r\n    background-color: #d01c1c;\r\n}\r\n\r\n\r\n.gdv-income-frag-answer-btn {\r\n    background-color: #36be36;\r\n}", ""]);



/***/ }),
/* 329 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
/* WEBPACK VAR INJECTION */(function(process, global) {

/**
 * Module dependencies
 */
var EventEmitter = __webpack_require__(25).EventEmitter
var Store = __webpack_require__(75)
var mqttPacket = __webpack_require__(337)
var Writable = __webpack_require__(23).Writable
var inherits = __webpack_require__(21)
var reInterval = __webpack_require__(344)
var validations = __webpack_require__(345)
var xtend = __webpack_require__(44)
var debug = __webpack_require__(8)('mqttjs:client')
var nextTick = process ? process.nextTick : function (callback) { setTimeout(callback, 0) }
var setImmediate = global.setImmediate || function (callback) {
  // works in node v0.8
  nextTick(callback)
}
var defaultConnectOptions = {
  keepalive: 60,
  reschedulePings: true,
  protocolId: 'MQTT',
  protocolVersion: 4,
  reconnectPeriod: 1000,
  connectTimeout: 30 * 1000,
  clean: true,
  resubscribe: true
}

var socketErrors = [
  'ECONNREFUSED',
  'EADDRINUSE',
  'ECONNRESET',
  'ENOTFOUND'
]

// Other Socket Errors: EADDRINUSE, ECONNRESET, ENOTFOUND.

var errors = {
  0: '',
  1: 'Unacceptable protocol version',
  2: 'Identifier rejected',
  3: 'Server unavailable',
  4: 'Bad username or password',
  5: 'Not authorized',
  16: 'No matching subscribers',
  17: 'No subscription existed',
  128: 'Unspecified error',
  129: 'Malformed Packet',
  130: 'Protocol Error',
  131: 'Implementation specific error',
  132: 'Unsupported Protocol Version',
  133: 'Client Identifier not valid',
  134: 'Bad User Name or Password',
  135: 'Not authorized',
  136: 'Server unavailable',
  137: 'Server busy',
  138: 'Banned',
  139: 'Server shutting down',
  140: 'Bad authentication method',
  141: 'Keep Alive timeout',
  142: 'Session taken over',
  143: 'Topic Filter invalid',
  144: 'Topic Name invalid',
  145: 'Packet identifier in use',
  146: 'Packet Identifier not found',
  147: 'Receive Maximum exceeded',
  148: 'Topic Alias invalid',
  149: 'Packet too large',
  150: 'Message rate too high',
  151: 'Quota exceeded',
  152: 'Administrative action',
  153: 'Payload format invalid',
  154: 'Retain not supported',
  155: 'QoS not supported',
  156: 'Use another server',
  157: 'Server moved',
  158: 'Shared Subscriptions not supported',
  159: 'Connection rate exceeded',
  160: 'Maximum connect time',
  161: 'Subscription Identifiers not supported',
  162: 'Wildcard Subscriptions not supported'
}

function defaultId () {
  return 'mqttjs_' + Math.random().toString(16).substr(2, 8)
}

function sendPacket (client, packet, cb) {
  debug('sendPacket :: packet: %O', packet)
  debug('sendPacket :: emitting `packetsend`')
  client.emit('packetsend', packet)

  debug('sendPacket :: writing to stream')
  var result = mqttPacket.writeToStream(packet, client.stream, client.options)
  debug('sendPacket :: writeToStream result %s', result)
  if (!result && cb) {
    debug('sendPacket :: handle events on `drain` once through callback.')
    client.stream.once('drain', cb)
  } else if (cb) {
    debug('sendPacket :: invoking cb')
    cb()
  }
}

function flush (queue) {
  if (queue) {
    debug('flush: queue exists? %b', !!(queue))
    Object.keys(queue).forEach(function (messageId) {
      if (typeof queue[messageId].cb === 'function') {
        queue[messageId].cb(new Error('Connection closed'))
        delete queue[messageId]
      }
    })
  }
}

function flushVolatile (queue) {
  if (queue) {
    debug('flushVolatile :: deleting volatile messages from the queue and setting their callbacks as error function')
    Object.keys(queue).forEach(function (messageId) {
      if (queue[messageId].volatile && typeof queue[messageId].cb === 'function') {
        queue[messageId].cb(new Error('Connection closed'))
        delete queue[messageId]
      }
    })
  }
}

function storeAndSend (client, packet, cb, cbStorePut) {
  debug('storeAndSend :: store packet with cmd %s to outgoingStore', packet.cmd)
  client.outgoingStore.put(packet, function storedPacket (err) {
    if (err) {
      return cb && cb(err)
    }
    cbStorePut()
    sendPacket(client, packet, cb)
  })
}

function nop (error) {
  debug('nop ::', error)
}

/**
 * MqttClient constructor
 *
 * @param {Stream} stream - stream
 * @param {Object} [options] - connection options
 * (see Connection#connect)
 */
function MqttClient (streamBuilder, options) {
  var k
  var that = this

  if (!(this instanceof MqttClient)) {
    return new MqttClient(streamBuilder, options)
  }

  this.options = options || {}

  // Defaults
  for (k in defaultConnectOptions) {
    if (typeof this.options[k] === 'undefined') {
      this.options[k] = defaultConnectOptions[k]
    } else {
      this.options[k] = options[k]
    }
  }

  debug('MqttClient :: options.protocol', options.protocol)
  debug('MqttClient :: options.protocolVersion', options.protocolVersion)
  debug('MqttClient :: options.username', options.username)
  debug('MqttClient :: options.keepalive', options.keepalive)
  debug('MqttClient :: options.reconnectPeriod', options.reconnectPeriod)
  debug('MqttClient :: options.rejectUnauthorized', options.rejectUnauthorized)

  this.options.clientId = (typeof options.clientId === 'string') ? options.clientId : defaultId()

  debug('MqttClient :: clientId', this.options.clientId)

  this.options.customHandleAcks = (options.protocolVersion === 5 && options.customHandleAcks) ? options.customHandleAcks : function () { arguments[3](0) }

  this.streamBuilder = streamBuilder

  // Inflight message storages
  this.outgoingStore = options.outgoingStore || new Store()
  this.incomingStore = options.incomingStore || new Store()

  // Should QoS zero messages be queued when the connection is broken?
  this.queueQoSZero = options.queueQoSZero === undefined ? true : options.queueQoSZero

  // map of subscribed topics to support reconnection
  this._resubscribeTopics = {}

  // map of a subscribe messageId and a topic
  this.messageIdToTopic = {}

  // Ping timer, setup in _setupPingTimer
  this.pingTimer = null
  // Is the client connected?
  this.connected = false
  // Are we disconnecting?
  this.disconnecting = false
  // Packet queue
  this.queue = []
  // connack timer
  this.connackTimer = null
  // Reconnect timer
  this.reconnectTimer = null
  // Is processing store?
  this._storeProcessing = false
  // Packet Ids are put into the store during store processing
  this._packetIdsDuringStoreProcessing = {}
  /**
   * MessageIDs starting with 1
   * ensure that nextId is min. 1, see https://github.com/mqttjs/MQTT.js/issues/810
   */
  this.nextId = Math.max(1, Math.floor(Math.random() * 65535))

  // Inflight callbacks
  this.outgoing = {}

  // True if connection is first time.
  this._firstConnection = true

  // Send queued packets
  this.on('connect', function () {
    var queue = this.queue

    function deliver () {
      var entry = queue.shift()
      debug('deliver :: entry %o', entry)
      var packet = null

      if (!entry) {
        return
      }

      packet = entry.packet
      debug('deliver :: call _sendPacket for %o', packet)
      that._sendPacket(
        packet,
        function (err) {
          if (entry.cb) {
            entry.cb(err)
          }
          deliver()
        }
      )
    }

    debug('connect :: sending queued packets')
    deliver()
  })

  this.on('close', function () {
    debug('close :: connected set to `false`')
    this.connected = false

    debug('close :: clearing connackTimer')
    clearTimeout(this.connackTimer)

    debug('close :: clearing ping timer')
    if (that.pingTimer !== null) {
      that.pingTimer.clear()
      that.pingTimer = null
    }

    debug('close :: calling _setupReconnect')
    this._setupReconnect()
  })
  EventEmitter.call(this)

  debug('MqttClient :: setting up stream')
  this._setupStream()
}
inherits(MqttClient, EventEmitter)

/**
 * setup the event handlers in the inner stream.
 *
 * @api private
 */
MqttClient.prototype._setupStream = function () {
  var connectPacket
  var that = this
  var writable = new Writable()
  var parser = mqttPacket.parser(this.options)
  var completeParse = null
  var packets = []

  debug('_setupStream :: calling method to clear reconnect')
  this._clearReconnect()

  debug('_setupStream :: using streamBuilder provided to client to create stream')
  this.stream = this.streamBuilder(this)

  parser.on('packet', function (packet) {
    debug('parser :: on packet push to packets array.')
    packets.push(packet)
  })

  function nextTickWork () {
    if (packets.length) {
      nextTick(work)
    } else {
      var done = completeParse
      completeParse = null
      done()
    }
  }

  function work () {
    debug('work :: getting next packet in queue')
    var packet = packets.shift()

    if (packet) {
      debug('work :: packet pulled from queue')
      that._handlePacket(packet, nextTickWork)
    } else {
      debug('work :: no packets in queue')
      var done = completeParse
      completeParse = null
      debug('work :: done flag is %s', !!(done))
      if (done) done()
    }
  }

  writable._write = function (buf, enc, done) {
    completeParse = done
    debug('writable stream :: parsing buffer')
    parser.parse(buf)
    work()
  }

  function streamErrorHandler (error) {
    debug('streamErrorHandler :: error', error.message)
    if (socketErrors.includes(error.code)) {
      // handle error
      debug('streamErrorHandler :: emitting error')
      that.emit('error', error)
    } else {
      nop(error)
    }
  }

  debug('_setupStream :: pipe stream to writable stream')
  this.stream.pipe(writable)

  // Suppress connection errors
  this.stream.on('error', streamErrorHandler)

  // Echo stream close
  this.stream.on('close', function () {
    debug('(%s)stream :: on close', that.options.clientId)
    flushVolatile(that.outgoing)
    debug('stream: emit close to MqttClient')
    that.emit('close')
  })

  // Send a connect packet
  debug('_setupStream: sending packet `connect`')
  connectPacket = Object.create(this.options)
  connectPacket.cmd = 'connect'
  // avoid message queue
  sendPacket(this, connectPacket)

  // Echo connection errors
  parser.on('error', this.emit.bind(this, 'error'))

  // auth
  if (this.options.properties) {
    if (!this.options.properties.authenticationMethod && this.options.properties.authenticationData) {
      that.end(() =>
        this.emit('error', new Error('Packet has no Authentication Method')
        ))
      return this
    }
    if (this.options.properties.authenticationMethod && this.options.authPacket && typeof this.options.authPacket === 'object') {
      var authPacket = xtend({cmd: 'auth', reasonCode: 0}, this.options.authPacket)
      sendPacket(this, authPacket)
    }
  }

  // many drain listeners are needed for qos 1 callbacks if the connection is intermittent
  this.stream.setMaxListeners(1000)

  clearTimeout(this.connackTimer)
  this.connackTimer = setTimeout(function () {
    debug('!!connectTimeout hit!! Calling _cleanUp with force `true`')
    that._cleanUp(true)
  }, this.options.connectTimeout)
}

MqttClient.prototype._handlePacket = function (packet, done) {
  var options = this.options

  if (options.protocolVersion === 5 && options.properties && options.properties.maximumPacketSize && options.properties.maximumPacketSize < packet.length) {
    this.emit('error', new Error('exceeding packets size ' + packet.cmd))
    this.end({reasonCode: 149, properties: { reasonString: 'Maximum packet size was exceeded' }})
    return this
  }
  debug('_handlePacket :: emitting packetreceive')
  this.emit('packetreceive', packet)

  switch (packet.cmd) {
    case 'publish':
      this._handlePublish(packet, done)
      break
    case 'puback':
    case 'pubrec':
    case 'pubcomp':
    case 'suback':
    case 'unsuback':
      this._handleAck(packet)
      done()
      break
    case 'pubrel':
      this._handlePubrel(packet, done)
      break
    case 'connack':
      this._handleConnack(packet)
      done()
      break
    case 'pingresp':
      this._handlePingresp(packet)
      done()
      break
    case 'disconnect':
      this._handleDisconnect(packet)
      done()
      break
    default:
      // do nothing
      // maybe we should do an error handling
      // or just log it
      break
  }
}

MqttClient.prototype._checkDisconnecting = function (callback) {
  if (this.disconnecting) {
    if (callback) {
      callback(new Error('client disconnecting'))
    } else {
      this.emit('error', new Error('client disconnecting'))
    }
  }
  return this.disconnecting
}

/**
 * publish - publish <message> to <topic>
 *
 * @param {String} topic - topic to publish to
 * @param {String, Buffer} message - message to publish
 * @param {Object} [opts] - publish options, includes:
 *    {Number} qos - qos level to publish on
 *    {Boolean} retain - whether or not to retain the message
 *    {Boolean} dup - whether or not mark a message as duplicate
 *    {Function} cbStorePut - function(){} called when message is put into `outgoingStore`
 * @param {Function} [callback] - function(err){}
 *    called when publish succeeds or fails
 * @returns {MqttClient} this - for chaining
 * @api public
 *
 * @example client.publish('topic', 'message');
 * @example
 *     client.publish('topic', 'message', {qos: 1, retain: true, dup: true});
 * @example client.publish('topic', 'message', console.log);
 */
MqttClient.prototype.publish = function (topic, message, opts, callback) {
  debug('publish :: message `%s` to topic `%s`', message, topic)
  var packet
  var options = this.options

  // .publish(topic, payload, cb);
  if (typeof opts === 'function') {
    callback = opts
    opts = null
  }

  // default opts
  var defaultOpts = {qos: 0, retain: false, dup: false}
  opts = xtend(defaultOpts, opts)

  if (this._checkDisconnecting(callback)) {
    return this
  }

  packet = {
    cmd: 'publish',
    topic: topic,
    payload: message,
    qos: opts.qos,
    retain: opts.retain,
    messageId: this._nextId(),
    dup: opts.dup
  }

  if (options.protocolVersion === 5) {
    packet.properties = opts.properties
    if ((!options.properties && packet.properties && packet.properties.topicAlias) || ((opts.properties && options.properties) &&
      ((opts.properties.topicAlias && options.properties.topicAliasMaximum && opts.properties.topicAlias > options.properties.topicAliasMaximum) ||
        (!options.properties.topicAliasMaximum && opts.properties.topicAlias)))) {
      /*
      if we are don`t setup topic alias or
      topic alias maximum less than topic alias or
      server don`t give topic alias maximum,
      we are removing topic alias from packet
      */
      delete packet.properties.topicAlias
    }
  }

  debug('publish :: qos', opts.qos)
  switch (opts.qos) {
    case 1:
    case 2:
      // Add to callbacks
      this.outgoing[packet.messageId] = {
        volatile: false,
        cb: callback || nop
      }
      if (this._storeProcessing) {
        debug('_storeProcessing enabled')
        this._packetIdsDuringStoreProcessing[packet.messageId] = false
        this._storePacket(packet, undefined, opts.cbStorePut)
      } else {
        debug('MqttClient:publish: packet cmd: %s', packet.cmd)
        this._sendPacket(packet, undefined, opts.cbStorePut)
      }
      break
    default:
      if (this._storeProcessing) {
        debug('_storeProcessing enabled')
        this._storePacket(packet, callback, opts.cbStorePut)
      } else {
        debug('MqttClient:publish: packet cmd: %s', packet.cmd)
        this._sendPacket(packet, callback, opts.cbStorePut)
      }
      break
  }

  return this
}

/**
 * subscribe - subscribe to <topic>
 *
 * @param {String, Array, Object} topic - topic(s) to subscribe to, supports objects in the form {'topic': qos}
 * @param {Object} [opts] - optional subscription options, includes:
 *    {Number} qos - subscribe qos level
 * @param {Function} [callback] - function(err, granted){} where:
 *    {Error} err - subscription error (none at the moment!)
 *    {Array} granted - array of {topic: 't', qos: 0}
 * @returns {MqttClient} this - for chaining
 * @api public
 * @example client.subscribe('topic');
 * @example client.subscribe('topic', {qos: 1});
 * @example client.subscribe({'topic': {qos: 0}, 'topic2': {qos: 1}}, console.log);
 * @example client.subscribe('topic', console.log);
 */
MqttClient.prototype.subscribe = function () {
  var packet
  var args = new Array(arguments.length)
  for (var i = 0; i < arguments.length; i++) {
    args[i] = arguments[i]
  }
  var subs = []
  var obj = args.shift()
  var resubscribe = obj.resubscribe
  var callback = args.pop() || nop
  var opts = args.pop()
  var invalidTopic
  var that = this
  var version = this.options.protocolVersion

  delete obj.resubscribe

  if (typeof obj === 'string') {
    obj = [obj]
  }

  if (typeof callback !== 'function') {
    opts = callback
    callback = nop
  }

  invalidTopic = validations.validateTopics(obj)
  if (invalidTopic !== null) {
    setImmediate(callback, new Error('Invalid topic ' + invalidTopic))
    return this
  }

  if (this._checkDisconnecting(callback)) {
    debug('subscribe: discconecting true')
    return this
  }

  var defaultOpts = {
    qos: 0
  }
  if (version === 5) {
    defaultOpts.nl = false
    defaultOpts.rap = false
    defaultOpts.rh = 0
  }
  opts = xtend(defaultOpts, opts)

  if (Array.isArray(obj)) {
    obj.forEach(function (topic) {
      debug('subscribe: array topic %s', topic)
      if (!that._resubscribeTopics.hasOwnProperty(topic) ||
        that._resubscribeTopics[topic].qos < opts.qos ||
          resubscribe) {
        var currentOpts = {
          topic: topic,
          qos: opts.qos
        }
        if (version === 5) {
          currentOpts.nl = opts.nl
          currentOpts.rap = opts.rap
          currentOpts.rh = opts.rh
          currentOpts.properties = opts.properties
        }
        debug('subscribe: pushing topic `%s` and qos `%s` to subs list', currentOpts.topic, currentOpts.qos)
        subs.push(currentOpts)
      }
    })
  } else {
    Object
      .keys(obj)
      .forEach(function (k) {
        debug('subscribe: object topic %s', k)
        if (!that._resubscribeTopics.hasOwnProperty(k) ||
          that._resubscribeTopics[k].qos < obj[k].qos ||
            resubscribe) {
          var currentOpts = {
            topic: k,
            qos: obj[k].qos
          }
          if (version === 5) {
            currentOpts.nl = obj[k].nl
            currentOpts.rap = obj[k].rap
            currentOpts.rh = obj[k].rh
            currentOpts.properties = opts.properties
          }
          debug('subscribe: pushing `%s` to subs list', currentOpts)
          subs.push(currentOpts)
        }
      })
  }

  packet = {
    cmd: 'subscribe',
    subscriptions: subs,
    qos: 1,
    retain: false,
    dup: false,
    messageId: this._nextId()
  }

  if (opts.properties) {
    packet.properties = opts.properties
  }

  if (!subs.length) {
    callback(null, [])
    return
  }

  // subscriptions to resubscribe to in case of disconnect
  if (this.options.resubscribe) {
    debug('subscribe :: resubscribe true')
    var topics = []
    subs.forEach(function (sub) {
      if (that.options.reconnectPeriod > 0) {
        var topic = { qos: sub.qos }
        if (version === 5) {
          topic.nl = sub.nl || false
          topic.rap = sub.rap || false
          topic.rh = sub.rh || 0
          topic.properties = sub.properties
        }
        that._resubscribeTopics[sub.topic] = topic
        topics.push(sub.topic)
      }
    })
    that.messageIdToTopic[packet.messageId] = topics
  }

  this.outgoing[packet.messageId] = {
    volatile: true,
    cb: function (err, packet) {
      if (!err) {
        var granted = packet.granted
        for (var i = 0; i < granted.length; i += 1) {
          subs[i].qos = granted[i]
        }
      }

      callback(err, subs)
    }
  }
  debug('subscribe :: call _sendPacket')
  this._sendPacket(packet)

  return this
}

/**
 * unsubscribe - unsubscribe from topic(s)
 *
 * @param {String, Array} topic - topics to unsubscribe from
 * @param {Object} [opts] - optional subscription options, includes:
 *    {Object} properties - properties of unsubscribe packet
 * @param {Function} [callback] - callback fired on unsuback
 * @returns {MqttClient} this - for chaining
 * @api public
 * @example client.unsubscribe('topic');
 * @example client.unsubscribe('topic', console.log);
 */
MqttClient.prototype.unsubscribe = function () {
  var packet = {
    cmd: 'unsubscribe',
    qos: 1,
    messageId: this._nextId()
  }
  var that = this
  var args = new Array(arguments.length)
  for (var i = 0; i < arguments.length; i++) {
    args[i] = arguments[i]
  }
  var topic = args.shift()
  var callback = args.pop() || nop
  var opts = args.pop()

  if (typeof topic === 'string') {
    topic = [topic]
  }

  if (typeof callback !== 'function') {
    opts = callback
    callback = nop
  }

  if (this._checkDisconnecting(callback)) {
    return this
  }

  if (typeof topic === 'string') {
    packet.unsubscriptions = [topic]
  } else if (Array.isArray(topic)) {
    packet.unsubscriptions = topic
  }

  if (this.options.resubscribe) {
    packet.unsubscriptions.forEach(function (topic) {
      delete that._resubscribeTopics[topic]
    })
  }

  if (typeof opts === 'object' && opts.properties) {
    packet.properties = opts.properties
  }

  this.outgoing[packet.messageId] = {
    volatile: true,
    cb: callback
  }

  debug('unsubscribe: call _sendPacket')
  this._sendPacket(packet)

  return this
}

/**
 * end - close connection
 *
 * @returns {MqttClient} this - for chaining
 * @param {Boolean} force - do not wait for all in-flight messages to be acked
 * @param {Object} opts - added to the disconnect packet
 * @param {Function} cb - called when the client has been closed
 *
 * @api public
 */
MqttClient.prototype.end = function (force, opts, cb) {
  var that = this

  debug('end :: (%s)', this.options.clientId)

  if (force == null || typeof force !== 'boolean') {
    cb = opts || nop
    opts = force
    force = false
    if (typeof opts !== 'object') {
      cb = opts
      opts = null
      if (typeof cb !== 'function') {
        cb = nop
      }
    }
  }

  if (typeof opts !== 'object') {
    cb = opts
    opts = null
  }

  debug('end :: cb? %s', !!cb)
  cb = cb || nop

  function closeStores () {
    debug('end :: closeStores: closing incoming and outgoing stores')
    that.disconnected = true
    that.incomingStore.close(function (e1) {
      that.outgoingStore.close(function (e2) {
        debug('end :: closeStores: emitting end')
        that.emit('end')
        if (cb) {
          let err = e1 || e2
          debug('end :: closeStores: invoking callback with args')
          cb(err)
        }
      })
    })
    if (that._deferredReconnect) {
      that._deferredReconnect()
    }
  }

  function finish () {
    // defer closesStores of an I/O cycle,
    // just to make sure things are
    // ok for websockets
    debug('end :: (%s) :: finish :: calling _cleanUp with force %s', that.options.clientId, force)
    that._cleanUp(force, () => {
      debug('end :: finish :: calling process.nextTick on closeStores')
      // var boundProcess = nextTick.bind(null, closeStores)
      nextTick(closeStores.bind(that))
    }, opts)
  }

  if (this.disconnecting) {
    cb()
    return this
  }

  this._clearReconnect()

  this.disconnecting = true

  if (!force && Object.keys(this.outgoing).length > 0) {
    // wait 10ms, just to be sure we received all of it
    debug('end :: (%s) :: calling finish in 10ms once outgoing is empty', that.options.clientId)
    this.once('outgoingEmpty', setTimeout.bind(null, finish, 10))
  } else {
    debug('end :: (%s) :: immediately calling finish', that.options.clientId)
    finish()
  }

  return this
}

/**
 * removeOutgoingMessage - remove a message in outgoing store
 * the outgoing callback will be called withe Error('Message removed') if the message is removed
 *
 * @param {Number} messageId - messageId to remove message
 * @returns {MqttClient} this - for chaining
 * @api public
 *
 * @example client.removeOutgoingMessage(client.getLastMessageId());
 */
MqttClient.prototype.removeOutgoingMessage = function (messageId) {
  var cb = this.outgoing[messageId] ? this.outgoing[messageId].cb : null
  delete this.outgoing[messageId]
  this.outgoingStore.del({messageId: messageId}, function () {
    cb(new Error('Message removed'))
  })
  return this
}

/**
 * reconnect - connect again using the same options as connect()
 *
 * @param {Object} [opts] - optional reconnect options, includes:
 *    {Store} incomingStore - a store for the incoming packets
 *    {Store} outgoingStore - a store for the outgoing packets
 *    if opts is not given, current stores are used
 * @returns {MqttClient} this - for chaining
 *
 * @api public
 */
MqttClient.prototype.reconnect = function (opts) {
  debug('client reconnect')
  var that = this
  var f = function () {
    if (opts) {
      that.options.incomingStore = opts.incomingStore
      that.options.outgoingStore = opts.outgoingStore
    } else {
      that.options.incomingStore = null
      that.options.outgoingStore = null
    }
    that.incomingStore = that.options.incomingStore || new Store()
    that.outgoingStore = that.options.outgoingStore || new Store()
    that.disconnecting = false
    that.disconnected = false
    that._deferredReconnect = null
    that._reconnect()
  }

  if (this.disconnecting && !this.disconnected) {
    this._deferredReconnect = f
  } else {
    f()
  }
  return this
}

/**
 * _reconnect - implement reconnection
 * @api privateish
 */
MqttClient.prototype._reconnect = function () {
  debug('_reconnect: emitting reconnect to client')
  this.emit('reconnect')
  if (this.connected) {
    this.end(() => { this._setupStream() })
    debug('client already connected. disconnecting first.')
  } else {
    debug('_reconnect: calling _setupStream')
    this._setupStream()
  }
}

/**
 * _setupReconnect - setup reconnect timer
 */
MqttClient.prototype._setupReconnect = function () {
  var that = this

  if (!that.disconnecting && !that.reconnectTimer && (that.options.reconnectPeriod > 0)) {
    if (!this.reconnecting) {
      debug('_setupReconnect :: emit `offline` state')
      this.emit('offline')
      debug('_setupReconnect :: set `reconnecting` to `true`')
      this.reconnecting = true
    }
    debug('_setupReconnect :: setting reconnectTimer for %d ms', that.options.reconnectPeriod)
    that.reconnectTimer = setInterval(function () {
      debug('reconnectTimer :: reconnect triggered!')
      that._reconnect()
    }, that.options.reconnectPeriod)
  } else {
    debug('_setupReconnect :: doing nothing...')
  }
}

/**
 * _clearReconnect - clear the reconnect timer
 */
MqttClient.prototype._clearReconnect = function () {
  debug('_clearReconnect : clearing reconnect timer')
  if (this.reconnectTimer) {
    clearInterval(this.reconnectTimer)
    this.reconnectTimer = null
  }
}

/**
 * _cleanUp - clean up on connection end
 * @api private
 */
MqttClient.prototype._cleanUp = function (forced, done) {
  var opts = arguments[2]
  if (done) {
    debug('_cleanUp :: done callback provided for on stream close')
    this.stream.on('close', done)
  }

  debug('_cleanUp :: forced? %s', forced)
  if (forced) {
    if ((this.options.reconnectPeriod === 0) && this.options.clean) {
      flush(this.outgoing)
    }
    debug('_cleanUp :: (%s) :: destroying stream', this.options.clientId)
    this.stream.destroy()
  } else {
    var packet = xtend({ cmd: 'disconnect' }, opts)
    debug('_cleanUp :: (%s) :: call _sendPacket with disconnect packet', this.options.clientId)
    this._sendPacket(
      packet,
      setImmediate.bind(
        null,
        this.stream.end.bind(this.stream)
      )
    )
  }

  if (!this.disconnecting) {
    debug('_cleanUp :: client not disconnecting. Clearing and resetting reconnect.')
    this._clearReconnect()
    this._setupReconnect()
  }

  if (this.pingTimer !== null) {
    debug('_cleanUp :: clearing pingTimer')
    this.pingTimer.clear()
    this.pingTimer = null
  }

  if (done && !this.connected) {
    debug('_cleanUp :: (%s) :: removing stream `done` callback `close` listener', this.options.clientId)
    this.stream.removeListener('close', done)
    done()
  }
}

/**
 * _sendPacket - send or queue a packet
 * @param {Object} packet - packet options
 * @param {Function} cb - callback when the packet is sent
 * @param {Function} cbStorePut - called when message is put into outgoingStore
 * @api private
 */
MqttClient.prototype._sendPacket = function (packet, cb, cbStorePut) {
  debug('_sendPacket :: (%s) ::  start', this.options.clientId)
  cbStorePut = cbStorePut || nop

  if (!this.connected) {
    debug('_sendPacket :: client not connected. Storing packet offline.')
    this._storePacket(packet, cb, cbStorePut)
    return
  }

  // When sending a packet, reschedule the ping timer
  this._shiftPingInterval()

  switch (packet.cmd) {
    case 'publish':
      break
    case 'pubrel':
      storeAndSend(this, packet, cb, cbStorePut)
      return
    default:
      sendPacket(this, packet, cb)
      return
  }

  switch (packet.qos) {
    case 2:
    case 1:
      storeAndSend(this, packet, cb, cbStorePut)
      break
    /**
     * no need of case here since it will be caught by default
     * and jshint comply that before default it must be a break
     * anyway it will result in -1 evaluation
     */
    case 0:
      /* falls through */
    default:
      sendPacket(this, packet, cb)
      break
  }
  debug('_sendPacket :: (%s) ::  end', this.options.clientId)
}

/**
 * _storePacket - queue a packet
 * @param {Object} packet - packet options
 * @param {Function} cb - callback when the packet is sent
 * @param {Function} cbStorePut - called when message is put into outgoingStore
 * @api private
 */
MqttClient.prototype._storePacket = function (packet, cb, cbStorePut) {
  debug('_storePacket :: packet: %o', packet)
  debug('_storePacket :: cb? %s', !!cb)
  cbStorePut = cbStorePut || nop

  // check that the packet is not a qos of 0, or that the command is not a publish
  if (((packet.qos || 0) === 0 && this.queueQoSZero) || packet.cmd !== 'publish') {
    this.queue.push({ packet: packet, cb: cb })
  } else if (packet.qos > 0) {
    cb = this.outgoing[packet.messageId] ? this.outgoing[packet.messageId].cb : null
    this.outgoingStore.put(packet, function (err) {
      if (err) {
        return cb && cb(err)
      }
      cbStorePut()
    })
  } else if (cb) {
    cb(new Error('No connection to broker'))
  }
}

/**
 * _setupPingTimer - setup the ping timer
 *
 * @api private
 */
MqttClient.prototype._setupPingTimer = function () {
  debug('_setupPingTimer :: keepalive %d (seconds)', this.options.keepalive)
  var that = this

  if (!this.pingTimer && this.options.keepalive) {
    this.pingResp = true
    this.pingTimer = reInterval(function () {
      that._checkPing()
    }, this.options.keepalive * 1000)
  }
}

/**
 * _shiftPingInterval - reschedule the ping interval
 *
 * @api private
 */
MqttClient.prototype._shiftPingInterval = function () {
  if (this.pingTimer && this.options.keepalive && this.options.reschedulePings) {
    this.pingTimer.reschedule(this.options.keepalive * 1000)
  }
}
/**
 * _checkPing - check if a pingresp has come back, and ping the server again
 *
 * @api private
 */
MqttClient.prototype._checkPing = function () {
  debug('_checkPing :: checking ping...')
  if (this.pingResp) {
    debug('_checkPing :: ping response received. Clearing flag and sending `pingreq`')
    this.pingResp = false
    this._sendPacket({ cmd: 'pingreq' })
  } else {
    // do a forced cleanup since socket will be in bad shape
    debug('_checkPing :: calling _cleanUp with force true')
    this._cleanUp(true)
  }
}

/**
 * _handlePingresp - handle a pingresp
 *
 * @api private
 */
MqttClient.prototype._handlePingresp = function () {
  this.pingResp = true
}

/**
 * _handleConnack
 *
 * @param {Object} packet
 * @api private
 */
MqttClient.prototype._handleConnack = function (packet) {
  debug('_handleConnack')
  var options = this.options
  var version = options.protocolVersion
  var rc = version === 5 ? packet.reasonCode : packet.returnCode

  clearTimeout(this.connackTimer)

  if (packet.properties) {
    if (packet.properties.topicAliasMaximum) {
      if (!options.properties) { options.properties = {} }
      options.properties.topicAliasMaximum = packet.properties.topicAliasMaximum
    }
    if (packet.properties.serverKeepAlive && options.keepalive) {
      options.keepalive = packet.properties.serverKeepAlive
      this._shiftPingInterval()
    }
    if (packet.properties.maximumPacketSize) {
      if (!options.properties) { options.properties = {} }
      options.properties.maximumPacketSize = packet.properties.maximumPacketSize
    }
  }

  if (rc === 0) {
    this.reconnecting = false
    this._onConnect(packet)
  } else if (rc > 0) {
    var err = new Error('Connection refused: ' + errors[rc])
    err.code = rc
    this.emit('error', err)
  }
}

/**
 * _handlePublish
 *
 * @param {Object} packet
 * @api private
 */
/*
those late 2 case should be rewrite to comply with coding style:

case 1:
case 0:
  // do not wait sending a puback
  // no callback passed
  if (1 === qos) {
    this._sendPacket({
      cmd: 'puback',
      messageId: messageId
    });
  }
  // emit the message event for both qos 1 and 0
  this.emit('message', topic, message, packet);
  this.handleMessage(packet, done);
  break;
default:
  // do nothing but every switch mus have a default
  // log or throw an error about unknown qos
  break;

for now i just suppressed the warnings
*/
MqttClient.prototype._handlePublish = function (packet, done) {
  debug('_handlePublish: packet %o', packet)
  done = typeof done !== 'undefined' ? done : nop
  var topic = packet.topic.toString()
  var message = packet.payload
  var qos = packet.qos
  var messageId = packet.messageId
  var that = this
  var options = this.options
  var validReasonCodes = [0, 16, 128, 131, 135, 144, 145, 151, 153]
  debug('_handlePublish: qos %d', qos)
  switch (qos) {
    case 2: {
      options.customHandleAcks(topic, message, packet, function (error, code) {
        if (!(error instanceof Error)) {
          code = error
          error = null
        }
        if (error) { return that.emit('error', error) }
        if (validReasonCodes.indexOf(code) === -1) { return that.emit('error', new Error('Wrong reason code for pubrec')) }
        if (code) {
          that._sendPacket({cmd: 'pubrec', messageId: messageId, reasonCode: code}, done)
        } else {
          that.incomingStore.put(packet, function () {
            that._sendPacket({cmd: 'pubrec', messageId: messageId}, done)
          })
        }
      })
      break
    }
    case 1: {
      // emit the message event
      options.customHandleAcks(topic, message, packet, function (error, code) {
        if (!(error instanceof Error)) {
          code = error
          error = null
        }
        if (error) { return that.emit('error', error) }
        if (validReasonCodes.indexOf(code) === -1) { return that.emit('error', new Error('Wrong reason code for puback')) }
        if (!code) { that.emit('message', topic, message, packet) }
        that.handleMessage(packet, function (err) {
          if (err) {
            return done && done(err)
          }
          that._sendPacket({cmd: 'puback', messageId: messageId, reasonCode: code}, done)
        })
      })
      break
    }
    case 0:
      // emit the message event
      this.emit('message', topic, message, packet)
      this.handleMessage(packet, done)
      break
    default:
      // do nothing
      debug('_handlePublish: unknown QoS. Doing nothing.')
      // log or throw an error about unknown qos
      break
  }
}

/**
 * Handle messages with backpressure support, one at a time.
 * Override at will.
 *
 * @param Packet packet the packet
 * @param Function callback call when finished
 * @api public
 */
MqttClient.prototype.handleMessage = function (packet, callback) {
  callback()
}

/**
 * _handleAck
 *
 * @param {Object} packet
 * @api private
 */

MqttClient.prototype._handleAck = function (packet) {
  /* eslint no-fallthrough: "off" */
  var messageId = packet.messageId
  var type = packet.cmd
  var response = null
  var cb = this.outgoing[messageId] ? this.outgoing[messageId].cb : null
  var that = this
  var err

  if (!cb) {
    debug('_handleAck :: Server sent an ack in error. Ignoring.')
    // Server sent an ack in error, ignore it.
    return
  }

  // Process
  debug('_handleAck :: packet type', type)
  switch (type) {
    case 'pubcomp':
      // same thing as puback for QoS 2
    case 'puback':
      var pubackRC = packet.reasonCode
      // Callback - we're done
      if (pubackRC && pubackRC > 0 && pubackRC !== 16) {
        err = new Error('Publish error: ' + errors[pubackRC])
        err.code = pubackRC
        cb(err, packet)
      }
      delete this.outgoing[messageId]
      this.outgoingStore.del(packet, cb)
      break
    case 'pubrec':
      response = {
        cmd: 'pubrel',
        qos: 2,
        messageId: messageId
      }
      var pubrecRC = packet.reasonCode

      if (pubrecRC && pubrecRC > 0 && pubrecRC !== 16) {
        err = new Error('Publish error: ' + errors[pubrecRC])
        err.code = pubrecRC
        cb(err, packet)
      } else {
        this._sendPacket(response)
      }
      break
    case 'suback':
      delete this.outgoing[messageId]
      for (var grantedI = 0; grantedI < packet.granted.length; grantedI++) {
        if ((packet.granted[grantedI] & 0x80) !== 0) {
          // suback with Failure status
          var topics = this.messageIdToTopic[messageId]
          if (topics) {
            topics.forEach(function (topic) {
              delete that._resubscribeTopics[topic]
            })
          }
        }
      }
      cb(null, packet)
      break
    case 'unsuback':
      delete this.outgoing[messageId]
      cb(null)
      break
    default:
      that.emit('error', new Error('unrecognized packet type'))
  }

  if (this.disconnecting &&
      Object.keys(this.outgoing).length === 0) {
    this.emit('outgoingEmpty')
  }
}

/**
 * _handlePubrel
 *
 * @param {Object} packet
 * @api private
 */
MqttClient.prototype._handlePubrel = function (packet, callback) {
  debug('handling pubrel packet')
  callback = typeof callback !== 'undefined' ? callback : nop
  var messageId = packet.messageId
  var that = this

  var comp = {cmd: 'pubcomp', messageId: messageId}

  that.incomingStore.get(packet, function (err, pub) {
    if (!err) {
      that.emit('message', pub.topic, pub.payload, pub)
      that.handleMessage(pub, function (err) {
        if (err) {
          return callback(err)
        }
        that.incomingStore.del(pub, nop)
        that._sendPacket(comp, callback)
      })
    } else {
      that._sendPacket(comp, callback)
    }
  })
}

/**
 * _handleDisconnect
 *
 * @param {Object} packet
 * @api private
 */
MqttClient.prototype._handleDisconnect = function (packet) {
  this.emit('disconnect', packet)
}

/**
 * _nextId
 * @return unsigned int
 */
MqttClient.prototype._nextId = function () {
  // id becomes current state of this.nextId and increments afterwards
  var id = this.nextId++
  // Ensure 16 bit unsigned int (max 65535, nextId got one higher)
  if (this.nextId === 65536) {
    this.nextId = 1
  }
  return id
}

/**
 * getLastMessageId
 * @return unsigned int
 */
MqttClient.prototype.getLastMessageId = function () {
  return (this.nextId === 1) ? 65535 : (this.nextId - 1)
}

/**
 * _resubscribe
 * @api private
 */
MqttClient.prototype._resubscribe = function (connack) {
  debug('_resubscribe')
  var _resubscribeTopicsKeys = Object.keys(this._resubscribeTopics)
  if (!this._firstConnection &&
      (this.options.clean || (this.options.protocolVersion === 5 && !connack.sessionPresent)) &&
      _resubscribeTopicsKeys.length > 0) {
    if (this.options.resubscribe) {
      if (this.options.protocolVersion === 5) {
        debug('_resubscribe: protocolVersion 5')
        for (var topicI = 0; topicI < _resubscribeTopicsKeys.length; topicI++) {
          var resubscribeTopic = {}
          resubscribeTopic[_resubscribeTopicsKeys[topicI]] = this._resubscribeTopics[_resubscribeTopicsKeys[topicI]]
          resubscribeTopic.resubscribe = true
          this.subscribe(resubscribeTopic, {properties: resubscribeTopic[_resubscribeTopicsKeys[topicI]].properties})
        }
      } else {
        this._resubscribeTopics.resubscribe = true
        this.subscribe(this._resubscribeTopics)
      }
    } else {
      this._resubscribeTopics = {}
    }
  }

  this._firstConnection = false
}

/**
 * _onConnect
 *
 * @api private
 */
MqttClient.prototype._onConnect = function (packet) {
  if (this.disconnected) {
    this.emit('connect', packet)
    return
  }

  var that = this

  this._setupPingTimer()
  this._resubscribe(packet)

  this.connected = true

  function startStreamProcess () {
    var outStore = that.outgoingStore.createStream()

    function clearStoreProcessing () {
      that._storeProcessing = false
      that._packetIdsDuringStoreProcessing = {}
    }

    that.once('close', remove)
    outStore.on('error', function (err) {
      clearStoreProcessing()
      that.removeListener('close', remove)
      that.emit('error', err)
    })

    function remove () {
      outStore.destroy()
      outStore = null
      clearStoreProcessing()
    }

    function storeDeliver () {
      // edge case, we wrapped this twice
      if (!outStore) {
        return
      }
      that._storeProcessing = true

      var packet = outStore.read(1)

      var cb

      if (!packet) {
        // read when data is available in the future
        outStore.once('readable', storeDeliver)
        return
      }

      // Skip already processed store packets
      if (that._packetIdsDuringStoreProcessing[packet.messageId]) {
        storeDeliver()
        return
      }

      // Avoid unnecessary stream read operations when disconnected
      if (!that.disconnecting && !that.reconnectTimer) {
        cb = that.outgoing[packet.messageId] ? that.outgoing[packet.messageId].cb : null
        that.outgoing[packet.messageId] = {
          volatile: false,
          cb: function (err, status) {
            // Ensure that the original callback passed in to publish gets invoked
            if (cb) {
              cb(err, status)
            }

            storeDeliver()
          }
        }
        that._packetIdsDuringStoreProcessing[packet.messageId] = true
        that._sendPacket(packet)
      } else if (outStore.destroy) {
        outStore.destroy()
      }
    }

    outStore.on('end', function () {
      var allProcessed = true
      for (var id in that._packetIdsDuringStoreProcessing) {
        if (!that._packetIdsDuringStoreProcessing[id]) {
          allProcessed = false
          break
        }
      }
      if (allProcessed) {
        clearStoreProcessing()
        that.removeListener('close', remove)
        that.emit('connect', packet)
      } else {
        startStreamProcess()
      }
    })
    storeDeliver()
  }
  // start flowing
  startStreamProcess()
}

module.exports = MqttClient

/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(15), __webpack_require__(13)))

/***/ }),
/* 330 */
/***/ (function(module, exports) {

/* (ignored) */

/***/ }),
/* 331 */
/***/ (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__(37).Buffer;
var util = __webpack_require__(332);

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;
  };
}

/***/ }),
/* 332 */
/***/ (function(module, exports) {

/* (ignored) */

/***/ }),
/* 333 */
/***/ (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__(334);
// 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__(13)))

/***/ }),
/* 334 */
/***/ (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__(13), __webpack_require__(15)))

/***/ }),
/* 335 */
/***/ (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__(13)))

/***/ }),
/* 336 */
/***/ (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__(81);

/*<replacement>*/
var util = Object.create(__webpack_require__(31));
util.inherits = __webpack_require__(21);
/*</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);
};

/***/ }),
/* 337 */
/***/ (function(module, exports, __webpack_require__) {

exports.parser = __webpack_require__(338).parser
exports.generate = __webpack_require__(342)
exports.writeToStream = __webpack_require__(83)


/***/ }),
/* 338 */
/***/ (function(module, exports, __webpack_require__) {

const bl = __webpack_require__(339)
const EventEmitter = __webpack_require__(25)
const Packet = __webpack_require__(341)
const constants = __webpack_require__(82)
const debug = __webpack_require__(8)('mqtt-packet:parser')

class Parser extends EventEmitter {
  constructor () {
    super()
    this.parser = this.constructor.parser
  }

  static parser (opt) {
    if (!(this instanceof Parser)) return (new Parser()).parser(opt)

    this.settings = opt || {}

    this._states = [
      '_parseHeader',
      '_parseLength',
      '_parsePayload',
      '_newPacket'
    ]

    this._resetState()
    return this
  }

  _resetState () {
    debug('_resetState: resetting packet, error, _list, and _stateCounter')
    this.packet = new Packet()
    this.error = null
    this._list = bl()
    this._stateCounter = 0
  }

  parse (buf) {
    if (this.error) this._resetState()

    this._list.append(buf)
    debug('parse: current state: %s', this._states[this._stateCounter])
    while ((this.packet.length !== -1 || this._list.length > 0) &&
      this[this._states[this._stateCounter]]() &&
      !this.error) {
      this._stateCounter++
      debug('parse: state complete. _stateCounter is now: %d', this._stateCounter)
      debug('parse: packet.length: %d, buffer list length: %d', this.packet.length, this._list.length)
      if (this._stateCounter >= this._states.length) this._stateCounter = 0
    }
    debug('parse: exited while loop. packet: %d, buffer list length: %d', this.packet.length, this._list.length)
    return this._list.length
  }

  _parseHeader () {
    // There is at least one byte in the buffer
    const zero = this._list.readUInt8(0)
    this.packet.cmd = constants.types[zero >> constants.CMD_SHIFT]
    this.packet.retain = (zero & constants.RETAIN_MASK) !== 0
    this.packet.qos = (zero >> constants.QOS_SHIFT) & constants.QOS_MASK
    this.packet.dup = (zero & constants.DUP_MASK) !== 0
    debug('_parseHeader: packet: %o', this.packet)

    this._list.consume(1)

    return true
  }

  _parseLength () {
    // There is at least one byte in the list
    const result = this._parseVarByteNum(true)

    if (result) {
      this.packet.length = result.value
      this._list.consume(result.bytes)
    }
    debug('_parseLength %d', result.value)
    return !!result
  }

  _parsePayload () {
    debug('_parsePayload: payload %O', this._list)
    let result = false

    // Do we have a payload? Do we have enough data to complete the payload?
    // PINGs have no payload
    if (this.packet.length === 0 || this._list.length >= this.packet.length) {
      this._pos = 0

      switch (this.packet.cmd) {
        case 'connect':
          this._parseConnect()
          break
        case 'connack':
          this._parseConnack()
          break
        case 'publish':
          this._parsePublish()
          break
        case 'puback':
        case 'pubrec':
        case 'pubrel':
        case 'pubcomp':
          this._parseConfirmation()
          break
        case 'subscribe':
          this._parseSubscribe()
          break
        case 'suback':
          this._parseSuback()
          break
        case 'unsubscribe':
          this._parseUnsubscribe()
          break
        case 'unsuback':
          this._parseUnsuback()
          break
        case 'pingreq':
        case 'pingresp':
          // These are empty, nothing to do
          break
        case 'disconnect':
          this._parseDisconnect()
          break
        case 'auth':
          this._parseAuth()
          break
        default:
          this._emitError(new Error('Not supported'))
      }

      result = true
    }
    debug('_parsePayload complete result: %s', result)
    return result
  }

  _parseConnect () {
    debug('_parseConnect')
    let topic // Will topic
    let payload // Will payload
    let password // Password
    let username // Username
    const flags = {}
    const packet = this.packet

    // Parse protocolId
    const protocolId = this._parseString()

    if (protocolId === null) return this._emitError(new Error('Cannot parse protocolId'))
    if (protocolId !== 'MQTT' && protocolId !== 'MQIsdp') {
      return this._emitError(new Error('Invalid protocolId'))
    }

    packet.protocolId = protocolId

    // Parse constants version number
    if (this._pos >= this._list.length) return this._emitError(new Error('Packet too short'))

    packet.protocolVersion = this._list.readUInt8(this._pos)

    if (packet.protocolVersion !== 3 && packet.protocolVersion !== 4 && packet.protocolVersion !== 5) {
      return this._emitError(new Error('Invalid protocol version'))
    }

    this._pos++

    if (this._pos >= this._list.length) {
      return this._emitError(new Error('Packet too short'))
    }

    // Parse connect flags
    flags.username = (this._list.readUInt8(this._pos) & constants.USERNAME_MASK)
    flags.password = (this._list.readUInt8(this._pos) & constants.PASSWORD_MASK)
    flags.will = (this._list.readUInt8(this._pos) & constants.WILL_FLAG_MASK)

    if (flags.will) {
      packet.will = {}
      packet.will.retain = (this._list.readUInt8(this._pos) & constants.WILL_RETAIN_MASK) !== 0
      packet.will.qos = (this._list.readUInt8(this._pos) &
        constants.WILL_QOS_MASK) >> constants.WILL_QOS_SHIFT
    }

    packet.clean = (this._list.readUInt8(this._pos) & constants.CLEAN_SESSION_MASK) !== 0
    this._pos++

    // Parse keepalive
    packet.keepalive = this._parseNum()
    if (packet.keepalive === -1) return this._emitError(new Error('Packet too short'))

    // parse properties
    if (packet.protocolVersion === 5) {
      const properties = this._parseProperties()
      if (Object.getOwnPropertyNames(properties).length) {
        packet.properties = properties
      }
    }
    // Parse clientId
    const clientId = this._parseString()
    if (clientId === null) return this._emitError(new Error('Packet too short'))
    packet.clientId = clientId
    debug('_parseConnect: packet.clientId: %s', packet.clientId)

    if (flags.will) {
      if (packet.protocolVersion === 5) {
        const willProperties = this._parseProperties()
        if (Object.getOwnPropertyNames(willProperties).length) {
          packet.will.properties = willProperties
        }
      }
      // Parse will topic
      topic = this._parseString()
      if (topic === null) return this._emitError(new Error('Cannot parse will topic'))
      packet.will.topic = topic
      debug('_parseConnect: packet.will.topic: %s', packet.will.topic)

      // Parse will payload
      payload = this._parseBuffer()
      if (payload === null) return this._emitError(new Error('Cannot parse will payload'))
      packet.will.payload = payload
      debug('_parseConnect: packet.will.paylaod: %s', packet.will.payload)
    }

    // Parse username
    if (flags.username) {
      username = this._parseString()
      if (username === null) return this._emitError(new Error('Cannot parse username'))
      packet.username = username
      debug('_parseConnect: packet.username: %s', packet.username)
    }

    // Parse password
    if (flags.password) {
      password = this._parseBuffer()
      if (password === null) return this._emitError(new Error('Cannot parse password'))
      packet.password = password
    }
    // need for right parse auth packet and self set up
    this.settings = packet
    debug('_parseConnect: complete')
    return packet
  }

  _parseConnack () {
    debug('_parseConnack')
    const packet = this.packet

    if (this._list.length < 2) return null

    packet.sessionPresent = !!(this._list.readUInt8(this._pos++) & constants.SESSIONPRESENT_MASK)
    if (this.settings.protocolVersion === 5) {
      packet.reasonCode = this._list.readUInt8(this._pos++)
    } else {
      packet.returnCode = this._list.readUInt8(this._pos++)
    }

    if (packet.returnCode === -1 || packet.reasonCode === -1) return this._emitError(new Error('Cannot parse return code'))
    // mqtt 5 properties
    if (this.settings.protocolVersion === 5) {
      const properties = this._parseProperties()
      if (Object.getOwnPropertyNames(properties).length) {
        packet.properties = properties
      }
    }
    debug('_parseConnack: complete')
  }

  _parsePublish () {
    debug('_parsePublish')
    const packet = this.packet
    packet.topic = this._parseString()

    if (packet.topic === null) return this._emitError(new Error('Cannot parse topic'))

    // Parse messageId
    if (packet.qos > 0) if (!this._parseMessageId()) { return }

    // Properties mqtt 5
    if (this.settings.protocolVersion === 5) {
      const properties = this._parseProperties()
      if (Object.getOwnPropertyNames(properties).length) {
        packet.properties = properties
      }
    }

    packet.payload = this._list.slice(this._pos, packet.length)
    debug('_parsePublish: payload from buffer list: %o', packet.payload)
  }

  _parseSubscribe () {
    debug('_parseSubscribe')
    const packet = this.packet
    let topic
    let options
    let qos
    let rh
    let rap
    let nl
    let subscription

    if (packet.qos !== 1) {
      return this._emitError(new Error('Wrong subscribe header'))
    }

    packet.subscriptions = []

    if (!this._parseMessageId()) { return }

    // Properties mqtt 5
    if (this.settings.protocolVersion === 5) {
      const properties = this._parseProperties()
      if (Object.getOwnPropertyNames(properties).length) {
        packet.properties = properties
      }
    }

    while (this._pos < packet.length) {
      // Parse topic
      topic = this._parseString()
      if (topic === null) return this._emitError(new Error('Cannot parse topic'))
      if (this._pos >= packet.length) return this._emitError(new Error('Malformed Subscribe Payload'))

      options = this._parseByte()
      qos = options & constants.SUBSCRIBE_OPTIONS_QOS_MASK
      nl = ((options >> constants.SUBSCRIBE_OPTIONS_NL_SHIFT) & constants.SUBSCRIBE_OPTIONS_NL_MASK) !== 0
      rap = ((options >> constants.SUBSCRIBE_OPTIONS_RAP_SHIFT) & constants.SUBSCRIBE_OPTIONS_RAP_MASK) !== 0
      rh = (options >> constants.SUBSCRIBE_OPTIONS_RH_SHIFT) & constants.SUBSCRIBE_OPTIONS_RH_MASK

      subscription = { topic, qos }

      // mqtt 5 options
      if (this.settings.protocolVersion === 5) {
        subscription.nl = nl
        subscription.rap = rap
        subscription.rh = rh
      }

      // Push pair to subscriptions
      debug('_parseSubscribe: push subscription `%s` to subscription', subscription)
      packet.subscriptions.push(subscription)
    }
  }

  _parseSuback () {
    debug('_parseSuback')
    const packet = this.packet
    this.packet.granted = []

    if (!this._parseMessageId()) { return }

    // Properties mqtt 5
    if (this.settings.protocolVersion === 5) {
      const properties = this._parseProperties()
      if (Object.getOwnPropertyNames(properties).length) {
        packet.properties = properties
      }
    }

    // Parse granted QoSes
    while (this._pos < this.packet.length) {
      this.packet.granted.push(this._list.readUInt8(this._pos++))
    }
  }

  _parseUnsubscribe () {
    debug('_parseUnsubscribe')
    const packet = this.packet

    packet.unsubscriptions = []

    // Parse messageId
    if (!this._parseMessageId()) { return }

    // Properties mqtt 5
    if (this.settings.protocolVersion === 5) {
      const properties = this._parseProperties()
      if (Object.getOwnPropertyNames(properties).length) {
        packet.properties = properties
      }
    }

    while (this._pos < packet.length) {
      // Parse topic
      const topic = this._parseString()
      if (topic === null) return this._emitError(new Error('Cannot parse topic'))

      // Push topic to unsubscriptions
      debug('_parseUnsubscribe: push topic `%s` to unsubscriptions', topic)
      packet.unsubscriptions.push(topic)
    }
  }

  _parseUnsuback () {
    debug('_parseUnsuback')
    const packet = this.packet
    if (!this._parseMessageId()) return this._emitError(new Error('Cannot parse messageId'))
    // Properties mqtt 5
    if (this.settings.protocolVersion === 5) {
      const properties = this._parseProperties()
      if (Object.getOwnPropertyNames(properties).length) {
        packet.properties = properties
      }
      // Parse granted QoSes
      packet.granted = []
      while (this._pos < this.packet.length) {
        this.packet.granted.push(this._list.readUInt8(this._pos++))
      }
    }
  }

  // parse packets like puback, pubrec, pubrel, pubcomp
  _parseConfirmation () {
    debug('_parseConfirmation: packet.cmd: `%s`', this.packet.cmd)
    const packet = this.packet

    this._parseMessageId()

    if (this.settings.protocolVersion === 5) {
      if (packet.length > 2) {
        // response code
        packet.reasonCode = this._parseByte()
        debug('_parseConfirmation: packet.reasonCode `%d`', packet.reasonCode)
      }

      if (packet.length > 3) {
        // properies mqtt 5
        const properties = this._parseProperties()
        if (Object.getOwnPropertyNames(properties).length) {
          packet.properties = properties
        }
      }
    }

    return true
  }

  // parse disconnect packet
  _parseDisconnect () {
    const packet = this.packet
    debug('_parseDisconnect')

    if (this.settings.protocolVersion === 5) {
      // response code
      packet.reasonCode = this._parseByte()
      // properies mqtt 5
      const properties = this._parseProperties()
      if (Object.getOwnPropertyNames(properties).length) {
        packet.properties = properties
      }
    }

    debug('_parseDisconnect result: true')
    return true
  }

  // parse auth packet
  _parseAuth () {
    debug('_parseAuth')
    const packet = this.packet

    if (this.settings.protocolVersion !== 5) {
      return this._emitError(new Error('Not supported auth packet for this version MQTT'))
    }

    // response code
    packet.reasonCode = this._parseByte()
    // properies mqtt 5
    const properties = this._parseProperties()
    if (Object.getOwnPropertyNames(properties).length) {
      packet.properties = properties
    }

    debug('_parseAuth: result: true')
    return true
  }

  _parseMessageId () {
    const packet = this.packet

    packet.messageId = this._parseNum()

    if (packet.messageId === null) {
      this._emitError(new Error('Cannot parse messageId'))
      return false
    }

    debug('_parseMessageId: packet.messageId %d', packet.messageId)
    return true
  }

  _parseString (maybeBuffer) {
    const length = this._parseNum()
    const end = length + this._pos

    if (length === -1 || end > this._list.length || end > this.packet.length) return null

    const result = this._list.toString('utf8', this._pos, end)
    this._pos += length
    debug('_parseString: result: %s', result)
    return result
  }

  _parseStringPair () {
    debug('_parseStringPair')
    return {
      name: this._parseString(),
      value: this._parseString()
    }
  }

  _parseBuffer () {
    const length = this._parseNum()
    const end = length + this._pos

    if (length === -1 || end > this._list.length || end > this.packet.length) return null

    const result = this._list.slice(this._pos, end)

    this._pos += length
    debug('_parseBuffer: result: %o', result)
    return result
  }

  _parseNum () {
    if (this._list.length - this._pos < 2) return -1

    const result = this._list.readUInt16BE(this._pos)
    this._pos += 2
    debug('_parseNum: result: %s', result)
    return result
  }

  _parse4ByteNum () {
    if (this._list.length - this._pos < 4) return -1

    const result = this._list.readUInt32BE(this._pos)
    this._pos += 4
    debug('_parse4ByteNum: result: %s', result)
    return result
  }

  _parseVarByteNum (fullInfoFlag) {
    debug('_parseVarByteNum')
    const maxBytes = 4
    let bytes = 0
    let mul = 1
    let value = 0
    let result = false
    let current
    const padding = this._pos ? this._pos : 0

    while (bytes < maxBytes) {
      current = this._list.readUInt8(padding + bytes++)
      value += mul * (current & constants.VARBYTEINT_MASK)
      mul *= 0x80

      if ((current & constants.VARBYTEINT_FIN_MASK) === 0) {
        result = true
        break
      }
      if (this._list.length <= bytes) {
        break
      }
    }

    if (!result && bytes === maxBytes && this._list.length >= bytes) {
      this._emitError(new Error('Invalid variable byte integer'))
    }

    if (padding) {
      this._pos += bytes
    }

    result = result
      ? fullInfoFlag ? {
        bytes,
        value
      } : value
      : false

    debug('_parseVarByteNum: result: %o', result)
    return result
  }

  _parseByte () {
    const result = this._list.readUInt8(this._pos)
    this._pos++
    debug('_parseByte: result: %o', result)
    return result
  }

  _parseByType (type) {
    debug('_parseByType: type: %s', type)
    switch (type) {
      case 'byte': {
        return this._parseByte() !== 0
      }
      case 'int8': {
        return this._parseByte()
      }
      case 'int16': {
        return this._parseNum()
      }
      case 'int32': {
        return this._parse4ByteNum()
      }
      case 'var': {
        return this._parseVarByteNum()
      }
      case 'string': {
        return this._parseString()
      }
      case 'pair': {
        return this._parseStringPair()
      }
      case 'binary': {
        return this._parseBuffer()
      }
    }
  }

  _parseProperties () {
    debug('_parseProperties')
    const length = this._parseVarByteNum()
    const start = this._pos
    const end = start + length
    const result = {}
    while (this._pos < end) {
      const type = this._parseByte()
      const name = constants.propertiesCodes[type]
      if (!name) {
        this._emitError(new Error('Unknown property'))
        return false
      }
      // user properties process
      if (name === 'userProperties') {
        if (!result[name]) {
          result[name] = Object.create(null)
        }
        const currentUserProperty = this._parseByType(constants.propertiesTypes[name])
        if (result[name][currentUserProperty.name]) {
          if (Array.isArray(result[name][currentUserProperty.name])) {
            result[name][currentUserProperty.name].push(currentUserProperty.value)
          } else {
            const currentValue = result[name][currentUserProperty.name]
            result[name][currentUserProperty.name] = [currentValue]
            result[name][currentUserProperty.name].push(currentUserProperty.value)
          }
        } else {
          result[name][currentUserProperty.name] = currentUserProperty.value
        }
        continue
      }
      if (result[name]) {
        if (Array.isArray(result[name])) {
          result[name].push(this._parseByType(constants.propertiesTypes[name]))
        } else {
          result[name] = [result[name]]
          result[name].push(this._parseByType(constants.propertiesTypes[name]))
        }
      } else {
        result[name] = this._parseByType(constants.propertiesTypes[name])
      }
    }
    return result
  }

  _newPacket () {
    debug('_newPacket')
    if (this.packet) {
      this._list.consume(this.packet.length)
      debug('_newPacket: parser emit packet: packet.cmd: %s, packet.payload: %s, packet.length: %d', this.packet.cmd, this.packet.payload, this.packet.length)
      this.emit('packet', this.packet)
    }
    debug('_newPacket: new packet')
    this.packet = new Packet()

    this._pos = 0

    return true
  }

  _emitError (err) {
    debug('_emitError')
    this.error = err
    this.emit('error', err)
  }
}

module.exports = Parser


/***/ }),
/* 339 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


const DuplexStream = __webpack_require__(23).Duplex
const inherits = __webpack_require__(21)
const BufferList = __webpack_require__(340)

function BufferListStream (callback) {
  if (!(this instanceof BufferListStream)) {
    return new BufferListStream(callback)
  }

  if (typeof callback === 'function') {
    this._callback = callback

    const piper = function piper (err) {
      if (this._callback) {
        this._callback(err)
        this._callback = null
      }
    }.bind(this)

    this.on('pipe', function onPipe (src) {
      src.on('error', piper)
    })
    this.on('unpipe', function onUnpipe (src) {
      src.removeListener('error', piper)
    })

    callback = null
  }

  BufferList._init.call(this, callback)
  DuplexStream.call(this)
}

inherits(BufferListStream, DuplexStream)
Object.assign(BufferListStream.prototype, BufferList.prototype)

BufferListStream.prototype._new = function _new (callback) {
  return new BufferListStream(callback)
}

BufferListStream.prototype._write = function _write (buf, encoding, callback) {
  this._appendBuffer(buf)

  if (typeof callback === 'function') {
    callback()
  }
}

BufferListStream.prototype._read = function _read (size) {
  if (!this.length) {
    return this.push(null)
  }

  size = Math.min(size, this.length)
  this.push(this.slice(0, size))
  this.consume(size)
}

BufferListStream.prototype.end = function end (chunk) {
  DuplexStream.prototype.end.call(this, chunk)

  if (this._callback) {
    this._callback(null, this.slice())
    this._callback = null
  }
}

BufferListStream.prototype._destroy = function _destroy (err, cb) {
  this._bufs.length = 0
  this.length = 0
  cb(err)
}

BufferListStream.prototype._isBufferList = function _isBufferList (b) {
  return b instanceof BufferListStream || b instanceof BufferList || BufferListStream.isBufferList(b)
}

BufferListStream.isBufferList = BufferList.isBufferList

module.exports = BufferListStream
module.exports.BufferListStream = BufferListStream
module.exports.BufferList = BufferList


/***/ }),
/* 340 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


const { Buffer } = __webpack_require__(11)
const symbol = Symbol.for('BufferList')

function BufferList (buf) {
  if (!(this instanceof BufferList)) {
    return new BufferList(buf)
  }

  BufferList._init.call(this, buf)
}

BufferList._init = function _init (buf) {
  Object.defineProperty(this, symbol, { value: true })

  this._bufs = []
  this.length = 0

  if (buf) {
    this.append(buf)
  }
}

BufferList.prototype._new = function _new (buf) {
  return new BufferList(buf)
}

BufferList.prototype._offset = function _offset (offset) {
  if (offset === 0) {
    return [0, 0]
  }

  let tot = 0

  for (let i = 0; i < this._bufs.length; i++) {
    const _t = tot + this._bufs[i].length
    if (offset < _t || i === this._bufs.length - 1) {
      return [i, offset - tot]
    }
    tot = _t
  }
}

BufferList.prototype._reverseOffset = function (blOffset) {
  const bufferId = blOffset[0]
  let offset = blOffset[1]

  for (let i = 0; i < bufferId; i++) {
    offset += this._bufs[i].length
  }

  return offset
}

BufferList.prototype.get = function get (index) {
  if (index > this.length || index < 0) {
    return undefined
  }

  const offset = this._offset(index)

  return this._bufs[offset[0]][offset[1]]
}

BufferList.prototype.slice = function slice (start, end) {
  if (typeof start === 'number' && start < 0) {
    start += this.length
  }

  if (typeof end === 'number' && end < 0) {
    end += this.length
  }

  return this.copy(null, 0, start, end)
}

BufferList.prototype.copy = function copy (dst, dstStart, srcStart, srcEnd) {
  if (typeof srcStart !== 'number' || srcStart < 0) {
    srcStart = 0
  }

  if (typeof srcEnd !== 'number' || srcEnd > this.length) {
    srcEnd = this.length
  }

  if (srcStart >= this.length) {
    return dst || Buffer.alloc(0)
  }

  if (srcEnd <= 0) {
    return dst || Buffer.alloc(0)
  }

  const copy = !!dst
  const off = this._offset(srcStart)
  const len = srcEnd - srcStart
  let bytes = len
  let bufoff = (copy && dstStart) || 0
  let start = off[1]

  // copy/slice everything
  if (srcStart === 0 && srcEnd === this.length) {
    if (!copy) {
      // slice, but full concat if multiple buffers
      return this._bufs.length === 1
        ? this._bufs[0]
        : Buffer.concat(this._bufs, this.length)
    }

    // copy, need to copy individual buffers
    for (let i = 0; i < this._bufs.length; i++) {
      this._bufs[i].copy(dst, bufoff)
      bufoff += this._bufs[i].length
    }

    return dst
  }

  // easy, cheap case where it's a subset of one of the buffers
  if (bytes <= this._bufs[off[0]].length - start) {
    return copy
      ? this._bufs[off[0]].copy(dst, dstStart, start, start + bytes)
      : this._bufs[off[0]].slice(start, start + bytes)
  }

  if (!copy) {
    // a slice, we need something to copy in to
    dst = Buffer.allocUnsafe(len)
  }

  for (let i = off[0]; i < this._bufs.length; i++) {
    const l = this._bufs[i].length - start

    if (bytes > l) {
      this._bufs[i].copy(dst, bufoff, start)
      bufoff += l
    } else {
      this._bufs[i].copy(dst, bufoff, start, start + bytes)
      bufoff += l
      break
    }

    bytes -= l

    if (start) {
      start = 0
    }
  }

  // safeguard so that we don't return uninitialized memory
  if (dst.length > bufoff) return dst.slice(0, bufoff)

  return dst
}

BufferList.prototype.shallowSlice = function shallowSlice (start, end) {
  start = start || 0
  end = typeof end !== 'number' ? this.length : end

  if (start < 0) {
    start += this.length
  }

  if (end < 0) {
    end += this.length
  }

  if (start === end) {
    return this._new()
  }

  const startOffset = this._offset(start)
  const endOffset = this._offset(end)
  const buffers = this._bufs.slice(startOffset[0], endOffset[0] + 1)

  if (endOffset[1] === 0) {
    buffers.pop()
  } else {
    buffers[buffers.length - 1] = buffers[buffers.length - 1].slice(0, endOffset[1])
  }

  if (startOffset[1] !== 0) {
    buffers[0] = buffers[0].slice(startOffset[1])
  }

  return this._new(buffers)
}

BufferList.prototype.toString = function toString (encoding, start, end) {
  return this.slice(start, end).toString(encoding)
}

BufferList.prototype.consume = function consume (bytes) {
  // first, normalize the argument, in accordance with how Buffer does it
  bytes = Math.trunc(bytes)
  // do nothing if not a positive number
  if (Number.isNaN(bytes) || bytes <= 0) return this

  while (this._bufs.length) {
    if (bytes >= this._bufs[0].length) {
      bytes -= this._bufs[0].length
      this.length -= this._bufs[0].length
      this._bufs.shift()
    } else {
      this._bufs[0] = this._bufs[0].slice(bytes)
      this.length -= bytes
      break
    }
  }

  return this
}

BufferList.prototype.duplicate = function duplicate () {
  const copy = this._new()

  for (let i = 0; i < this._bufs.length; i++) {
    copy.append(this._bufs[i])
  }

  return copy
}

BufferList.prototype.append = function append (buf) {
  if (buf == null) {
    return this
  }

  if (buf.buffer) {
    // append a view of the underlying ArrayBuffer
    this._appendBuffer(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength))
  } else if (Array.isArray(buf)) {
    for (let i = 0; i < buf.length; i++) {
      this.append(buf[i])
    }
  } else if (this._isBufferList(buf)) {
    // unwrap argument into individual BufferLists
    for (let i = 0; i < buf._bufs.length; i++) {
      this.append(buf._bufs[i])
    }
  } else {
    // coerce number arguments to strings, since Buffer(number) does
    // uninitialized memory allocation
    if (typeof buf === 'number') {
      buf = buf.toString()
    }

    this._appendBuffer(Buffer.from(buf))
  }

  return this
}

BufferList.prototype._appendBuffer = function appendBuffer (buf) {
  this._bufs.push(buf)
  this.length += buf.length
}

BufferList.prototype.indexOf = function (search, offset, encoding) {
  if (encoding === undefined && typeof offset === 'string') {
    encoding = offset
    offset = undefined
  }

  if (typeof search === 'function' || Array.isArray(search)) {
    throw new TypeError('The "value" argument must be one of type string, Buffer, BufferList, or Uint8Array.')
  } else if (typeof search === 'number') {
    search = Buffer.from([search])
  } else if (typeof search === 'string') {
    search = Buffer.from(search, encoding)
  } else if (this._isBufferList(search)) {
    search = search.slice()
  } else if (Array.isArray(search.buffer)) {
    search = Buffer.from(search.buffer, search.byteOffset, search.byteLength)
  } else if (!Buffer.isBuffer(search)) {
    search = Buffer.from(search)
  }

  offset = Number(offset || 0)

  if (isNaN(offset)) {
    offset = 0
  }

  if (offset < 0) {
    offset = this.length + offset
  }

  if (offset < 0) {
    offset = 0
  }

  if (search.length === 0) {
    return offset > this.length ? this.length : offset
  }

  const blOffset = this._offset(offset)
  let blIndex = blOffset[0] // index of which internal buffer we're working on
  let buffOffset = blOffset[1] // offset of the internal buffer we're working on

  // scan over each buffer
  for (; blIndex < this._bufs.length; blIndex++) {
    const buff = this._bufs[blIndex]

    while (buffOffset < buff.length) {
      const availableWindow = buff.length - buffOffset

      if (availableWindow >= search.length) {
        const nativeSearchResult = buff.indexOf(search, buffOffset)

        if (nativeSearchResult !== -1) {
          return this._reverseOffset([blIndex, nativeSearchResult])
        }

        buffOffset = buff.length - search.length + 1 // end of native search window
      } else {
        const revOffset = this._reverseOffset([blIndex, buffOffset])

        if (this._match(revOffset, search)) {
          return revOffset
        }

        buffOffset++
      }
    }

    buffOffset = 0
  }

  return -1
}

BufferList.prototype._match = function (offset, search) {
  if (this.length - offset < search.length) {
    return false
  }

  for (let searchOffset = 0; searchOffset < search.length; searchOffset++) {
    if (this.get(offset + searchOffset) !== search[searchOffset]) {
      return false
    }
  }
  return true
}

;(function () {
  const methods = {
    readDoubleBE: 8,
    readDoubleLE: 8,
    readFloatBE: 4,
    readFloatLE: 4,
    readInt32BE: 4,
    readInt32LE: 4,
    readUInt32BE: 4,
    readUInt32LE: 4,
    readInt16BE: 2,
    readInt16LE: 2,
    readUInt16BE: 2,
    readUInt16LE: 2,
    readInt8: 1,
    readUInt8: 1,
    readIntBE: null,
    readIntLE: null,
    readUIntBE: null,
    readUIntLE: null
  }

  for (const m in methods) {
    (function (m) {
      if (methods[m] === null) {
        BufferList.prototype[m] = function (offset, byteLength) {
          return this.slice(offset, offset + byteLength)[m](0, byteLength)
        }
      } else {
        BufferList.prototype[m] = function (offset) {
          return this.slice(offset, offset + methods[m])[m](0)
        }
      }
    }(m))
  }
}())

// Used internally by the class and also as an indicator of this object being
// a `BufferList`. It's not possible to use `instanceof BufferList` in a browser
// environment because there could be multiple different copies of the
// BufferList class and some `BufferList`s might be `BufferList`s.
BufferList.prototype._isBufferList = function _isBufferList (b) {
  return b instanceof BufferList || BufferList.isBufferList(b)
}

BufferList.isBufferList = function isBufferList (b) {
  return b != null && b[symbol]
}

module.exports = BufferList


/***/ }),
/* 341 */
/***/ (function(module, exports) {

class Packet {
  constructor () {
    this.cmd = null
    this.retain = false
    this.qos = 0
    this.dup = false
    this.length = -1
    this.topic = null
    this.payload = null
  }
}

module.exports = Packet


/***/ }),
/* 342 */
/***/ (function(module, exports, __webpack_require__) {

/* WEBPACK VAR INJECTION */(function(Buffer) {const writeToStream = __webpack_require__(83)
const EventEmitter = __webpack_require__(25)

function generate (packet, opts) {
  const stream = new Accumulator()
  writeToStream(packet, stream, opts)
  return stream.concat()
}

class Accumulator extends EventEmitter {
  constructor () {
    super()
    this._array = new Array(20)
    this._i = 0
  }

  write (chunk) {
    this._array[this._i++] = chunk
    return true
  }

  concat () {
    let length = 0
    const lengths = new Array(this._array.length)
    const list = this._array
    let pos = 0
    let i

    for (i = 0; i < list.length && list[i] !== undefined; i++) {
      if (typeof list[i] !== 'string') lengths[i] = list[i].length
      else lengths[i] = Buffer.byteLength(list[i])

      length += lengths[i]
    }

    const result = Buffer.allocUnsafe(length)

    for (i = 0; i < list.length && list[i] !== undefined; i++) {
      if (typeof list[i] !== 'string') {
        list[i].copy(result, pos)
        pos += lengths[i]
      } else {
        result.write(list[i], pos)
        pos += lengths[i]
      }
    }

    return result
  }
}

module.exports = generate

/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(11).Buffer))

/***/ }),
/* 343 */
/***/ (function(module, exports, __webpack_require__) {

/* WEBPACK VAR INJECTION */(function(Buffer) {const max = 65536
const cache = {}

// in node 6 Buffer.subarray returns a Uint8Array instead of a Buffer
// later versions return a Buffer
// alternative is Buffer.slice but that creates a new buffer
// creating new buffers takes time
// SubOk is only false on node < 8
const SubOk = Buffer.isBuffer(Buffer.from([1, 2]).subarray(0, 1))

function generateBuffer (i) {
  const buffer = Buffer.allocUnsafe(2)
  buffer.writeUInt8(i >> 8, 0)
  buffer.writeUInt8(i & 0x00FF, 0 + 1)

  return buffer
}

function generateCache () {
  for (let i = 0; i < max; i++) {
    cache[i] = generateBuffer(i)
  }
}

function genBufVariableByteInt (num) {
  const maxLength = 4 // max 4 bytes
  let digit = 0
  let pos = 0
  const buffer = Buffer.allocUnsafe(maxLength)

  do {
    digit = num % 128 | 0
    num = num / 128 | 0
    if (num > 0) digit = digit | 0x80

    buffer.writeUInt8(digit, pos++)
  } while (num > 0 && pos < maxLength)

  if (num > 0) {
    pos = 0
  }

  return SubOk ? buffer.subarray(0, pos) : buffer.slice(0, pos)
}

function generate4ByteBuffer (num) {
  const buffer = Buffer.allocUnsafe(4)
  buffer.writeUInt32BE(num, 0)
  return buffer
}

module.exports = {
  cache,
  generateCache,
  generateNumber: generateBuffer,
  genBufVariableByteInt,
  generate4ByteBuffer
}

/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(11).Buffer))

/***/ }),
/* 344 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


function ReInterval (callback, interval, args) {
  var self = this;

  this._callback = callback;
  this._args = args;

  this._interval = setInterval(callback, interval, this._args);

  this.reschedule = function (interval) {
    // if no interval entered, use the interval passed in on creation
    if (!interval)
      interval = self._interval;

    if (self._interval)
      clearInterval(self._interval);
    self._interval = setInterval(self._callback, interval, self._args);
  };

  this.clear = function () {
    if (self._interval) {
      clearInterval(self._interval);
      self._interval = undefined;
    }
  };
  
  this.destroy = function () {
    if (self._interval) {
      clearInterval(self._interval);
    }
    self._callback = undefined;
    self._interval = undefined;
    self._args = undefined;
  };
}

function reInterval () {
  if (typeof arguments[0] !== 'function')
    throw new Error('callback needed');
  if (typeof arguments[1] !== 'number')
    throw new Error('interval needed');

  var args;

  if (arguments.length > 0) {
    args = new Array(arguments.length - 2);

    for (var i = 0; i < args.length; i++) {
      args[i] = arguments[i + 2];
    }
  }

  return new ReInterval(arguments[0], arguments[1], args);
}

module.exports = reInterval;


/***/ }),
/* 345 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


/**
 * Validate a topic to see if it's valid or not.
 * A topic is valid if it follow below rules:
 * - Rule #1: If any part of the topic is not `+` or `#`, then it must not contain `+` and '#'
 * - Rule #2: Part `#` must be located at the end of the mailbox
 *
 * @param {String} topic - A topic
 * @returns {Boolean} If the topic is valid, returns true. Otherwise, returns false.
 */
function validateTopic (topic) {
  var parts = topic.split('/')

  for (var i = 0; i < parts.length; i++) {
    if (parts[i] === '+') {
      continue
    }

    if (parts[i] === '#') {
      // for Rule #2
      return i === parts.length - 1
    }

    if (parts[i].indexOf('+') !== -1 || parts[i].indexOf('#') !== -1) {
      return false
    }
  }

  return true
}

/**
 * Validate an array of topics to see if any of them is valid or not
  * @param {Array} topics - Array of topics
 * @returns {String} If the topics is valid, returns null. Otherwise, returns the invalid one
 */
function validateTopics (topics) {
  if (topics.length === 0) {
    return 'empty_topic_list'
  }
  for (var i = 0; i < topics.length; i++) {
    if (!validateTopic(topics[i])) {
      return topics[i]
    }
  }
  return null
}

module.exports = {
  validateTopics: validateTopics
}


/***/ }),
/* 346 */
/***/ (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 punycode = __webpack_require__(347);
var util = __webpack_require__(349);

exports.parse = urlParse;
exports.resolve = urlResolve;
exports.resolveObject = urlResolveObject;
exports.format = urlFormat;

exports.Url = Url;

function Url() {
  this.protocol = null;
  this.slashes = null;
  this.auth = null;
  this.host = null;
  this.port = null;
  this.hostname = null;
  this.hash = null;
  this.search = null;
  this.query = null;
  this.pathname = null;
  this.path = null;
  this.href = null;
}

// Reference: RFC 3986, RFC 1808, RFC 2396

// define these here so at least they only have to be
// compiled once on the first module load.
var protocolPattern = /^([a-z0-9.+-]+:)/i,
    portPattern = /:[0-9]*$/,

    // Special case for a simple path URL
    simplePathPattern = /^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,

    // RFC 2396: characters reserved for delimiting URLs.
    // We actually just auto-escape these.
    delims = ['<', '>', '"', '`', ' ', '\r', '\n', '\t'],

    // RFC 2396: characters not allowed for various reasons.
    unwise = ['{', '}', '|', '\\', '^', '`'].concat(delims),

    // Allowed by RFCs, but cause of XSS attacks.  Always escape these.
    autoEscape = ['\''].concat(unwise),
    // Characters that are never ever allowed in a hostname.
    // Note that any invalid chars are also handled, but these
    // are the ones that are *expected* to be seen, so we fast-path
    // them.
    nonHostChars = ['%', '/', '?', ';', '#'].concat(autoEscape),
    hostEndingChars = ['/', '?', '#'],
    hostnameMaxLen = 255,
    hostnamePartPattern = /^[+a-z0-9A-Z_-]{0,63}$/,
    hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/,
    // protocols that can allow "unsafe" and "unwise" chars.
    unsafeProtocol = {
      'javascript': true,
      'javascript:': true
    },
    // protocols that never have a hostname.
    hostlessProtocol = {
      'javascript': true,
      'javascript:': true
    },
    // protocols that always contain a // bit.
    slashedProtocol = {
      'http': true,
      'https': true,
      'ftp': true,
      'gopher': true,
      'file': true,
      'http:': true,
      'https:': true,
      'ftp:': true,
      'gopher:': true,
      'file:': true
    },
    querystring = __webpack_require__(350);

function urlParse(url, parseQueryString, slashesDenoteHost) {
  if (url && util.isObject(url) && url instanceof Url) return url;

  var u = new Url;
  u.parse(url, parseQueryString, slashesDenoteHost);
  return u;
}

Url.prototype.parse = function(url, parseQueryString, slashesDenoteHost) {
  if (!util.isString(url)) {
    throw new TypeError("Parameter 'url' must be a string, not " + typeof url);
  }

  // Copy chrome, IE, opera backslash-handling behavior.
  // Back slashes before the query string get converted to forward slashes
  // See: https://code.google.com/p/chromium/issues/detail?id=25916
  var queryIndex = url.indexOf('?'),
      splitter =
          (queryIndex !== -1 && queryIndex < url.indexOf('#')) ? '?' : '#',
      uSplit = url.split(splitter),
      slashRegex = /\\/g;
  uSplit[0] = uSplit[0].replace(slashRegex, '/');
  url = uSplit.join(splitter);

  var rest = url;

  // trim before proceeding.
  // This is to support parse stuff like "  http://foo.com  \n"
  rest = rest.trim();

  if (!slashesDenoteHost && url.split('#').length === 1) {
    // Try fast path regexp
    var simplePath = simplePathPattern.exec(rest);
    if (simplePath) {
      this.path = rest;
      this.href = rest;
      this.pathname = simplePath[1];
      if (simplePath[2]) {
        this.search = simplePath[2];
        if (parseQueryString) {
          this.query = querystring.parse(this.search.substr(1));
        } else {
          this.query = this.search.substr(1);
        }
      } else if (parseQueryString) {
        this.search = '';
        this.query = {};
      }
      return this;
    }
  }

  var proto = protocolPattern.exec(rest);
  if (proto) {
    proto = proto[0];
    var lowerProto = proto.toLowerCase();
    this.protocol = lowerProto;
    rest = rest.substr(proto.length);
  }

  // figure out if it's got a host
  // user@server is *always* interpreted as a hostname, and url
  // resolution will treat //foo/bar as host=foo,path=bar because that's
  // how the browser resolves relative URLs.
  if (slashesDenoteHost || proto || rest.match(/^\/\/[^@\/]+@[^@\/]+/)) {
    var slashes = rest.substr(0, 2) === '//';
    if (slashes && !(proto && hostlessProtocol[proto])) {
      rest = rest.substr(2);
      this.slashes = true;
    }
  }

  if (!hostlessProtocol[proto] &&
      (slashes || (proto && !slashedProtocol[proto]))) {

    // there's a hostname.
    // the first instance of /, ?, ;, or # ends the host.
    //
    // If there is an @ in the hostname, then non-host chars *are* allowed
    // to the left of the last @ sign, unless some host-ending character
    // comes *before* the @-sign.
    // URLs are obnoxious.
    //
    // ex:
    // http://a@b@c/ => user:a@b host:c
    // http://a@b?@c => user:a host:c path:/?@c

    // v0.12 TODO(isaacs): This is not quite how Chrome does things.
    // Review our test case against browsers more comprehensively.

    // find the first instance of any hostEndingChars
    var hostEnd = -1;
    for (var i = 0; i < hostEndingChars.length; i++) {
      var hec = rest.indexOf(hostEndingChars[i]);
      if (hec !== -1 && (hostEnd === -1 || hec < hostEnd))
        hostEnd = hec;
    }

    // at this point, either we have an explicit point where the
    // auth portion cannot go past, or the last @ char is the decider.
    var auth, atSign;
    if (hostEnd === -1) {
      // atSign can be anywhere.
      atSign = rest.lastIndexOf('@');
    } else {
      // atSign must be in auth portion.
      // http://a@b/c@d => host:b auth:a path:/c@d
      atSign = rest.lastIndexOf('@', hostEnd);
    }

    // Now we have a portion which is definitely the auth.
    // Pull that off.
    if (atSign !== -1) {
      auth = rest.slice(0, atSign);
      rest = rest.slice(atSign + 1);
      this.auth = decodeURIComponent(auth);
    }

    // the host is the remaining to the left of the first non-host char
    hostEnd = -1;
    for (var i = 0; i < nonHostChars.length; i++) {
      var hec = rest.indexOf(nonHostChars[i]);
      if (hec !== -1 && (hostEnd === -1 || hec < hostEnd))
        hostEnd = hec;
    }
    // if we still have not hit it, then the entire thing is a host.
    if (hostEnd === -1)
      hostEnd = rest.length;

    this.host = rest.slice(0, hostEnd);
    rest = rest.slice(hostEnd);

    // pull out port.
    this.parseHost();

    // we've indicated that there is a hostname,
    // so even if it's empty, it has to be present.
    this.hostname = this.hostname || '';

    // if hostname begins with [ and ends with ]
    // assume that it's an IPv6 address.
    var ipv6Hostname = this.hostname[0] === '[' &&
        this.hostname[this.hostname.length - 1] === ']';

    // validate a little.
    if (!ipv6Hostname) {
      var hostparts = this.hostname.split(/\./);
      for (var i = 0, l = hostparts.length; i < l; i++) {
        var part = hostparts[i];
        if (!part) continue;
        if (!part.match(hostnamePartPattern)) {
          var newpart = '';
          for (var j = 0, k = part.length; j < k; j++) {
            if (part.charCodeAt(j) > 127) {
              // we replace non-ASCII char with a temporary placeholder
              // we need this to make sure size of hostname is not
              // broken by replacing non-ASCII by nothing
              newpart += 'x';
            } else {
              newpart += part[j];
            }
          }
          // we test again with ASCII char only
          if (!newpart.match(hostnamePartPattern)) {
            var validParts = hostparts.slice(0, i);
            var notHost = hostparts.slice(i + 1);
            var bit = part.match(hostnamePartStart);
            if (bit) {
              validParts.push(bit[1]);
              notHost.unshift(bit[2]);
            }
            if (notHost.length) {
              rest = '/' + notHost.join('.') + rest;
            }
            this.hostname = validParts.join('.');
            break;
          }
        }
      }
    }

    if (this.hostname.length > hostnameMaxLen) {
      this.hostname = '';
    } else {
      // hostnames are always lower case.
      this.hostname = this.hostname.toLowerCase();
    }

    if (!ipv6Hostname) {
      // IDNA Support: Returns a punycoded representation of "domain".
      // It only converts parts of the domain name that
      // have non-ASCII characters, i.e. it doesn't matter if
      // you call it with a domain that already is ASCII-only.
      this.hostname = punycode.toASCII(this.hostname);
    }

    var p = this.port ? ':' + this.port : '';
    var h = this.hostname || '';
    this.host = h + p;
    this.href += this.host;

    // strip [ and ] from the hostname
    // the host field still retains them, though
    if (ipv6Hostname) {
      this.hostname = this.hostname.substr(1, this.hostname.length - 2);
      if (rest[0] !== '/') {
        rest = '/' + rest;
      }
    }
  }

  // now rest is set to the post-host stuff.
  // chop off any delim chars.
  if (!unsafeProtocol[lowerProto]) {

    // First, make 100% sure that any "autoEscape" chars get
    // escaped, even if encodeURIComponent doesn't think they
    // need to be.
    for (var i = 0, l = autoEscape.length; i < l; i++) {
      var ae = autoEscape[i];
      if (rest.indexOf(ae) === -1)
        continue;
      var esc = encodeURIComponent(ae);
      if (esc === ae) {
        esc = escape(ae);
      }
      rest = rest.split(ae).join(esc);
    }
  }


  // chop off from the tail first.
  var hash = rest.indexOf('#');
  if (hash !== -1) {
    // got a fragment string.
    this.hash = rest.substr(hash);
    rest = rest.slice(0, hash);
  }
  var qm = rest.indexOf('?');
  if (qm !== -1) {
    this.search = rest.substr(qm);
    this.query = rest.substr(qm + 1);
    if (parseQueryString) {
      this.query = querystring.parse(this.query);
    }
    rest = rest.slice(0, qm);
  } else if (parseQueryString) {
    // no query string, but parseQueryString still requested
    this.search = '';
    this.query = {};
  }
  if (rest) this.pathname = rest;
  if (slashedProtocol[lowerProto] &&
      this.hostname && !this.pathname) {
    this.pathname = '/';
  }

  //to support http.request
  if (this.pathname || this.search) {
    var p = this.pathname || '';
    var s = this.search || '';
    this.path = p + s;
  }

  // finally, reconstruct the href based on what has been validated.
  this.href = this.format();
  return this;
};

// format a parsed object into a url string
function urlFormat(obj) {
  // ensure it's an object, and not a string url.
  // If it's an obj, this is a no-op.
  // this way, you can call url_format() on strings
  // to clean up potentially wonky urls.
  if (util.isString(obj)) obj = urlParse(obj);
  if (!(obj instanceof Url)) return Url.prototype.format.call(obj);
  return obj.format();
}

Url.prototype.format = function() {
  var auth = this.auth || '';
  if (auth) {
    auth = encodeURIComponent(auth);
    auth = auth.replace(/%3A/i, ':');
    auth += '@';
  }

  var protocol = this.protocol || '',
      pathname = this.pathname || '',
      hash = this.hash || '',
      host = false,
      query = '';

  if (this.host) {
    host = auth + this.host;
  } else if (this.hostname) {
    host = auth + (this.hostname.indexOf(':') === -1 ?
        this.hostname :
        '[' + this.hostname + ']');
    if (this.port) {
      host += ':' + this.port;
    }
  }

  if (this.query &&
      util.isObject(this.query) &&
      Object.keys(this.query).length) {
    query = querystring.stringify(this.query);
  }

  var search = this.search || (query && ('?' + query)) || '';

  if (protocol && protocol.substr(-1) !== ':') protocol += ':';

  // only the slashedProtocols get the //.  Not mailto:, xmpp:, etc.
  // unless they had them to begin with.
  if (this.slashes ||
      (!protocol || slashedProtocol[protocol]) && host !== false) {
    host = '//' + (host || '');
    if (pathname && pathname.charAt(0) !== '/') pathname = '/' + pathname;
  } else if (!host) {
    host = '';
  }

  if (hash && hash.charAt(0) !== '#') hash = '#' + hash;
  if (search && search.charAt(0) !== '?') search = '?' + search;

  pathname = pathname.replace(/[?#]/g, function(match) {
    return encodeURIComponent(match);
  });
  search = search.replace('#', '%23');

  return protocol + host + pathname + search + hash;
};

function urlResolve(source, relative) {
  return urlParse(source, false, true).resolve(relative);
}

Url.prototype.resolve = function(relative) {
  return this.resolveObject(urlParse(relative, false, true)).format();
};

function urlResolveObject(source, relative) {
  if (!source) return relative;
  return urlParse(source, false, true).resolveObject(relative);
}

Url.prototype.resolveObject = function(relative) {
  if (util.isString(relative)) {
    var rel = new Url();
    rel.parse(relative, false, true);
    relative = rel;
  }

  var result = new Url();
  var tkeys = Object.keys(this);
  for (var tk = 0; tk < tkeys.length; tk++) {
    var tkey = tkeys[tk];
    result[tkey] = this[tkey];
  }

  // hash is always overridden, no matter what.
  // even href="" will remove it.
  result.hash = relative.hash;

  // if the relative url is empty, then there's nothing left to do here.
  if (relative.href === '') {
    result.href = result.format();
    return result;
  }

  // hrefs like //foo/bar always cut to the protocol.
  if (relative.slashes && !relative.protocol) {
    // take everything except the protocol from relative
    var rkeys = Object.keys(relative);
    for (var rk = 0; rk < rkeys.length; rk++) {
      var rkey = rkeys[rk];
      if (rkey !== 'protocol')
        result[rkey] = relative[rkey];
    }

    //urlParse appends trailing / to urls like http://www.example.com
    if (slashedProtocol[result.protocol] &&
        result.hostname && !result.pathname) {
      result.path = result.pathname = '/';
    }

    result.href = result.format();
    return result;
  }

  if (relative.protocol && relative.protocol !== result.protocol) {
    // if it's a known url protocol, then changing
    // the protocol does weird things
    // first, if it's not file:, then we MUST have a host,
    // and if there was a path
    // to begin with, then we MUST have a path.
    // if it is file:, then the host is dropped,
    // because that's known to be hostless.
    // anything else is assumed to be absolute.
    if (!slashedProtocol[relative.protocol]) {
      var keys = Object.keys(relative);
      for (var v = 0; v < keys.length; v++) {
        var k = keys[v];
        result[k] = relative[k];
      }
      result.href = result.format();
      return result;
    }

    result.protocol = relative.protocol;
    if (!relative.host && !hostlessProtocol[relative.protocol]) {
      var relPath = (relative.pathname || '').split('/');
      while (relPath.length && !(relative.host = relPath.shift()));
      if (!relative.host) relative.host = '';
      if (!relative.hostname) relative.hostname = '';
      if (relPath[0] !== '') relPath.unshift('');
      if (relPath.length < 2) relPath.unshift('');
      result.pathname = relPath.join('/');
    } else {
      result.pathname = relative.pathname;
    }
    result.search = relative.search;
    result.query = relative.query;
    result.host = relative.host || '';
    result.auth = relative.auth;
    result.hostname = relative.hostname || relative.host;
    result.port = relative.port;
    // to support http.request
    if (result.pathname || result.search) {
      var p = result.pathname || '';
      var s = result.search || '';
      result.path = p + s;
    }
    result.slashes = result.slashes || relative.slashes;
    result.href = result.format();
    return result;
  }

  var isSourceAbs = (result.pathname && result.pathname.charAt(0) === '/'),
      isRelAbs = (
          relative.host ||
          relative.pathname && relative.pathname.charAt(0) === '/'
      ),
      mustEndAbs = (isRelAbs || isSourceAbs ||
                    (result.host && relative.pathname)),
      removeAllDots = mustEndAbs,
      srcPath = result.pathname && result.pathname.split('/') || [],
      relPath = relative.pathname && relative.pathname.split('/') || [],
      psychotic = result.protocol && !slashedProtocol[result.protocol];

  // if the url is a non-slashed url, then relative
  // links like ../.. should be able
  // to crawl up to the hostname, as well.  This is strange.
  // result.protocol has already been set by now.
  // Later on, put the first path part into the host field.
  if (psychotic) {
    result.hostname = '';
    result.port = null;
    if (result.host) {
      if (srcPath[0] === '') srcPath[0] = result.host;
      else srcPath.unshift(result.host);
    }
    result.host = '';
    if (relative.protocol) {
      relative.hostname = null;
      relative.port = null;
      if (relative.host) {
        if (relPath[0] === '') relPath[0] = relative.host;
        else relPath.unshift(relative.host);
      }
      relative.host = null;
    }
    mustEndAbs = mustEndAbs && (relPath[0] === '' || srcPath[0] === '');
  }

  if (isRelAbs) {
    // it's absolute.
    result.host = (relative.host || relative.host === '') ?
                  relative.host : result.host;
    result.hostname = (relative.hostname || relative.hostname === '') ?
                      relative.hostname : result.hostname;
    result.search = relative.search;
    result.query = relative.query;
    srcPath = relPath;
    // fall through to the dot-handling below.
  } else if (relPath.length) {
    // it's relative
    // throw away the existing file, and take the new path instead.
    if (!srcPath) srcPath = [];
    srcPath.pop();
    srcPath = srcPath.concat(relPath);
    result.search = relative.search;
    result.query = relative.query;
  } else if (!util.isNullOrUndefined(relative.search)) {
    // just pull out the search.
    // like href='?foo'.
    // Put this after the other two cases because it simplifies the booleans
    if (psychotic) {
      result.hostname = result.host = srcPath.shift();
      //occationaly the auth can get stuck only in host
      //this especially happens in cases like
      //url.resolveObject('mailto:local1@domain1', 'local2@domain2')
      var authInHost = result.host && result.host.indexOf('@') > 0 ?
                       result.host.split('@') : false;
      if (authInHost) {
        result.auth = authInHost.shift();
        result.host = result.hostname = authInHost.shift();
      }
    }
    result.search = relative.search;
    result.query = relative.query;
    //to support http.request
    if (!util.isNull(result.pathname) || !util.isNull(result.search)) {
      result.path = (result.pathname ? result.pathname : '') +
                    (result.search ? result.search : '');
    }
    result.href = result.format();
    return result;
  }

  if (!srcPath.length) {
    // no path at all.  easy.
    // we've already handled the other stuff above.
    result.pathname = null;
    //to support http.request
    if (result.search) {
      result.path = '/' + result.search;
    } else {
      result.path = null;
    }
    result.href = result.format();
    return result;
  }

  // if a url ENDs in . or .., then it must get a trailing slash.
  // however, if it ends in anything else non-slashy,
  // then it must NOT get a trailing slash.
  var last = srcPath.slice(-1)[0];
  var hasTrailingSlash = (
      (result.host || relative.host || srcPath.length > 1) &&
      (last === '.' || last === '..') || last === '');

  // strip single dots, resolve double dots to parent dir
  // if the path tries to go above the root, `up` ends up > 0
  var up = 0;
  for (var i = srcPath.length; i >= 0; i--) {
    last = srcPath[i];
    if (last === '.') {
      srcPath.splice(i, 1);
    } else if (last === '..') {
      srcPath.splice(i, 1);
      up++;
    } else if (up) {
      srcPath.splice(i, 1);
      up--;
    }
  }

  // if the path is allowed to go above the root, restore leading ..s
  if (!mustEndAbs && !removeAllDots) {
    for (; up--; up) {
      srcPath.unshift('..');
    }
  }

  if (mustEndAbs && srcPath[0] !== '' &&
      (!srcPath[0] || srcPath[0].charAt(0) !== '/')) {
    srcPath.unshift('');
  }

  if (hasTrailingSlash && (srcPath.join('/').substr(-1) !== '/')) {
    srcPath.push('');
  }

  var isAbsolute = srcPath[0] === '' ||
      (srcPath[0] && srcPath[0].charAt(0) === '/');

  // put the host back
  if (psychotic) {
    result.hostname = result.host = isAbsolute ? '' :
                                    srcPath.length ? srcPath.shift() : '';
    //occationaly the auth can get stuck only in host
    //this especially happens in cases like
    //url.resolveObject('mailto:local1@domain1', 'local2@domain2')
    var authInHost = result.host && result.host.indexOf('@') > 0 ?
                     result.host.split('@') : false;
    if (authInHost) {
      result.auth = authInHost.shift();
      result.host = result.hostname = authInHost.shift();
    }
  }

  mustEndAbs = mustEndAbs || (result.host && srcPath.length);

  if (mustEndAbs && !isAbsolute) {
    srcPath.unshift('');
  }

  if (!srcPath.length) {
    result.pathname = null;
    result.path = null;
  } else {
    result.pathname = srcPath.join('/');
  }

  //to support request.http
  if (!util.isNull(result.pathname) || !util.isNull(result.search)) {
    result.path = (result.pathname ? result.pathname : '') +
                  (result.search ? result.search : '');
  }
  result.auth = relative.auth || result.auth;
  result.slashes = result.slashes || relative.slashes;
  result.href = result.format();
  return result;
};

Url.prototype.parseHost = function() {
  var host = this.host;
  var port = portPattern.exec(host);
  if (port) {
    port = port[0];
    if (port !== ':') {
      this.port = port.substr(1);
    }
    host = host.substr(0, host.length - port.length);
  }
  if (host) this.hostname = host;
};


/***/ }),
/* 347 */
/***/ (function(module, exports, __webpack_require__) {

/* WEBPACK VAR INJECTION */(function(module, global) {var __WEBPACK_AMD_DEFINE_RESULT__;/*! https://mths.be/punycode v1.4.1 by @mathias */
;(function(root) {

	/** Detect free variables */
	var freeExports =  true && exports &&
		!exports.nodeType && exports;
	var freeModule =  true && module &&
		!module.nodeType && module;
	var freeGlobal = typeof global == 'object' && global;
	if (
		freeGlobal.global === freeGlobal ||
		freeGlobal.window === freeGlobal ||
		freeGlobal.self === freeGlobal
	) {
		root = freeGlobal;
	}

	/**
	 * The `punycode` object.
	 * @name punycode
	 * @type Object
	 */
	var punycode,

	/** Highest positive signed 32-bit float value */
	maxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1

	/** Bootstring parameters */
	base = 36,
	tMin = 1,
	tMax = 26,
	skew = 38,
	damp = 700,
	initialBias = 72,
	initialN = 128, // 0x80
	delimiter = '-', // '\x2D'

	/** Regular expressions */
	regexPunycode = /^xn--/,
	regexNonASCII = /[^\x20-\x7E]/, // unprintable ASCII chars + non-ASCII chars
	regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g, // RFC 3490 separators

	/** Error messages */
	errors = {
		'overflow': 'Overflow: input needs wider integers to process',
		'not-basic': 'Illegal input >= 0x80 (not a basic code point)',
		'invalid-input': 'Invalid input'
	},

	/** Convenience shortcuts */
	baseMinusTMin = base - tMin,
	floor = Math.floor,
	stringFromCharCode = String.fromCharCode,

	/** Temporary variable */
	key;

	/*--------------------------------------------------------------------------*/

	/**
	 * A generic error utility function.
	 * @private
	 * @param {String} type The error type.
	 * @returns {Error} Throws a `RangeError` with the applicable error message.
	 */
	function error(type) {
		throw new RangeError(errors[type]);
	}

	/**
	 * A generic `Array#map` utility function.
	 * @private
	 * @param {Array} array The array to iterate over.
	 * @param {Function} callback The function that gets called for every array
	 * item.
	 * @returns {Array} A new array of values returned by the callback function.
	 */
	function map(array, fn) {
		var length = array.length;
		var result = [];
		while (length--) {
			result[length] = fn(array[length]);
		}
		return result;
	}

	/**
	 * A simple `Array#map`-like wrapper to work with domain name strings or email
	 * addresses.
	 * @private
	 * @param {String} domain The domain name or email address.
	 * @param {Function} callback The function that gets called for every
	 * character.
	 * @returns {Array} A new string of characters returned by the callback
	 * function.
	 */
	function mapDomain(string, fn) {
		var parts = string.split('@');
		var result = '';
		if (parts.length > 1) {
			// In email addresses, only the domain name should be punycoded. Leave
			// the local part (i.e. everything up to `@`) intact.
			result = parts[0] + '@';
			string = parts[1];
		}
		// Avoid `split(regex)` for IE8 compatibility. See #17.
		string = string.replace(regexSeparators, '\x2E');
		var labels = string.split('.');
		var encoded = map(labels, fn).join('.');
		return result + encoded;
	}

	/**
	 * Creates an array containing the numeric code points of each Unicode
	 * character in the string. While JavaScript uses UCS-2 internally,
	 * this function will convert a pair of surrogate halves (each of which
	 * UCS-2 exposes as separate characters) into a single code point,
	 * matching UTF-16.
	 * @see `punycode.ucs2.encode`
	 * @see <https://mathiasbynens.be/notes/javascript-encoding>
	 * @memberOf punycode.ucs2
	 * @name decode
	 * @param {String} string The Unicode input string (UCS-2).
	 * @returns {Array} The new array of code points.
	 */
	function ucs2decode(string) {
		var output = [],
		    counter = 0,
		    length = string.length,
		    value,
		    extra;
		while (counter < length) {
			value = string.charCodeAt(counter++);
			if (value >= 0xD800 && value <= 0xDBFF && counter < length) {
				// high surrogate, and there is a next character
				extra = string.charCodeAt(counter++);
				if ((extra & 0xFC00) == 0xDC00) { // low surrogate
					output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
				} else {
					// unmatched surrogate; only append this code unit, in case the next
					// code unit is the high surrogate of a surrogate pair
					output.push(value);
					counter--;
				}
			} else {
				output.push(value);
			}
		}
		return output;
	}

	/**
	 * Creates a string based on an array of numeric code points.
	 * @see `punycode.ucs2.decode`
	 * @memberOf punycode.ucs2
	 * @name encode
	 * @param {Array} codePoints The array of numeric code points.
	 * @returns {String} The new Unicode string (UCS-2).
	 */
	function ucs2encode(array) {
		return map(array, function(value) {
			var output = '';
			if (value > 0xFFFF) {
				value -= 0x10000;
				output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800);
				value = 0xDC00 | value & 0x3FF;
			}
			output += stringFromCharCode(value);
			return output;
		}).join('');
	}

	/**
	 * Converts a basic code point into a digit/integer.
	 * @see `digitToBasic()`
	 * @private
	 * @param {Number} codePoint The basic numeric code point value.
	 * @returns {Number} The numeric value of a basic code point (for use in
	 * representing integers) in the range `0` to `base - 1`, or `base` if
	 * the code point does not represent a value.
	 */
	function basicToDigit(codePoint) {
		if (codePoint - 48 < 10) {
			return codePoint - 22;
		}
		if (codePoint - 65 < 26) {
			return codePoint - 65;
		}
		if (codePoint - 97 < 26) {
			return codePoint - 97;
		}
		return base;
	}

	/**
	 * Converts a digit/integer into a basic code point.
	 * @see `basicToDigit()`
	 * @private
	 * @param {Number} digit The numeric value of a basic code point.
	 * @returns {Number} The basic code point whose value (when used for
	 * representing integers) is `digit`, which needs to be in the range
	 * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is
	 * used; else, the lowercase form is used. The behavior is undefined
	 * if `flag` is non-zero and `digit` has no uppercase form.
	 */
	function digitToBasic(digit, flag) {
		//  0..25 map to ASCII a..z or A..Z
		// 26..35 map to ASCII 0..9
		return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);
	}

	/**
	 * Bias adaptation function as per section 3.4 of RFC 3492.
	 * https://tools.ietf.org/html/rfc3492#section-3.4
	 * @private
	 */
	function adapt(delta, numPoints, firstTime) {
		var k = 0;
		delta = firstTime ? floor(delta / damp) : delta >> 1;
		delta += floor(delta / numPoints);
		for (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) {
			delta = floor(delta / baseMinusTMin);
		}
		return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));
	}

	/**
	 * Converts a Punycode string of ASCII-only symbols to a string of Unicode
	 * symbols.
	 * @memberOf punycode
	 * @param {String} input The Punycode string of ASCII-only symbols.
	 * @returns {String} The resulting string of Unicode symbols.
	 */
	function decode(input) {
		// Don't use UCS-2
		var output = [],
		    inputLength = input.length,
		    out,
		    i = 0,
		    n = initialN,
		    bias = initialBias,
		    basic,
		    j,
		    index,
		    oldi,
		    w,
		    k,
		    digit,
		    t,
		    /** Cached calculation results */
		    baseMinusT;

		// Handle the basic code points: let `basic` be the number of input code
		// points before the last delimiter, or `0` if there is none, then copy
		// the first basic code points to the output.

		basic = input.lastIndexOf(delimiter);
		if (basic < 0) {
			basic = 0;
		}

		for (j = 0; j < basic; ++j) {
			// if it's not a basic code point
			if (input.charCodeAt(j) >= 0x80) {
				error('not-basic');
			}
			output.push(input.charCodeAt(j));
		}

		// Main decoding loop: start just after the last delimiter if any basic code
		// points were copied; start at the beginning otherwise.

		for (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) {

			// `index` is the index of the next character to be consumed.
			// Decode a generalized variable-length integer into `delta`,
			// which gets added to `i`. The overflow checking is easier
			// if we increase `i` as we go, then subtract off its starting
			// value at the end to obtain `delta`.
			for (oldi = i, w = 1, k = base; /* no condition */; k += base) {

				if (index >= inputLength) {
					error('invalid-input');
				}

				digit = basicToDigit(input.charCodeAt(index++));

				if (digit >= base || digit > floor((maxInt - i) / w)) {
					error('overflow');
				}

				i += digit * w;
				t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);

				if (digit < t) {
					break;
				}

				baseMinusT = base - t;
				if (w > floor(maxInt / baseMinusT)) {
					error('overflow');
				}

				w *= baseMinusT;

			}

			out = output.length + 1;
			bias = adapt(i - oldi, out, oldi == 0);

			// `i` was supposed to wrap around from `out` to `0`,
			// incrementing `n` each time, so we'll fix that now:
			if (floor(i / out) > maxInt - n) {
				error('overflow');
			}

			n += floor(i / out);
			i %= out;

			// Insert `n` at position `i` of the output
			output.splice(i++, 0, n);

		}

		return ucs2encode(output);
	}

	/**
	 * Converts a string of Unicode symbols (e.g. a domain name label) to a
	 * Punycode string of ASCII-only symbols.
	 * @memberOf punycode
	 * @param {String} input The string of Unicode symbols.
	 * @returns {String} The resulting Punycode string of ASCII-only symbols.
	 */
	function encode(input) {
		var n,
		    delta,
		    handledCPCount,
		    basicLength,
		    bias,
		    j,
		    m,
		    q,
		    k,
		    t,
		    currentValue,
		    output = [],
		    /** `inputLength` will hold the number of code points in `input`. */
		    inputLength,
		    /** Cached calculation results */
		    handledCPCountPlusOne,
		    baseMinusT,
		    qMinusT;

		// Convert the input in UCS-2 to Unicode
		input = ucs2decode(input);

		// Cache the length
		inputLength = input.length;

		// Initialize the state
		n = initialN;
		delta = 0;
		bias = initialBias;

		// Handle the basic code points
		for (j = 0; j < inputLength; ++j) {
			currentValue = input[j];
			if (currentValue < 0x80) {
				output.push(stringFromCharCode(currentValue));
			}
		}

		handledCPCount = basicLength = output.length;

		// `handledCPCount` is the number of code points that have been handled;
		// `basicLength` is the number of basic code points.

		// Finish the basic string - if it is not empty - with a delimiter
		if (basicLength) {
			output.push(delimiter);
		}

		// Main encoding loop:
		while (handledCPCount < inputLength) {

			// All non-basic code points < n have been handled already. Find the next
			// larger one:
			for (m = maxInt, j = 0; j < inputLength; ++j) {
				currentValue = input[j];
				if (currentValue >= n && currentValue < m) {
					m = currentValue;
				}
			}

			// Increase `delta` enough to advance the decoder's <n,i> state to <m,0>,
			// but guard against overflow
			handledCPCountPlusOne = handledCPCount + 1;
			if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {
				error('overflow');
			}

			delta += (m - n) * handledCPCountPlusOne;
			n = m;

			for (j = 0; j < inputLength; ++j) {
				currentValue = input[j];

				if (currentValue < n && ++delta > maxInt) {
					error('overflow');
				}

				if (currentValue == n) {
					// Represent delta as a generalized variable-length integer
					for (q = delta, k = base; /* no condition */; k += base) {
						t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);
						if (q < t) {
							break;
						}
						qMinusT = q - t;
						baseMinusT = base - t;
						output.push(
							stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0))
						);
						q = floor(qMinusT / baseMinusT);
					}

					output.push(stringFromCharCode(digitToBasic(q, 0)));
					bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);
					delta = 0;
					++handledCPCount;
				}
			}

			++delta;
			++n;

		}
		return output.join('');
	}

	/**
	 * Converts a Punycode string representing a domain name or an email address
	 * to Unicode. Only the Punycoded parts of the input will be converted, i.e.
	 * it doesn't matter if you call it on a string that has already been
	 * converted to Unicode.
	 * @memberOf punycode
	 * @param {String} input The Punycoded domain name or email address to
	 * convert to Unicode.
	 * @returns {String} The Unicode representation of the given Punycode
	 * string.
	 */
	function toUnicode(input) {
		return mapDomain(input, function(string) {
			return regexPunycode.test(string)
				? decode(string.slice(4).toLowerCase())
				: string;
		});
	}

	/**
	 * Converts a Unicode string representing a domain name or an email address to
	 * Punycode. Only the non-ASCII parts of the domain name will be converted,
	 * i.e. it doesn't matter if you call it with a domain that's already in
	 * ASCII.
	 * @memberOf punycode
	 * @param {String} input The domain name or email address to convert, as a
	 * Unicode string.
	 * @returns {String} The Punycode representation of the given domain name or
	 * email address.
	 */
	function toASCII(input) {
		return mapDomain(input, function(string) {
			return regexNonASCII.test(string)
				? 'xn--' + encode(string)
				: string;
		});
	}

	/*--------------------------------------------------------------------------*/

	/** Define the public API */
	punycode = {
		/**
		 * A string representing the current Punycode.js version number.
		 * @memberOf punycode
		 * @type String
		 */
		'version': '1.4.1',
		/**
		 * An object of methods to convert from JavaScript's internal character
		 * representation (UCS-2) to Unicode code points, and back.
		 * @see <https://mathiasbynens.be/notes/javascript-encoding>
		 * @memberOf punycode
		 * @type Object
		 */
		'ucs2': {
			'decode': ucs2decode,
			'encode': ucs2encode
		},
		'decode': decode,
		'encode': encode,
		'toASCII': toASCII,
		'toUnicode': toUnicode
	};

	/** Expose `punycode` */
	// Some AMD build optimizers, like r.js, check for specific condition patterns
	// like the following:
	if (
		true
	) {
		!(__WEBPACK_AMD_DEFINE_RESULT__ = (function() {
			return punycode;
		}).call(exports, __webpack_require__, exports, module),
				__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
	} else {}

}(this));

/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(348)(module), __webpack_require__(13)))

/***/ }),
/* 348 */
/***/ (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;
};


/***/ }),
/* 349 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


module.exports = {
  isString: function(arg) {
    return typeof(arg) === 'string';
  },
  isObject: function(arg) {
    return typeof(arg) === 'object' && arg !== null;
  },
  isNull: function(arg) {
    return arg === null;
  },
  isNullOrUndefined: function(arg) {
    return arg == null;
  }
};


/***/ }),
/* 350 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


exports.decode = exports.parse = __webpack_require__(351);
exports.encode = exports.stringify = __webpack_require__(352);


/***/ }),
/* 351 */
/***/ (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.



// If obj.hasOwnProperty has been overridden, then calling
// obj.hasOwnProperty(prop) will break.
// See: https://github.com/joyent/node/issues/1707
function hasOwnProperty(obj, prop) {
  return Object.prototype.hasOwnProperty.call(obj, prop);
}

module.exports = function(qs, sep, eq, options) {
  sep = sep || '&';
  eq = eq || '=';
  var obj = {};

  if (typeof qs !== 'string' || qs.length === 0) {
    return obj;
  }

  var regexp = /\+/g;
  qs = qs.split(sep);

  var maxKeys = 1000;
  if (options && typeof options.maxKeys === 'number') {
    maxKeys = options.maxKeys;
  }

  var len = qs.length;
  // maxKeys <= 0 means that we should not limit keys count
  if (maxKeys > 0 && len > maxKeys) {
    len = maxKeys;
  }

  for (var i = 0; i < len; ++i) {
    var x = qs[i].replace(regexp, '%20'),
        idx = x.indexOf(eq),
        kstr, vstr, k, v;

    if (idx >= 0) {
      kstr = x.substr(0, idx);
      vstr = x.substr(idx + 1);
    } else {
      kstr = x;
      vstr = '';
    }

    k = decodeURIComponent(kstr);
    v = decodeURIComponent(vstr);

    if (!hasOwnProperty(obj, k)) {
      obj[k] = v;
    } else if (isArray(obj[k])) {
      obj[k].push(v);
    } else {
      obj[k] = [obj[k], v];
    }
  }

  return obj;
};

var isArray = Array.isArray || function (xs) {
  return Object.prototype.toString.call(xs) === '[object Array]';
};


/***/ }),
/* 352 */
/***/ (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 stringifyPrimitive = function(v) {
  switch (typeof v) {
    case 'string':
      return v;

    case 'boolean':
      return v ? 'true' : 'false';

    case 'number':
      return isFinite(v) ? v : '';

    default:
      return '';
  }
};

module.exports = function(obj, sep, eq, name) {
  sep = sep || '&';
  eq = eq || '=';
  if (obj === null) {
    obj = undefined;
  }

  if (typeof obj === 'object') {
    return map(objectKeys(obj), function(k) {
      var ks = encodeURIComponent(stringifyPrimitive(k)) + eq;
      if (isArray(obj[k])) {
        return map(obj[k], function(v) {
          return ks + encodeURIComponent(stringifyPrimitive(v));
        }).join(sep);
      } else {
        return ks + encodeURIComponent(stringifyPrimitive(obj[k]));
      }
    }).join(sep);

  }

  if (!name) return '';
  return encodeURIComponent(stringifyPrimitive(name)) + eq +
         encodeURIComponent(stringifyPrimitive(obj));
};

var isArray = Array.isArray || function (xs) {
  return Object.prototype.toString.call(xs) === '[object Array]';
};

function map (xs, f) {
  if (xs.map) return xs.map(f);
  var res = [];
  for (var i = 0; i < xs.length; i++) {
    res.push(f(xs[i], i));
  }
  return res;
}

var objectKeys = Object.keys || function (obj) {
  var res = [];
  for (var key in obj) {
    if (Object.prototype.hasOwnProperty.call(obj, key)) res.push(key);
  }
  return res;
};


/***/ }),
/* 353 */
/***/ (function(module, exports) {

/* (ignored) */

/***/ }),
/* 354 */
/***/ (function(module, exports) {

/* (ignored) */

/***/ }),
/* 355 */
/***/ (function(module, exports, __webpack_require__) {

/* WEBPACK VAR INJECTION */(function(process) {var once = __webpack_require__(356);

var noop = function() {};

var isRequest = function(stream) {
	return stream.setHeader && typeof stream.abort === 'function';
};

var isChildProcess = function(stream) {
	return stream.stdio && Array.isArray(stream.stdio) && stream.stdio.length === 3
};

var eos = function(stream, opts, callback) {
	if (typeof opts === 'function') return eos(stream, null, opts);
	if (!opts) opts = {};

	callback = once(callback || noop);

	var ws = stream._writableState;
	var rs = stream._readableState;
	var readable = opts.readable || (opts.readable !== false && stream.readable);
	var writable = opts.writable || (opts.writable !== false && stream.writable);
	var cancelled = false;

	var onlegacyfinish = function() {
		if (!stream.writable) onfinish();
	};

	var onfinish = function() {
		writable = false;
		if (!readable) callback.call(stream);
	};

	var onend = function() {
		readable = false;
		if (!writable) callback.call(stream);
	};

	var onexit = function(exitCode) {
		callback.call(stream, exitCode ? new Error('exited with error code: ' + exitCode) : null);
	};

	var onerror = function(err) {
		callback.call(stream, err);
	};

	var onclose = function() {
		process.nextTick(onclosenexttick);
	};

	var onclosenexttick = function() {
		if (cancelled) return;
		if (readable && !(rs && (rs.ended && !rs.destroyed))) return callback.call(stream, new Error('premature close'));
		if (writable && !(ws && (ws.ended && !ws.destroyed))) return callback.call(stream, new Error('premature close'));
	};

	var onrequest = function() {
		stream.req.on('finish', onfinish);
	};

	if (isRequest(stream)) {
		stream.on('complete', onfinish);
		stream.on('abort', onclose);
		if (stream.req) onrequest();
		else stream.on('request', onrequest);
	} else if (writable && !ws) { // legacy streams
		stream.on('end', onlegacyfinish);
		stream.on('close', onlegacyfinish);
	}

	if (isChildProcess(stream)) stream.on('exit', onexit);

	stream.on('end', onend);
	stream.on('finish', onfinish);
	if (opts.error !== false) stream.on('error', onerror);
	stream.on('close', onclose);

	return function() {
		cancelled = true;
		stream.removeListener('complete', onfinish);
		stream.removeListener('abort', onclose);
		stream.removeListener('request', onrequest);
		if (stream.req) stream.req.removeListener('finish', onfinish);
		stream.removeListener('end', onlegacyfinish);
		stream.removeListener('close', onlegacyfinish);
		stream.removeListener('finish', onfinish);
		stream.removeListener('exit', onexit);
		stream.removeListener('end', onend);
		stream.removeListener('error', onerror);
		stream.removeListener('close', onclose);
	};
};

module.exports = eos;

/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(15)))

/***/ }),
/* 356 */
/***/ (function(module, exports, __webpack_require__) {

var wrappy = __webpack_require__(357)
module.exports = wrappy(once)
module.exports.strict = wrappy(onceStrict)

once.proto = once(function () {
  Object.defineProperty(Function.prototype, 'once', {
    value: function () {
      return once(this)
    },
    configurable: true
  })

  Object.defineProperty(Function.prototype, 'onceStrict', {
    value: function () {
      return onceStrict(this)
    },
    configurable: true
  })
})

function once (fn) {
  var f = function () {
    if (f.called) return f.value
    f.called = true
    return f.value = fn.apply(this, arguments)
  }
  f.called = false
  return f
}

function onceStrict (fn) {
  var f = function () {
    if (f.called)
      throw new Error(f.onceError)
    f.called = true
    return f.value = fn.apply(this, arguments)
  }
  var name = fn.name || 'Function wrapped with `once`'
  f.onceError = name + " shouldn't be called more than once"
  f.called = false
  return f
}


/***/ }),
/* 357 */
/***/ (function(module, exports) {

// Returns a wrapper function that returns a wrapped callback
// The wrapper function should do some stuff, and return a
// presumably different callback function.
// This makes sure that own properties are retained, so that
// decorations and such are not lost along the way.
module.exports = wrappy
function wrappy (fn, cb) {
  if (fn && cb) return wrappy(fn)(cb)

  if (typeof fn !== 'function')
    throw new TypeError('need wrapper function')

  Object.keys(fn).forEach(function (k) {
    wrapper[k] = fn[k]
  })

  return wrapper

  function wrapper() {
    var args = new Array(arguments.length)
    for (var i = 0; i < args.length; i++) {
      args[i] = arguments[i]
    }
    var ret = fn.apply(this, args)
    var cb = args[args.length-1]
    if (typeof ret === 'function' && ret !== cb) {
      Object.keys(cb).forEach(function (k) {
        ret[k] = cb[k]
      })
    }
    return ret
  }
}


/***/ }),
/* 358 */
/***/ (function(module, exports) {

module.exports = shift

function shift (stream) {
  var rs = stream._readableState
  if (!rs) return null
  return (rs.objectMode || typeof stream._duplexState === 'number') ? stream.read() : stream.read(getStateLength(rs))
}

function getStateLength (state) {
  if (state.buffer.length) {
    // Since node 6.3.0 state.buffer is a BufferList not an array
    if (state.buffer.head) {
      return state.buffer.head.data.length
    }

    return state.buffer[0].length
  }

  return state.length
}


/***/ }),
/* 359 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


module.exports = function() {
  throw new Error(
    'ws does not work in the browser. Browser clients must use the native ' +
      'WebSocket object'
  );
};


/***/ }),
/* 360 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);

// NAMESPACE OBJECT: ./node_modules/webrtc-adapter/src/js/chrome/chrome_shim.js
var chrome_shim_namespaceObject = {};
__webpack_require__.r(chrome_shim_namespaceObject);
__webpack_require__.d(chrome_shim_namespaceObject, "shimGetUserMedia", function() { return shimGetUserMedia; });
__webpack_require__.d(chrome_shim_namespaceObject, "shimGetDisplayMedia", function() { return shimGetDisplayMedia; });
__webpack_require__.d(chrome_shim_namespaceObject, "shimMediaStream", function() { return shimMediaStream; });
__webpack_require__.d(chrome_shim_namespaceObject, "shimOnTrack", function() { return shimOnTrack; });
__webpack_require__.d(chrome_shim_namespaceObject, "shimGetSendersWithDtmf", function() { return shimGetSendersWithDtmf; });
__webpack_require__.d(chrome_shim_namespaceObject, "shimGetStats", function() { return shimGetStats; });
__webpack_require__.d(chrome_shim_namespaceObject, "shimSenderReceiverGetStats", function() { return shimSenderReceiverGetStats; });
__webpack_require__.d(chrome_shim_namespaceObject, "shimAddTrackRemoveTrackWithNative", function() { return shimAddTrackRemoveTrackWithNative; });
__webpack_require__.d(chrome_shim_namespaceObject, "shimAddTrackRemoveTrack", function() { return shimAddTrackRemoveTrack; });
__webpack_require__.d(chrome_shim_namespaceObject, "shimPeerConnection", function() { return shimPeerConnection; });
__webpack_require__.d(chrome_shim_namespaceObject, "fixNegotiationNeeded", function() { return fixNegotiationNeeded; });

// NAMESPACE OBJECT: ./node_modules/webrtc-adapter/src/js/edge/edge_shim.js
var edge_shim_namespaceObject = {};
__webpack_require__.r(edge_shim_namespaceObject);
__webpack_require__.d(edge_shim_namespaceObject, "shimGetUserMedia", function() { return getusermedia_shimGetUserMedia; });
__webpack_require__.d(edge_shim_namespaceObject, "shimGetDisplayMedia", function() { return getdisplaymedia_shimGetDisplayMedia; });
__webpack_require__.d(edge_shim_namespaceObject, "shimPeerConnection", function() { return edge_shim_shimPeerConnection; });
__webpack_require__.d(edge_shim_namespaceObject, "shimReplaceTrack", function() { return shimReplaceTrack; });

// NAMESPACE OBJECT: ./node_modules/webrtc-adapter/src/js/firefox/firefox_shim.js
var firefox_shim_namespaceObject = {};
__webpack_require__.r(firefox_shim_namespaceObject);
__webpack_require__.d(firefox_shim_namespaceObject, "shimGetUserMedia", function() { return firefox_getusermedia_shimGetUserMedia; });
__webpack_require__.d(firefox_shim_namespaceObject, "shimGetDisplayMedia", function() { return firefox_getdisplaymedia_shimGetDisplayMedia; });
__webpack_require__.d(firefox_shim_namespaceObject, "shimOnTrack", function() { return firefox_shim_shimOnTrack; });
__webpack_require__.d(firefox_shim_namespaceObject, "shimPeerConnection", function() { return firefox_shim_shimPeerConnection; });
__webpack_require__.d(firefox_shim_namespaceObject, "shimSenderGetStats", function() { return shimSenderGetStats; });
__webpack_require__.d(firefox_shim_namespaceObject, "shimReceiverGetStats", function() { return shimReceiverGetStats; });
__webpack_require__.d(firefox_shim_namespaceObject, "shimRemoveStream", function() { return shimRemoveStream; });
__webpack_require__.d(firefox_shim_namespaceObject, "shimRTCDataChannel", function() { return shimRTCDataChannel; });
__webpack_require__.d(firefox_shim_namespaceObject, "shimAddTransceiver", function() { return shimAddTransceiver; });
__webpack_require__.d(firefox_shim_namespaceObject, "shimGetParameters", function() { return shimGetParameters; });
__webpack_require__.d(firefox_shim_namespaceObject, "shimCreateOffer", function() { return shimCreateOffer; });
__webpack_require__.d(firefox_shim_namespaceObject, "shimCreateAnswer", function() { return shimCreateAnswer; });

// NAMESPACE OBJECT: ./node_modules/webrtc-adapter/src/js/safari/safari_shim.js
var safari_shim_namespaceObject = {};
__webpack_require__.r(safari_shim_namespaceObject);
__webpack_require__.d(safari_shim_namespaceObject, "shimLocalStreamsAPI", function() { return shimLocalStreamsAPI; });
__webpack_require__.d(safari_shim_namespaceObject, "shimRemoteStreamsAPI", function() { return shimRemoteStreamsAPI; });
__webpack_require__.d(safari_shim_namespaceObject, "shimCallbacksAPI", function() { return shimCallbacksAPI; });
__webpack_require__.d(safari_shim_namespaceObject, "shimGetUserMedia", function() { return safari_shim_shimGetUserMedia; });
__webpack_require__.d(safari_shim_namespaceObject, "shimConstraints", function() { return shimConstraints; });
__webpack_require__.d(safari_shim_namespaceObject, "shimRTCIceServerUrls", function() { return shimRTCIceServerUrls; });
__webpack_require__.d(safari_shim_namespaceObject, "shimTrackEventTransceiver", function() { return shimTrackEventTransceiver; });
__webpack_require__.d(safari_shim_namespaceObject, "shimCreateOfferLegacy", function() { return shimCreateOfferLegacy; });
__webpack_require__.d(safari_shim_namespaceObject, "shimAudioContext", function() { return shimAudioContext; });

// NAMESPACE OBJECT: ./node_modules/webrtc-adapter/src/js/common_shim.js
var common_shim_namespaceObject = {};
__webpack_require__.r(common_shim_namespaceObject);
__webpack_require__.d(common_shim_namespaceObject, "shimRTCIceCandidate", function() { return shimRTCIceCandidate; });
__webpack_require__.d(common_shim_namespaceObject, "shimMaxMessageSize", function() { return shimMaxMessageSize; });
__webpack_require__.d(common_shim_namespaceObject, "shimSendThrowTypeError", function() { return shimSendThrowTypeError; });
__webpack_require__.d(common_shim_namespaceObject, "shimConnectionState", function() { return shimConnectionState; });
__webpack_require__.d(common_shim_namespaceObject, "removeAllowExtmapMixed", function() { return removeAllowExtmapMixed; });

// 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/Code/noop.js
function noop(){};
// 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);
};

/**
 * @param {string} key
 * @param {*} value
 * @returns {*}
 */
Context.prototype.setContext = function (key, value) {
    return this.getContextManager().set(key, value);
};

/**
 * @returns {ContextManager}
 */
Context.prototype.getContextManager = function () {
    return this.parent.getContextManager();
};

/**
 * @param {Context} parent
 */
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();
};

Context.prototype.onDestroy = noop;
Context.prototype.onStop = noop;
Context.prototype.onStart = noop;
Context.prototype.onResume = noop;
Context.prototype.onPause = noop;
Context.prototype.onDetached = noop;
Context.prototype.onAttached = noop;


/* harmony default export */ var AppPattern_Context = (Context);
// EXTERNAL MODULE: ./node_modules/absol/src/HTML5/OOP.js
var OOP = __webpack_require__(3);

// CONCATENATED MODULE: ./node_modules/absol/src/AppPattern/GrandContext.js




/***
 * @extends Context
 * @constructor
 */
function GrandContext(){
    AppPattern_Context.call(this);
    this.ctxMng = new AppPattern_ContextManager();
}

OOP["a" /* default */].mixClass(GrandContext, AppPattern_Context);


GrandContext.prototype.getContextManager = function () {
    return this.ctxMng;
};

/**
 * find context from parent
 * @return {*}
 */
GrandContext.prototype.getContext = function () {
    return AppPattern_Context.prototype.getContext.apply(this, arguments)
        || (this.parent && this.parent.getContext.apply(this.parent, arguments));
};

/* harmony default export */ var AppPattern_GrandContext = (GrandContext);
// CONCATENATED MODULE: ./node_modules/absol/src/AppPattern/Fragment.js





/***
 * @extends GrandContext
 * @constructor
 */
function Fragment() {
    AppPattern_GrandContext.call(this);
    this.ctxMng = new AppPattern_ContextManager();
}

OOP["a" /* default */].mixClass(Fragment, AppPattern_GrandContext);

Fragment.prototype.getContextManager = function () {
    return this.ctxMng;
};

Fragment.prototype.createView = function () {
    throw new Error("Not implement!");
};

Fragment.prototype.getView = function () {
    if (this.$view) return this.$view;
    this.$view = this.createView() || this.$view;
    if (!this.$view) throw new Error("this.$view must be not null!");
    if (this.onCreated) this.onCreated();
    return this.$view;
};

Fragment.prototype.onCreated = noop;

/* harmony default export */ var AppPattern_Fragment = (Fragment);
// EXTERNAL MODULE: ./node_modules/absol-acomp/css/autocompleteinput.css
var autocompleteinput = __webpack_require__(95);

// EXTERNAL MODULE: ./node_modules/absol-acomp/ACore.js
var ACore = __webpack_require__(0);

// EXTERNAL MODULE: ./node_modules/absol/src/HTML5/Dom.js + 3 modules
var Dom = __webpack_require__(1);

// 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(texts, options) {
    if (!this.queryItems) return new SearchStringArrayAdapter(texts, options);
    
    this.texts = texts;
}

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.onAttached = function(parent){
    this.parent = parent;
};

SearchStringArrayAdapter.prototype.getItemText = function (item, mInput) {
    return item.text;
};

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);
// 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(objects, options) {
    if (!this.queryItems) return new SearchObjectArrayAdapter(texts, options);
    this.objects = objects;
    this.options = options;
}

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.prototype.onAttached = function (parent) {
    this.parent = parent;
    parent.getSelectedObject = function () {
        if (this._selectedIndex >= 0) {
            return this.$poolItems[this._selectedIndex]._holderItem;
        }
        else {
            return null;
        }
    }
};

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.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);
// EXTERNAL MODULE: ./node_modules/absol/src/HTML5/EventEmitter.js
var EventEmitter = __webpack_require__(2);

// CONCATENATED MODULE: ./node_modules/absol-acomp/js/AutoCompleteInput.js









var AutoCompleteInput_ = ACore["a" /* default */]._;
var AutoCompleteInput_$ = ACore["a" /* default */].$;

function AutoCompleteInput() {
    this.$input = AutoCompleteInput_$('input', this)
        .on('keyup', this.eventHandler.keyup)
        .on('keydown', this.eventHandler.keydown)
        .on('focus', this.eventHandler.focus)
        .on('blur', this.eventHandler.blur);


    this.$dropdown = AutoCompleteInput_$('.absol-autocomplete-input-dropdown', this);
    this.$vscroller = AutoCompleteInput_$('bscroller', this).on('click', this.eventHandler.vscrollerClick);
    this.$poolItems = [];
    this._currentData = [];
    this._sessionIndex = 0;
    this._updatedSession = -1;
    this._cache = {};
    OOP["a" /* default */].drillProperty(this, this.$input, 'value');

    return this;
}

AutoCompleteInput.tag = 'AutoCompleteInput';

AutoCompleteInput.render = function () {
    return 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'
                    }
                }
            }
        ]
    });
};


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["b" /* 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["b" /* 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/boardtable.css
var boardtable = __webpack_require__(47);

// EXTERNAL MODULE: ./node_modules/absol/src/HTML5/AElement.js
var AElement = __webpack_require__(6);

// CONCATENATED MODULE: ./node_modules/absol-acomp/js/Board.js




var Board_ = ACore["a" /* default */]._;
var Board_$ = ACore["a" /* default */].$;


/***
 * @extends AElement
 * @constructor
 */
function Board() {
}


Board.tag = "board";
Board.render = function () {
    return Board_({
        class: 'as-board',
        extendEvent: ['sizechange', 'changeposition']
    });
};


Board.prototype.getParent = function () {
    var parent = this.parentElement;
    while (parent) {
        if (parent.classList.contains('ac-board-table')) return parent;
        parent = parent.parentElement;
    }
    return null;
};


ACore["a" /* default */].install(Board);

/* harmony default export */ var js_Board = (Board);
// CONCATENATED MODULE: ./node_modules/absol/src/Math/Vec2.js
/***
 *
 * @param  {Number} x
 * @param {Number} y
 * @constructor
 */
function Vec2(x, y) {
    this.x = x;
    this.y = y;
}

/***
 *
 * @returns {Vec2}
 */
Vec2.prototype.copy = function () {
    return new Vec2(this.x, this.y);
};

/***
 *
 * @returns {string}
 */
Vec2.prototype.toString = function () {
    return "(" + this.x + ", " + this.y + ")";
};

/***
 *
 * @returns {number}
 */
Vec2.prototype.abs = function () {
    return Math.sqrt(this.x * this.x + this.y * this.y);
};

/***
 *
 * @returns {Vec2}
 */
Vec2.prototype.normalized = function () {
    var l = this.abs();
    if (l == 0) l = 1;
    return this.div(l);
};

/***
 *
 * @param {number} h
 * @returns {Vec2}
 */
Vec2.prototype.mult = function (h) {
    return new Vec2(this.x * h, this.y * h);
};

/***
 *
 * @param {number} h
 * @returns {Vec2}
 */
Vec2.prototype.div = function (h) {
    return new Vec2(this.x / h, this.y / h);
};

/***
 *
 * @param v
 * @returns {number}
 */
Vec2.prototype.dist = function (v) {
    var dx = v.x - this.x;
    var dy = v.y - this.y;
    return Math.sqrt(dx * dx + dy * dy);
};

/***
 *
 * @param {Vec2} v
 * @returns {Vec2}
 */
Vec2.prototype.sub = function (v) {
    return new Vec2(this.x - v.x, this.y - v.y);
};

/***
 *
 * @param {Vec2} v
 * @returns {Vec2}
 */
Vec2.prototype.add = function (v) {
    return new Vec2(this.x + v.x, this.y + v.y);
};

/***
 *
 * @returns {Vec2}
 */
Vec2.prototype.inv = function () {
    return new Vec2(-this.x, -this.y);
};

/***
 *
 * @param {Vec2} v
 * @param {number} h
 * @returns {Vec2}
 */
Vec2.prototype.linear = function (v, h) {
    return new Vec2(this.x * (1 - h) + v.x * h, this.y * (1 - h) + v.y * h);
};

/***
 *
 * @param {Vec2} v1
 * @returns {number}
 */
Vec2.prototype.dot = function (v1) {
    return this.x * v1.x + this.y * v1.y;
};

/***
 *
 * @returns {number}
 */
Vec2.prototype.direction = function () {
    return Math.atan2(this.y, this.x);
};

/***
 *
 * @param {Number} dx
 * @param {Number} dy
 */
Vec2.prototype.translate = function (dx, dy) {
    return this.add(new Vec2(dx, dy));
};


/****
 *
 * @param {Number} angle - radian
 * @returns {Vec2}
 */
Vec2.prototype.rotate = function (angle) {
    var sinA = Math.sin(angle);
    var cosA = Math.cos(angle);
    var x = this.x * cosA - this.y * sinA;
    var y = this.x * sinA + this.y * cosA;
    return new Vec2(x, y);
};

/***
 *
 * @returns {Vec2}
 */
Vec2.prototype.rotate90 = function () {
    return new Vec2(-this.y, this.x);
};


/***
 *
 * @param {number} angle
 * @returns {Vec2}
 */
Vec2.fromDirection = function (angle) {
    return new Vec2(Math.cos(angle), Math.sin(angle));
};

/***
 *
 * @param x
 * @param y
 * @returns {Vec2}
 */
Vec2.make = function (x, y) {
    if (x instanceof Array) {
        return new Vec2(x[0], x[1]);
    }
    else if (x instanceof Vec2) {
        return x.copy();
    }
    else
        return new Vec2(x, y);
};

/* harmony default export */ var Math_Vec2 = (Vec2);
// CONCATENATED MODULE: ./node_modules/absol/src/HTML5/Element.js

/* harmony default export */ var Element = (AElement["a" /* default */]);
// 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;
}

/**
 *
 * @return {Vec2}
 * @constructor
 */
Rectangle.prototype.A = function () {
    return new Math_Vec2(this.x, this.y);
};

/***
 *
 * @return {Vec2}
 * @constructor
 */
Rectangle.prototype.B = function () {
    return new Math_Vec2(this.x + this.width, this.y);
};

/***
 *
 * @return {Vec2}
 * @constructor
 */
Rectangle.prototype.C = function () {
    return new Math_Vec2(this.x + this.width, this.y + this.height);
};

/***
 *
 * @return {Vec2}
 * @constructor
 */
Rectangle.prototype.D = function () {
    return new Math_Vec2(this.x, this.y + this.height);
};

/***
 *
 * @return {number}
 */
Rectangle.prototype.square = function () {
    return this.width * this.height;
};


Rectangle.prototype.nearestPoint = function (arg0, arg1) {
    if (arg1) arg0 = 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);
};

/***
 *
 * @param {Rectangle} r
 * @param {boolean} margin
 * @return {boolean}
 */
Rectangle.prototype.isCollapse = function (r, margin) {
    if (!margin) margin = 0;
    if (this.x >= r.x + r.width + margin) return false;
    if (this.y >= r.y + r.height + margin) return false;

    if (r.x >= this.x + this.width + margin) return false;
    if (r.y >= this.y + this.height + margin) return false;
    return true;
};

/***
 *
 * @param {Rectangle} r
 * @return {number}
 */
Rectangle.prototype.collapsedSquare = function (r) {
    var collapseRect = this.collapsedRect(r);
    if (collapseRect) {
        return collapseRect.square();
    }
    else {
        return 0;
    }
};

/***
 *
 * @param {Rectangle} r
 * @return {Rectangle}
 */
Rectangle.prototype.collapsedRect = function (r) {
    var maxX, minX, maxY, minY, width, height;
    minX = Math.max(this.x, r.x);
    minY = Math.max(this.y, r.y);
    maxX = Math.min(this.x + this.width, r.x + r.width);
    maxY = Math.min(this.y + this.height, r.y + r.height);
    width = maxX - minX;
    height = maxY - minY;
    if (width >= 0 && height >= 0) {
        return new Rectangle(minX, minY, width, height);
    }
    return null;
};

/**
 * @param {Rectangle} r
 * @returns {Boolean}
 */
Rectangle.prototype.contains = function (r) {
    return (this.x <= r.x) && (this.y <= r.y) && (this.x + this.width >= r.x + r.width) && (this.y + this.height >= r.y + r.height);
};

/**
 * @param {Vec2} p
 * @returns {Boolean}
 */
Rectangle.prototype.containsPoint = function (p) {
    return (this.x <= p.x) && (this.y <= p.y) && (this.x + this.width >= p.x) && (this.y + this.height >= p.y);
};

/**
 * @param {Rectangle} other
 * @returns {Rectangle}
 */
Rectangle.prototype.merge = function (other) {
    var left = Math.min(this.x, other.x);
    var top = Math.min(this.y, other.y);
    var right = Math.max(this.x + this.width, other.x + other.width);
    var bottom = Math.max(this.y + this.height, other.y + other.height);
    return new Rectangle(left, top, right - left, bottom - top);
};


/**
 * @returns {Rectangle}
 */
Rectangle.prototype.clone = function () {
    return new Rectangle(this.x, this.y, this.width, this.height);
};

/***
 *
 * @param {Rectangle} r
 */
Rectangle.prototype.equals = function (r) {
    return this.x == r.x && this.y == r.y && this.height == r.height && this.width == r.width;
};

/**
 * @param {Number} x
 * @param {Number} y
 * @param {Number} width
 * @param {Number} height
 * @returns {Rectangle}
 */
Rectangle.make = function (x, y, width, height) {
    return new Rectangle(x, y, width, height);
};


/**
 * @param {Number} x
 * @param {Number} y
 * @param {Number} width
 * @param {Number} height
 * @returns {Rectangle}
 */
Rectangle.makeCenter = function (x, y, width, height) {
    return new Rectangle(x - width / 2, y - height / 2, width, height);
};

/**
 * @param {ClientRect|DOMRect} clientRect
 * @returns {Rectangle}
 */
Rectangle.fromClientRect = function (clientRect) {
    return new Rectangle(clientRect.left, clientRect.top, clientRect.width, clientRect.height);
};

/* harmony default export */ var Math_Rectangle = (Rectangle);
// 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 getSelectionText() {
    var text = "";
    var activeEl = document.activeElement;
    var activeElTagName = activeEl ? activeEl.tagName.toLowerCase() : null;
    if (
        (activeElTagName == "textarea") || (activeElTagName == "input" &&
        /^(?:text|search|password|tel|url)$/i.test(activeEl.type)) &&
        (typeof activeEl.selectionStart == "number")
    ) {
        text = activeEl.value.slice(activeEl.selectionStart, activeEl.selectionEnd);
    } else if (window.getSelection) {
        text = window.getSelection().toString();
    }
    return text;
}

/***
 *
 * @param num
 * @param maxVal
 * @return {number}
 */
function positiveIntMod(num, maxVal) {
    if (maxVal <= 0) return 0;
    if (num >= 0 && num < maxVal) {
        return Math.floor(num);
    }
    else if (num === Infinity) {
        if (maxVal === Infinity)
            return Infinity;
        else
            return 0;
    }
    else if (num < 0) {
        return (num + (Math.ceil(-num / maxVal) * maxVal)) % maxVal;
    }
    else if (num >= maxVal) {
        return Math.floor(num) % maxVal
    }
    else return 0;

}


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;
}


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;
}


/**
 *
 * @param {AElement} elt
 */
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();
        }
    });
}


function buildCss(StyleSheet) {
    ACore["a" /* default */]._({
        tag: 'style',
        props: {
            innerHTML: Object.keys(StyleSheet).map(function (key) {
                var style = StyleSheet[key];
                return key + ' {\n' +
                    Object.keys(style).map(function (propName) {
                        return propName + ': ' + style[propName] + ';';
                    }).join('\n') +
                    '}';
            }).join('\n')
        }
    }).addTo(document.head);
}

/***
 *
 * @param {"camera"|"microphone"|"camcorder"|{accept:("image/*"|"audio/*"|"video/*"|undefined), capture:boolean|undefined, multiple:boolean|undefined}|{}} props
 * @return {Promise<File[]>}
 */
function openFileDialog(props, unSafe) {
    return new Promise(function (resolve) {
        var input = ACore["a" /* default */]._({
            tag: 'input',
            style: {
                display: 'none'
            },
            attr: {
                type: 'file'
            }
        }).addTo(document.body);
        props = props || {};
        if (props === 'camera') {
            props = {
                accept: 'image/*',
                capture: 'camera'
            }
        }
        else if (props === 'microphone') {
            props = {
                accept: 'audio/*',
                capture: "microphone"
            }
        }
        else if (props === 'camcorder') {
            props = {
                accept: 'video/*',
                capture: 'camcorder'
            }
        }

        if (props.accept) {
            if (props.accept instanceof Array)
                input.attr('accept', props.accept.join(','));
            else
                input.attr('accept', props.accept);
        }
        else {
            input.attr('accept', null);
        }

        if (props.capture) {
            input.attr('capture', props.capture);
        }
        if (props.multiple) {
            input.attr('multiple', 'true');
        }
        else {
            input.attr('multiple');
        }
        input.value = null;

        function focusHandler() {
            setTimeout(function () {
                window.removeEventListener('focus', focusHandler);
                if (unSafe) {
                    input.off('change', changeHandler);
                    input.remove();
                    resolve([]);
                }
            }, 1000);
        }

        function changeHandler() {
            input.off('change', changeHandler);
            window.removeEventListener('focus', focusHandler);
            var files = Array.prototype.slice.call(input.files)
            resolve(files);
            input.remove();
        }

        input.on('change', changeHandler);
        input.click();

        setTimeout(function () {
            window.addEventListener('focus', focusHandler);
        }, 10);
    });
}


var charWidth = {
    "A": 9.337890625,
    "a": 7.7861328125,
    "Ă": 9.337890625,
    "ă": 7.7861328125,
    "Â": 9.337890625,
    "â": 7.7861328125,
    "B": 9.337890625,
    "b": 7.7861328125,
    "C": 10.1103515625,
    "c": 7,
    "D": 10.1103515625,
    "d": 7.7861328125,
    "Đ": 10.1103515625,
    "đ": 7.7861328125,
    "E": 9.337890625,
    "e": 7.7861328125,
    "Ê": 9.337890625,
    "ê": 7.7861328125,
    "G": 10.8896484375,
    "g": 7.7861328125,
    "H": 10.1103515625,
    "h": 7.7861328125,
    "I": 3.8896484375,
    "i": 3.1103515625,
    "K": 9.337890625,
    "k": 7,
    "L": 7.7861328125,
    "l": 3.1103515625,
    "M": 11.662109375,
    "m": 11.662109375,
    "N": 10.1103515625,
    "n": 7.7861328125,
    "O": 10.8896484375,
    "o": 7.7861328125,
    "Ô": 10.8896484375,
    "ô": 7.7861328125,
    "Ơ": 12.00390625,
    "ơ": 9.1806640625,
    "P": 9.337890625,
    "p": 7.7861328125,
    "Q": 10.8896484375,
    "q": 7.7861328125,
    "R": 10.1103515625,
    "r": 4.662109375,
    "S": 9.337890625,
    "s": 7,
    "T": 8.5517578125,
    "t": 3.8896484375,
    "U": 10.1103515625,
    "u": 7.7861328125,
    "Ư": 11.9560546875,
    "ư": 9.3720703125,
    "V": 9.337890625,
    "v": 7,
    "X": 9.337890625,
    "x": 7,
    "Y": 9.337890625,
    "y": 7,
    " ": 3.8896484375
};


function estimateWidth14(text) {
    // return absol.text.measureText(text, '14px arial').width
    var l = 0;
    for (var j = 0; j < text.length; ++j) {
        l += (charWidth[text.charAt(j)]) || 9.337890625;
    }
    return l;
}

/***
 *
 * @param {number} v
 * @returns {number}
 */
function absCeil(v) {
    var a = Math.ceil(Math.abs(v));
    return v < 0 ? -a : a;
}

var propertyFilter =
    ["$trigger",
        "$content", "_isShow", "defineEvent", "isSupportedEvent",
        "emit", "fire", "eventEmittorOnWithTime", "on", "once",
        "off", "init", "eventHandler", "super", "defineAttribute",
        "defineAttributes", "attr", "addStyle", "removeStyle", "addChild", "addTo", "selfRemove",
        "selfReplace", "clearChild", "containsClass", "addClass", "removeClass", "getComputedStyleValue",
        "getFontSize", "findChildAfter", "findChildBefore", "addChildBefore", "addChildAfter",
        "getBoundingRecursiveRect", "isDescendantOf", "getCSSRules", "afterAttached", "afterDisplayed",
        "_azar_extendEvents", "__azar_force", "_azar_extendAttributes", "_azar_extendTags",
        "findAvailablePosition", "$container", "autoFixParrentSize", "sync", "$dropper", "$vmenu",
        "$button", "$text", "$key", "$arrow", "$iconCtn", "_textMarginRight", "_tabIndex",
        '$icon', '_icon', '$textNode', '$primaryBtn', '$extendBtn', '_menuHolder', '_items'].reduce(function (ac, cr) {
        ac[cr] = true;
        return ac;
    }, {});

/**
 * This is a solution for menu, before a better one.
 * @param obj
 * @returns {{}}
 */
function cleanMenuItemProperty(obj) {
    var res = {};
    var keys = Object.keys(obj);
    var key;
    for (var i = 0; i < keys.length; ++i) {
        key = keys[i];
        if (!propertyFilter[key]) {
            res[key] = obj[key];
        }
    }
    res.text = obj.text;
    if (obj.icon) {
        res.icon = obj.icon;
    }
    if (obj.items) {
        res.items = obj.items;
    }

    return res;
}

/***
 *
 * @param {AElement} e1
 * @param {AElement} e2
 */
function swapElt(e1, e2) {
    var temp = _('div');
    e1.parentElement.replaceChild(temp, e1);
    e2.parentElement.replaceChild(e1, e2);
    temp.parentElement.replaceChild(e2, temp);
}

/**
 *
 * @param {HTMLElement} elt
 */
function vScrollIntoView(elt) {
    var parent = elt.parentElement;
    var overflowStyle;
    while (parent) {
        overflowStyle = window.getComputedStyle(parent)['overflow'];
        if ((overflowStyle === 'auto' || overflowStyle === 'hidden auto' || overflowStyle === 'scroll' || parent.tagName === 'HTML')
            && (parent.clientHeight < parent.scrollHeight)) {
            break;
        }
        parent = parent.parentElement;
    }
    if (!parent) return;
    var eBound = elt.getBoundingClientRect();
    var viewportBound = parent.getBoundingClientRect();
    var currentScrollTop = parent.scrollTop;
    var newScrollTop = currentScrollTop;
    if (eBound.bottom > viewportBound.bottom) {
        newScrollTop = currentScrollTop + (eBound.bottom - viewportBound.bottom);
    }
    if (eBound.top < viewportBound.top) {
        newScrollTop = currentScrollTop - (viewportBound.top - eBound.top);
    }

    if (newScrollTop != currentScrollTop) {
        parent.scrollTop = newScrollTop;
    }
}


// EXTERNAL MODULE: ./node_modules/absol-acomp/css/hanger.css
var hanger = __webpack_require__(99);

// EXTERNAL MODULE: ./node_modules/absol/src/Detector/BrowserDetector.js
var BrowserDetector = __webpack_require__(7);

// CONCATENATED MODULE: ./node_modules/absol-acomp/js/Hanger.js







var Hanger_ = ACore["a" /* default */]._;
var Hanger_$ = ACore["a" /* default */].$;

/****
 * @extends AElement
 * @constructor
 */
function Hanger() {
    this.addClass('as-hanger');
    this.defineEvent(['predrag', 'dragstart', 'drag', 'dragend']);
    this._hangOn = 0;
    this._hangerPointerData = null;
    this.on2({
        mousedown: this.eventHandler.hangerPointerDown,
        touchstart: this.eventHandler.hangerPointerDown,
    });

    this._touchEvents = {
        touchend: this.eventHandler.hangerPointerFinish,
        touchcancel: this.eventHandler.hangerPointerFinish,
        touchmove: this.eventHandler.hangerPointerMove
    }
    this._mouseEvents = {
        mouseup: this.eventHandler.hangerPointerFinish,
        mouseleave: this.eventHandler.hangerPointerFinish,
        mousemove: this.eventHandler.hangerPointerMove
    };
}

Hanger.tag = 'hanger';

Hanger.render = function () {
    return Hanger_('div');
};

Hanger.prototype.on2 = function () {
    if (arguments.length == 1) {
        for (var name in arguments[0]) {
            Hanger.prototype.on2.call(this, name, arguments[0][name]);
        }
    }
    else if (arguments.length == 2) {
        this.addEventListener(arguments[0], arguments[1], BrowserDetector["a" /* default */].supportPassiveEvent ? { passive: false } : true);
    }
};


Hanger.prototype.off2 = function () {
    if (arguments.length == 1) {
        for (var name in arguments[0]) {
            Hanger.prototype.off2.call(this, name, arguments[0][name]);
        }
    }
    else if (arguments.length == 2) {
        this.removeEventListener(arguments[0], arguments[1], BrowserDetector["a" /* default */].supportPassiveEvent ? { passive: false } : true);
    }
};


Hanger.property = {};

/**
 * @type {Hanger}
 */
Hanger.property.hangOn = {
    set: function (value) {
        if (!(value > 0)) value = 0;
        this._hangOn = value;
    },
    get: function () {
        return this._hangOn;
    }
};

/**
 * @type {Hanger}
 */
Hanger.eventHandler = {};

Hanger.eventHandler.hangerPointerDown = function (event) {
    if (this._hangerPointerData) return;
    var bound = this.getBoundingClientRect();
    var startingPoint;
    var isTouch = event.type === 'touchstart';
    var pointerIdent = -1;
    var target;
    if (isTouch) {
        var touch = event.changedTouches[0];
        target = touch.target;
        pointerIdent = touch.identifier;
        startingPoint = new Math_Vec2(touch.clientX, touch.clientY);
    }
    else {
        startingPoint = new Math_Vec2(event.clientX, event.clientY);
        target = event.target;
    }
    var offsetVec = startingPoint.sub(new Math_Vec2(bound.left, bound.top));

    this._hangerPointerData = {
        state: 0,
        isTouch: isTouch,
        bound: bound,
        startingPoint: startingPoint,
        offsetVec: offsetVec,
        pointerIdent: pointerIdent,
        target: target
    };
    var preDragEvent = {
        type: 'predrag',
        originEvent: event,
        isTouch: isTouch,
        bound: bound,
        startingPoint: startingPoint,
        currentPoint: startingPoint,
        offsetVec: offsetVec,
        pointerIdent: pointerIdent,
        canceled: false,
        cancel: function () {
            this.canceled = true;
        },
        clientX: startingPoint.x,
        clientY: startingPoint.y,
        target: target,
        preventDefault: function () {
            event.preventDefault();
        }
    };
    this.emit('predrag', preDragEvent, this);
    if (preDragEvent.canceled) {
        this._hangerPointerData = null;
        return;
    }
    ;
    if (isTouch)
        this.on2.call(document.body, this._touchEvents)
    else
        this.on2.call(document.body, this._mouseEvents);

};

Hanger.eventHandler.hangerPointerMove = function (event) {
    var pointerData = this._hangerPointerData;
    var isTouch = pointerData.isTouch;
    var pointerIdent = -2;
    var currentPoint;
    if (isTouch) {
        var touch = Object(EventEmitter["c" /* findChangedTouchByIdent */])(event, pointerData.pointerIdent);
        if (touch) {
            pointerIdent = touch.identifier;
            currentPoint = new Math_Vec2(touch.clientX, touch.clientY);
        }
    }
    else {
        currentPoint = new Math_Vec2(event.clientX, event.clientY);
        pointerIdent = -1;
    }
    if (pointerIdent != pointerData.pointerIdent) return;
    pointerData.currentPoint = currentPoint;
    if (pointerData.state == 0) {
        var distance = currentPoint.sub(pointerData.startingPoint).abs();
        if (distance >= this._hangOn) {
            var dragStartEvent = {
                type: 'dragstart',
                originEvent: event,
                isTouch: isTouch,
                bound: pointerData.bound,
                startingPoint: pointerData.startingPoint,
                offsetVec: pointerData.offsetVec,
                pointerIdent: pointerIdent,
                currentPoint: currentPoint,
                target: pointerData.target,
                clientX: currentPoint.x,
                clientY: currentPoint.y,
                preventDefault: function () {
                    event.preventDefault();
                }
            };
            pointerData.state = 1;
            this.emit('dragstart', dragStartEvent, this);
        }
    }

    if (pointerData.state === 1) {
        var dragEvent = {
            type: 'drag',
            originEvent: event,
            isTouch: isTouch,
            bound: pointerData.bound,
            startingPoint: pointerData.startingPoint,
            offsetVec: pointerData.offsetVec,
            pointerIdent: pointerIdent,
            currentPoint: currentPoint,
            target: pointerData.target,
            clientX: currentPoint.x,
            clientY: currentPoint.y,
            preventDefault: function () {
                event.preventDefault();
            }
        };
        this.emit('drag', dragEvent, this);
    }
};

Hanger.eventHandler.hangerPointerFinish = function (event) {
    var pointerData = this._hangerPointerData;
    var isTouch = event.type === 'touchend';
    if (pointerData.isTouch !== isTouch) return;
    var pointerIdent = -2;
    var currentPoint;
    if (isTouch) {
        var touch = Object(EventEmitter["c" /* findChangedTouchByIdent */])(event, pointerData.pointerIdent);
        if (touch) {
            pointerIdent = touch.identifier;
            currentPoint = new Math_Vec2(touch.clientX, touch.clientY);
        }
    }
    else {
        currentPoint = new Math_Vec2(event.clientX, event.clientY);
        pointerIdent = -1;
    }
    if (pointerIdent !== pointerData.pointerIdent) return;
    if (pointerData.state === 1) {
        var dragEndEvent = {
            type: 'dragend',
            originEvent: event,
            isTouch: isTouch,
            bound: pointerData.bound,
            startingPoint: pointerData.startingPoint,
            offsetVec: pointerData.offsetVec,
            pointerIdent: pointerIdent,
            currentPoint: currentPoint,
            target: pointerData.target,
            clientX: currentPoint.x,
            clientY: currentPoint.y,
            preventDefault: function () {
                event.preventDefault();
            }
        };
        this.emit('dragend', dragEndEvent, this);
    }

    this._hangerPointerData = null;
    if (isTouch)
        this.off2.call(document.body, this._touchEvents)
    else
        this.off2.call(document.body, this._mouseEvents);
};

ACore["a" /* default */].install(Hanger);

/* harmony default export */ var js_Hanger = (Hanger);

// CONCATENATED MODULE: ./node_modules/absol-acomp/js/BoardTable.js












var BoardTable_ = ACore["a" /* default */]._;
var BoardTable_$ = ACore["a" /* default */].$;


/***
 * @extends AElement
 * @constructor
 */
function BoardTable() {
    var events = {
        touchstart: this.eventHandler.mousedown,
        mousedown: this.eventHandler.mousedown
    };
    js_Hanger.prototype.on2.call(this, events);
    this._childHolders = [];
    this._dragEventData = null;
    this._friends = [];
    this._longPressEventData = null;
}

BoardTable.tag = 'boardtable';
BoardTable.render = function () {
    return BoardTable_({
        class: 'as-board-table',
        extendEvent: ['sizechange', 'orderchange', 'itemleave', 'itementer', 'dragitemstart', 'dragitemend']
    });
};

var EFFECT_ZONE_CLASS_NAME = 'as-board-table-effect-zone';
var DRAG_ZONE_CLASS_NAME = 'as-board-drag-zone';
var FREE_ZONE_CLASS_NAME = 'as-board-free-zone';

BoardTable.EFFECT_ZONE_CLASS_NAME = EFFECT_ZONE_CLASS_NAME;
BoardTable.DRAG_ZONE_CLASS_NAME = DRAG_ZONE_CLASS_NAME;
BoardTable.FREE_ZONE_CLASS_NAME = FREE_ZONE_CLASS_NAME;

BoardTable.prototype.$preventContext = BoardTable_({
    tag: 'textarea',
    class: 'as-board-table-prevent-context',
    props: { readOnly: true }
});

BoardTable.prototype.maxScrollSpeed = 300;


BoardTable.prototype.findDomChildBefore = function (elt) {
    var nodes = this.childNodes;
    for (var i = 0; i < nodes.length; ++i) {
        if (nodes[i] == elt) return nodes[i - 1];
    }
    return null;
};


BoardTable.prototype.findDomChildAfter = function (elt) {
    var nodes = this.childNodes;
    for (var i = 0; i < nodes.length; ++i) {
        if (nodes[i] == elt) return nodes[i + 1];
    }
    return null;
};


BoardTable.prototype.addChild = function (elt) {
    if (elt.classList.contains('as-board')) {
        elt.selfRemove();
        var atElt;
        if (this._childHolders.length > 0) {
            atElt = this.findDomChildAfter(this._childHolders[this._childHolders.length - 1].elt);
            if (atElt) {
                if (atElt != -1)
                    this.insertBefore(elt, atElt);
                else
                    throw new Error("Violation data!");
            }
            else {
                this.appendChild(elt);
            }
        }
        else {
            this.appendChild(elt);
        }
        var holder = {
            elt: elt,
        };
        elt.on('sizechange', holder.onsizechange);
        this._childHolders.push(holder);
    }
    else {
        this.appendChild(elt);
    }
    return this;
};


BoardTable.prototype.removeChild = function (elt) {
    var holderIndex = this.findChildHolderIndex(elt);
    if (holderIndex >= 0) {
        var holder = this._childHolders[holderIndex];
        holder.elt.off('sizechange', holder.onsizechange);
        this._childHolders.splice(holderIndex, 1);
        holder.elt.remove();
    }
    else {
        this.super(elt);
    }
};

BoardTable.prototype.findChildBefore = function (elt) {
    var holderIndex = this.findChildHolderIndex(elt);
    if (holderIndex < 0) return holderIndex;
    if (holderIndex < 1) return null;
    return this._childHolders[holderIndex - 1];
};


BoardTable.prototype.findChildAfter = function (elt) {
    var holderIndex = this.findChildHolderIndex(elt);
    if (holderIndex < 0) return holderIndex;
    if (holderIndex <= this._childHolders.length) return null;
    return this._childHolders[holderIndex + 1];
};

BoardTable.prototype.addChildBefore = function (elt, at) {
    elt.selfRemove();
    var atIndex = this.findChildHolderIndex(at);
    if (elt.classList.contains('as-board')) {
        if (atIndex < 0) {
            if (this._childHolders.length > 0) {
                if (this.findDomChildAfter(this._childHolders[this._childHolders.length - 1].elt) == at) {
                    atIndex = this._childHolders.length;
                }
                else {
                    throw new Error("Invalid position, you must insert board next to other board!");
                }
            }
        }

        this.insertBefore(elt, at);
        var holder = {
            elt: elt
        };
        this._childHolders.splice(atIndex, 0, holder);
    }
    else {
        if (atIndex > 0) {
            throw new Error("Invalid position, you can not insert othert type between two board!");
        }
        else {
            this.insertBefore(elt, at);
        }
    }
    return this;
};

BoardTable.prototype.addChildAfter = function (elt, at) {
    elt.selfRemove();
    var atIndex = this.findChildHolderIndex(at);
    var afterAt = this.findDomChildAfter(at);
    if (elt.classList.contains('as-board')) {
        if (atIndex < 0) {
            if (this._childHolders.length > 0) {
                if (this.findDomChildBefore(this._childHolders[0].elt) == at) {
                    atIndex = -1;
                }
                else
                    throw new Error("Invalid position,  you must insert board next to other board!");
            }
        }

        var holder = {
            elt: elt
        };
        if (!afterAt) {
            this.appendChild(elt);
        }
        else {
            this.insertBefore(elt, afterAt);
        }
        this._childHolders.splice(atIndex + 1, 0, holder);
    }
    else {
        if (this._childHolders.length > 1 && atIndex >= 0 && atIndex + 1 < this._childHolders.length) {
            throw new Error("Invalid position, you can not insert othert type between two board!");
        }
        else {
            if (!afterAt) {
                this.appendChild(elt);
            }
            else {
                this.insertBefore(elt, afterAt);
            }

        }
    }
    return this;
};

BoardTable.prototype.clearChild = function () {
    this._childHolders = [];
    return Element.prototype.clearChild.call(this);
};


BoardTable.prototype.findChildHolder = function (elt) {
    return this._childHolders[this.findChildHolderIndex(elt)];
};


BoardTable.prototype.findChildHolderIndex = function (elt) {
    for (var i = 0; i < this._childHolders.length; ++i) {
        if (this._childHolders[i].elt == elt) return i;
    }
    return -1;
};


BoardTable.prototype.getEffectZone = function () {
    var ez = this;
    while (ez) {
        if (ez.classList.contains(EFFECT_ZONE_CLASS_NAME)) {
            return ez;
        }
        ez = ez.parentElement;
    }
    return this;
};

BoardTable.prototype._findDragZone = function (elt) {
    var res = null;
    while (elt != this && elt) {
        if (elt.classList.contains('as-board-table')) return null;//maybe in other
        if (!res && elt.classList.contains(DRAG_ZONE_CLASS_NAME)) {
            res = elt;
        }
        if (!res && elt.classList.contains(FREE_ZONE_CLASS_NAME)) return null;// do not drag
        elt = elt.parentElement;
    }
    return res;
};

BoardTable.prototype._findBoard = function (elt) {
    while (elt != this && elt) {
        if (elt.classList.contains('as-board')) return elt;
        elt = elt.parentElement;
    }
    return null;
};


BoardTable.prototype.getAllFriends = function () {
    var thisBT = this;
    var res = [];
    var friendQR;
    for (var i = 0; i < this._friends.length; ++i) {
        friendQR = this._friends[i];
        if (friendQR != this && friendQR && friendQR.classList && friendQR.classList.contains('as-board-table')) {
            res.push(friendQR);
        }
        else if (typeof friendQR == 'string') {// query
            BoardTable_$(friendQR, false, function (elt) {
                if (thisBT != elt && elt.classList && elt.classList.contains('as-board-table')) {
                    res.push(elt);
                }
                return false;
            });
        }
    }

    return res;
};


BoardTable.prototype._findHoverBoardIndex = function (clientX, clientY, excludes) {
    var cli = new Math_Vec2(clientX, clientY);
    var bound;
    for (var i = 0; i < this._childHolders.length; ++i) {
        // holder =
        if (excludes && excludes.indexOf(this._childHolders[i].elt) >= 0) continue;
        bound = Math_Rectangle.fromClientRect(this._childHolders[i].elt.getBoundingClientRect());
        if (bound.containsPoint(cli)) return i;
    }
    return -1;
};


/**
 * @type {BoardTable}
 */
BoardTable.eventHandler = {};


BoardTable.eventHandler.mousedown = function (event) {
    if (this._dragEventData) return;
    var mousePos;
    var pointerIdent = -1;
    var target;
    var isTouch = event.type === 'touchstart';
    if (isTouch) {
        var touch = event.changedTouches[0];
        target = touch.target;
        pointerIdent = touch.identifier;
        mousePos = new Math_Vec2(touch.clientX, touch.clientY);
    }
    else {
        mousePos = new Math_Vec2(event.clientX, event.clientY);
        target = event.target;
    }


    var dragzone = this._findDragZone(target);
    if (dragzone) {
        var boardElt = this._findBoard(dragzone);
        var holderIndex = this.findChildHolderIndex(boardElt);
        if (holderIndex < 0) return;// can not move
        var cBound = boardElt.getBoundingClientRect();
        var mouseBoardOffset = mousePos.sub(new Math_Vec2(cBound.left, cBound.top));
        this._dragEventData = {
            boardElt: boardElt,
            state: 'WAIT',
            mouseStartPos: mousePos,
            mousePos: mousePos,
            mouseBoardOffset: mouseBoardOffset,
            holderIndex: holderIndex,
            boardBound: cBound,
            isTouch: isTouch,
            pointerIdent: pointerIdent
        };
        var cEvent = EventEmitter["b" /* default */].copyEvent(event);

        if (isTouch) {
            js_Hanger.prototype.on2.call(document.body, {
                touchend: this.eventHandler.touchFinishBeforeReadyDrag,
                touchcancel: this.eventHandler.touchFinishBeforeReadyDrag,
                touchmove: this.eventHandler.touchMoveBeforeReadyDrag
            });
            this.$preventContext.off('contextmenu', this.eventHandler.contextMenu);//event maybe not remove because of double click
            this.$preventContext.on('contextmenu', this.eventHandler.contextMenu);
            var thisBT = this;

            this._dragEventData._longPressTimeout = setTimeout(function () {
                thisBT._longPressEventData = -1;
                thisBT.$preventContext.addStyle({
                    '--x': mousePos.x + 'px',
                    '--y': mousePos.y + 'px'
                }).addTo(document.body);
                thisBT.eventHandler.readyDrag(cEvent);
            }, 400);
        }
        else {
            this.eventHandler.readyDrag(event);
        }
    }
};

BoardTable.eventHandler.touchFinishBeforeReadyDrag = function (event) {
    var thisBT = this;
    var dragEventData = this._dragEventData;
    if (!dragEventData) return;
    js_Hanger.prototype.off2.call(document.body, {
        touchend: this.eventHandler.touchFinishBeforeReadyDrag,
        touchcancel: this.eventHandler.touchFinishBeforeReadyDrag,
        touchmove: this.eventHandler.touchMoveBeforeReadyDrag
    })
    if (this._dragEventData._longPressTimeout > 0) {
        clearTimeout(this._dragEventData._longPressTimeout);
    }
    if (dragEventData.state === 'WAIT') {
        this._dragEventData = null;// canceled
    }
    else {
        setTimeout(function () {
            thisBT.$preventContext.off('contextmenu', thisBT.eventHandler.contextMenu);
            thisBT.$preventContext.remove();
        }, 60);
    }


};

BoardTable.eventHandler.contextMenu = function (event) {
    event.preventDefault();
    this.$preventContext.off('contextmenu', this.eventHandler.contextMenu);
    this.$preventContext.remove();
    this.eventHandler.touchFinishBeforeReadyDrag(event);
}

BoardTable.eventHandler.touchMoveBeforeReadyDrag = function (event) {
    var dragEventData = this._dragEventData;
    var touch = Object(EventEmitter["c" /* findChangedTouchByIdent */])(event, dragEventData.pointerIdent);
    if (!touch) return;
    var mousePos = new Math_Vec2(touch.clientX, touch.clientY);
    if (dragEventData.state === 'WAIT') {
        var dv = mousePos.sub(dragEventData.mouseStartPos);
        if (dv.abs() > 8) {
            this.eventHandler.touchFinishBeforeReadyDrag(event);
            this._dragEventData = null;// cancel
        }
    }
    else {
        this.$preventContext.addStyle({
            '--x': mousePos.x + 'px',
            '--y': mousePos.y + 'px'
        });
    }

};

BoardTable.eventHandler.readyDrag = function (event) {
    var dragEventData = this._dragEventData;
    dragEventData.state = "PRE_DRAG";
    var bodyEvents = {};
    if (dragEventData.isTouch) {
        bodyEvents.touchmove = this.eventHandler.mousemove;
        bodyEvents.touchcancel = this.eventHandler.mousefinish;
        bodyEvents.touchend = this.eventHandler.mousefinish;
    }
    else {
        bodyEvents.mousemove = this.eventHandler.mousemove;
        bodyEvents.mouseup = this.eventHandler.mousefinish;
        bodyEvents.mouseleave = this.eventHandler.mousefinish;
    }

    js_Hanger.prototype.on2.call(document.body, bodyEvents);
    if (dragEventData.isTouch) {
        this.eventHandler.mousemove(event);
    }
};

BoardTable.eventHandler.mousemovePredrag = function (event) {
    var dragEventData = this._dragEventData;
    var mousePos = dragEventData.mousePos;
    var thisBT = this;
    event.preventDefault();
    var cBound = dragEventData.boardElt.getBoundingClientRect();
    if (mousePos.sub(dragEventData.mouseStartPos).abs() > 8 || dragEventData.isTouch) {
        dragEventData.placeHolderElt = BoardTable_$(dragEventData.boardElt.cloneNode(false))
            .addClass('as-board-place-holder')
            .addStyle({
                width: cBound.width + 'px',
                height: cBound.height + 'px'
            });
        dragEventData.friendHolders = this.getAllFriends().concat([this]).map(function (elt) {
            //include itself
            var effectZone = elt.getEffectZone();
            var res = {
                elt: elt,
                effectZone: effectZone
            }
            if (!dragEventData.isTouch) {
                var enterEvent = thisBT.eventHandler.enterFriendEffectZone.bind(thisBT, elt);
                js_Hanger.prototype.on2.call(effectZone, dragEventData.isTouch ? 'touchmove' : 'mouseenter', enterEvent);
                res.enterEvent = enterEvent;
            }
            else {
                // use move event to detect
            }

            return res;
        });
        dragEventData.inEffectZoneOf = this
        dragEventData.cardStyle = {
            width: dragEventData.boardElt.style.width,
            height: dragEventData.boardElt.style.height
        };

        dragEventData.boardElt.addStyle({
            width: cBound.width + 'px',
            height: cBound.height + 'px'
        });

        this.insertBefore(dragEventData.placeHolderElt, dragEventData.boardElt);
        dragEventData.state = "DRAG";
        BoardTable_$(document.body).addClass('as-has-board-table-drag');
        dragEventData.boardElt.addClass('as-board-moving');
        dragEventData.boardAt = dragEventData.holderIndex;
        dragEventData.boardIn = thisBT;
        this.emit('dragitemstart', {
            type: 'dragitemstart',
            target: this,
            boardElt: this._dragEventData.boardElt
        }, this);
    }
};


BoardTable.eventHandler.mousemoveDragInSelf = function (event) {
    var dragEventData = this._dragEventData;
    var mousePos = dragEventData.mousePos;
    if (this._childHolders.length < 2) {
        if (dragEventData.boardIn != this) {
            this.insertBefore(dragEventData.placeHolderElt, this._childHolders[0].elt);
            dragEventData.boardIn = this;
            dragEventData.boardAt = 0;
        }
    }
    else {
        // bản thân chỉ có 1, hoặc nhiều hơn
        var i = this._findHoverBoardIndex(mousePos.x, mousePos.y, [dragEventData.boardElt]);
        if (i >= 0) {
            if (dragEventData.boardIn != this) {
                dragEventData.boardIn = this;
            }
            var viewIndex;
            if ((i < dragEventData.holderIndex && i < dragEventData.boardAt)
                || (i > dragEventData.holderIndex && i > dragEventData.boardAt)
                || dragEventData.holderIndex == dragEventData.boardAt) {
                viewIndex = i;
            }
            else {
                if (dragEventData.holderIndex > dragEventData.boardAt) {
                    viewIndex = i + 1;
                }
                else {
                    viewIndex = i - 1;
                }
            }

            var fbound = this._childHolders[i].elt.getBoundingClientRect();
            var displayStyple = this._childHolders[i].elt.getComputedStyleValue('display');

            if (mousePos.x > fbound.left && mousePos.x < fbound.right
                && mousePos.y > fbound.top && mousePos.y < fbound.bottom) {
                if (displayStyple.startsWith('inline')) {
                    if (dragEventData.boardBound.width < fbound.width) {
                        if (dragEventData.boardAt > viewIndex && mousePos.x > fbound.left + dragEventData.boardBound.width) {
                            viewIndex += 1;
                        }
                        else if (dragEventData.boardAt < viewIndex && mousePos.x < fbound.left + fbound.width - dragEventData.boardBound.width) {
                            viewIndex -= 1;
                        }
                    }
                }
                else {
                    if (dragEventData.boardBound.height < fbound.height) {
                        if (dragEventData.boardAt > viewIndex && mousePos.y >= fbound.top + dragEventData.boardBound.height) {
                            viewIndex += 1;
                        }
                        else if (dragEventData.boardAt < viewIndex && mousePos.y <= fbound.top + fbound.height - dragEventData.boardBound.height) {
                            viewIndex -= 1;
                        }
                    }
                }
                viewIndex = Math.max(0, Math.min(this._childHolders.length, viewIndex));
                if (viewIndex != dragEventData.boardAt) {
                    dragEventData.boardAt = viewIndex;
                    if (dragEventData.holderIndex >= viewIndex) {
                        this.insertBefore(dragEventData.placeHolderElt, this._childHolders[viewIndex].elt);
                    }
                    else {
                        var bf = Element.prototype.findChildAfter.call(this, this._childHolders[viewIndex].elt);
                        if (bf)
                            this.insertBefore(dragEventData.placeHolderElt, bf);
                        else {
                            this.appendChild(dragEventData.placeHolderElt);
                        }
                    }
                }
            }
        }
    }
};

BoardTable.eventHandler.mousemoveDragInOther = function (event) {
    var dragEventData = this._dragEventData;
    var mousePos = dragEventData.mousePos;
    var other = dragEventData.inEffectZoneOf;
    if (other._childHolders.length == 0) {
        if (dragEventData.boardIn != other) {
            dragEventData.boardIn = other;
            dragEventData.boardAt = 0;
            other.appendChild(dragEventData.placeHolderElt);
        }
    }
    else {
        var i = other._findHoverBoardIndex(mousePos.x, mousePos.y);
        if (i >= 0) {
            if (dragEventData.boardIn != other) {
                dragEventData.boardIn = other;
            }
            var displayStyple = other._childHolders[i].elt.getComputedStyleValue('display');
            var di = 0;
            var bbound = other._childHolders[i].elt.getBoundingClientRect();

            if (displayStyple.startsWith('inline')) {
                if (mousePos.x > bbound.left + bbound.width / 2) di++;
            }
            else {
                if (mousePos.y > bbound.top + bbound.height / 2) di++;
            }
            i += di;
            if (i < other._childHolders.length) {
                other.insertBefore(dragEventData.placeHolderElt, other._childHolders[i].elt);
            }
            else {
                var bf = other.findChildAfter(other._childHolders[other._childHolders.length - 1].elt);
                if (bf) {
                    other.insertBefore(dragEventData.placeHolderElt, bf);
                }
                else {
                    other.appendChild(dragEventData.placeHolderElt)
                }
            }
            dragEventData.boardAt = i;
        }
    }
};


BoardTable.eventHandler.mousemoveDrag = function (event) {
    var dragEventData = this._dragEventData;
    if (dragEventData.inEffectZoneOf == this) {
        this.eventHandler.mousemoveDragInSelf(event);
    }
    else {
        this.eventHandler.mousemoveDragInOther(event);
    }
};

BoardTable.eventHandler.boarDrag = function (event) {
    var dragEventData = this._dragEventData;
    var mousePos = dragEventData.mousePos;
    var boardPos = mousePos.sub(dragEventData.mouseBoardOffset);
    dragEventData.boardElt.addStyle({
        left: boardPos.x + 'px',
        top: boardPos.y + 'px'
    });
};


BoardTable.eventHandler.dragOnEffectZone = function (event) {
    var dragEventData = this._dragEventData;
    var mousePos = dragEventData.mousePos;
    var friendHolders = dragEventData.friendHolders;
    var bound;
    for (var i = 0; i < friendHolders.length; ++i) {
        bound = Math_Rectangle.fromClientRect(friendHolders[i].effectZone.getBoundingClientRect());
        if (bound.containsPoint(mousePos)) {
            dragEventData.inEffectZoneOf = friendHolders[i].elt;
            break;
        }
    }
};

BoardTable.eventHandler.mousemoveOverflow = function (event) {
    if (!this._dragEventData) return;
    var dragEventData = this._dragEventData;
    var scrollerX = this._dragEventData.boardIn;
    var overflowStyle;
    while (scrollerX) {
        overflowStyle = window.getComputedStyle(scrollerX)['overflow'];
        if ((overflowStyle === 'auto' || overflowStyle === 'auto hidden' || overflowStyle === 'scroll' || scrollerX.tagName === 'HTML') && (scrollerX.clientWidth < scrollerX.scrollWidth)) break;
        scrollerX = scrollerX.parentElement;
    }
    var scrollerY = this._dragEventData.boardIn;
    while (scrollerY) {
        overflowStyle = window.getComputedStyle(scrollerY)['overflow'];
        if ((overflowStyle === 'auto' || overflowStyle === 'hidden auto' || overflowStyle === 'scroll' || scrollerY.tagName === 'HTML') && (scrollerY.clientHeight < scrollerY.scrollHeight)) break;
        scrollerY = scrollerY.parentElement;
    }

    var outBound;
    var bBound;
    var screenSize = Dom["b" /* default */].getScreenSize();
    var vx = 0;
    var vy = 0;
    bBound = this._dragEventData.boardElt.getBoundingClientRect();
    if (scrollerX) {
        if (dragEventData.$scrollerX !== scrollerX) {
            dragEventData.scrollerXValue = scrollerX.scrollLeft;
            dragEventData.$scrollerX = scrollerX;
        }
        outBound = scrollerX.getBoundingClientRect();
        outBound = {
            left: Math.max(outBound.left, 0),
            top: Math.max(outBound.top, 0),
            bottom: Math.min(outBound.bottom, screenSize.height),
            right: Math.min(outBound.right, screenSize.width)
        }
        if (bBound.left < outBound.left) {
            vx = bBound.left - outBound.left;
        }
        else if (bBound.right > outBound.right) {
            vx = bBound.right - outBound.right;
        }
    }
    else {
        dragEventData.$scrollerX = null;
    }

    if (scrollerY) {
        if (dragEventData.$scrollerY !== scrollerY) {
            dragEventData.scrollerYValue = scrollerY.scrollTop;
            dragEventData.$scrollerY = scrollerY;
        }
        outBound = scrollerY.getBoundingClientRect();
        outBound = {
            left: Math.max(outBound.left, 0),
            top: Math.max(outBound.top, 0),
            bottom: Math.min(outBound.bottom, screenSize.height),
            right: Math.min(outBound.right, screenSize.width)
        }
        if (bBound.top < outBound.top) {
            vy = bBound.top - outBound.top;
        }
        else if (bBound.bottom > outBound.bottom) {
            vy = bBound.bottom - outBound.bottom;
        }
    }
    else {
        dragEventData.$scrollerY = null;
    }


    vx = Math.max(-this.maxScrollSpeed, Math.min(this.maxScrollSpeed, vx * Math.sqrt(Math.abs(vx))));
    vy = Math.max(-this.maxScrollSpeed, Math.min(this.maxScrollSpeed, vy * Math.sqrt(Math.abs(vy))));
    if (vx !== 0 || vy !== 0) {
        var copyEvent = {
            type: event.type,
            preventDefault: function () {/* noop */
            },
            target: event.target
        };
        if (event.type === 'touchmove') {
            copyEvent.changedTouches = Array.prototype.map.call(event.changedTouches, function (it) {
                return { identifier: it.identifier, clientX: it.clientX, clientY: it.clientY, target: it.target }
            });
            copyEvent.touches = Array.prototype.map.call(event.touches, function (it) {
                return { identifier: it.identifier, clientX: it.clientX, clientY: it.clientY, target: it.target }
            });
        }
        else {
            copyEvent.clientX = event.clientX;
            copyEvent.clientY = event.clientY
        }
        var thisBT = this;
        var now = new Date().getTime();
        if (dragEventData.requestAnimationFrameId >= 0) {
            cancelAnimationFrame(dragEventData.requestAnimationFrameId);
        }
        dragEventData.requestAnimationFrameId = requestAnimationFrame(function () {
            dragEventData.requestAnimationFrameId = -1;
            var dt = (new Date().getTime() - now) / 1000;
            if (dragEventData.$scrollerY) {
                dragEventData.scrollerYValue += vy * dt;
                dragEventData.scrollerYValue = Math.max(0, Math.min(dragEventData.$scrollerY.scrollHeight - dragEventData.$scrollerY.clientHeight, dragEventData.scrollerYValue))
                dragEventData.$scrollerY.scrollTop = dragEventData.scrollerYValue;
            }

            if (dragEventData.$scrollerX) {
                dragEventData.scrollerXValue += vx * dt;
                dragEventData.scrollerXValue = Math.max(0, Math.min(dragEventData.$scrollerX.scrollWidth - dragEventData.$scrollerX.clientWidth, dragEventData.scrollerXValue))
                dragEventData.$scrollerX.scrollLeft = dragEventData.scrollerXValue;
            }

            if (thisBT._dragEventData && thisBT._dragEventData.state === "DRAG") {
                thisBT.eventHandler.mousemoveOverflow(copyEvent);
            }
        });
    }
};

BoardTable.eventHandler.mousemove = function (event) {
    var dragEventData = this._dragEventData;
    var isTouch = event.type === 'touchmove' || event.type === 'touchstart';// call from timeout
    if (dragEventData.isTouch !== isTouch) return;
    var mousePos;
    var pointerIdent;
    var touch = -2;
    if (isTouch) {
        touch = Object(EventEmitter["c" /* findChangedTouchByIdent */])(event, dragEventData.pointerIdent);
        if (touch) {
            pointerIdent = touch.identifier;
            mousePos = new Math_Vec2(touch.clientX, touch.clientY);
        }
    }
    else {
        pointerIdent = -1;
        mousePos = new Math_Vec2(event.clientX, event.clientY);
    }
    if (dragEventData.pointerIdent !== pointerIdent) return;
    dragEventData.mousePos = mousePos;
    event.preventDefault();
    if (dragEventData.isTouch && dragEventData.state === 'DRAG') {
        this.eventHandler.dragOnEffectZone(event);//because touch not have mouseenter event
    }
    if (dragEventData.state === 'PRE_DRAG') {
        this.eventHandler.mousemovePredrag(event);
    }
    if (dragEventData.state === 'DRAG') {
        this.eventHandler.mousemoveDrag(event);
        this.eventHandler.boarDrag(event);
        this.eventHandler.mousemoveOverflow(event);
    }
};


BoardTable.eventHandler.mousefinish = function (event) {
    var dragEventData = this._dragEventData;
    var isTouch = event.type === 'touchend';
    if (dragEventData.isTouch !== isTouch) return;
    var mousePos;
    var pointerIdent;
    var touch = -2;
    if (isTouch) {
        touch = Object(EventEmitter["c" /* findChangedTouchByIdent */])(event, dragEventData.pointerIdent);
        if (touch) {
            pointerIdent = touch.identifier;
            mousePos = new Math_Vec2(touch.clientX, touch.clientY);
        }
    }
    else {
        pointerIdent = -1;
        mousePos = new Math_Vec2(event.clientX, event.clientY);
    }
    if (dragEventData.pointerIdent !== pointerIdent) return;
    dragEventData.mousePos = mousePos;

    var changed;
    if (dragEventData.state == 'DRAG') {
        setTimeout(function () {
            BoardTable_$(document.body).removeClass('as-has-board-table-drag');
        }, 1)
        dragEventData.boardElt.removeClass('as-board-moving')
            .removeStyle('left')
            .removeStyle('top');
        dragEventData.boardElt.addStyle(dragEventData.cardStyle);
        dragEventData.placeHolderElt.remove();
        dragEventData.state = "FINISH";
        if (!dragEventData.isTouch)
            dragEventData.friendHolders.forEach(function (holder) {
                js_Hanger.prototype.off2.call(holder.effectZone, 'mouseenter', holder.enterEvent);
            });

        if (dragEventData.boardIn == this) {
            if (dragEventData.holderIndex != dragEventData.boardAt) {
                if (dragEventData.holderIndex > dragEventData.boardAt) {
                    this.insertBefore(dragEventData.boardElt, this._childHolders[dragEventData.boardAt].elt);
                }
                else if (dragEventData.holderIndex < dragEventData.boardAt) {
                    var bf = Element.prototype.findChildAfter.call(this, this._childHolders[dragEventData.boardAt].elt);
                    if (bf)
                        this.insertBefore(dragEventData.boardElt, bf);
                    else {
                        this.appendChild(dragEventData.boardElt);
                    }
                }
                var holder = this._childHolders.splice(dragEventData.holderIndex, 1)[0];
                this._childHolders.splice(dragEventData.boardAt, 0, holder);
                changed = 'orderchange';
                this.emit('orderchange', {
                    type: 'orderchange',
                    boardElt: holder.elt,
                    action: 'move',
                    from: dragEventData.holderIndex,
                    to: dragEventData.boardAt,
                    target: this,
                }, this);
            }
        }
        else {
            var holder = this._childHolders.splice(dragEventData.holderIndex, 1)[0];
            holder.elt.remove();
            ///remove all event
            var other = dragEventData.boardIn;
            changed = 'itemleave';
            this.emit('itemleave', {
                type: 'itemleave',
                item: holder.elt,
                from: { index: dragEventData.holderIndex, table: this },
                to: { index: dragEventData.boardAt, table: other },
                target: this
            }, this);
            if (other._childHolders.length == 0) {
                other.appendChild(holder.elt);
                other._childHolders.push(holder);
            }
            else {
                if (dragEventData.boardAt < other._childHolders.length) {
                    other.insertBefore(holder.elt, other._childHolders[dragEventData.boardAt].elt);
                    other._childHolders.splice(dragEventData.boardAt, 0, holder);
                }
                else {
                    var bf = other.findDomChildAfter(other._childHolders.elt);
                    if (bf) {
                        other.insertBefore(holder.elt, bf);
                    }
                    else {
                        other.appendChild(holder.elt);
                    }
                    other._childHolders.push(holder);
                }
            }
            other.emit('itementer', {
                type: 'itementer',
                item: holder.elt,
                target: other,
                from: { index: dragEventData.holderIndex, table: this },
                to: { index: dragEventData.boardAt, table: other }
            }, other);
        }
        this.emit('dragitemend', {
            type: 'dragitemend',
            target: this,
            changed: changed,
            boardElt: this._dragEventData.boardElt
        }, this);
    }

    var bodyEvents = {};
    if (dragEventData.isTouch) {
        bodyEvents.touchmove = this.eventHandler.mousemove;
        bodyEvents.touchcancel = this.eventHandler.mousefinish;
        bodyEvents.touchend = this.eventHandler.mousefinish;
    }
    else {
        bodyEvents.mousemove = this.eventHandler.mousemove;
        bodyEvents.mouseup = this.eventHandler.mousefinish;
        bodyEvents.mouseleave = this.eventHandler.mousefinish;
    }
    js_Hanger.prototype.off2.call(document.body, bodyEvents);
    this._dragEventData = null;
};

BoardTable.eventHandler.enterFriendEffectZone = function (friendElt, event) {
    this._dragEventData.inEffectZoneOf = friendElt;
};

BoardTable.prototype.getAllBoards = function () {
    return this._childHolders.map(function (holder) {
        return holder.elt;
    });
};


BoardTable.property = {};
BoardTable.property.friends = {
    set: function (value) {
        value = value || [];
        if (!(value instanceof Array))
            value = [value];
        this._friends = value;
    },
    get: function () {
        return this._friends;
    }
};

ACore["a" /* default */].install(BoardTable);
/* harmony default export */ var js_BoardTable = (BoardTable);
// EXTERNAL MODULE: ./node_modules/absol-acomp/css/bscroller.css
var bscroller = __webpack_require__(101);

// CONCATENATED MODULE: ./node_modules/absol-acomp/js/BScroller.js





var BScroller_ = ACore["a" /* default */]._;
var BScroller_$ = ACore["a" /* default */].$;



/***
 * @extends AElement
 * @constructor
 */
function BScroller() {
    this.addClass('as-bscroller');
}


BScroller.tag = "bscroller";

BScroller.render = function (data) {
    if (data && data.elt) {
        return BScroller_$(data.elt)
    }
    else
        return BScroller_('div');
};

BScroller.prototype.scrollInto = function (element) {
    if (Element.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);

/* harmony default export */ var js_BScroller = (BScroller);
// EXTERNAL MODULE: ./node_modules/absol-acomp/css/buttonarray.css
var buttonarray = __webpack_require__(103);

// CONCATENATED MODULE: ./node_modules/absol-acomp/js/ButtonArray.js




var ButtonArray_ = ACore["a" /* default */]._;
var ButtonArray_$ = ACore["a" /* default */].$;


/***
 * @extends AElement
 * @constructor
 */
function ButtonArray() {
    this._dict = {};
    this._pool = [];
    this._items = [];
    this.$lastActiveBtn = null;
    this._value = undefined;
    this._lastValue = this._value;
}

ButtonArray.tag = 'buttonarray';
ButtonArray.render = function () {
    return ButtonArray_({
        extendEvent: ['change'],
        class: 'as-button-array'
    });
};

ButtonArray.prototype._newButton = function () {
    var button = ButtonArray_({
        tag: 'button',
        class: 'as-button-array-item',
        child: { text: 'null' }
    });
    button.on('click', this.eventHandler.clickItem.bind(this, button));
    return button;
};

ButtonArray.prototype._requestButton = function (items) {
    var button;
    if (this._pool.length > 0) {
        button = this._pool.pop();
    }
    else {
        button = this._newButton();
    }
    return button;
};

ButtonArray.prototype._assignButton = function (button, data) {
    button._data = data;
    button.childNodes[0].data = data.text;
};

ButtonArray.prototype._releaseButton = function (button) {
    this._pool.push(button);
};

ButtonArray.prototype._getFullFormat = function (item) {
    var res = {};
    if ((typeof item == 'string') || (typeof item == 'number') || (typeof item == 'boolean') || (item === null) || (item === undefined)) {
        res.ident = item;
        res.value = item;
        res.text = item + '';
    }
    else if (item && (typeof item == 'object')) {
        res.value = item.value;
        res.ident = res.value + '';
        res.text = item.text;
    }
    return res;
};


ButtonArray.property = {};

/**
 * @type {ButtonArray}
 */
ButtonArray.property.items = {
    set: function (items) {
        items = items || [];
        this._items = items;
        var child;
        while (this.childNodes.length > items.length) {
            child = this.lastChild;
            this._releaseButton(child);
            this.removeChild(child);
        }

        while (this.childNodes.length < items.length) {
            this.addChild(this._requestButton());
        }
        var item;
        for (var i = 0; i < items.length; ++i) {
            item = this._getFullFormat(items[i]);
            this._assignButton(this.childNodes[i], item);
            this._dict[item.ident] = {
                elt: this.childNodes[i],
                data: item
            }
        }
        if (items.length > 0) {
            if (!this._dict[this._value + '']) {
                this._value = this._getFullFormat(items[0]).value;
            }
        }
        this.value = this._value;
    },
    get: function () {
        return this._items;
    }
};

ButtonArray.property.value = {
    set: function (value) {
        this._value = value;
        this._lastValue = this._value;
        if (this.$lastActiveBtn) {
            this.$lastActiveBtn.removeClass('as-active');
            this.$lastActiveBtn = null;
        }
        var hodler = this._dict[value + ''];
        if (hodler) {
            hodler.elt.addClass('as-active');
            this.$lastActiveBtn = hodler.elt;
        }
    },
    get: function () {
        return this._value;
    }
};


ButtonArray.eventHandler = {};

ButtonArray.eventHandler.clickItem = function (item, event) {
    if (this._lastValue != item._data.value) {
        this.value = item._data.value;
        this.emit('change', { target: this, value: this.value, type: 'change' }, this);
    }
};


ACore["a" /* default */].install(ButtonArray);

/* harmony default export */ var js_ButtonArray = (ButtonArray);
// EXTERNAL MODULE: ./node_modules/absol-acomp/css/calendarinput.css
var calendarinput = __webpack_require__(105);

// CONCATENATED MODULE: ./node_modules/absol/src/String/stringFormat.js
/**
 * 
 * @param {String} s 
 * @param {Number} maxLength 
 */
function wrapToLines(s, maxLength) {
    var res = [];
    var currentWord = '';
    var currentLine = '';
    for (var i = 0; i < s.length; ++i) {
        if (s[i].match(/\s/)) {
            if (currentWord.length + currentLine.length >= maxLength) {
                if (currentLine.length > 0) {
                    res.push(currentLine.trim());
                    currentLine = '';
                    currentWord = currentWord.trimLeft() + s[i];
                }
                else {
                    currentLine = currentLine + currentWord;
                    res.push(currentLine.trim());
                    currentLine = '';
                    currentWord = '';

                }
            }
            else {
                currentLine = currentLine + currentWord;
                currentWord = s[i];
            }
        }
        else {
            currentWord = currentWord + s[i];
        }
    }
    currentLine = (currentLine + currentWord).trim();
    if (currentLine.length > 0) res.push(currentLine);
    return res;
}

/**
 * 
 * @param {String} s
 * @returns {String} 
 */
function nonAccentVietnamese(s) {
    return s.replace(/à|á|ạ|ả|ã|â|ầ|ấ|ậ|ẩ|ẫ|ă|ằ|ắ|ặ|ẳ|ẵ/g, "a")
        .replace(/À|Á|Ạ|Ả|Ã|Â|Ầ|Ấ|Ậ|Ẩ|Ẫ|Ă|Ằ|Ắ|Ặ|Ẳ|Ẵ/g, "A")
        .replace(/è|é|ẹ|ẻ|ẽ|ê|ề|ế|ệ|ể|ễ/g, "e")
        .replace(/È|É|Ẹ|Ẻ|Ẽ|Ê|Ề|Ế|Ệ|Ể|Ễ/g, "E")
        .replace(/ì|í|ị|ỉ|ĩ/g, "i")
        .replace(/Ì|Í|Ị|Ỉ|Ĩ/g, "I")
        .replace(/ò|ó|ọ|ỏ|õ|ô|ồ|ố|ộ|ổ|ỗ|ơ|ờ|ớ|ợ|ở|ỡ/g, "o")
        .replace(/Ò|Ó|Ọ|Ỏ|Õ|Ô|Ồ|Ố|Ộ|Ổ|Ỗ|Ơ|Ờ|Ớ|Ợ|Ở|Ỡ/g, "O")
        .replace(/ù|ú|ụ|ủ|ũ|ư|ừ|ứ|ự|ử|ữ/g, "u")
        .replace(/Ù|Ú|Ụ|Ủ|Ũ|Ư|Ừ|Ứ|Ự|Ử|Ữ/g, "U")
        .replace(/ỳ|ý|ỵ|ỷ|ỹ/g, "y")
        .replace(/Ỳ|Ý|Ỵ|Ỷ|Ỹ/g, "Y")
        .replace(/đ/g, "d")
        .replace(/Đ/g, "D")
        .replace(/\u0300|\u0301|\u0303|\u0309|\u0323/g, "")
        .replace(/\u02C6|\u0306|\u031B/g, "");
}




/**
 * 
 * @param {String} s
 * @returns {String} 
 */
function pascalCaseToCamelCase(s) {
    return s.substr(0, 1).toLowerCase() + s.substr(1);
}

/**
 * 
 * @param {String} s
 * @returns {String} 
 */
function kebabCaseToCamelCase(s) {
    return s.replace(/-+([^-])/g, function (full, c) {
        return c.toUpperCase();
    });
}

/**
 * 
 * @param {String} s 
 * @returns {String} 
 */
function underScoreToCamelCase(s) {
    return s.replace(/(_+)?([^_]+)/g, function (full, underscore, word) {
        if (underscore) {
            if (word) {
                return word.substr(0, 1).toUpperCase() + word.substr(1).toLowerCase();
            }
            else return '';
        }
        else {
            return word.toLowerCase();
        };
    });
}


/**
 * 
 * @param {String} s 
 * @returns {String} 
 */
function camelCaseToPascalCase(s) {
    return s.substr(0, 1).toUpperCase() + s.substr(1);
}

/**
 * 
 * @param {String} s 
 * @returns {String} 
 */
function underScoreToPascalCase(s) {
    return s.replace(/(_+|^)?([^_]+)/g, function (full, underscore, word) {
        return word.substr(0, 1).toUpperCase() + word.substr(1).toLowerCase();
    });
}


/**
 * 
 * @param {String} s
 * @returns {String} 
 */
function kebabCaseToPascalCase(s) {
    return s.replace(/(-+|^)([^-])/g, function (full, u, c) {
        return c.toUpperCase();
    });
}


/**
 * 
 * @param {String} s
 * @returns {String} 
 */
function pascalCaseToKebabCase(s) {
    return s.replace(/[A-Z][^A-Z]*/g, function (full, index) {
        if (index == 0)
            return full.toLowerCase();
        return '-' + full.toLowerCase()
    });
}

/**
 * 
 * @param {String} s
 * @returns {String} 
 */
function camelCaseToKebabCase(s) {
    return s.replace(/(^|[A-Z])[^A-Z]*/g, function (full, index) {
        if (index == 0)
            return full.toLowerCase();
        return '-' + full.toLowerCase()
    });
}

/**
 * 
 * @param {String} s
 * @returns {String} 
 */
function underScoreToKebabCase(s) {
    return s.replace(/(^|_+)([^_]+)/g, function (full, score, word, index) {
        if (index == 0)
            return word.toLowerCase();
        return '-' + word.toLowerCase()
    });
}



/**
 * 
 * @param {String} s
 * @returns {String} 
 */
function pascalCaseToUnderScore(s) {
    return s.replace(/[A-Z][^A-Z]*/g, function (full, index) {
        if (index == 0)
            return full.toLowerCase();
        return '_' + full.toLowerCase()
    });
}

/**
 * 
 * @param {String} s
 * @returns {String} 
 */
function pascalCaseToUpperUnderScore(s) {
    return s.replace(/[A-Z][^A-Z]*/g, function (full, index) {
        if (index == 0)
            return full.toUpperCase();
        return '_' + full.toUpperCase()
    });
}


/**
 * 
 * @param {String} s
 * @returns {String} 
 */
function camelCaseToUnderScore(s) {
    return s.replace(/(^|[A-Z])[^A-Z]*/g, function (full, index) {
        if (index == 0)
            return full.toLowerCase();
        return '_' + full.toLowerCase()
    });
}
/**
 * 
 * @param {String} s
 * @returns {String} 
 */
function camelCaseToUpperUnderScore(s) {
    return s.replace(/(^|[A-Z])[^A-Z]*/g, function (full, index) {
        if (index == 0)
            return full.toUpperCase();
        return '_' + full.toUpperCase()
    });
}

/**
 * 
 * @param {String} s
 * @returns {String} 
 */
function kebabCaseToUnderScore(s) {
    return s.replace(/(-+|^)([^-]+)/g, function (full, u, word, index) {
        if (index == 0) return word.toLowerCase();
        return '_' + word.toLowerCase()
    });
}



/**
 * 
 * @param {String} s
 * @returns {String} 
 */
function kebabCaseToUpperUnderScore(s) {
    return s.replace(/(-+|^)([^-]+)/g, function (full, u, word, index) {
        if (index == 0) return word.toUpperCase();
        return '_' + word.toUpperCase()
    });
}



String.nonAccentVietnamese = nonAccentVietnamese;

String.prototype.nonAccentVietnamese = function () {
    return String.nonAccentVietnamese(this);
};
// 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"];



var formatTokenRegex = /([,\.\-\/])|([a-zA-Z0-9]+)/g;//more

/**
 * 
 * @param {Date} date 
 * @param {String} format 
 * @returns {String}
 */
function formatDateString(date, format) {
    format = format || 'dd/mm/yyyy';
    var dt = date.getDate();
    var day = date.getDay();
    var month = date.getMonth();
    var year = date.getFullYear()
    return format.replace(formatTokenRegex, function (x) {
        switch (x) {
            case "dddd": return dayNames[day];
            case "ddd": return shortDayNames[day];
            case "dd": return dt < 10 ? '0' + dt : '' + dt;
            case "d": return '' + dt;
            case "mmmm": return monthNames[month];
            case "mmm": return shortMonthNames[month];
            case "mm": return (month + 1) < 10 ? '0' + (month + 1) : '' + (month + 1);
            case "m": return '' + (month + 1);
            case 'yy': return (year + '').match(/..$/)[0];
            case 'yyyy': return year + '';
            default:
                return x;
        }
    });
}

function formartDateString(){
    window.ALogger.warn("spelled incorrectly: formartDateString");
    return formatDateString.apply(null, arguments);
}

/**
 *
 * @param {String} text
 * @param {String} format
 * @returns {String}
 */
function parseDateString(text, format) {
    text = nonAccentVietnamese(text).toLowerCase();
    format = nonAccentVietnamese(format).toLowerCase();
    var textTokens = text.match(formatTokenRegex) || [];
    var formatTokens = format.match(formatTokenRegex) || [];
    var year = NaN;
    var month = NaN;
    var day = NaN;
    var n = Math.min(textTokens.length, formatTokens.length);
    var textToken;
    var formatToken;
    for (var i = 0; i < n; ++i) {
        textToken = textTokens[i];
        formatToken = formatTokens[i];
        switch (formatToken) {
            case "dd": day = parseInt(textToken); break;
            case "d": day = parseInt(textToken); break;
            case "mmmm": month = monthNames.indexOf(textToken.substr(0, 1).toUpperCase() + textToken.substr(1).toLowerCase()); break;
            case "mmm": month = shortMonthNames.indexOf(textToken.substr(0, 1).toUpperCase() + textToken.substr(1).toLowerCase()); break;
            case "mm": month = parseInt(textToken) - 1; break;
            case "m": month = parseInt(textToken) - 1; break;
            case 'yy': year = Math.floor((new Date().getFullYear()) / 100) * 100 + parseInt(textToken); break;
            case 'yyyy': year = parseInt(textToken); break;
            default:
                if (textToken != formatToken)
                    throw new Error('Unexpected token ' + textToken);
        }
    }

    if (isNaN(year)) throw new Error('Invalid year');
    if (isNaN(month) && month != -1) {
        throw new Error('Invalid month');
    }
    else {
        month = Math.max(0, Math.min(11, month));
    }
    if (!isNaN(day)) {
        day = Math.max(1, Math.min(31, day));
        if (!isNaN(month)) {
            day = Math.min(daysInMonth(2000, month), day);
            if (!isNaN(year)) day = Math.min(daysInMonth(year, month), day);
        }
    }
    else {
        throw new Error('Invalid day');
    }
    return new Date(year, month, day, 0, 0, 0, 0);
}


/**
 * @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);
    }
}

/**
 * 
 * @param {Number} year
 * @param {Number} month
 * @returns {Number}
 */
function daysInMonth(year, month) {
    var start = new Date(year, month, 1);
    var end = nextMonth(start);
    return compareDate(end, start);
}
// EXTERNAL MODULE: ./node_modules/absol-acomp/css/chromecalendar.css
var chromecalendar = __webpack_require__(107);

// EXTERNAL MODULE: ./node_modules/absol-acomp/css/scroller.css
var css_scroller = __webpack_require__(109);

// 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 int_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 int_distance(x0, y0, x1, y1) {
    var dx = x0 - x1;
    var dy = y0 - y1;
    return Math.sqrt(dx * dx + dy * dy);
}

/**
 *
 * @param {Number} numb
 * @param {Number} floatFixed
 * @param {"."|","} decimalSeparator
 * @param {","|"."} thousandsSeparator
 * @param {Number} decimalPadding
 */
function numberToString(numb, floatFixed, decimalSeparator, thousandsSeparator, decimalPadding) {
    if (floatFixed === undefined || floatFixed === null || typeof floatFixed != "number" || isNaN(floatFixed) || floatFixed < -1) floatFixed = -1;
    if (decimalSeparator === undefined || decimalSeparator === null || (decimalSeparator != '.' && decimalSeparator != ',')) decimalSeparator = '.';
    if (thousandsSeparator === undefined || thousandsSeparator === null || (floatFixed >= 0 && thousandsSeparator == decimalSeparator)) thousandsSeparator = undefined;
    if (thousandsSeparator != ',' && thousandsSeparator != '.') thousandsSeparator = undefined;
    if (decimalPadding === undefined || decimalPadding === null || typeof decimalPadding != "number" || isNaN(decimalPadding) || decimalPadding < 0) decimalPadding = 0;

    var text = numb.toString();
    var matched = text.match(/[+-]?([0-9]*)(\.([0-9]*))?(e([+-]?[0-9]+))?/);
    var dec = matched[1] || '';
    var real = matched[3] || '';
    var floatPoint = parseInt(matched[5] || '0');
    var decDigits = dec.split('').map(function (d) {
        return parseInt(d)
    });
    var realDigits = real.split('').map(function (d) {
        return parseInt(d)
    });

    while (floatPoint < 0) {
        if (decDigits.length > 0) {
            realDigits.unshift(decDigits.pop());
        }
        else {
            realDigits.unshift(0);
        }
        floatPoint++;
    }
    while (floatPoint > 0) {
        if (realDigits.length > 0) {
            decDigits.push(realDigits.unshift());
        }
        else {
            decDigits.push(0);
        }
        floatPoint++;
    }

    var mem = 0, i, cValue;
    if (floatFixed > realDigits.length) {
        while (realDigits.length < floatFixed) {
            realDigits.push(0);
        }
    }
    else if (floatFixed < realDigits.length && floatFixed >= 0) {
        i = floatFixed;
        mem = realDigits[i] >= 5 ? 1 : 0;
        realDigits.splice(floatFixed);
        --i;
        while (mem > 0) {
            if (i >= 0) {
                cValue = realDigits[i] + mem;
                realDigits[i] = cValue % 10;
                mem = Math.floor(cValue / 10);
            }
            else {
                if (decDigits.length + i < 0) decDigits.unshift(0);
                cValue = decDigits[decDigits.length + i] + mem;
                decDigits[decDigits.length + i] = cValue % 10;
                mem = Math.floor(cValue / 10);
            }
            --i;
        }
    }


    while (decDigits.length < decimalPadding) {
        decDigits.unshift(0);
    }

    var decText = numb < 0 ? '-' : '';
    var breadMod = (decDigits.length + 2) % 3;
    if (thousandsSeparator) {
        for (i = 0; i < decDigits.length; ++i) {
            decText += decDigits[i];
            if (i % 3 == breadMod && i + 1 < decDigits.length) {
                decText += thousandsSeparator;
            }
        }
    }
    else {
        decText += decDigits.join('');
    }

    var realText = realDigits.length == 0 ? '' : decimalSeparator + realDigits.join('');

    return decText + realText;
}


function numberAutoFixed(x, eDelta) {
    eDelta = eDelta || 10;
    eDelta = Math.round(eDelta);
    var e = parseFloat('1e+' + eDelta);
    return Math.round(x * e) / e;
}

function harmonicMean(a, b) {
    return 2 / (1 / a + 1 / b);
}
// 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["b" /* 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 thisVS = this;
    this.$attachHook = Scroller_$('attachhook', this);
    this.sync = new Promise(function (rs) {
        thisVS.$attachHook.once('error', function () {
            rs();
        });
    });

    this.$attachHook.on('error', function () {
        thisVS.requestUpdateSize();
    });
    this.$vscrollbar = Scroller_$('vscrollbar', this).on('scroll', this.eventHandler.scrollScrollbar);
    this.$viewport = Scroller_$('.absol-vscroller-viewport', this)
        .on('scroll', this.eventHandler.scrollViewport);
    OOP["a" /* default */].extends(thisVS.$viewport, {
        removeChild: function () {
            this.super.apply(this, arguments);
            thisVS.requestUpdateSize();
            return thisVS;
        }
    })
}

VScroller.tag = 'vscroller';
VScroller.render = function () {
    return Scroller_({
        class: 'absol-vscroller',
        child: ['.absol-vscroller-viewport',
            {
                class: ['absol-scrollbar-container', 'vertical'],
                child: 'vscrollbar'
            },
            'attachhook'
        ]
    });
};


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.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(int_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 thisHS = this;
    this.$attachHook = Scroller_$('attachhook', this)
        .on('error', function () {
            this.requestUpdateSize = this.requestUpdateSize || thisHS.requestUpdateSize.bind(thisHS);
            Dom["b" /* default */].addToResizeSystem(this);
        });

    this.sync = new Promise(function (rs, rj) {
        thisHS.$attachHook.once('error', rs);
    });
    this.$hscrollbar = Scroller_$('hscrollbar', this).on('scroll', this.eventHandler.scrollScrollbar);
    this.$viewport = Scroller_$('.absol-hscroller-viewport', this)
        .on('scroll', this.eventHandler.scrollViewport);
    OOP["a" /* default */].extends(this.$viewport, {
        removeChild: function () {
            this.super.apply(this, arguments);
            thisHS.requestUpdateSize();
            return thisHS;
        }
    });
}


HScroller.tag = 'hscroller';

HScroller.render = function () {
    return Scroller_({
        class: 'absol-hscroller',
        child: ['.absol-hscroller-viewport',
            {
                class: ['absol-scrollbar-container', 'horizontal'],
                child: 'hscrollbar'
            },
            'attachhook'
        ]
    });
};

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.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 thisSB = this;
    this.$button = Scroller_$('.absol-scrollbar-button', this);
    this.on('active', function () {
        if (!thisSB.$forceModal) thisSB.$forceModal = Scroller_('.absol-scrollbar-force-modal');
        thisSB.$forceModal.addTo(document.body);
    }).on('deactive', function () {
        setTimeout(function () {
            thisSB.$forceModal.remove();
        }, 30);
    });
}

Scrollbar.tag = 'scrollbar';

Scrollbar.render = function () {
    return Scroller_({
        class: ['absol-scrollbar'],
        extendEvent: ['scroll', 'active', 'deactive'],
        child: '.absol-scrollbar-button'
    });
};

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 thisVS = this;
    var top0, innerOffset0;
    var pointerMoveEventHandler = function (event) {
        event.preventDefault();
        var dy = event.clientY - top0;
        var newInnerOffset = innerOffset0 + dy * (thisVS.innerHeight / thisVS.outerHeight) * (thisVS.outerHeight / thisVS.getBoundingClientRect().height);
        if (newInnerOffset + thisVS.outerHeight > thisVS.innerHeight)
            newInnerOffset = thisVS.innerHeight - thisVS.outerHeight;
        if (newInnerOffset < 0) newInnerOffset = 0;
        thisVS.innerOffset = newInnerOffset;
        //todo
        event.innerOffset = newInnerOffset;
        thisVS.emit('scroll', event);
    };

    var finishEventHandler = function (event) {
        var body = Scroller_$(document.body);
        body.off('pointerleave', finishEventHandler);
        body.off('pointerup', finishEventHandler);
        body.off('pointermove', pointerMoveEventHandler);
        thisVS.removeClass('absol-active');
        thisVS.emit('deactive', { type: 'deactive', originEvent: event, tagert: thisVS });
    };

    var pointerDownEventHandler = function (event) {
        var boundRes = thisVS.getBoundingClientRect();
        var boundButton = thisVS.$button.getBoundingClientRect();
        top0 = event.clientY;
        if (event.target == thisVS.$button) {
            innerOffset0 = thisVS.innerOffset;
        }
        else {
            var newInnerOffset = int_map(top0 - boundButton.height / 2 - boundRes.top, 0, boundRes.height, 0, thisVS.innerHeight);
            if (newInnerOffset + thisVS.outerHeight > thisVS.innerHeight)
                newInnerOffset = thisVS.innerHeight - thisVS.outerHeight;
            if (newInnerOffset < 0) newInnerOffset = 0;
            thisVS.innerOffset = newInnerOffset;
            //todo
            event.innerOffset = newInnerOffset;
            innerOffset0 = newInnerOffset;
            thisVS.emit('scroll', event);
        }
        var body = Scroller_$(document.body);
        body.on('pointerleave', finishEventHandler);
        body.on('pointerup', finishEventHandler);
        body.on('pointermove', pointerMoveEventHandler);
        thisVS.addClass('absol-active');
        thisVS.emit('active', { type: 'active', originEvent: event, tagert: thisVS });
    };

    this.on('pointerdown', pointerDownEventHandler, true);
}

VScrollbar.tag = 'vscrollbar';
VScrollbar.render = function () {
    return Scroller_({
        tag: 'scrollbar',
        class: 'absol-vscrollbar'
    }, true);
};


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 thisHS = this;

    var left0, innerOffset0;
    var pointerMoveEventHandler = function (event) {
        event.preventDefault();
        var dy = event.clientX - left0;
        var newInnerOffset = innerOffset0 + dy * (thisHS.innerWidth / thisHS.outerWidth) * (thisHS.outerWidth / thisHS.getBoundingClientRect().width);
        if (newInnerOffset + thisHS.outerWidth > thisHS.innerWidth)
            newInnerOffset = thisHS.innerWidth - thisHS.outerWidth;
        if (newInnerOffset < 0) newInnerOffset = 0;
        thisHS.innerOffset = newInnerOffset;
        //todo
        event.innerOffset = newInnerOffset;
        thisHS.emit('scroll', event);
    };

    var finishEventHandler = function (event) {
        var body = Scroller_$(document.body);
        body.off('pointerleave', finishEventHandler);
        body.off('pointerup', finishEventHandler);
        body.off('pointermove', pointerMoveEventHandler);
        thisHS.removeClass('absol-active');
        thisHS.emit('deactive', { type: 'deactive', originEvent: event, tagert: thisHS });
    };

    var pointerDownEventHandler = function (event) {
        var boundRes = thisHS.getBoundingClientRect();
        var boundButton = thisHS.$button.getBoundingClientRect();
        left0 = event.clientX;
        if (event.target == thisHS.$button) {
            innerOffset0 = thisHS.innerOffset;
        }
        else {
            var newInnerOffset = int_map(left0 - boundButton.width / 2 - boundRes.left, 0, boundRes.width, 0, thisHS.innerWidth);
            if (newInnerOffset + thisHS.outerWidth > thisHS.innerWidth)
                newInnerOffset = thisHS.innerWidth - thisHS.outerWidth;
            if (newInnerOffset < 0) newInnerOffset = 0;
            thisHS.innerOffset = newInnerOffset;
            //todo
            event.innerOffset = newInnerOffset;
            innerOffset0 = newInnerOffset;
            thisHS.emit('scroll', event);
        }
        var body = Scroller_$(document.body);
        body.on('pointerleave', finishEventHandler);
        body.on('pointerup', finishEventHandler);
        body.on('pointermove', pointerMoveEventHandler);
        thisHS.addClass('absol-active');
        thisHS.emit('active', { type: 'deactive', originEvent: event, tagert: thisHS });
    };

    this.on('pointerdown', pointerDownEventHandler, true);
}

HScrollbar.tag = 'hscrollbar';

HScrollbar.render = function () {
    return Scroller_({
        tag: 'scrollbar',
        class: 'absol-hscrollbar'
    }, true);
}

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 */].install([VScrollbar, HScrollbar, Scrollbar, VScroller, HScroller]);
// CONCATENATED MODULE: ./node_modules/absol-acomp/js/ChromeCalendar.js









var ChromeCalendar_ = ACore["a" /* default */]._;
var ChromeCalendar_$ = ACore["a" /* default */].$;

/**
 * @extends AElement
 * @constructor
 */
function ChromeCalendar() {
    var thisCal = this;
    this.$years = ChromeCalendar_$('.absol-chrome-calendar-years', this);
    ChromeCalendar_({
        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 () {

                        thisCal.expandYear(this.__year__);
                    }
                }
            };
        })
    }).addTo(this.$years);
    this.$title = ChromeCalendar_$('.absol-chrome-calendar-title', this)
        .on('click', function () {
            thisCal.viewYear();
        });
    this.$titleTime = ChromeCalendar_$('.absol-chrome-calendar-title > .title-time', this);

    this.$instance = ChromeCalendar_$('.absol-chrome-calendar-instance', this);

    this.$month = ChromeCalendar_$('.absol-chrome-calendar-month', this);
    this._minLimitDate = new Date(1890, 0, 1, 0, 0, 0, 0, 0);
    this._maxLimitDate = new Date(2090, 0, 1, 0, 0, 0, 0, 0);

    this._selectedDates = [beginOfDay(new Date())];
    this._viewDate = new Date();

    this.$prevBtn = ChromeCalendar_$('.absol-chrome-calendar-header-buttons > button.prev-btn', this)
        .on('click', function () {
            thisCal.viewPrevMonth();
        });
    this.$todayBtn = ChromeCalendar_$('.absol-chrome-calendar-header-buttons > button.today-btn', this)
        .on('click', function () {
            thisCal.viewToday();
            thisCal.pickDate(new Date());
        });
    this.$nextBtn = ChromeCalendar_$('.absol-chrome-calendar-header-buttons > button.next-btn', this)
        .on('click', function () {
            thisCal.viewNexMounth();
        });

    /***
     *
     * @type {VScroller}
     */
    this.$yearScroller = ChromeCalendar_$('vscroller.absol-chrome-calendar-years', this);
    this.$yearItems = [];

    ChromeCalendar_$('.absol-chrome-calendar-year', this.$yearScroller, function (e) {
        thisCal.$yearItems.push(e);
    });

    this.$attachHook = ChromeCalendar_('attachhook').addTo(this)
        .on('error', function () {
            thisCal.$yearScroller.requestUpdateSize();
            thisCal.expandYear(thisCal._viewDate.getFullYear());
        });

    this.sync = new Promise(function (rs) {
        thisCal.$attachHook.on('error', rs);
    });

    return this;
}


ChromeCalendar.tag = 'ChromeCalendar'.toLowerCase();
ChromeCalendar.render = function () {
    return 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: {}
                    }
                ]
            }
        ]
    });

}


/**
 * @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._session = Math.random() * 10000000000 >> 0;
ChromeCalendar._listener = undefined;


ChromeCalendar.showWhenClick = function (element, calendarProps, anchor, calendarPickListener, darkTheme) {
    var res = {
        calendarProps: Object.assign({ maxDateLimit: null, minDateLimit: null }, 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["b" /* 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["b" /* 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["b" /* default */].documentReady.then(exec);

};


/* harmony default export */ var js_ChromeCalendar = (ChromeCalendar);
// CONCATENATED MODULE: ./node_modules/absol-acomp/js/CalendarInput.js







var CalendarInput_ = ACore["a" /* default */]._;
var CalendarInput_$ = ACore["a" /* default */].$;



/**
 * @extends AElement
 * @constructor
 */
function CalendarInput() {
    var thisCI = this;
    this.$input = CalendarInput_$('input', this);
    this._value = null;

    this._quickOption = js_ChromeCalendar.showWhenClick(this, {
        minLimitDate: this.minLimitDate || this.minDateLimit,
        maxLimitDate: this.maxLimitDate || this.maxDateLimit,
        selectedDates: [new Date()]
    }, 'auto', function (value) {
        thisCI._value = value;
        thisCI.$input.value = thisCI.formartDateString(value);
        thisCI._quickOption.calendarProps.selectedDates = [value];//change new option
        thisCI.emit('change', { target: thisCI, value: value }, thisCI);
    });

    OOP["a" /* default */].drillProperty(this, this._quickOption.calendarProps, {
        minLimitDate: 'minLimitDate',
        maxLimitDate: 'maxLimitDate',
        minDateLimit: 'minLimitDate',
        maxDateLimit: 'maxLimitDate'
    });

}

CalendarInput.tag = 'CalendarInput'.toLowerCase();

CalendarInput.render = function () {
    return CalendarInput_({
        extendEvent: ['change'],
        class: 'absol-calendar-input',
        child: 'input[type="text"][readonly="true"][value="dd/mm/yyyy"]'
    });
};

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;
            this._quickOption.calendarProps.selectedDates = [new Date()]
        }
        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);

function OldCalendarInput(){

}

OldCalendarInput.tag = 'calendar-input';

OldCalendarInput.render = function(data){
    return CalendarInput_({
        tag: 'calendarinput',
        extendEvent: 'changed',
        props: data,
        on: {
            change: function (ev) {
                this.emit('changed', ev.value);
            }
        }
    });
};

ACore["a" /* default */].install(OldCalendarInput);

/* harmony default export */ var js_CalendarInput = (CalendarInput);

// EXTERNAL MODULE: ./node_modules/absol-acomp/css/checkboxinput.css
var checkboxinput = __webpack_require__(111);

// CONCATENATED MODULE: ./node_modules/absol-acomp/js/CheckBoxInput.js






var CheckBoxInput_ = ACore["a" /* default */]._;
var CheckBoxInput_$ = ACore["a" /* default */].$;

var tickIcon = CheckBoxInput_(['<svg class="as-checkbox-input-check-icon" width="18px" height="18px" 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; stroke-width: 1"/>',
        '  <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('')
);


/***
 * @extends AElement
 * @constructor
 */
function CheckboxInput() {
    this.$input = CheckBoxInput_$('input', this)
        .on('change', this.notifyChange.bind(this));
    this.checked = false;
    this.disabled = false;
    this.on('click', this.eventHandler.click);
    this.onchange = null;
}

CheckboxInput.tag = "CheckboxInput".toLowerCase();

CheckboxInput.render = function (data) {
    return CheckBoxInput_({
            tag: 'label',
            extendEvent: 'change',
            class: 'as-checkbox-input',
            child: [
                {
                    elt: data && data.$input,
                    tag: 'input',
                    class: 'as-checkbox-input-value',
                    attr: {
                        type: 'checkbox'
                    }
                },
                tickIcon.cloneNode(true)
            ]
        }
    )
};

/***
 * as normal, change event will be fired when checkbox change by system
 */
CheckboxInput.prototype.notifyChange = function () {
    var event = { checked: this.checked };
    this.emit('change', event, this);
};

CheckboxInput.prototype._updateCheckedClass = function () {
    if (this.checked) {
        this.addClass('as-checked');
    }
    else {
        this.removeClass('as-checked');
    }
};


CheckboxInput.property = {};

CheckboxInput.property.disabled = {
    set: function (value) {
        if (value) {
            this.addClass('as-disabled');
        }
        else {
            this.removeClass('as-disabled');
        }
        this.$input.disabled = !!value;
    },
    get: function () {
        return this.$input.disabled;
    }
};

/***
 *
 * @type {CheckboxInput}
 */
CheckboxInput.property.checked = {
    set: function (value) {
        this.$input.checked = !!value;
        this._updateCheckedClass();
    },
    get: function () {
        return this.$input.checked;
    }
}

CheckboxInput.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;
        }
    }
};

/***
 *
 * @type {CheckboxInput}
 */
CheckboxInput.eventHandler = {};

CheckboxInput.eventHandler.click = function () {
    this._updateCheckedClass();
};


ACore["a" /* default */].install(CheckboxInput);


CheckboxInput.autoReplace = function () {
    var placeHolders = Array.prototype.slice.call(document.getElementsByTagName(this.tag));
    var ph;
    var attOfPH;
    var attrs;
    var style;
    var classList;
    var attNode;
    var attrName, attrValue;
    var props;
    for (var i = 0; i < placeHolders.length; ++i) {
        ph = placeHolders[i];
        attOfPH = ph.attributes;
        classList = [];
        style = {};
        attrs = {};
        props = {};
        for (var j = 0; j < attOfPH.length; ++j) {
            attNode = attOfPH[j];
            attrName = attNode.nodeName;
            attrValue = attNode.nodeValue;
            if (attrName == 'style') {
                attrValue.trim().split(';').reduce(function (style, prop) {
                    var p = prop.split(':');
                    if (p.length == 2) {
                        style[p[0].trim()] = p[1].trim();
                    }
                    return style;
                }, style);
            }
            else if (attrName == 'class') {
                classList = attrValue.trim().split(/\s+/);
            }
            else if (attrName == 'onchange') {
                props.onchange = new Function('event', 'sender', attrValue);
            }
            else {
                attrs[attrName] = attrValue;
            }
        }
        var newElt = CheckBoxInput_({
            tag: this.tag,
            attr: attrs,
            class: classList,
            style: style,
            props: props
        });
        CheckBoxInput_$(ph).selfReplace(newElt);
    }
};

CheckboxInput.initAfterLoad = function () {
    Dom["b" /* default */].documentReady.then(function () {
        CheckboxInput.autoReplace();
    })
};


/* harmony default export */ var CheckBoxInput = (CheckboxInput);
// EXTERNAL MODULE: ./node_modules/absol-acomp/css/checkbox.css
var css_checkbox = __webpack_require__(113);

// CONCATENATED MODULE: ./node_modules/absol-acomp/js/CheckBox.js







var CheckBox_ = ACore["a" /* default */]._;
var CheckBox_$ = ACore["a" /* default */].$;
var $$ = ACore["a" /* default */].$$;


/***
 * @extends AElement
 * @constructor
 */
function CheckBox() {
    this.defineEvent('change');
    /***
     *
     * @type {CheckboxInput}
     */
    this.$input = CheckBox_$('checkboxinput', this).on('change',
        this.notifyChange.bind(this)
    );
    this.$labels = $$('span', this);
    this.on('click', this.eventHandler.click);
    OOP["a" /* default */].drillProperty(this, this.$input, ['checked'])
}

CheckBox.tag = 'checkbox';

CheckBox.render = function () {
    return CheckBox_({
        class: ['absol-checkbox','as-no-label'],
        child: [
            {
                tag: 'span',
                class: ['absol-checkbox-label', 'as-left'],
                child: { text: '' }
            },
            'checkboxinput',
            {
                tag: 'span',
                class: ['absol-checkbox-label', 'as-right'],
                child: { text: '' }
            }
        ]
    });
};


CheckBox.prototype.notifyChange = function () {
    this.emit('change', { type: 'change', checked: this.checked, target: this }, this);
};
//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 = {};
CheckBox.property.text = {
    get: function () {
        return  this._text;
    },
    set: function (value) {
        value = value || '';
        if (value.length === 0){
            this.addClass('as-no-label');
        }
        else{
            this.removeClass('as-no-label');
        }
        this._text = value;
        this.$labels[0].firstChild.data = value;
        this.$labels[1].firstChild.data = value;
    }
};


CheckBox.property.disabled = {
    get: function (){
        return    this.$input.disabled;
    },
    set: function (value){
        value = !!value;
        this.$input.disabled = value;
        if (value){
            this.addClass('as-disabled');
        }
        else {
            this.removeClass('as-disabled');
        }
    }
};



/***
 *
 * @type {{}|CheckBox}
 */
CheckBox.eventHandler = {};

CheckBox.eventHandler.click = function (event){
    if (!EventEmitter["b" /* default */].hitElement(this.$input, event)){
        this.$input.click();
    }
};

ACore["a" /* default */].install(CheckBox);
/* harmony default export */ var js_CheckBox = (CheckBox);
// EXTERNAL MODULE: ./node_modules/absol-acomp/css/circlesectionlabel.css
var circlesectionlabel = __webpack_require__(115);

// EXTERNAL MODULE: ./node_modules/absol/src/HTML5/ElementNS.js
var ElementNS = __webpack_require__(27);

// CONCATENATED MODULE: ./node_modules/absol/src/HTML5/Svg.js




var sattachhookCreator = function () {
    var res = Svg.ShareInstance._('<image  class="absol-attachhook" style="display:none"  href=""/>');
    res.defineEvent('attached');
    res.on('error', function (event) {
        if (!this._attached && this.isDescendantOf(document.body)) {
            this._attached = true;
            this.emit('attached', event, this);
        }
    });
    res._attached = false;
    Object.defineProperty(res, 'attached', {
        get: function () {
            return this._attached;
        }
    });
    res.resetState = function () {
        this._attached = false;
        this.src = '';
    };

    return res;
};

/***
 * @extends Dom
 * @param option
 * @constructor
 */
function Svg(option) {
    Dom["b" /* 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["b" /* 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.prototype);
        Object.defineProperties(element, prototypes);
        Element.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(ElementNS["a" /* default */].prototype);
        Object.defineProperties(element, prototypes);
        ElementNS["a" /* default */].call(element);
    }
    return element;
};


Svg.prototype.makeNewElement = function (tagName) {
    return document.createElementNS(this.svgNS, tagName);
};


Svg.ShareInstance = new Svg();

Svg.svgToCanvas = function (element) {
    if (typeof element == 'string') {
        element = Dom["b" /* 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.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.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["b" /* 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["b" /* default */].ShareInstance._('img');
        image.attr('src', src)
            .addTo(renderSpace);
        var canvas = document.createElement("canvas");
        renderSpace.addChild(canvas);
        return Dom["b" /* 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');
    }
};

function svgToRasterImageUrl(element) {
    return Svg.svgToCanvas(element).then(function (canvas) {
        return canvas.toDataURL();
    });
}

Svg.svgToRasterImageUrl = svgToRasterImageUrl;


function svgToExportedString(element) {
    if (typeof element == 'string') {
        element = Dom["b" /* 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.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.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["b" /* 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.svgToExportedString = svgToExportedString;


function svgToSvgUrl(element) {
    var 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;
}

Svg.svgToSvgUrl = svgToSvgUrl;

Dom["b" /* default */].printElement = function (option) {
    var _ = Dom["b" /* default */].ShareInstance._;
    var $ = Dom["b" /* default */].ShareInstance.$;
    option = option || {};
    if (typeof option == 'string') {
        option = { elt: Dom["b" /* default */].ShareInstance.$(option) };
    }
    else if (typeof option.elt == 'string') {
        option.elt = $(option.elt);
    }
    else if (Dom["b" /* default */].isDomNode(option)) {
        option = { elt: option };
    }
    if (Dom["b" /* default */].isDomNode(option.elt)) {
        function afterCloneCb(originElt, newElt) {
            if (!newElt.tagName) return;
            var tagName = newElt.tagName.toLowerCase();
            if (newElt.getBBox && tagName!== 'svg') return;
            var url, img;
            var needCopyStyle = option.computeStyle;
            if (!newElt.tagName) console.log(newElt.nodeType, newElt)
            if (tagName === 'canvas' || tagName === 'svg') {
                if (tagName === "canvas") {
                    url = originElt.toDataURL();
                }
                else {
                    url = svgToSvgUrl(originElt);
                }
                img = _({
                    tag: 'img',
                    props: {
                        src: url
                    }
                });
                $(newElt).selfReplace(img);
                newElt = img;
                needCopyStyle = true;
            }
            else if (tagName === 'script') {
                newElt.remove();
            }
            else if (tagName === 'img') {
                newElt.setAttribute('src', originElt.src);
            }

            if (needCopyStyle) {
                Object(Dom["a" /* copyStyleRule */])(originElt, newElt);
            }
            return newElt;
        }


        var newElt = Object(Dom["c" /* depthClone */])(option.elt, afterCloneCb);


        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["b" /* 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>',
            option.overideStyle ? '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;',
            '}',
            option.extendCss || '',
            '</style>',
            '</he' + 'ad>',

            '<bod' + 'y>',
            eltCode,
            '<scr' + 'ipt>' + (option.extendScript || '') + '</scri' + 'pt>',//browser parse  script tag fail
            '<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 = (Svg);
// CONCATENATED MODULE: ./node_modules/absol-acomp/js/CircleSectionLabel.js






var CircleSectionLabel_ = ACore["a" /* default */]._;
var CircleSectionLabel_$ = ACore["a" /* default */].$;

var _g = HTML5_Svg.ShareInstance._;
var $g = HTML5_Svg.ShareInstance.$;


var Design = {
    circleHeight: 218 - 36,
    borderWidth: 36,
    textBoxHeight: 146,
    textHeight: 48,
    indexHeight: 54,
    textBoxPaddingLeft: 80,
    indexArrowRadius: (172 - 18) / 2,
    indexArrowStrokeWidth: 18,
    indexArrowStartAngle: -Math.PI / 6,
    indexArrowEndAngle: -7 * Math.PI / 12
};

var CircleSectionLabel_StyleSheet = {
    '.as-circle-section-label-text': {
        height: Design.textBoxHeight / Design.textHeight + 'em',
        'padding-left': Design.textBoxPaddingLeft / Design.textHeight + 'em',
        'line-height': Design.textBoxHeight / Design.textHeight + 'em'
    },
    '.as-circle-section-label-index': {
        'font-size': Design.indexHeight / Design.textHeight + 'em',
        height: (Design.circleHeight + Design.borderWidth) / Design.indexHeight + 'em',
        'line-height': (Design.circleHeight + Design.borderWidth) / Design.indexHeight + 'em',
        width: (Design.circleHeight + Design.borderWidth) / Design.indexHeight + 'em'
    },

};

CircleSectionLabel_({
    tag: 'style',
    id: 'circle-section-label-style',
    props: {
        innerHTML: Object.keys(CircleSectionLabel_StyleSheet).map(function (key) {
            var style = CircleSectionLabel_StyleSheet[key];
            return key + ' {\n'
                + Object.keys(style).map(function (propName) {
                    return propName + ': ' + style[propName] + ';';
                }).join('\n')
                + '}';
        }).join('\n')
    }
}).addTo(document.head);


/**
 * @extends AElement
 * @constructor
 */
function CircleSectionLabel() {
    this._ident = (Math.random() + '').replace(/[^0-9]/g, '_');
    this.$background = CircleSectionLabel_$('.as-circle-section-label-background', this);
    this.$index = CircleSectionLabel_$('.as-circle-section-label-index', this);
    this.$text = CircleSectionLabel_$('.as-circle-section-label-text', this);
    this.$attachhook = CircleSectionLabel_('attachhook').addTo(this).on('error', function () {
        Dom["b" /* default */].addToResizeSystem(this);
        this.requestUpdateSize();
    });

    this.$attachhook.requestUpdateSize = this.redrawBackground.bind(this);
    this.$svg = _g({
        tag: 'svg',
        attr: {
            width: '0',
            height: '0'
        },
        child: [
            {
                tag: 'defs',
                child: [
                    {
                        tag: 'marker',
                        id: 'marker_' + this._ident,
                        attr: {
                            markerWidth: "4",
                            markerHeight: "4",
                            refX: "0",
                            refY: "1",
                            orient: "auto",
                            markerUnits: "strokeWidth",
                            viewBox: "0 0 4 4"
                        },
                        child: {
                            tag: 'path',
                            class: 'as-circle-section-label-arrow-marker-path',
                            attr: {
                                d: 'M0,0 L0,2 L2,1 z'
                            }
                        }
                    }
                ]
            },
            'rect.as-circle-section-label-text-box',
            'circle.as-circle-section-label-index-box',
            'path.as-circle-section-label-arrow'
        ]
    }).addTo(this.$background);
    this.$indexBox = $g('circle.as-circle-section-label-index-box', this.$svg);
    this.$textBox = $g('rect.as-circle-section-label-text-box', this.$svg);
    // this.$marker = $g('defs marker', this.$svg);
    // this.$markerPath = $g(' path', this.$marker);
    this.$arrow = $g('path.as-circle-section-label-arrow', this.$svg)
        .attr({
            'marker-end': "url(" + '#marker_' + this._ident + ")"
        });
};

CircleSectionLabel.prototype.redrawBackground = function () {
    var indexBound = this.$index.getBoundingClientRect();
    var textBound = this.$text.getBoundingClientRect();
    var cHeight = indexBound.height;
    var cWidth = textBound.right - indexBound.left;
    this.$svg.attr({
        height: cHeight + '',
        width: cWidth + '',
        viewBox: [0, 0, cWidth, cHeight].join(' ')
    });

    var borderWidth = cHeight * Design.borderWidth / (Design.circleHeight + Design.borderWidth);
    var radius = cHeight * Design.circleHeight / (Design.circleHeight + Design.borderWidth) / 2;
    var x0 = indexBound.width / 2;
    var y0 = cHeight / 2;


    this.$indexBox.attr({
        r: radius + '',
        cx: x0,
        cy: y0
    })
        .addStyle({
            strokeWidth: borderWidth + ''
        });
    var textBoxHeight = textBound.height;
    this.$textBox.attr(
        {
            x: x0 / 2,
            y: (cHeight - textBoxHeight) / 2,
            width: cWidth - x0 - 1,
            height: textBoxHeight,
            rx: textBoxHeight / 2,
            ry: textBoxHeight / 2
        }
    );
    var arrowRadius = cHeight * Design.indexArrowRadius / (Design.circleHeight + Design.borderWidth);
    this.$arrow.attr({
        d: [
            'M', x0 + arrowRadius * Math.cos(Design.indexArrowStartAngle), y0 + arrowRadius * Math.sin(Design.indexArrowStartAngle),
            'A', arrowRadius, arrowRadius, 0, 1, 1, x0 + arrowRadius * Math.cos(Design.indexArrowEndAngle), y0 + arrowRadius * Math.sin(Design.indexArrowEndAngle)
        ].join(' ')
    }).addStyle('stroke-width', cHeight * Design.indexArrowStrokeWidth / (Design.circleHeight + Design.borderWidth))
};

CircleSectionLabel.tag = 'CircleSectionLabel'.toLowerCase();
CircleSectionLabel.render = function () {
    return CircleSectionLabel_({
        class: 'as-circle-section-label',
        child: [
            {
                class: 'as-circle-section-label-background'
            },
            '.as-circle-section-label-index',
            '.as-circle-section-label-text'
        ]
    });
};

CircleSectionLabel.property = {};
CircleSectionLabel.property.index = {
    set: function (value) {
        this._index = value;
        this.$index.clearChild().addChild(CircleSectionLabel_({ text: value + '' }))
    },
    get: function () {
        return this._index;
    }
};

CircleSectionLabel.property.text = {
    set: function (value) {
        this._text = value;
        this.$text.clearChild().addChild(CircleSectionLabel_({ text: value + '' }))
    },
    get: function () {
        return this._text;
    }
}


ACore["a" /* default */].install(CircleSectionLabel);
/* harmony default export */ var js_CircleSectionLabel = (CircleSectionLabel);
// EXTERNAL MODULE: ./node_modules/absol-acomp/css/contextmenu.css
var contextmenu = __webpack_require__(117);

// EXTERNAL MODULE: ./node_modules/absol-acomp/css/menu.css
var css_menu = __webpack_require__(119);

// EXTERNAL MODULE: ./node_modules/absol-acomp/css/follower.css
var follower = __webpack_require__(121);

// CONCATENATED MODULE: ./node_modules/absol-acomp/js/Follower.js







var Follower_ = ACore["a" /* default */]._;
var Follower_$ = ACore["a" /* default */].$;


/***
 * @extends AElement
 * @constructor
 */
function Follower() {
    this.$attachhook = Follower_('attachhook', this)
        .addTo(this)
        .on('attached', function () {
            this.requestUpdateSize();
            Dom["b" /* default */].addToResizeSystem(this);
        });
    this.$attachhook.requestUpdateSize = this.updatePosition.bind(this);

    this.$followTarget = undefined;
    this.$scrollTrackElts = [];
    this._scrollTrackEventHandler = undefined;
    this._anchor = Follower.ANCHOR_PRIORITY;
    this.defineEvent(['updateposition', 'preupdateposition']);
}

Follower.tag = 'Follower'.toLowerCase();
Follower.render = function () {
    return Follower_('.absol-follower');
};


Follower.prototype.clearChild = function () {
    var children = Array.prototype.slice.call(this.children);
    var attachhookElt = this.$attachhook;
    children.forEach(function (elt) {
        if (elt != attachhookElt)
            elt.remove();
    });
}

//Todo: remove child, find child....

/**
 * 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;
    this.emit('preupdateposition', { target: this }, this);
    var targetBound = this.$followTarget.getBoundingClientRect();
    var screenSize = Dom["b" /* default */].getScreenSize();
    var outRect = new Math_Rectangle(0, 0, screenSize.width, screenSize.height);
    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] * bound.width;
        y = targetBound.top + factor[2] * targetBound.height + factor[3] * bound.height;
        newContentRect = new Math_Rectangle(x, y, bound.width, bound.height);
        score = newContentRect.collapsedSquare(outRect);
        if (score - 10 > bestScore) {
            bestAnchor = anchors[i];
            bestScore = score;
            bestX = x;
            bestY = y;
        }
    }

    if (this._lastAnchor !==bestAnchor){
        this.removeClass('as-anchor-'+ this._lastAnchor);
        this._lastAnchor = bestAnchor;
        this.addClass('as-anchor-'+ this._lastAnchor);
    }



    this.addStyle({
        left: bestX + 'px',
        top: bestY + 'px'
    });
    this.emit('updateposition', { target: this }, this);
};


Follower.prototype.refollow = function () {
    if (!this.$followTarget) return;
    this.updatePosition();
    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;
            return;
        }
        else if (typeof elt == 'string') {
            elt = Follower_$(elt) || document.getElementById(elt);
        }

        if (Dom["b" /* default */].isDomNode(elt)) {
            this.$followTarget = elt;
            this._lastAncho = undefined;
            this.refollow();
        }
        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);

/* harmony default export */ var js_Follower = (Follower);
// CONCATENATED MODULE: ./node_modules/absol-acomp/js/Menu.js








var Menu_ = ACore["a" /* default */]._;
var Menu_$ = ACore["a" /* default */].$;

/***
 * @extends AElement
 * @constructor
 */
function MenuButton() {
    this.$text = Menu_$('.absol-vmenu-button-text', this);
    this.$key = Menu_$('.absol-vmenu-button-key', this);


    this.$arrow = Menu_$('.absol-vmenu-arrow', this);
    this.$iconCtn = Menu_$('.absol-vmenu-button-ext-icon-container', this);

    OOP["a" /* default */].drillProperty(this, this.$text, 'text', 'innerHTML');
    OOP["a" /* default */].drillProperty(this, this.$key, 'key', 'innerHTML');
}

MenuButton.tag = 'menubutton';

MenuButton.render = function () {
    return 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'
            }
        ]
    });
};

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) {
        if (value)
            this.icon = { tag: 'img', props: { src: value } };
        else
            this.icon = value;
    },
    get: function () {
        return this.icon && this.icon.props && this.icon.props.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);

/***
 *
 * @extends Follower
 * @constructor
 */
function Dropdown() {
    this.$container = Menu_$('.absol-dropdown-content', this);
    this.$container.followTarget = this;
    this.$container.anchor = [1, 2, 6, 5];

}

Dropdown.tag = 'dropdown';

Dropdown.render = function () {
    return Menu_({
        class: ['absol-drop-hidden', 'absol-dropdown'], child: 'follower.absol-dropdown-content.as-bscroller'
    });
};


Dropdown.property = {};
Dropdown.property.show = {
    set: function (value) {
        if (value) {
            this.removeClass('absol-drop-hidden');
            if (this.$container.lastChild && this.$container.lastChild.$items) {
                this.$container.lastChild.$items.forEach(function (itemElt) {
                    if (itemElt.autoFixParrentSize) {
                        itemElt.autoFixParrentSize();
                    }
                });
            }
            var aPst = this.findAvailablePosition();
            if (aPst.crampedHeight) {
                this.removeClass('overlap-top');
                this.$container.followTarget = null;
                this.$container.addStyle({
                    'max-height': aPst.maxHeight + 'px'
                });
                this.$container.refollow();
                this.$container.updatePosition();
                this.$container.addStyle('top', this.getBoundingClientRect().top + aPst.posTop + 'px');


            }
            else {
                this.$container.removeStyle('max-height')
                    .removeStyle('top');
                this.$container.refollow();
                this.$container.updatePosition();
            }
        }
        else {
            this.addClass('absol-drop-hidden');
        }
    },
    get: function () {
        return !this.containsClass('absol-drop-hidden');
    }
};

Dropdown.prototype.findAvailablePosition = function () {
    var outBound = Dom["b" /* default */].traceOutBoundingClientRect(document.body);
    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.bottom + outBound.bottom;
    var result = {};

    if (distLeft >= containerBound.width) result.left = true;
    if (distTop >= containerBound.height) result.top = true;
    if (distRight >= containerBound.width) result.right = true;
    if (distBottom >= containerBound.height) result.bottom = true;
    if (distRight + bound.width >= containerBound.width) result.overlapRight = true;
    if (distLeft + bound.width >= containerBound.width) result.overlapLeft = true;
    if (distBottom + bound.height >= containerBound.height) result.overlapBottom = true;
    if (distTop + bound.height >= containerBound.height) result.overlapTop = true;
    if (!result.overlapTop && !result.overlapBottom) {
        result.crampedHeight = true;
        result.maxHeight = outBound.height - 20;
        result.posTop = distBottom - Math.min(containerBound.height, result.maxHeight) + bound.height - 10;
    }

    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() {
    this.$container = Menu_$('.absol-dropright-content', this);
    this.$container.followTarget = this;
    this.$container.anchor = [0, 3, 7, 4];
}

Dropright.tag = 'dropright';

Dropright.render = function () {
    return Menu_({
        class: ['absol-drop-hidden', 'absol-dropright'],
        child: 'follower.absol-dropright-content.as-bscroller',
        data: { $trigger: undefined, $content: undefined, _isShow: false }
    });
}

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>');
}

VMenuLine.tag = 'VMenuLine'.toLowerCase();

function VMenuItem() {
    var thisVM = this;

    this.sync = new Promise(function (rs) {
        Menu_('attachhook').addTo(thisVM).on('error', function () {
            this.remove();
            rs();
        })
    });
    this.$dropper = Menu_$('dropright', this);
    this.$vmenu = Menu_$('vmenu', this);
    this.$button = Menu_$('menubutton', this);

    this.$text = thisVM.$button.$text;

    this.$key = thisVM.$button.$key;
    this.$arrow = thisVM.$button.$arrow;
    this.$iconCtn = thisVM.$button.$iconCtn;


    OOP["a" /* default */].drillProperty(this, this.$button, ['text', 'extendClasses', 'extendStyle', 'key', 'icon', 'iconSrc']);
    OOP["a" /* default */].drillProperty(this, this.$vmenu, ['activeTab']);

    this.eventHandler = OOP["a" /* default */].bindFunctions(this, VMenuItem.eventHandler);
    this.$vmenu.on('press', this.eventHandler.pressItem, true);

    this.$button.on('click', this.eventHandler.clickButton, true);
    this.$button.on('mouseenter', this.eventHandler.enterButton, true);
    this._textMarginRight = 0;
}


VMenuItem.tag = 'VMenuItem'.toLowerCase();

VMenuItem.render = function () {
    return Menu_({
        tag: 'dropright',
        extendEvent: ['press', 'enter'],
        child: ['menubutton',
            {
                tag: 'vmenu',
            }]
    });
};

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
    if (!parentWidth) return;
    var buttonWidth = this.$button.getBoundingClientRect().width;
    var fontSize = this.$text.getFontSize();
    this._textMarginRight = parentWidth - buttonWidth + this._textMarginRight;
    this.$text.addStyle('margin-right', this._textMarginRight / fontSize + 'em');
};

VMenuItem.eventHandler = {};


VMenuItem.eventHandler.enterButton = function (event) {
    event.menuItem = this;
    var newEvent = EventEmitter["b" /* default */].copyEvent(event);
    this.emit('enter', newEvent, this);
};


VMenuItem.eventHandler.pressItem = function (event) {
    var newEvent = EventEmitter["b" /* 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["b" /* 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 thisVM = this;

    this.sync = new Promise(function (rs) {
        Menu_('attachhook').addTo(thisVM).on('error', function () {
            this.remove();
            rs();
        })
    });
}

VMenu.tag = 'vmenu';

VMenu.render = function () {
    return Menu_({
        class: 'absol-vmenu',
        extendEvent: 'press'
    });
};


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) {
                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 || [];
    }
};


VMenu.eventHandler = {};
VMenu.eventHandler.enterItem = function (event) {
    var tabIndex = event.menuItem._tabIndex;
    this.activeTab = tabIndex;
};


VMenu.eventHandler.pressItem = function (event) {
    this.emit('press', EventEmitter["b" /* 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 itemElt;
        if (typeof item === 'string' && (item.substr(0, 1) === '-' || item.substr(0, 1) === '=')) {
            itemElt = Menu_('vmenuline');
        }
        else if (Object(Dom["e" /* isDomNode */])(item)) {
            itemElt = item;
        }
        else if (item.child || item.class || item.tag || item.style || typeof item === 'string') {
            itemElt = Menu_(item);
        }
        else {
            itemElt = 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(itemElt);
        return itemElt;
    }.bind(this));
    //todo
};


function HMenuItem() {
    this.$vmenu = Menu_$('vmenu', this);
    this.$dropDown = this;
    this.$button = Menu_$('button.absol-hmenu-button', this);
    OOP["a" /* default */].drillProperty(this, this.$button, 'text', 'innerHTML');
    OOP["a" /* default */].drillProperty(this, this.$vmenu, 'items');
    OOP["a" /* default */].drillProperty(this, this.$vmenu, 'activeTab');

    this.$button.on('click', this.eventHandler.clickButton);
    this.$button.on('mouseenter', this.eventHandler.enterButton, true);
    this.$vmenu.on('press', this.eventHandler.pressItem, true);

    //property show not need because dropdown is itself
    return this;
}

HMenuItem.tag = 'HMenuItem'.toLowerCase();

HMenuItem.render = function () {
    return Menu_({
        tag: 'dropdown',
        extendEvent: ['press', 'enter'],
        child: ['button.absol-hmenu-button',
            'vmenu'
        ]
    });
};


HMenuItem.eventHandler = {};

HMenuItem.eventHandler.clickButton = function (event) {
    event.menuItem = this;
    event.hmenuItem = this;
    this.emit('press', EventEmitter["b" /* default */].copyEvent(event, { target: this }), this);
};

HMenuItem.eventHandler.enterButton = function (event) {
    event.menuItem = this;
    this.emit('enter', EventEmitter["b" /* default */].copyEvent(event, { target: this }), this);
};

HMenuItem.eventHandler.pressItem = function (event) {
    this.emit('press', EventEmitter["b" /* 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);
};

/***
 * @extends AElement
 * @constructor
 */
function HMenu() {
}

HMenu.tag = 'hmenu';

HMenu.render = function () {
    return Menu_({
        class: 'absol-hmenu',
        extendEvent: ['press', 'enter', 'activetab', 'cancel']
    });
};


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;
    }
    else {
        event.isLeaf = (!event.menuItem.items || !event.menuItem.items.length);
        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 (EventEmitter["b" /* default */].hitElement(this, event)) return;
    this.activeTab = -1;
    window.removeEventListener('blur', this.eventHandler.clickSomewhere);
};


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) {
        var lastValue = this._activeTab;
        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');
            }
        }
        if (!(lastValue >= 0) && (this._activeTab >= 0)) {
            setTimeout(function () {
                Menu_$(document.body).on('click', this.eventHandler.clickSomewhere, false);
                window.addEventListener('blur', this.eventHandler.clickSomewhere);
            }.bind(this), 100);
        }
        else if ((lastValue >= 0) && !(this._activeTab >= 0)) {
            Menu_$(document.body).off('click', this.eventHandler.clickSomewhere, false);
        }
        if (lastValue >= 0) {
            if (tabIndex >= 0 && tabIndex != lastValue) {
                this.emit('activetab', { type: 'activetab', tabIndex: tabIndex, target: this }, this);
            }
            else if (!(tabIndex >= 0)) {
                this.emit('cancel', { type: 'cancel', lastActiveIndex: lastValue, target: this }, this);
            }
        }
        else {
            if (tabIndex >= 0) {
                this.emit('activetab', { type: 'activetab', tabIndex: tabIndex, target: this }, this);
            }
        }
    },
    get: function () {
        return this._activeTab;
    }
};

/***
 * @extends AElement
 * @constructor
 */
function VRootMenu() {
    this._items = [];
    this.items = [];
}

VRootMenu.tag = 'VRootMenu'.toLowerCase();

VRootMenu.render = function () {
    return Menu_({
        class: 'as-v-root-menu',
        extendEvent: ['press', 'enter', 'activetab', 'cancel']
    });
};


VRootMenu.prototype._childFromItems = function (items) {
    var thisM = this;
    this.clearChild();
    this.$items = items.map(function (item, i) {
        var itemElt;
        if (typeof item === 'string' && (item.substr(0, 1) === '-' || item.substr(0, 1) === '=')) {
            itemElt = Menu_('vmenuline');
        }
        else if (Object(Dom["e" /* isDomNode */])(item)) {
            itemElt = item;
        }
        else if (item.child || item.class || item.tag || item.style || typeof item === 'string') {
            itemElt = Menu_(item);
        }
        else {
            itemElt = Menu_({
                tag: 'vmenuitem',
                props: item,
                on: {
                    enter: thisM.eventHandler.enterItem,
                    press: thisM.eventHandler.pressItem
                }
            });
        }
        itemElt._tabIndex = i;
        thisM.addChild(itemElt);
        return itemElt;
    });
};

VRootMenu.property = Object.assign({}, HMenu.property);

VRootMenu.eventHandler = Object.assign({}, HMenu.eventHandler);


ACore["a" /* default */].install([HMenu, VMenuItem, VMenu, Dropright, VMenuLine, Dropdown, HMenuItem, VRootMenu]);
// CONCATENATED MODULE: ./node_modules/absol-acomp/js/ContextMenu.js










var ContextMenu_ = ACore["a" /* default */]._;
var ContextMenu_$ = ACore["a" /* default */].$;

var supportContextEvent = false;

/**
 * @extends AElement
 * @constructor
 */
function ContextCaptor() {
    this.attachedElt = null;
    this.$textarea = ContextMenu_$('textarea', this)
        .on('contextmenu', this.eventHandler.contextmenu, true);
    this._ss = 0;
    this._isTouch = false;
    /**
     this._target = null;
     * @type {Vec2}
     */
    this._posStart = null;
    /**
     * @type {Vec2}
     */
    this._posCurrent = null;
    this._touchId = -100;
    this._longPressTimeout = -1;
    this._removeTimeout = -1;
    this._fireContextMenuTimeout = -1;
    this.$target = null;
    this._pointerSession = 0;
    this._lastContextSession = 0;

    this.mousedownEvent = null;
    this.sync = Promise.resolve();
};

ContextCaptor.prototype.attachTo = function (elt) {
    if (this.attachedElt) {
        this.attachedElt.removeEventListener('mousedown', this.eventHandler.mousedown);
        this.attachedElt.removeEventListener('touchstart', this.eventHandler.mousedown);
        this.attachedElt = null;
    }
    this.attachedElt = elt;
    if (this.attachedElt) {
        this.attachedElt.addEventListener('mousedown', this.eventHandler.mousedown);
        this.attachedElt.addEventListener('touchstart', this.eventHandler.mousedown);
    }
    return this;
};

ContextCaptor.tag = 'ContextCaptor'.toLowerCase();

ContextCaptor.render = function () {
    return ContextMenu_({
        class: 'absol-context-menu-anchor',
        extendEvent: 'requestcontextmenu',
        child: [
            'textarea'
        ]
    });
};

ContextCaptor.prototype.showContextMenu = function (x, y, props, onSelectItems, onCancel) {
    var self = this;
    var anchor = ContextMenu_('.absol-context-menu-anchor').addTo(document.body);
    var finish = function (event) {
        (document.body).off('click', finish)
            .off('touchcancel', finish)
            .off('touchend', finish)
            .off('contextmenu', finish);

        self.off('requestcontextmenu', finish);
        setTimeout(function () {
            anchor.selfRemove();//
        }, 10);
    };
    var vmenu = ContextMenu_({
        tag: 'vmenu',
        props: props,
        on: {
            press: onSelectItems || function () {
            }
        }
    }).addTo(anchor);
    setTimeout(function () {
        var screenSize = Dom["b" /* default */].getScreenSize();
        var menuBound = vmenu.getBoundingClientRect();
        if (x + menuBound.width > screenSize.width - 17) {
            x -= menuBound.width;
        }
        if (y + menuBound.height > screenSize.height - 17) {
            y -= menuBound.height;
        }

        anchor.addStyle({
            left: x + 'px',
            top: y + 'px'
        });
        anchor.addClass('absol-active');
    }, 30);
    setTimeout(function () {
        ContextMenu_$(document.body).on('click', finish)
            .on('contextmenu', finish);
        self.on('requestcontextmenu', finish);
    }, 10)
};

ContextCaptor.prototype._checkNeedHandle = function (target) {
    var current = target;
    var needHandle = false;
    while (current && !needHandle && !current.classList.contains('as-system-context-menu')) {
        if (current.isSupportedEvent && current.isSupportedEvent('contextmenu'))
            needHandle = true;
        current = current.parentElement;
    }
    return needHandle;
};


ContextCaptor.prototype._fireContextMenuEvent = function () {
    if (this._lastContextSession >= this._pointerSession) return false;// prevent fire multi-times in a pointer session
    var showed = false;
    this._lastContextSession = this._pointerSession;
    var baseEventData = {
        clientX: this._posCurrent.x,
        clientY: this._posCurrent.y,
        target: this.$target
    };
    this.emit('requestcontextmenu', baseEventData, this);
    var self = this;

    var propagation = true;
    var localEvent = Object.assign({
        clientX: this._posCurrent.x, clientY: this._posCurrent.y,
        target: this.$target,
        showContextMenu: function (props, onSelectItems) {
            showed = true;
            self.sync = self.sync.then(function () {
                return new Promise(function (rs) {
                    setTimeout(function () {
                        self.showContextMenu(self._posCurrent.x, self._posCurrent.y, props, onSelectItems);
                        rs();
                    }, 30)
                });
            })
        },
        stopPropagation: function () {
            propagation = false;
        }
    }, baseEventData);

    Object.defineProperty(localEvent, 'selectedText', {
        get: function () {
            return getSelectionText();
        }
    });

    var current = this.$target;
    while (current && propagation) {
        if (current.isSupportedEvent && current.isSupportedEvent('contextmenu')) {
            current.emit('contextmenu', localEvent, current, this);
        }
        current = current.parentElement;
    }
    return showed;
};

/**
 * @type {ContextCaptor}
 */
ContextCaptor.eventHandler = {};

ContextCaptor.eventHandler.mousedown = function (event) {
    if (this._touchId != -100) return;
    this._pointerSession++;
    var target;
    var isTouch;
    var touchId;
    var posCurrent;
    var pointer;
    if (event.type == 'touchstart') {
        isTouch = true;
        pointer = event.changedTouches[0];
        touchId = pointer.identifier;
    }
    else {
        isTouch = false;
        touchId = -1;
        pointer = event;
    }
    target = pointer.target;

    posCurrent = new Math_Vec2(pointer.clientX, pointer.clientY);

    if (isTouch) {
        var dragzone = js_BoardTable.prototype._findDragZone(target);
        if (dragzone) return;
        var thisCT = this;
        this._longPressTimeout = setTimeout(function () {
            if (!thisCT._checkNeedHandle(target)) return;
            if (thisCT._removeTimeout > 0) {
                clearTimeout(thisCT._removeTimeout);
                thisCT._removeTimeout = -1;
            }

            thisCT._ss++;
            thisCT.moveTo(thisCT._posCurrent);
            thisCT.active(true);
            thisCT._longPressTimeout = -1;
            if (thisCT._fireContextMenuTimeout >= 0) {
                clearTimeout(thisCT._fireContextMenuTimeout);
            }
            // show if device not support contextmenu event (after 700ms)
            thisCT._fireContextMenuTimeout = setTimeout(function () {
                if (!supportContextEvent) {
                    thisCT._fireContextMenuEvent();
                }
            }, 300);
        }, 400);
        this.$target = target;
        this._isTouch = isTouch;
        this._touchId = touchId;
        this._posCurrent = posCurrent;
        this._posStart = posCurrent;
        ContextMenu_$(document.body).on('touchmove', thisCT.eventHandler.mousemove)
            .on('touchend', thisCT.eventHandler.mousefinish)
            .on('touchcancel', thisCT.eventHandler.mousefinish);

    }
    else {
        if (EventEmitter["b" /* default */].isMouseRight(event) && this._checkNeedHandle(target)) {
            if (this._removeTimeout > 0) {
                clearTimeout(this._removeTimeout);
                this._removeTimeout = -1;
            }
            this.$target = target;
            this._isTouch = isTouch;
            this._posCurrent = posCurrent;
            this._posStart = posCurrent;
            this._touchId = touchId;
            this._ss++;
            this.moveTo(this._posCurrent);
            this.active(true);

            ContextMenu_$(document.body).on('mousemove', this.eventHandler.mousemove)
                .on('mouseup', this.eventHandler.mousefinish)
                .on('mouseleave', this.eventHandler.mousefinish);
        }
    }
};

/**
 * @param {Vec2} pos
 */
ContextCaptor.prototype.moveTo = function (pos) {
    this.addStyle({
        left: pos.x - 80 + 'px',
        top: pos.y - 80 + 'px'
    });
};

ContextCaptor.prototype.active = function (flag) {
    if (flag)
        this.addClass('absol-active');
    else
        this.removeClass('absol-active');
};

ContextCaptor.eventHandler.mousemove = function (event) {
    var isTouch = this._isTouch;
    var touchId;
    var pointer;
    var posCurrent;
    if (isTouch) {
        pointer = event.changedTouches[0];
        touchId = pointer.identifier;
    }
    else {
        isTouch = false;
        touchId = -1;
        pointer = event;
    }

    if (touchId != this._touchId) return;
    posCurrent = new Math_Vec2(pointer.clientX, pointer.clientY);
    this._posCurrent = posCurrent;
    if (isTouch) {
        if (this._posStart.sub(posCurrent).abs() > 10) this.eventHandler.mousefinish(event);
    }
    this.moveTo(posCurrent);
};


ContextCaptor.eventHandler.mousefinish = function (event) {

    var isTouch = this._isTouch;
    var touchId;
    var pointer;

    if (isTouch) {
        pointer = event.changedTouches[0];
        touchId = pointer.identifier;
    }
    else {
        isTouch = false;
        touchId = -1;
        pointer = event;

    }
    if (touchId != this._touchId) return;
    if (isTouch) {
        ContextMenu_$(document.body).off('touchmove', this.eventHandler.mousemove)
            .off('touchend', this.eventHandler.mousefinish)
            .off('touchcancel', this.eventHandler.mousefinish);
        if (this._longPressTimeout > 0) {
            clearTimeout(this._longPressTimeout);
            this._longPressTimeout = -1;
        }
    }
    else {
        ContextMenu_$(document.body).off('mousemove', this.eventHandler.mousemove)
            .off('mouseup', this.eventHandler.mousefinish)
            .off('mouseleave', this.eventHandler.mousefinish);
    }

    this._touchId = -100;
    if (this._fireContextMenuTimeout >= 0) {
        clearTimeout(this._fireContextMenuTimeout);
    }
    var thisCT = this;
    this._removeTimeout = setTimeout(function () {
        thisCT.active(false);
        thisCT._removeTimeout = -1;

    }, 1);
};

ContextCaptor.eventHandler.contextmenu = function (event) {
    supportContextEvent = true;
    event.preventDefault();
    this._fireContextMenuEvent();

};


ContextCaptor.auto = function () {
    console.warn("ContextCaptor: use BContextCapture instead, with native support!");
    if (ContextCaptor.$elt) return;
    ContextCaptor.$elt = ContextMenu_('contextcaptor');
    Dom["b" /* default */].documentReady.then(function () {
        ContextCaptor.$elt.addTo(document.body);
        ContextCaptor.$elt.attachTo(document.body);
    });
};

ACore["a" /* default */].install(ContextCaptor);

/* harmony default export */ var ContextMenu = (ContextCaptor);
// EXTERNAL MODULE: ./node_modules/absol-acomp/css/dateinput.css
var dateinput = __webpack_require__(48);

// CONCATENATED MODULE: ./node_modules/absol-acomp/js/DateInput.js








var DateInput_ = ACore["a" /* default */]._;
var DateInput_$ = ACore["a" /* default */].$;

/**
 * @extends AElement
 * @constructor
 */
function DateInput() {
    this._lastValue = null;
    this._value = null;
    this._format = 'dd/mm/yyyy';
    this.$input = DateInput_$('input', this)
        .on('mouseup', this.eventHandler.mouseup)
        .on('keydown', this.eventHandler.keydown)
        .on('paste', this.eventHandler.paste)
        .on('cut', this.eventHandler.cut)
        .on('focus', this.eventHandler.focus);
    this._minLimitDate = new Date(1890, 0, 1, 0, 0, 0, 0);
    this._maxLimitDate = new Date(2090, 0, 1, 0, 0, 0, 0);
    this.$calendarBtn = DateInput_$('.as-date-input-icon-ctn', this)
        .on('mousedown', this.eventHandler.mousedownCalendarBtn);
    this._calendarHolder = js_ChromeCalendar.showWhenClick(this.$calendarBtn, {
        minLimitDate: this._minLimitDate,
        maxLimitDate: this._maxLimitDate,
        selectedDates: [new Date()],
    }, 'auto', this.eventHandler.calendarSelect);
    this._calendarHolder.element = this;
    this._formater = DateInput.formaters[this._format];
    OOP["a" /* default */].drillProperty(this, this._calendarHolder.calendarProps, ['minLimitDate', 'maxLimitDate']);
    this.value = null;
}

DateInput.formaters = {
    'dd/mm/yyyy': {
        separator: '/',
        nan: ['dd', 'mm', 'yyyy'],
        dayIdx: 0,
        monthIdx: 1,
        yearIdx: 2
    },
    'dd-mm-yyyy': {
        separator: '-',
        nan: ['dd', 'mm', 'yyyy'],
        dayIdx: 0,
        monthIdx: 1,
        yearIdx: 2
    },
    'dd.mm.yyyy': {
        separator: '.',
        nan: ['dd', 'mm', 'yyyy'],
        dayIdx: 0,
        monthIdx: 1,
        yearIdx: 2
    },
    'yyyy/mm/dd': {
        separator: '/',
        nan: ['yyyy', 'mm', 'dd'],
        dayIdx: 2,
        monthIdx: 1,
        yearIdx: 0
    },
    'yyyy-mm-dd': {
        separator: '-',
        nan: ['yyyy', 'mm', 'dd'],
        dayIdx: 2,
        monthIdx: 1,
        yearIdx: 0
    },
    'mm/dd/yyyy': {
        separator: '/',
        nan: ['mm', 'dd', 'yyyy'],
        dayIdx: 1,
        monthIdx: 0,
        yearIdx: 2
    },
};


DateInput.tag = 'dateinput';

DateInput.render = function () {
    //only support dd/mm/yyyy
    return DateInput_({
        class: 'as-date-input',
        extendEvent: ['change'],
        child: [{
            tag: 'input',
            props: {
                value: '__/__/____'
            }
        },
            {
                class: 'as-date-input-icon-ctn',
                child: 'span.mdi.mdi-calendar'
            }
        ]
    });
};

DateInput.prototype._autoSelect = function () {
    var slEnd = this.$input.selectionEnd;
    var slStart = this.$input.selectionStart;
    var texts = this.$input.value.split(this._formater.separator);
    var lTexts = texts.reduce(function (ac, cr) {
        ac.push(ac[ac.length - 1] + cr.length + 1);
        return ac;
    }, [0]);

    function indexOf(offset) {
        var l;
        for (var i = 0; i < lTexts.length; ++i) {
            l = lTexts[i];
            if (l > offset) return i;
        }
        return texts.length;
    }

    var i0 = indexOf(slStart);
    var i1 = indexOf(slEnd);

    if (i0 == i1) {
        this.$input.selectionStart = lTexts[i0 - 1];
        this.$input.selectionEnd = lTexts[i0] - 1;
    }
    else {
        this.$input.selectionStart = 0;
        this.$input.selectionEnd = lTexts[lTexts.length - 1];
    }
};

DateInput.prototype.notifyChange = function () {
    this.emit('change', { type: 'change', target: this, value: this._value }, this);
}

DateInput.prototype._countSeparator = function (text) {
    return text.replace(new RegExp('[^\\' + this._formater.separator + ']', 'g'), '').length
};

DateInput.prototype._cleanCharacter = function (text) {
    return text.replace(new RegExp('[^0-9\\' + this._formater.separator + ']', 'g'), '');
};

DateInput.prototype._splitBySeparator = function (text) {
    return text.split(this._formater.separator);
};

DateInput.prototype._onlySeparator = function (text) {
    return text.replace(new RegExp('[^\\' + this._formater.separator + ']', 'g'), '')
};

DateInput.prototype._isAcceptKey = function (key) {
    return !!key.match(new RegExp('[0-9\\' + this._formater.separator + ']', 'i'));
};

/**
 * @type {DateInput}
 */
DateInput.eventHandler = {};

DateInput.eventHandler.paste = function (event) {
    var paste = (event.clipboardData || window.clipboardData).getData('text');
    event.preventDefault();
    paste = this._cleanCharacter(paste);
    var slEnd = this.$input.selectionEnd;
    var slStart = this.$input.selectionStart;
    var sStart = Math.min(slStart, slEnd);
    var sEnd = Math.max(slEnd, slStart);
    var value = this.$input.value;
    var slashPasteCount = this._countSeparator(paste)
    var slashSelectedCount = this._countSeparator(value.substr(sStart, sEnd - sStart));

    if (slashPasteCount < 2) {
        if (slashPasteCount > slashSelectedCount) {
            paste = this._splitBySeparator(paste).slice(0, slashSelectedCount + 1).join(this._formater.separator);
        }
        else if (slashPasteCount < slashSelectedCount) {
            paste += this._formater.separator.repeat(slashSelectedCount - slashPasteCount);
        }
        slStart = (value.substr(0, sStart) + paste).length;
        slEnd = slStart;
        value = value.substr(0, sStart) + paste + value.substr(sEnd);
    }
    else {
        value = this._splitBySeparator(paste).slice(0, 3).join(this._formater.separator);
        slStart = value.length;
        slEnd = value.length;
    }
    this.$input.value = value;
    this.$input.selectionStart = slStart;
    this.$input.selectionEnd = slEnd;
};

DateInput.eventHandler.cut = function (event) {
    event.preventDefault();
    var slEnd = this.$input.selectionEnd;
    var slStart = this.$input.selectionStart;
    var sStart = Math.min(slStart, slEnd);
    var sEnd = Math.max(slEnd, slStart);
    var value = this.$input.value;
    this.$input.value = value.substr(0, sStart) + this._onlySeparator(value.substr(sStart, sEnd - sStart)) + value.substr(sEnd);
    this.$input.selectionStart = slStart;
    this.$input.selectionEnd = slStart;
};

DateInput.eventHandler.mouseup = function () {
    setTimeout(this._autoSelect.bind(this), 1);
};

DateInput.eventHandler.focus = function () {
    this.$input.on('blur', this.eventHandler.blur);
};

DateInput.eventHandler.blur = function () {
    var thisIp = this;
    this.$input.off('blur', this.eventHandler.blur);
    var value = this.$input.value;
    var slashValueCount = this._countSeparator(value).length;
    for (var i = slashValueCount; i < 2; ++i) value += this._formater.separator;
    var texts = value.split(this._formater.separator).slice(0, 3);
    var day = parseInt(texts[this._formater.dayIdx]);
    var month = parseInt(texts[this._formater.monthIdx]);
    var year = parseInt(texts[this._formater.yearIdx]);
    if (!isNaN(year)) year = Math.min(2090, Math.max(year, 1890));
    if (!isNaN(month)) month = Math.max(1, Math.min(12, month));
    if (!isNaN(day)) {
        day = Math.max(1, Math.min(31, day));
        if (!isNaN(month)) {
            day = Math.min(daysInMonth(2000, month), day);
            if (!isNaN(year)) day = Math.min(daysInMonth(year, month), day);
        }
    }
    if (!isNaN(year) && !isNaN(month) && !isNaN(day)) {
        var dateValue = new Date(year, month - 1, day, 0, 0, 0, 0);
        if (this._lastValue == null || compareDate(dateValue, this._lastValue) != 0) {
            this.value = dateValue;
            this.notifyChange();
        }
    }
    else {
        var values = this._formater.nan.slice();
        values[this._formater.dayIdx] = day;
        values[this._formater.monthIdx] = month;
        values[this._formater.yearIdx] = year;

        this.$input.value = values.map(function (e, i) {
            if (isNaN(e)) return thisIp._formater.nan[i];
            e = e + '';
            while (e.length < thisIp._formater.nan[i].length) e = '0' + e;
            return e;
        }).join(this._formater.separator);
        if (this._lastValue != null) {
            this._value = null;
            this.notifyChange();
        }
    }
};


DateInput.eventHandler.calendarSelect = function (value) {
    this.value = value;
    this.notifyChange();
};

DateInput.eventHandler.keydown = function (event) {
    var slEnd = this.$input.selectionEnd;
    var slStart = this.$input.selectionStart;
    var value = this.$input.value;
    var sStart = Math.min(slStart, slEnd);
    var sEnd = Math.max(slEnd, slStart);
    var selectedValue = value.substr(sStart, sEnd - sStart);
    var slashValueCount = this._countSeparator(value);
    var slashSelectedCount = this._countSeparator(selectedValue);

    var texts = this._splitBySeparator(value);
    var lTexts = texts.reduce(function (ac, cr) {
        ac.push(ac[ac.length - 1] + cr.length + 1);
        return ac;
    }, [0]);

    function indexOf(offset) {
        var l;
        for (var i = 0; i < lTexts.length; ++i) {
            l = lTexts[i];
            if (l > offset) return i;
        }
        return texts.length;
    }

    var i0 = indexOf(slStart);
    var i1 = indexOf(slEnd);
    if (event.key == 'Enter') {
        event.preventDefault();
        this.$input.blur();
    }
    else if (event.key == 'Meta') {
        event.preventDefault();
    }
    else if (event.key == 'Backspace') {
        if (slStart == slEnd) {
            if (slStart > 0) {
                if (value.charAt(slStart - 1) == this._formater.separator) {
                    event.preventDefault();
                    this.$input.value = value;
                    this.$input.selectionStart = slStart - 1;
                    this.$input.selectionEnd = slStart - 1;
                }
            }
        }
        else if (i0 != i1) {
            event.preventDefault();
            this.$input.value = value.substr(0, sStart) + this._onlySeparator(selectedValue) + value.substr(sEnd);
            this.$input.selectionStart = slStart;
            this.$input.selectionEnd = slStart;
        }
    }
    else if (event.key == 'Delete') {
        if (slStart == slEnd) {
            if (slStart < value.length) {
                if (value.charAt(slStart) == this._formater.separator) {
                    event.preventDefault();
                    this.$input.value = value;
                    this.$input.selectionStart = slStart + 1;
                    this.$input.selectionEnd = slStart + 1;
                }
            }
        }
        else if (i0 != i1) {
            event.preventDefault();
            this.$input.value = value.substr(0, sStart) + this._onlySeparator(selectedValue) + value.substr(sEnd);
            this.$input.selectionStart = slStart;
            this.$input.selectionEnd = slStart;
        }
    }
    else if (!event.ctrlKey && !event.altKey && event.key && event.key.length == 1) {
        if (this._isAcceptKey(event.key)) {
            if (event.key == this._formater.separator) {
                if (slashSelectedCount == 0 && slashValueCount >= 2 && value.charAt(slEnd) != this._formater.separator) {
                    event.preventDefault();
                }
                else if (value.charAt(slEnd) == this._formater.separator) {
                    event.preventDefault();
                    this.$input.selectionStart = lTexts[i1];
                    this.$input.selectionEnd = lTexts[i1 + 1] - 1;
                }
            }
        }
        else {
            event.preventDefault();
        }
    }
    else if (!event.ctrlKey && !event.altKey && event.key == "Tab") {
        if (event.shiftKey) {
            if (i0 > 1) {
                event.preventDefault();
                this.$input.selectionStart = lTexts[i1 - 2];
                this.$input.selectionEnd = lTexts[i1 - 1] - 1;
            }
        }
        else {
            if (i1 < texts.length) {
                event.preventDefault();
                this.$input.selectionStart = lTexts[i1];
                this.$input.selectionEnd = lTexts[i1 + 1] - 1;
            }
        }
    }
};


DateInput.property = {};

DateInput.property.value = {
    set: function (value) {
        if (value === false || value === null || value === undefined) {
            this.$input.value = this._format;
            this._value = null;
        }
        else if ((typeof value == 'string') || (typeof value == 'number')) {
            this._value = beginOfDay(new Date(value));
            this.$input.value = formartDateString(this._value, this._format);
        }
        else if (value.getTime) {
            this._value = beginOfDay(value);
            this.$input.value = formartDateString(this._value, this._format);
        }
        this._lastValue = this._value;
        this._calendarHolder.calendarProps.selectedDates = [this._value || new Date()];
    },
    get: function () {
        return this._value;
    }
};

DateInput.property.format = {
    set: function (value) {
        value = value || 'dd/mm/yyyy';
        if (value == this._format) return;
        if (DateInput.formaters[value]) {
            this._formater = DateInput.formaters[value];
            this._format = value;
            this.value = this.value;
        }
        else {
            throw new Error("Not support format " + value);
        }
    },
    get: function () {
        return this._format;
    }
};

DateInput.property.disabled = {
    set: function (value) {
        value = !!value;
        this.$input.disabled = value;
        if (value) this.addClass('as-disabled');
        else this.removeClass('as-disabled');
    },
    get: function () {
        return this.$input.disabled;
    }
};

ACore["a" /* default */].install(DateInput);

/* harmony default export */ var js_DateInput = (DateInput);
// CONCATENATED MODULE: ./node_modules/absol-acomp/js/DateInput2.js








var DateInput2_ = ACore["a" /* default */]._;
var DateInput2_$ = ACore["a" /* default */].$;

/**
 * @extends AElement
 * @constructor
 */
function DateInput2() {
    this._lastValue = null;
    this._value = null;
    this._format = 'dd/mm/yyyy';
    this.$input = DateInput2_$('input', this)
        .on('keydown', this.eventHandler.keydown)
        .on('focus', this.eventHandler.focus);
    this._minLimitDate = new Date(1890, 0, 1, 0, 0, 0, 0);
    this._maxLimitDate = new Date(2090, 0, 1, 0, 0, 0, 0);
    this.$calendarBtn = DateInput2_$('.as-date-input-icon-ctn', this)
        .on('mousedown', this.eventHandler.mousedownCalendarBtn);
    this._calendarHolder = js_ChromeCalendar.showWhenClick(this.$calendarBtn, {
        minLimitDate: this._minLimitDate,
        maxLimitDate: this._maxLimitDate,
        selectedDates: [new Date()],
    }, 'auto', this.eventHandler.calendarSelect);
    this._calendarHolder.element = this;
    this._formater = js_DateInput.formaters[this._format];
    OOP["a" /* default */].drillProperty(this, this._calendarHolder.calendarProps, {
        minLimitDate: 'minLimitDate',
        maxLimitDate: 'maxLimitDate',
        minDateLimit: 'minLimitDate',
        maxDateLimit: 'maxLimitDate'
    });

    this.value = null;
}

DateInput2.tag = 'dateinput';
DateInput2.render = js_DateInput.render;


DateInput2.prototype._autoSelect = function () {
    var slEnd = this.$input.selectionEnd;
    var slStart = this.$input.selectionStart;
    var texts = this.$input.value.split(this._formater.separator);
    var lTexts = texts.reduce(function (ac, cr) {
        ac.push(ac[ac.length - 1] + cr.length + 1);
        return ac;
    }, [0]);

    function indexOf(offset) {
        var l;
        for (var i = 0; i < lTexts.length; ++i) {
            l = lTexts[i];
            if (l > offset) return i;
        }
        return texts.length;
    }

    var i0 = indexOf(slStart);
    var i1 = indexOf(slEnd);

    if (i0 == i1) {
        this.$input.selectionStart = lTexts[i0 - 1];
        this.$input.selectionEnd = lTexts[i0] - 1;
    }
    else {
        this.$input.selectionStart = 0;
        this.$input.selectionEnd = lTexts[lTexts.length - 1];
    }
};

/**
 * @param {String} text
 */
DateInput2.prototype._verifyFormat = function (text) {
    var regex = /([,\.\-\/])|([a-zA-Z0-9]+)/g;
    var tokens = text.match(regex);
    var count = [['dd', 'd'], ['m', 'mm', 'mmm', 'mmmm'], ['yy', 'yyyy']].map(function (list) {
        return list.reduce(function (ac, cr) {
            if (tokens.indexOf(cr) >= 0) return ac + 1;
            return ac;
        }, 0);
    });
    return count[0] == 1 && count[1] == 1 && count[2] == 1;
};

DateInput2.prototype.notifyChange = function () {
    this.emit('change', { type: 'change', target: this, value: this._value }, this);
};

DateInput2.prototype.focus = function () {
    this.$input.focus();
};

DateInput2.prototype.blur = function () {
    this.$input.blur();
};

/**
 * @type {DateInput2}
 */
DateInput2.eventHandler = {};


DateInput2.eventHandler.focus = function () {
    this.$input.on('blur', this.eventHandler.blur);
};

DateInput2.eventHandler.blur = function () {
    try {
        var newVal = parseDateString(this.$input.value, this._format);
        if (!this._value || compareDate(newVal, this._value)) {
            this.value = newVal;
            this.notifyChange();
        }
    } catch (error) {
        this.value = this._value;
    }
    this.$input.off('blur', this.eventHandler.blur);
};

DateInput2.eventHandler.keydown = function (event) {
    if (event.key == "Enter") {
        this.$input.blur();
    }
};


DateInput2.eventHandler.calendarSelect = function (value) {
    this.value = value;
    this.notifyChange();
};


DateInput2.property = {};

DateInput2.property.value = {
    set: function (value) {
        if (value === false || value === null || value === undefined) {
            this.$input.value = this.format;
            this._value = null;
        }
        else if ((typeof value == 'string') || (typeof value == 'number')) {
            this._value = beginOfDay(new Date(value));
            this.$input.value = formartDateString(this._value, this._format);
        }
        else if (value.getTime) {
            this._value = beginOfDay(value);
            this.$input.value = formartDateString(this._value, this._format);
        }
        this._lastValue = this._value;
        this._calendarHolder.calendarProps.selectedDates = [this._value || new Date()];
    },
    get: function () {
        return this._value;
    }
};

/**
 * @type {DateInput2}
 */
DateInput2.property.format = {
    set: function (value) {
        value = value || 'dd/mm/yyyy';
        if (!this._verifyFormat(value)) {
            value = 'dd/mm/yyyy';
            console.error("Invalid date format: " + value);
        }
        this._format = value;
        this.value = this.value;//update
    },
    get: function () {
        return this._format;
    }
};

DateInput2.property.disabled = {
    set: function (value) {
        value = !!value;
        this.$input.disabled = value;
        if (value) this.addClass('as-disabled');
        else this.removeClass('as-disabled');
    },
    get: function () {
        return this.$input.disabled;
    }
}

ACore["a" /* default */].install(DateInput2);

/* harmony default export */ var js_DateInput2 = (DateInput2);
// EXTERNAL MODULE: ./node_modules/absol-acomp/css/draggablestack.css
var draggablestack = __webpack_require__(49);

// 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-acomp/js/PositionTracker.js





/***
 * @extends {AElement}
 * @constructor
 */
function PositionTracker() {
    this.defineEvent('positionchange');
    this.$trackScrollParents = [];
    this._scrollTrackEventHandler = this.notifyPositionChange.bind(this);
}

PositionTracker.tag = 'PositionTracker'.toLowerCase();

/***
 *
 * @return {AElement}
 */
PositionTracker.render = function () {
    return _('div');
};


PositionTracker.prototype.notifyPositionChange = function (event) {
    this.emit('positionchange', { type: 'positionchange', originEvent: event });
};

PositionTracker.prototype.startTrackPosition = function () {
    if (this.$trackScrollParents.length > 0)
        this.stopTrackPosition();
    var trackElt = this;
    while (trackElt) {
        if (trackElt.addEventListener)
            trackElt.addEventListener('scroll', this._scrollTrackEventHandler, false);
        else
            trackElt.attachEvent('onscroll', this._scrollTrackEventHandler, false);

        this.$trackScrollParents.push(trackElt);
        trackElt = trackElt.parentElement;
    }
    if (document.addEventListener) {
        document.addEventListener('scroll', this._scrollTrackEventHandler, false);
    }
    else {
        document.attachEvent('onscroll', this._scrollTrackEventHandler, false);
    }
    this.$trackScrollParents.push(document);
};

PositionTracker.prototype.stopTrackPosition = function () {
    var trackElt;
    for (var i = 0; i < this.$trackScrollParents.length; ++i) {
        trackElt = this.$trackScrollParents[i];
        if (trackElt.removeEventListener)
            trackElt.removeEventListener('scroll', this._scrollTrackEventHandler, false);
        else
            trackElt.dettachEvent('onscroll', this._scrollTrackEventHandler, false);
    }
    this.$trackScrollParents = [];
};

ACore["a" /* default */].install(PositionTracker);

/* harmony default export */ var js_PositionTracker = (PositionTracker);

// CONCATENATED MODULE: ./node_modules/absol-acomp/js/DraggableVStack.js










var DraggableVStack_ = ACore["a" /* default */]._;
var DraggableVStack_$ = ACore["a" /* default */].$;


/***
 * @augments Hanger
 * @augments PositionTracker
 * @constructor
 */
function DraggableVStack() {
    DraggableVStack_({ tag: 'PositionTracker'.toLowerCase(), elt: this });
    this.$cloneContainer = DraggableVStack_('.absol-draggable-stack-clone-container');
    this.on('predrag', this.eventHandler.predrag)
        .on('dragstart', this.eventHandler.dragstart)
        .on('drag', this.eventHandler.drag)
        .on('dragend', this.eventHandler.dragend);
    this._state = 0;
    this.friends = [];
    this.$friends = [];
    this._privateDraggableVStackIdent = randomIdent(35);
    this._dragData = null;
    this.on('positionchange', this.eventHandler.scroll);
}


DraggableVStack.tag = 'DraggableVStack'.toLowerCase();

DraggableVStack.render = function () {
    return DraggableVStack_({
        tag: 'hanger',
        extendEvent: ['change', 'orderchange', 'itemleave', 'itementer'],
        class: ['absol-draggable-stack', 'absol-draggable-vstack']
    });
};

DraggableVStack.prototype._updateFriends = function () {
    var dict = {};
    dict[this._privateDraggableVStackIdent] = this;
    this.$friends = this.friends.reduce(function (ac, cr) {
        if (Dom["b" /* default */].isDomNode(cr)) {
            if (cr._privateDraggableVStackIdent) {
                ac.result.push(cr);
                ac.dict[cr._privateDraggableVStackIdent] = cr;
            }
        }
        else if (typeof cr === 'string') {
            DraggableVStack_$(cr, false, function (elt) {
                if (elt._privateDraggableVStackIdent) {
                    if (!ac.dict[elt._privateDraggableVStackIdent]) {
                        ac.result.push(elt);
                        ac.dict[elt._privateDraggableVStackIdent] = elt;
                    }
                }
            })
        }
        return ac;
    }, { dict: dict, result: [] }).result;
};

DraggableVStack.prototype._findIndex = function (clientY) {
    var childBounds = Array.prototype.map.call(this.childNodes, function (elt) {
        return elt.getBoundingClientRect()
    });
    var childTops = childBounds.map(function (b) {
        return b.top;
    });
    childTops.push((childBounds[childBounds.length - 1] || this.getBoundingClientRect()).bottom);
    var nearestIdx = 0;
    var nearestVal = 10000000;
    var val;
    for (var i = 0; i < childTops.length; ++i) {
        val = Math.abs(clientY - childTops[i]);
        if (val < nearestVal) {
            nearestVal = val;
            nearestIdx = i;
        }
    }
    return nearestIdx;
};

/***
 *
 * @type {DraggableVStack|{}}
 */
DraggableVStack.eventHandler = {};
DraggableVStack.eventHandler.predrag = function (event) {
    var dragzone = this._findDragzone(event.target);
    if (!dragzone) {
        event.cancel();
    }
};

DraggableVStack.eventHandler.dragstart = function (event) {
    this.startTrackPosition();
    event.preventDefault();
    this._updateFriends();
    this._state = 1;
    this.addClass('as-state-drag');

    this._dragData = {
        mouseStartPos: new Math_Vec2(event.clientX, event.clientY),
        elt: this._findDirectChild(event.target),
        rootBound: this.getBoundingClientRect(),
        dest: this
    };
    this._dragData.mouseCurrentPos = this._dragData.mouseStartPos;
    this._updateDestChildrenBound();
    this._dragData.idx = Array.prototype.indexOf.call(this.childNodes, this._dragData.elt);

    this._dragData.eltBound = this._dragData.destChildBounds[this._dragData.idx];
    this._dragData.offsetPos = this._dragData.mouseStartPos.sub(new Math_Vec2(this._dragData.eltBound.left, this._dragData.eltBound.top));
    this._dragData.eltRelative = new Math_Vec2(this._dragData.eltBound.left, this._dragData.eltBound.top).sub(new Math_Vec2(this._dragData.rootBound.left, this._dragData.rootBound.top));

    this.$cloneContainer.addTo(document.body);
    this.$cloneContainer.clearChild().addChild(DraggableVStack_$(this._dragData.elt.cloneNode(true)).addStyle({
        boxSizing: 'border-box',
        width: this._dragData.eltBound.width + 'px',
        height: this._dragData.eltBound.height + 'px'
    }));
    this.$cloneContainer.addStyle({
        left: this._dragData.eltBound.left + 'px',
        top: this._dragData.eltBound.top + 'px',
    });
    this._dragData.elt.addClass('dragging');
};


DraggableVStack.eventHandler.drag = function (event) {
    event.preventDefault();
    this._dragData.mouseCurrentPos = new Math_Vec2(event.clientX, event.clientY);
    this._updateHoverDest();
    this._updateDraggingPosition();
    this.eventHandler.dragOverflow(event);
};

DraggableVStack.prototype.getClientY = function () {
    var top = 1000000;
    var bottom = -10000000;
    var child;
    var childBound;
    for (var i = 0; i < this.childNodes.length; ++i) {
        child = this.childNodes[i];
        if (child === this.$cloneContainer) continue;
        if (child.getBoundingClientRect) {
            childBound = child.getBoundingClientRect();
            top = Math.min(top, childBound.top);
            bottom = Math.max(bottom, childBound.bottom);
        }
    }
    return { top: top, bottom: bottom };
};

DraggableVStack.eventHandler.dragOverflow = function (event) {
    var scroller = this;
    while (scroller) {
        var overflowStyle = window.getComputedStyle(scroller)['overflow'];
        if ((overflowStyle === 'auto' || overflowStyle === 'scroll' || scroller.tagName === 'HTML') && (scroller.clientHeight < scroller.scrollHeight)) break;
        scroller = scroller.parentElement;
    }
    if (!scroller) return;
    var outBound = scroller.getBoundingClientRect();
    var bBound = this.$cloneContainer.getBoundingClientRect();
    var screenSize = Dom["b" /* default */].getScreenSize();
    if (scroller.tagName !== "HTML") {
        outBound = {
            top: Math.max(outBound.top, 0),
            bottom: Math.min(outBound.bottom, screenSize.height)
        }
    }
    else {
        outBound = {
            top: 0,
            bottom: screenSize.height
        }
    }
    var vy = 0;
    if (bBound.top < outBound.top) {
        vy = bBound.top - outBound.top;
    }
    else if (bBound.bottom > outBound.bottom) {
        vy = bBound.bottom - outBound.bottom;
    }

    var dt = 1 / 30;
    if (vy !== 0) {
        var copyEvent = {
            type: event.type,
            preventDefault: function () {/* noop */
            },
            target: event.target
        };

        copyEvent.clientX = event.clientX;
        copyEvent.clientY = event.clientY

        var thisBT = this;

        setTimeout(function () {
            if (scroller.scrollHeight > scroller.clientHeight) {
                scroller.scrollTop += absCeil(vy * dt);
            }

            if (thisBT._state === 1) {
                thisBT.eventHandler.dragOverflow(copyEvent);
            }
        }, dt * 1000);
    }
};


DraggableVStack.eventHandler.scroll = function (event) {
    this._updateDraggingPosition();
};

DraggableVStack.eventHandler.dragend = function (event) {
    this.stopTrackPosition();
    event.preventDefault();
    this._dragData.dest.removeClass('as-state-drag');
    this.$cloneContainer.remove();
    this._dragData.elt.removeClass('dragging');
    this.removeClass('as-state-no-change');
    this._state = 0;
    var beforeElt;
    if (this._dragData.dest === this) {
        if (this._dragData.idx === this._dragData.destIdx || (this._dragData.idx + 1 === this._dragData.destIdx)) {
            //todo
        }
        else {
            if (this._dragData.destIdx === this.childNodes.length) {
                this._dragData.elt.remove();
                this.addChild(this._dragData.elt);
                this.emit('change', {
                    type: 'change',
                    fromStack: this,
                    toStack: this,
                    elt: this._dragData.elt,
                    sourceIndex: this._dragData.idx,
                    destIndex: this.childNodes.length,
                    oldIdx: this._dragData.idx,
                    newIdx: this.childNodes.length - 1,
                    desc: "Move element to end of stack."
                }, this);
                this.emit('orderchange', {
                    type: 'orderchange',
                    fromStack: this,
                    toStack: this,
                    elt: this._dragData.elt,
                    oldIdx: this._dragData.idx,
                    newIdx: this.childNodes.length - 1,
                    desc: "Move element to end of stack."
                }, this);
            }
            else {
                beforeElt = this.childNodes[this._dragData.destIdx];
                this._dragData.elt.remove();
                this.addChildBefore(this._dragData.elt, beforeElt);
                this.emit('change', {
                    type: 'change',
                    fromStack: this,
                    toStack: this,
                    elt: this._dragData.elt,
                    sourceIndex: this._dragData.idx,
                    destIndex: this._dragData.destIdx,
                    oldIdx: this._dragData.idx,
                    newIdx: this._dragData.destIdx > this._dragData.idx ? this._dragData.destIdx - 1 : this._dragData.destIdx,
                    desc: "Move element to before  this.childNodes[" + this._dragData.destIdx + "]"
                }, this);
                this.emit('orderchange', {
                    type: 'orderchange',
                    fromStack: this,
                    toStack: this,
                    elt: this._dragData.elt,
                    oldIdx: this._dragData.idx,
                    newIdx: this._dragData.destIdx > this._dragData.idx ? this._dragData.destIdx - 1 : this._dragData.destIdx,
                    desc: "Move element to before  this.childNodes[" + this._dragData.destIdx + "]"
                }, this);
            }
        }
    }
    else {
        if (this._dragData.destIdx === this._dragData.dest.childNodes.length) {
            this.emit('orderchange', {
                type: 'itemleave',
                fromStack: this,
                toStack: this._dragData.dest,
                oldIdx: this._dragData.idx,
                newIdx: this.childNodes.length - 1,
                desc: "Move element to end of friend stack."
            }, this);
            this._dragData.elt.remove();
            this._dragData.dest.addChild(this._dragData.elt);
            this._dragData.dest.emit('orderchange', {
                type: 'itementer',
                fromStack: this,
                toStack: this._dragData.dest,
                oldIdx: this._dragData.idx,
                newIdx: this.childNodes.length - 1,
                desc: "Move element to end of friend stack."
            }, this._dragData.dest);
            this.emit('change', {
                type: 'change',
                fromStack: this,
                toStack: this._dragData.dest,
                elt: this._dragData.elt,
                sourceIndex: this._dragData.idx,
                destIndex: this.childNodes.length,
                oldIdx: this._dragData.idx,
                newIdx: this.childNodes.length - 1,
                desc: "Move element to end of friend stack."
            });
        }
        else {
            beforeElt = this._dragData.dest.childNodes[this._dragData.destIdx];
            this._dragData.elt.remove();
            this.emit('itemleave', {
                type: 'itemleave',
                fromStack: this,
                toStack: this._dragData.dest,
                elt: this._dragData.elt,
                oldIdx: this._dragData.idx,
                newIdx: this._dragData.destIdx,
                desc: "Move element to before friend.childNodes[" + this._dragData.destIdx + "]"
            }, this);
            this._dragData.dest.addChildBefore(this._dragData.elt, beforeElt);
            this._dragData.dest.emit('itementer', {
                type: 'itementer',
                fromStack: this,
                toStack: this._dragData.dest,
                elt: this._dragData.elt,
                oldIdx: this._dragData.idx,
                newIdx: this._dragData.destIdx,
                desc: "Move element to before friend.childNodes[" + this._dragData.destIdx + "]"
            }, this._dragData.dest);
            this.emit('change', {
                type: 'change',
                fromStack: this,
                toStack: this._dragData.dest,
                elt: this._dragData.elt,
                sourceIndex: this._dragData.idx,
                destIndex: this._dragData.destIdx,
                oldIdx: this._dragData.idx,
                newIdx: this._dragData.destIdx,
                desc: "Move element to before friend.childNodes[" + this._dragData.destIdx + "]"
            }, this);
        }
    }
};


DraggableVStack.prototype._updateDestChildrenBound = function () {

    var top0 = this._dragData.dest.getBoundingClientRect().top;
    this._dragData.destChildBounds = Array.prototype.map.call(this._dragData.dest.childNodes, function (elt) {
        return elt.getBoundingClientRect()
    });
    this._dragData.destChildTops = this._dragData.destChildBounds.map(function (bound) {
        return bound.top - top0;
    }).concat([(this._dragData.destChildBounds[this._dragData.destChildBounds.length - 1] || this.getBoundingClientRect()).bottom - top0]);
}



DraggableVStack.prototype._updateHoverDest = function () {
    var bound;
    var newDest;
    var friendElt;
    var friendList = this.$friends.concat([this]);
    var top0;
    for (var i = 0; i < friendList.length; ++i) {
        friendElt = friendList[i];
        bound = Math_Rectangle.fromClientRect(friendElt.getBoundingClientRect());
        if (bound.containsPoint(this._dragData.mouseCurrentPos)) {
            top0 = bound.y;
            newDest = friendElt;
            break;
        }
    }

    if (newDest && this._dragData.dest !== newDest) {
        this._dragData.dest.removeClass('as-state-drag');
        this._dragData.dest = newDest;
        this._dragData.dest.addClass('as-state-drag');
        this._dragData.dest.addStyle('--dest-y', 'unset');
        this._updateDestChildrenBound();
    }
};

DraggableVStack.prototype._updateDraggingPosition = function () {
    var bound = this.getBoundingClientRect();
    var clonePos = this._dragData.mouseCurrentPos.sub(this._dragData.offsetPos);

    this.$cloneContainer.addStyle({
        top: clonePos.y + 'px',
        left: bound.left + 'px'
    });

    this._dragData.destIdx = this._dragData.dest._findIndex(clonePos.y + this._dragData.eltBound.height / 2);
    this._dragData.dest.addStyle('--dest-y', this._dragData.destChildTops[this._dragData.destIdx] + 'px');
    if (this._dragData.dest === this) {
        if (this._dragData.idx === this._dragData.destIdx || (this._dragData.idx + 1 === this._dragData.destIdx)) {
            this.addClass('as-state-no-change');
        }
        else {
            this.removeClass('as-state-no-change');
        }
    }
};


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["b" /* 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;
};

DraggableVStack.property = {};

DraggableVStack.property.friends = {
    set: function (value) {
        if (!(value instanceof Array)) value = [value];
        this._friends = value;
    },
    get: function () {
        return this._friends;
    }
};

ACore["a" /* default */].install(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 */].$;

/***
 * @augments DraggableVStack
 * @augments PositionTracker
 * @constructor
 */
function DraggableHStack() {
    this._dragData = null;
    this.$cloneContainer = DraggableHStack_('.absol-draggable-stack-clone-container');
    this.on('predrag', this.eventHandler.predrag)
        .on('dragstart', this.eventHandler.dragstart)
        .on('drag', this.eventHandler.drag)
        .on('dragend', this.eventHandler.dragend);
    DraggableHStack_({ elt: this, tag: js_PositionTracker })
        .on('positionchange', this._updateDraggingPosition.bind(this));
}


DraggableHStack.tag = "DraggableHStack".toLowerCase();
DraggableHStack.render = function () {
    return DraggableHStack_({
        tag: 'hanger',
        extendEvent: 'change',
        class: ['absol-draggable-stack', 'absol-draggable-hstack']
    });
};

/***
 *
 * @param {Rectangle} rect
 * @returns {number}
 * @private
 */
DraggableHStack.prototype._findDropIdx = function (rect) {
    if (!this._dragData) return -1;
    var centerX = rect.x + rect.width / 2;
    var currentBound = Math_Rectangle.fromClientRect(this.getBoundingClientRect());
    var nearestDistance = Math.abs(centerX - currentBound.width);//end of stack
    var cDist;
    var nearestIndex = this._dragData.childBounds.length;
    var childX;
    for (var i = 0; i < this._dragData.childBounds.length; ++i) {
        childX = this._dragData.childBounds[i].x + currentBound.x - this._dragData.bound.x;
        cDist = Math.abs(centerX - childX);
        if (cDist < nearestDistance) {
            nearestDistance = cDist;
            nearestIndex = i;
        }
    }
    return nearestIndex;
};

/***
 *
 * @type {DraggableHStack|{}}
 */
DraggableHStack.eventHandler = {};

DraggableHStack.eventHandler.predrag = js_DraggableVStack.eventHandler.predrag;

DraggableHStack.eventHandler.dragstart = function (event) {
    this.addClass('as-has-dragging');
    this.startTrackPosition();
    var mousePos = new Math_Vec2(event.clientX, event.clientY);
    var elt = this._findDirectChild(event.target);
    var childBounds = Array.prototype.map.call(this.childNodes, function (e) {
        return Math_Rectangle.fromClientRect(e.getBoundingClientRect());
    });
    var eltIdx = Array.prototype.indexOf.call(this.childNodes, elt);
    var eltBound = childBounds[eltIdx];
    var eltMouseOffset = mousePos.sub(new Math_Vec2(eltBound.x, eltBound.y));


    this._dragData = {
        mouseStartPos: mousePos,
        mousePos: mousePos,
        bound: Math_Rectangle.fromClientRect(this.getBoundingClientRect()),
        childBounds: childBounds,
        elt: elt,
        eltIdx: eltIdx,
        eltBound: eltBound,
        eltMouseOffset: eltMouseOffset
    };

    this.$cloneContainer.addStyle({
        left: eltBound.x + 'px',
        top: eltBound.y + 'px',
        width: eltBound.width + 'px',
        height: eltBound.height + 'px',
    }).clearChild()
        .addChild(DraggableHStack_$(elt.cloneNode(true)))
        .addTo(document.body);
    elt.addClass('as-dragging');
    this._updateDraggingPosition();
};


DraggableHStack.eventHandler.drag = function (event) {
    event.preventDefault();
    this._dragData.mousePos = new Math_Vec2(event.clientX, event.clientY);
    this._updateDraggingPosition();
};


DraggableHStack.eventHandler.dragend = function (event) {
    var thisS = this;
    this.stopTrackPosition();
    this.removeClass('as-has-dragging');
    this._dragData.elt.removeClass('as-dragging');
    if (this._dragData.destIdx == this._dragData.eltIdx || this._dragData.destIdx == this._dragData.eltIdx + 1) {
        this.$cloneContainer.addClass('as-home-going');
        this._updateDraggingPosition();
        setTimeout(function () {
            thisS.$cloneContainer.selfRemove()
                .removeClass('as-home-going');
        }, 100);
    }
    else {
        if (this._dragData.destIdx === this._dragData.childBounds.length) {
            this._dragData.elt.remove();
            this.addChild(this._dragData.elt);
            this.emit('change', {
                type: 'change',
                elt: this._dragData.elt,
                sourceIndex: this._dragData.eltIdx,
                destIndex: this._dragData.childBounds.length,
                oldIdx: this._dragData.eltIdx,
                newIdx: this._dragData.childBounds.length - 1,
                desc: "Move element to end of stack."
            }, this);
        }
        else {
            var beforeElt = this.childNodes[this._dragData.destIdx];
            this._dragData.elt.remove();
            this.addChildBefore(this._dragData.elt, beforeElt);
            this.emit('change', {
                type: 'change',
                elt: this._dragData.elt,
                sourceIndex: this._dragData.eltIdx,
                destIndex: this._dragData.destIdx,
                oldIdx: this._dragData.eltIdx,
                newIdx: this._dragData.destIdx > this._dragData.eltIdx ? this._dragData.destIdx - 1 : this._dragData.destIdx,
                desc: "Move element to before  this.childNodes[" + this._dragData.destIdx + "]"
            }, this);
        }
        this.$cloneContainer.selfRemove()
            .removeClass('as-home-going');
    }

    this.removeClass('as-no-change');
};


DraggableHStack.prototype._findDragzone = js_DraggableVStack.prototype._findDragzone;
DraggableHStack.prototype._findDirectChild = js_DraggableVStack.prototype._findDirectChild;


DraggableHStack.prototype._updateDraggingPosition = function () {
    var bound = this.getBoundingClientRect();
    var x, y;
    if (this.$cloneContainer.containsClass('as-home-going')) {
        x = this._dragData.eltBound.x - this._dragData.bound.x + bound.left;
        y = this._dragData.eltBound.y - this._dragData.bound.y + bound.top;
    }
    else {
        y = bound.top + (this._dragData.eltBound.y - this._dragData.bound.y);
        var newPos = this._dragData.mousePos.sub(this._dragData.eltMouseOffset);
        x = newPos.x;
    }
    this.$cloneContainer.addStyle({
        left: x + 'px',
        top: y + 'px'
    });
    var cBound = this._dragData.eltBound.clone();
    cBound.x = x;
    cBound.y = y;
    var destIdx = this._findDropIdx(cBound);
    this._dragData.destIdx = destIdx;
    var destX;
    if (destIdx >= this._dragData.childBounds.length) {
        var lastRect = this._dragData.childBounds[this._dragData.childBounds.length - 1];
        destX = lastRect.x + lastRect.width - this._dragData.bound.x;
    }
    else {
        destX = this._dragData.childBounds[destIdx].x - this._dragData.bound.x;
    }
    this.addStyle('--dest-x', destX + 'px');
    if (destIdx == this._dragData.eltIdx || destIdx == this._dragData.eltIdx + 1) {
        this.addClass('as-no-change');
    }
    else {
        this.removeClass('as-no-change');
    }
};


ACore["a" /* default */].install(DraggableHStack);
/* harmony default export */ var js_DraggableHStack = (DraggableHStack);
// EXTERNAL MODULE: ./node_modules/absol-acomp/css/droppanel.css
var droppanel = __webpack_require__(50);

// EXTERNAL MODULE: ./node_modules/absol-acomp/css/exptree.css
var exptree = __webpack_require__(126);

// 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" >' +
        '    <rect style="fill: transparent; stroke: none" x="0" y="0" width="3.7042" height="3.7042"></rect>' +
        '    <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">\
                <rect style="fill: transparent; stroke: none" x="0" y="0" width="24" height="24"></rect>\
                <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>');
});

/***
 * @extends AElement
 * @constructor
 */
function ExpNode() {
    var thisEN = this;
    this.$level = ExpTree_$('.absol-exp-node-level', this);
    this.$removeIcon = ExpTree_$('remove-ico', this)
        .on('click', function (event) {
            thisEN.emit('pressremove', { target: thisEN, type: 'pressremove' }, this);
        });
    this.on('keydown', this.eventHandler.buttonKeydown);

    this.$toggleIcon = ExpTree_$('toggler-ico', this)
        .on('click', function (event) {
            thisEN.emit('presstoggle', Object(EventEmitter["a" /* copyEvent */])(event, { target: thisEN, type: 'pressremove' }), this);
        });

    this.on('click', function (event) {
        if (!EventEmitter["b" /* default */].hitElement(thisEN.$removeIcon, event) && !EventEmitter["b" /* default */].hitElement(thisEN.$toggleIcon, event))
            thisEN.emit('press', Object(EventEmitter["a" /* copyEvent */])(event, { target: thisEN, type: 'press' }), this);
    })

    this.$iconCtn = ExpTree_$('div.absol-exp-node-ext-icon', this);
    this.$extIcon = ExpTree_$('img.absol-exp-node-ext-icon', this);
    this.$name = ExpTree_$('span.absol-exp-node-name', this);
    this.$desc = ExpTree_$('span.absol-exp-node-desc', this);
    contenteditableTextOnly(this.$name, function (text) {
        return text.replace(/[\\\/\|\?\:\<\>\*\r\n]/, '').trim();
    });
    OOP["a" /* default */].drillProperty(thisEN, thisEN.$extIcon, 'extSrc', 'src');
    this._level = 0;
    this.__isExpNode__ = true;
    return thisEN;
}


ExpNode.tag = 'expnode';

ExpNode.render = function () {
    return ExpTree_({
        tag: 'button',
        extendEvent: ['pressremove', 'press', 'presstoggle'],
        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'
        ]
    });
};

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["b" /* 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 = '&nbsp;'.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('as-active');
            this.addClass('active');
        }
        else {
            this.removeClass('as-active');
            this.removeClass('active');
        }
    },
    get: function () {
        return this.containsClass('as-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);
        }
        else if (key == "ESC") {
            event.preventDefault();
            span.innerHTML = lastName;
            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);
};

ExpNode.prototype.findNodeBefore = function () {
    var tree = this.parentElement;
    var root;
    var prevTree;
    var res = null;
    if (tree.__isExpTree__) {
        root = tree.getRoot();
        root.visitRecursive(function (cTree) {
            if (cTree === tree) {
                res = prevTree;
            }
            prevTree = cTree;
        })
    }
    return res && res.getNode();
};

ExpNode.prototype.findNodeAfter = function () {
    var tree = this.parentElement;
    var root;
    var prevTree;
    var res = null;
    if (tree.__isExpTree__) {
        root = tree.getRoot();
        root.visitRecursive(function (cTree) {
            if (prevTree === tree) {
                res = cTree;
            }
            prevTree = cTree;
        })
    }
    return res && res.getNode();
};

ExpNode.eventHandler = {};

/****
 *
 * @param {KeyboardEvent} event
 */
ExpNode.eventHandler.buttonKeydown = function (event) {
    if (event.target === this) {
        if (!event.metaKey && !event.shiftKey && !event.ctrlKey && !event.altKey) {
            var destNode;
            var tree = this.parentElement;
            var parentTree = tree && tree.getParent();
            switch (event.key) {
                case 'ArrowLeft':
                    if (tree.status === 'open') {
                        tree.status = 'close';
                        tree.notifyStatusChange();
                    }
                    else {
                        destNode = parentTree && parentTree.getNode();
                    }
                    break;
                case 'ArrowRight':
                    if (tree.status === 'close') {
                        tree.status = 'open';
                        tree.notifyStatusChange();
                    }
                    else {
                        destNode = this.findNodeAfter();
                    }
                    break;
                case 'ArrowUp':
                    destNode = this.findNodeBefore();
                    break;
                case 'ArrowDown':
                    destNode = this.findNodeAfter();
                    break;
                case 'Space':
                    this.click();
                    break;
            }
            if (destNode) {
                destNode.focus();
                event.preventDefault();
            }
        }
    }
};

/***
 * @extends AElement
 * @constructor
 */
function ExpTree() {
    var thisET = this;
    this.$node = ExpTree_$('expnode', this)
        .on('press', function (event) {
            thisET.emit('press', Object.assign({}, {
                target: thisET,
                node: this,
                type: 'press'
            }, event), this);
        })
        .on('pressremove', function (event) {
            thisET.emit('pressremove', Object.assign({}, {
                target: thisET,
                node: this,
                type: 'pressremove'
            }, event), this);
        })
        .on('presstoggle', this.eventHandler.nodePressToggle);

    this.$itemsContainer = ExpTree_$('.absol-exp-items', thisET);
    OOP["a" /* default */].drillProperty(this, this.$node, ['desc', 'name', 'title', 'extSrc', 'active', 'icon']);
    this.__isExpTree__ = true;
    this._level = 0;
}


ExpTree.tag = 'ExpTree'.toLowerCase();

ExpTree.render = function () {
    return ExpTree_({
        class: 'absol-exp-tree',
        extendEvent: ['press', 'pressremove', 'statuschange'],
        child: [
            'expnode',
            '.absol-exp-items'
        ]
    });
};

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);
};

/****
 *
 * @return {ExpTree}
 */
ExpTree.prototype.getParent = function () {
    var current = this.parentNode;
    while (current) {
        if (current.__isExpTree__)
            break;
        current = current.parentNode;
    }
    return current;
};

/***
 *
 * @return {ExpTree}
 */
ExpTree.prototype.getRoot = function () {
    var parent = this.getParent();
    if (!parent) return this;
    return parent.getRoot();
}


ExpTree.prototype.getNode = function () {
    return this.$node;
};

ExpTree.prototype.getChildren = function () {
    return Array.apply(null, this.$itemsContainer.childNodes);
};

/***
 *
 * @param {function(tree: ExpTree): void} cb
 */
ExpTree.prototype.visitRecursive = function (cb) {
    cb(this);
    if (this.status === 'open')
        Array.prototype.forEach.call(this.$itemsContainer.childNodes, function (child) {
            child.visitRecursive(cb);
        });
};

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;
};

ExpTree.prototype.toggle = function () {
    switch (this.status) {
        case 'close':
            this.status = 'open';
            break;
        case 'open':
            this.status = 'close';
            break;
    }
};


ExpTree.prototype.notifyStatusChange = function (props) {
    this.emit('statuschange', Object.assign({ type: 'statuschange', target: this }, props), this);
};

ExpTree.eventHandler = {};

ExpTree.eventHandler.nodePressToggle = function (event) {
    this.toggle();
    this.notifyStatusChange({ originEvent: event });
};

/***
 * @extends ExpTree
 * @constructor
 */
function ExpGroup() {
    this.addClass('as-exp-group');
    this.__isExpTree__ = true;
}


ExpGroup.tag = 'ExpGroup'.toLowerCase();

ExpGroup.render = function () {
    return ExpTree_('div');
};

/***
 *
 * @param {function(tree: ExpTree): void} cb
 */
ExpGroup.prototype.visitRecursive = function (cb) {
    Array.prototype.forEach.call(this.childNodes, function (child) {
        child.visitRecursive(cb);
    });
};

ExpGroup.prototype.getParent = function () {
    return null;
};

ExpGroup.prototype.getRoot = function () {
    return this;
};

ExpGroup.prototype.getNode = function () {
    return null;
};

ACore["a" /* default */].install(ExpNode);
ACore["a" /* default */].install(ExpTree);
ACore["a" /* default */].install(ExpGroup);


/* harmony default export */ var js_ExpTree = (ExpTree);
// CONCATENATED MODULE: ./node_modules/absol-acomp/js/DropPanel.js








var DropPanel_ = ACore["a" /* default */]._;
var DropPanel_$ = ACore["a" /* default */].$;

/**
 * @extends AElement
 * @constructor
 */
function DropPanel() {
    var thisDP = this;
    /***
     *
     * @type {ExpGroup}
     */
    this.$body = DropPanel_$('.absol-drop-panel-body', this);
    this.$head = DropPanel_$('.absol-drop-panel-head', this)
        .on('click', thisDP.eventHandler.clickHead);

    this.$name = DropPanel_$('.absol-drop-panel-name', thisDP);
    OOP["a" /* default */].drillProperty(this, this.$name, 'name', 'innerHTML');
    return thisDP;
}

DropPanel.tag = 'DropPanel'.toLowerCase();

DropPanel.render = function () {
    return DropPanel_({
        class: 'absol-drop-panel',
        extendEvent: ['toggle'],
        child: [
            {
                class: 'absol-drop-panel-head',
                child: [
                    'toggler-ico',
                    {
                        tag: 'span',
                        class: "absol-drop-panel-name"
                    }
                ]

            },
            {
                tag:'expgroup',
                class: ['absol-drop-panel-body', 'absol-bscroller']
            }
        ]
    });
};


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);

/* 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 */].$;

/**
 * @extends AElement
 * @constructor
 */
function DropPanelStack() {
    var res = this;
    this.$attachHook = DropPanelStack_('attachhook').on('error', function () {
        Dom["b" /* default */].addToResizeSystem(this);
        this.updateSize = res.updateSize.bind(res);
    });
    this.sync = new Promise(function (rs) {
        res.$attachHook.once('error', rs);
    });
}

DropPanelStack.tag = 'DropPanelStack'.toLowerCase();

DropPanelStack.render = function () {
    return DropPanelStack_({
        class: 'absol-drop-panel-stack',
        child: ['attachhook']
    });
};

DropPanelStack.prototype.updateSize = function () {
};

DropPanelStack.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;
};


DropPanelStack.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', DropPanelStack);

/* harmony default export */ var js_DropPanelStack = (DropPanelStack);
// EXTERNAL MODULE: ./node_modules/absol-acomp/css/editabletext.css
var editabletext = __webpack_require__(128);

// CONCATENATED MODULE: ./node_modules/absol-acomp/js/EditableText.js






var EditableText_ = ACore["a" /* default */]._;
var EditableText_$ = ACore["a" /* default */].$;

/***
 * @extends AElement
 * @constructor
 */
function EditableText() {
    var thisET = this;
    this.$span = EditableText_$('span', this);
    this.$text = document.createTextNode('');
    this.$span.addChild(this.$text);

    this.$higne = EditableText_$('.absol-editabe-text-higne', this);
    this.$input = EditableText_$('input', this);

    OOP["a" /* default */].drillProperty(this, this.$input, ['selectionStart', 'selectionEnd']);
    this.sync = new Promise(function (rs) {
        EditableText_('attachhook').addTo(thisET).once('error', rs);
    });

    this.$input.on('keydown', this.eventHandler.inputKeyDown, true);
    this.$input.on('change', this.eventHandler.inputChange);
    this.$input.on('blur', this.eventHandler.inputBlur);
};

EditableText.tag = 'EditableText'.toLowerCase();

EditableText.render = function () {
    return EditableText_({
        class: 'absol-editabe-text',
        extendEvent: ['blur', 'focus', 'change', 'modify'],
        child: [
            {
                class: 'absol-editabe-text-higne',
                child: '<input type="text">'
            },
            'span'
        ]
    });
};


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.eventHandler = {};

EditableText.eventHandler.inputKeyDown = function (event) {
    requestAnimationFrame(function () {
        this.text = this.$input.value;
        this._update();
        event.text = this.text;
        this.emit('modify', event);
    }.bind(this));
};


EditableText.eventHandler.inputChange = function (event) {
    this.editing = false;
    this.emit('change', event);
};

EditableText.eventHandler.inputBlur = function (event) {
    this.editing = false;
    this.emit('blur', event);
};

ACore["a" /* default */].install(EditableText);

/* harmony default export */ var js_EditableText = (EditableText);

// EXTERNAL MODULE: ./node_modules/absol-acomp/css/emojipicker.css
var emojipicker = __webpack_require__(130);

// CONCATENATED MODULE: ./node_modules/absol-acomp/js/EmojiAnims.js
var EmojiAnims = [
    [
        "(heart)",
        "heart.png",
        "Heart"
    ],
    [
        "(cool)",
        "cool.png",
        "Cool"
    ],
    [
        "(hearteyes)",
        "hearteyes.png",
        "Heart eyes"
    ],
    [
        "(stareyes)",
        "stareyes.png",
        "Star eyes"
    ],
    [
        "(like)",
        "like.png",
        "Like"
    ],
    [
        "(unamused)",
        "unamused.png",
        "Unamused"
    ],
    [
        "(cwl)",
        "cwl.png",
        "Crying with laughter"
    ],
    [
        "(xd)",
        "xd.png",
        "XD smiley"
    ],
    [
        ":)",
        "smile.png",
        "Smile"
    ],
    [
        ":(",
        "sad.png",
        "Sad"
    ],
    [
        ":D",
        "laugh.png",
        "Laugh"
    ],
    [
        ":O",
        "surprised.png",
        "Surprised"
    ],
    [
        ";)",
        "wink.png",
        "Wink"
    ],
    [
        ";(",
        "cry.png",
        "Crying"
    ],
    [
        "(shivering)",
        "shivering.png",
        "Cold shivering"
    ],
    [
        "(:|",
        "sweat.png",
        "Sweating"
    ],
    [
        ":|",
        "speechless.png",
        "Speechless"
    ],
    [
        ":P",
        "tongueout.png",
        "Cheeky"
    ],
    [
        ":$",
        "blush.png",
        "Blushing"
    ],
    [
        "(inlove)",
        "inlove.png",
        "In love"
    ],
    [
        "(kiss)",
        "kiss.png",
        "Kiss"
    ],
    [
        ":^)",
        "wonder.png",
        "Wondering"
    ],
    [
        "|-)",
        "sleepy.png",
        "Sleepy"
    ],
    [
        "|-(",
        "dull.png",
        "Dull"
    ],
    [
        "(yawn)",
        "yawn.png",
        "Yawn"
    ],
    [
        "(puke)",
        "puke.png",
        "Vomiting"
    ],
    [
        "(doh)",
        "doh.png",
        "Doh!"
    ],
    [
        "(angry)",
        "angry.png",
        "Angry"
    ],
    [
        "(wasntme)",
        "wasntme.png",
        "It wasn't me!"
    ],
    [
        "(worry)",
        "worry.png",
        "Worried"
    ],
    [
        "(mm)",
        "mmm.png",
        "Mmmmm…"
    ],
    [
        "(nerd)",
        "nerdy.png",
        "Nerdy"
    ],
    [
        "(rainbowsmile)",
        "rainbowsmile.png",
        "Rainbow smile"
    ],
    [
        ":x",
        "lipssealed.png",
        "My lips are sealed"
    ],
    [
        "(devil)",
        "devil.png",
        "Devil"
    ],
    [
        "(angel)",
        "angel.png",
        "Angel"
    ],
    [
        "(envy)",
        "envy.png",
        "Envy"
    ],
    [
        "(makeup)",
        "makeup.png",
        "Make-up"
    ],
    [
        "(think)",
        "think.png",
        "Thinking"
    ],
    [
        "(rofl)",
        "rofl.png",
        "Rolling on the floor laughing"
    ],
    [
        "(happy)",
        "happy.png",
        "Happy"
    ],
    [
        "(smirk)",
        "smirk.png",
        "Smirking"
    ],
    [
        "(nod)",
        "nod.png",
        "Nodding"
    ],
    [
        "(shake)",
        "shake.png",
        "Shake"
    ],
    [
        "(waiting)",
        "waiting.png",
        "Waiting"
    ],
    [
        "(emo)",
        "emo.png",
        "Emo"
    ],
    [
        "(donttalk)",
        "donttalktome.png",
        "Don't talk to me"
    ],
    [
        "(idea)",
        "idea.png",
        "Idea"
    ],
    [
        "(talk)",
        "talk.png",
        "Talking"
    ],
    [
        "(swear)",
        "swear.png",
        "Swearing"
    ],
    [
        "]:)",
        "evilgrin.png",
        "Evil grin"
    ],
    [
        "(headbang)",
        "headbang.png",
        "Banging head on wall"
    ],
    [
        "(learn)",
        "learn.png",
        "Global Learning"
    ],
    [
        "(headphones)",
        "headphones.png",
        "Listening to headphones"
    ],
    [
        "(morningafter)",
        "hungover.png",
        "Morning after party"
    ],
    [
        "(selfie)",
        "selfie.png",
        "Selfie"
    ],
    [
        "(shock)",
        "shock.png",
        "Spoiler alert"
    ],
    [
        "(llsshock)",
        "llsshock.png",
        "Spoiler alert"
    ],
    [
        "(ttm)",
        "ttm.png",
        "Talking too much"
    ],
    [
        "(dream)",
        "dream.png",
        "Dreaming"
    ],
    [
        "(ill)",
        "ill.png",
        "Ill"
    ],
    [
        "(tired)",
        "tired.png",
        "Tired"
    ],
    [
        "(party)",
        "party.png",
        "Party"
    ],
    [
        "(bandit)",
        "bandit.png",
        "Bandit"
    ],
    [
        "(tauri)",
        "tauri.png",
        "Bald man with glasses"
    ],
    [
        "(nazar)",
        "nazar.png",
        "Blessing"
    ],
    [
        "(movember)",
        "movember.png",
        "Movember"
    ],
    [
        "(mysteryskype)",
        "mysteryskype.png",
        "Mystery Skype"
    ],
    [
        "(dotdfemale)",
        "dotdfemale.png",
        "Day of the dead"
    ],
    [
        "(dotdmale)",
        "dotdmale.png",
        "Day of the dead"
    ],
    [
        "(selfiediwali)",
        "selfiediwali.png",
        "Selfie Diwali"
    ],
    [
        "(diwaliselfie)",
        "diwaliselfie.png",
        "Diwali selfie"
    ],
    [
        "(steveaoki)",
        "steveaoki.png",
        "Steve Aoki"
    ],
    [
        "(aokijump)",
        "aokijump.png",
        "Aoki jump"
    ],
    [
        "(cakethrow)",
        "cakethrow.png",
        "Cake throw"
    ],
    [
        "(kolony)",
        "kolony.png",
        "Kolony"
    ],
    [
        "(joy)",
        "joy.png",
        "Joy"
    ],
    [
        "(anger)",
        "anger.png",
        "Anger"
    ],
    [
        "(sadness)",
        "sadness.png",
        "Sadness"
    ],
    [
        "(disgust)",
        "disgust.png",
        "Disgust"
    ],
    [
        "(fear)",
        "fear.png",
        "Fear"
    ],
    [
        "(hestonfacepalm)",
        "hestonfacepalm.png",
        "Heston facepalm"
    ],
    [
        "(heston)",
        "heston.png",
        "Heston Blumenthal"
    ],
    [
        "(stormtrooper)",
        "stormtrooper.png",
        "Storm trooper"
    ],
    [
        "(kyloren)",
        "kyloren.png",
        "Kylo Ren"
    ],
    [
        "(captainphasma)",
        "captainphasma.png",
        "Captain Phasma"
    ],
    [
        "(malthe)",
        "malthe.png",
        "Smiling man with glasses"
    ],
    [
        "(ladyvamp)",
        "ladyvampire.png",
        "Lady vampire"
    ],
    [
        "(vampire)",
        "vampire.png",
        "Vampire"
    ],
    [
        "(ghost)",
        "ghost.png",
        "Ghost"
    ],
    [
        "(skull)",
        "skull.png",
        "Skull"
    ],
    [
        "(pumpkin)",
        "pumpkin.png",
        "Pumpkin"
    ],
    [
        "(santa)",
        "santa.png",
        "Santa"
    ],
    [
        "(xmascwl)",
        "xmascwl.png",
        "Xmas crying with laughter"
    ],
    [
        "(festiveparty)",
        "festiveparty.png",
        "Festive party"
    ],
    [
        "(holidayspirit)",
        "holidayspirit.png",
        "Holiday spirit"
    ],
    [
        "(rudolfsurprise)",
        "rudolfsurprise.png",
        "Surprised Rudolf"
    ],
    [
        "(rudolfidea)",
        "rudolfidea.png",
        "Rudolf idea"
    ],
    [
        "(wtf)",
        "wtf.png",
        "WTF…"
    ],
    [
        "(smoking)",
        "smoke.png",
        "Smoking"
    ],
    [
        "(drunk)",
        "drunk.png",
        "Drunk"
    ],
    [
        "(finger)",
        "finger.png",
        "Finger"
    ],
    [
        "(oliver)",
        "oliver.png",
        "Man saying come on"
    ],
    [
        "(xmassarcastic)",
        "xmassarcastic.png",
        "Xmas sarcastic"
    ],
    [
        "(xmascry)",
        "xmascry.png",
        "Xmas cry"
    ],
    [
        "(wave)",
        "hi.png",
        "Hi"
    ],
    [
        "(highfive)",
        "highfive.png",
        "High five"
    ],
    [
        "(clap)",
        "clap.png",
        "Clapping"
    ],
    [
        "(sarcastic)",
        "sarcastic.png",
        "Sarcastic"
    ],
    [
        "(chuckle)",
        "giggle.png",
        "Giggle"
    ],
    [
        "(facepalm)",
        "facepalm.png",
        "Facepalm"
    ],
    [
        "(rock)",
        "rock.png",
        "Rock"
    ],
    [
        "(yn)",
        "fingerscrossed.png",
        "Fingers crossed"
    ],
    [
        "(listening)",
        "listening.png",
        "Listening"
    ],
    [
        "(wait)",
        "wait.png",
        "Wait"
    ],
    [
        "(whew)",
        "whew.png",
        "Relieved"
    ],
    [
        "(tmi)",
        "tmi.png",
        "Too much information"
    ],
    [
        "(call)",
        "call.png",
        "Call"
    ],
    [
        "(punch)",
        "punch.png",
        "Punch"
    ],
    [
        "(talktothehand)",
        "talktothehand.png",
        "Talk to the hand"
    ],
    [
        "(whistle)",
        "whistle.png",
        "Whistle"
    ],
    [
        "(slap)",
        "slap.png",
        "Slap"
    ],
    [
        "(lalala)",
        "lalala.png",
        "Lalala"
    ],
    [
        "(y)",
        "yes.png",
        "Yes"
    ],
    [
        "(n)",
        "no.png",
        "No"
    ],
    [
        "(handshake)",
        "handshake.png",
        "Handshake"
    ],
    [
        "(fistbump)",
        "fistbump.png",
        "Fist bump"
    ],
    [
        "(poke)",
        "poke.png",
        "Poke"
    ],
    [
        "(celebrate)",
        "handsinair.png",
        "Hands celebrating"
    ],
    [
        "(hearthands)",
        "hearthands.png",
        "Heart hands"
    ],
    [
        "(victory)",
        "victory.png",
        "Victory sign"
    ],
    [
        "(noworries)",
        "noworries.png",
        "No worries"
    ],
    [
        "(ok)",
        "ok.png",
        "OK"
    ],
    [
        "(pray)",
        "praying.png",
        "Praying"
    ],
    [
        "(flex)",
        "muscle.png",
        "Muscle"
    ],
    [
        "(ek)",
        "naturescall.png",
        "Nature's call"
    ],
    [
        "(woty)",
        "woty.png",
        "Woman of the year"
    ],
    [
        "(glassceiling)",
        "glassceiling.png",
        "Glass ceiling"
    ],
    [
        "(deadyes)",
        "deadyes.png",
        "Dead yes"
    ],
    [
        "(xmasyes)",
        "xmasyes.png",
        "Xmas yes"
    ],
    [
        "(dropthemic)",
        "dropthemic.png",
        "Drop the mic"
    ]
];

/* harmony default export */ var js_EmojiAnims = (EmojiAnims);
// CONCATENATED MODULE: ./node_modules/absol-acomp/js/Sprite.js




var Sprite_ = ACore["a" /* default */]._;
var Sprite_$ = ACore["a" /* default */].$;

var NOT_READY = 0;
var READY = 1;
var START = 2;
var RUNNING = 3;
var PAUSE = 4;
var STOP = 5;
var ERROR = 6;
var STATE_TO_STRING = ['NOT_READY', 'READY', 'START', 'RUNNING', 'PAUSE', 'STOP', 'ERROR'];



/**
 * @augments AElement
 * @augments HTMLCanvasElement
 * @constructor
 */
function Sprite() {
    this.loadTextureTimeout = 5000;
    this._textureLoaded = false;
    this._state = NOT_READY;
    this.defineEvent(['ready', 'srcerror', 'play', 'resume', 'pause', 'stop', 'reset', 'end', 'frame']);
    this._length = 60;
    this._lastDrawFrame = -1;
    this._frameIndex = 0;
    this._timeout = -1;
    this.ctx = this.getContext('2d');
    this._fps = 10;
    this._lastDrawMilis = 0;
    this._overTime = 0;
    this.draw = this.draw.bind(this);
    this.texture = null;
    this._frames = { type: 'grid', col: 1, row: 1 };
    this._loop = false;
}


Sprite.cache = {};


Sprite.prototype.draw = function () {
    //todo
    var now = new Date().getTime();
    var dt = this._overTime + now - this._lastDrawMilis;
    var di = Math.floor(dt / 1000 * this._fps);
    var frameIndex = (this._frameIndex + di);
    if (this._loop) {
        frameIndex = frameIndex % this._length;
    }
    else {
        frameIndex = Math.min(this._length - 1, frameIndex);
    }

    if (!isNaN(this._frameIndex) && frameIndex != this._frameIndex) {
        this.drawFrame(this._frameIndex);
    }

    this._overTime = dt - di * 1000 / this._fps;
    var nextTime = now + 1000 / this._fps - this._overTime - new Date().getTime();
    this._lastDrawMilis = now;
    this._frameIndex = frameIndex;

    this._timeout = -1;
    if (this._loop || frameIndex + 1 < this._length) {
        if (this._state == RUNNING)
            this._timeout = setTimeout(this.draw, nextTime);
    }
    else this.stop();
};

Sprite.prototype.drawFrame = function (index) {
    if (this._lastDrawFrame == index) return;
    this._lastDrawFrame = index;
    this.ctx.clearRect(0, 0, this.width, this.height);
    if (this._frames.type == 'grid') {
        var imgWidth = this.texture.naturalWidth;
        var imgHeight = this.texture.naturalHeight;
        var sHeight = imgHeight / this._frames.row;
        var sWidth = imgWidth / this._frames.col;
        var sx = (index % this._frames.col) * sWidth;
        var sy = Math.floor(index / this._frames.col) * sHeight;
        this.ctx.drawImage(this.texture, sx, sy, sWidth, sHeight, 0, 0, this.width, this.height)
    }
    else {

    }
    this.emit('frame', { name: 'frame', target: this, frameIndex: index }, this);
};

Sprite.prototype.stop = function () {
    this.pause();
    if (this._state != PAUSE) return this;
    this._state = STOP;
    this.emit('stop', { name: 'stop', target: this }, this);
    return this;
};


Sprite.prototype.pause = function () {
    if (this._state != RUNNING) return this;
    this._state = PAUSE;
    if (this._timeout > 0) {
        clearTimeout(this._timeout);
        this._timeout = -1;
    }
    var now = new Date().getTime();
    this._overTime += now - this._lastDrawMilis;
    this.emit('pause', { name: 'pause', target: this }, this);
};

Sprite.prototype.resume = function () {
    if (this._state != START && this._state != PAUSE) return this;
    if (this._state == RUNNING) return this;
    this._state = RUNNING;
    var now = new Date().getTime();
    this._lastDrawMilis = now;
    this.draw();
    this.emit('resume', { name: 'pause', target: this }, this);
};

Sprite.prototype.reset = function () {
    this._frameIndex = 0;
    this._overTime = 0;
}

Sprite.prototype.play = function () {
    if (this._state == ERROR) return this;
    if (this._state == RUNNING) return this;
    if (this._state == READY || this._state == STOP) {
        this.reset();
    }
    this._state = START;
    this.emit('play', { name: 'start', target: this }, this);
    this.resume();
    return this;
};

Sprite.prototype.afterReady = function () {
    var thisSprite = this;
    if (this._state != NOT_READY && this._state != ERROR)
        return Promise.resolve();
    else return new Promise(function (rs, rj) {
        thisSprite.once('ready', rs);
        thisSprite.once('srcerror', rj);
    });
};

Sprite.tag = 'sprite';

Sprite.render = function () {
    return Sprite_('canvas.as-sprite');
};


Sprite.property = {};


Sprite.property.frames = {
    set: function (value) {
        this.stop();
        this._lastDrawFrame = -1;
        if (value && value.type == 'grid') {
            this._length = value.col * value.row;
        }
        this._frames = value;
        if (this._textureLoaded && this._frames && this._state == NOT_READY) {//todo: verify frame
            this._state = READY;
            this.emit('ready', { target: this, name: 'ready' }, this);
        }
    },
    get: function () {
        return this._frames;
    }
};

Sprite.property.frameIndex = {
    set: function (value) {
        value = value || 0;
        if (value < 0) value = this._length - 1;
        if (this._loop) {
            this._frameIndex = value % this._length;
            this._overTime = 0;
        }
        else {
            this._frameIndex = Math.max(this._length - 1, value);
            this._overTime = 0;

        }
        this.drawFrame(this._frameIndex);
    },
    get: function () {
        return this._frameIndex;
    }
};


Sprite.property.src = {
    set: function (value) {
        this.stop();
        this._lastDrawFrame = -1;//did not draw any thing 
        value = value || [];
        var lastSrc = this._src;
        this._src = value || null;
        if (lastSrc == this._src) return;
        if (!value) this.texture = null;
        else {
            var cImage;
            if (!Sprite.cache[this._src]) {
                cImage = new Image();
                Sprite.cache[this._src] = cImage;
                cImage.src = this._src;
            }
            else {
                cImage = Sprite.cache[this._src];
            }
            this.texture = cImage;
            this._state = NOT_READY;
            var thisSprite = this;
            this._textureLoaded = false;
            Dom["b" /* default */].waitImageLoaded(this.texture, this.loadTextureTimeout).then(function (rs) {
                    if (thisSprite.texture == cImage) {
                        thisSprite._textureLoaded = true;
                        if (thisSprite._frames) {
                            thisSprite._lastDrawFrame = -1;
                            thisSprite._state = READY;
                            thisSprite.emit('ready', { target: thisSprite, name: 'ready' }, thisSprite);
                        }
                    }
                },
                function () {
                    if (thisSprite.texture == cImage) {
                        thisSprite._state = ERROR;
                        thisSprite.emit('srcerror', { target: thisSprite, name: 'srcerror' }, thisSprite);
                    }
                });
        }

    },
    get: function () {
        return this._src;
    }
}

Sprite.property.state = {
    get: function () {
        return STATE_TO_STRING[this._state];
    }
};
Sprite.property.length = {
    get: function () {
        return this._length;
    }
};

Sprite.property.fps = {
    set: function (value) {
        value = Math.max(value || 0, 0);
        this._fps = value;
        if (this._state == RUNNING) {
            clearTimeout(this._timeout);
            this._timeout = -1;
            var now = new Date().getTime();
            this._overTime += now - this._lastDrawMilis;
            this._overTime = Math.min(1000 / this._fps, this._overTime);
            this.draw();
        }

    },
    get: function () {
        return this._fps;
    }
};

Sprite.property.loop = {
    set: function (value) {
        value = !!value;
        this._loop = value;
    },
    get: function () {
        return this._loop;
    }
}

ACore["a" /* default */].install(Sprite);

/* harmony default export */ var js_Sprite = (Sprite);
// CONCATENATED MODULE: ./node_modules/absol-acomp/js/EmojiPicker.js






var EmojiPicker_ = ACore["a" /* default */]._;
var EmojiPicker_$ = ACore["a" /* default */].$;

/***
 * @extends AElement
 * @constructor
 */
function EmojiPicker() {
    var thisPicker = this;
    this._aliveTimeout = 90;
    this._assetRoot = this.attr('data-asset-root');
    /***
     *
     * @type {Sprite}
     */
    this.$previewAnim = EmojiPicker_$('sprite.as-emoji-picker-preview-anim', this)
        .on('ready', this.eventHandler.previewAnimReady)
        .on('frame', this.eventHandler.previewAnimFrame);
    this.$previewAnim.loop = true;
    this.$previewAnim.src = this._assetRoot + '/anim/x120/' + js_EmojiAnims[0][1];
    this.$previewAnim.fps = 30;
    this.$desc = EmojiPicker_$('.as-emoji-picker-preview-desc', this);
    this.$shortcut = EmojiPicker_$('.as-emoji-picker-preview-shortcut', this);
    this.$desc.clearChild().addChild(EmojiPicker_({ text: js_EmojiAnims[0][2] }));
    this.$shortcut.clearChild().addChild(EmojiPicker_({ text: js_EmojiAnims[0][0] }));
    this.$list = EmojiPicker_$('.as-emoji-picker-list', this);
    this.$items = js_EmojiAnims.reduce(function (ac, it) {
        var itemElt = EmojiPicker_({
            tag: 'img',
            class: 'as-emoji-picker-item',
            props: {
                src: thisPicker._assetRoot + '/static/x20/' + it[1]
            }
        }).addTo(thisPicker.$list);
        itemElt.on('mouseenter', thisPicker.eventHandler.mouseenterItem.bind(thisPicker, it, itemElt));
        itemElt.on('click', thisPicker.eventHandler.clickItem.bind(thisPicker, it));
        ac[it[0]] = itemElt;
        return ac;
    }, {});
    this.$attachook = EmojiPicker_('attachhook').addTo(this).on('error', this.eventHandler.attach);
}

EmojiPicker.assetRoot = 'https://absol.cf/emoji';
EmojiPicker.tag = 'EmojiPicker'.toLowerCase();

EmojiPicker.render = function (data) {
    data = data || {};
    data.assetRoot = data.assetRoot || EmojiPicker.assetRoot;
    return EmojiPicker_({
        class: 'as-emoji-picker',
        extendEvent: 'pick',
        attr: {
            'data-asset-root': data.assetRoot
        },
        child: [
            {
                class: 'as-emoji-picker-preview',
                child: [
                    {
                        class: '.as-emoji-picker-preview-anim-ctn',
                        child: 'sprite.as-emoji-picker-preview-anim'
                    },
                    '.as-emoji-picker-preview-desc',
                    '.as-emoji-picker-preview-shortcut'
                ]
            },
            {
                tag: 'bscroller',
                class: 'as-emoji-picker-list'
            }
        ]
    });
};


/**
 * @type {EmojiPicker}
 */
EmojiPicker.eventHandler = {};


EmojiPicker.eventHandler.attach = function () {
    this._aliveTimeout = 90;
    setTimeout(this.$previewAnim.play.bind(this.$previewAnim), 1);
};

EmojiPicker.eventHandler.previewAnimReady = function () {
    this.$previewAnim.frames = {
        type: 'grid',
        col: 1,
        row: this.$previewAnim.texture.naturalHeight / this.$previewAnim.texture.naturalWidth
    };
    this.$previewAnim.play();
};

EmojiPicker.eventHandler.previewAnimFrame = function () {
    if (this._aliveTimeout == 0) {
        var bound = this.getBoundingClientRect();
        if (bound.width == 0) {
            this.$previewAnim.stop();
        }
        else {
            this._aliveTimeout = 90;
        }
    }
    this._aliveTimeout--;
};


EmojiPicker.eventHandler.mouseenterItem = function (itemData, itemElt, event) {
    if (this.$lastHoverItem == itemElt) return;
    this.$lastHoverItem = itemElt;
    this.$previewAnim.src = this._assetRoot + '/anim/x120/' + itemData[1];
    this.$desc.clearChild().addChild(EmojiPicker_({ text: itemData[2] }));
    this.$shortcut.clearChild().addChild(EmojiPicker_({ text: itemData[0] }));
};

EmojiPicker.eventHandler.clickItem = function (itemData, event) {
    this.emit('pick', { name: 'pick', key: itemData[0], target: this }, this);
};

ACore["a" /* default */].install(EmojiPicker);
/* harmony default export */ var js_EmojiPicker = (EmojiPicker);

// EXTERNAL MODULE: ./node_modules/absol-acomp/css/flexiconbutton.css
var flexiconbutton = __webpack_require__(132);

// CONCATENATED MODULE: ./node_modules/absol-acomp/js/FlexiconButton.js




var FlexiconButton_ = ACore["a" /* default */]._;
var FlexiconButton_$ = ACore["a" /* default */].$;

/**
 * @extends AElement
 * @constructor
 */
function FlexiconButton() {
    this._icon = null;
    this.$content = FlexiconButton_$('.as-flexicon-button-content', this);
    this.$iconCtn = FlexiconButton_$('.as-flexicon-button-icon-container', this);
    this.$textCtn = FlexiconButton_$('.as-flexicon-button-text-container', this);
}

FlexiconButton.tag = 'FlexiconButton'.toLowerCase();

FlexiconButton.render = function () {
    return FlexiconButton_({
        tag: 'button',
        class: 'as-flexicon-button',
        child: {
            class: 'as-icon-button-table-box',
            child: {
                class: 'as-flexicon-button-content',
                child: [
                    '.as-flexicon-button-icon-container',
                    '.as-flexicon-button-text-container',
                ]
            }
        }
    });
};

FlexiconButton.property = {};

FlexiconButton.property.icon = {
    set: function (value) {
        value = value || null;
        this._icon = value;
        this.$iconCtn.clearChild();
        if (value !== null) {
            this.$iconCtn.addChild(FlexiconButton_(value));
        }
    },
    get: function () {
        return this._icon;
    }
};

FlexiconButton.property.text = {
    set: function (value) {
        value = value || null;
        this._text = value;
        this.$textCtn.clearChild();
        if (value !== null) {
            this.$textCtn.addChild(FlexiconButton_({ text: value }));
        }
    },
    get: function () {
        this._text;
    }
};


ACore["a" /* default */].install(FlexiconButton);


/* harmony default export */ var js_FlexiconButton = (FlexiconButton);
// EXTERNAL MODULE: ./node_modules/absol-acomp/css/flexiconinput.css
var flexiconinput = __webpack_require__(134);

// CONCATENATED MODULE: ./node_modules/absol-acomp/js/FlexiconInput.js





var FlexiconInput_ = ACore["a" /* default */]._;
var FlexiconInput_$ = ACore["a" /* default */].$;


/***
 * @extends AElement
 * @constructor
 */
function FlexiconInput() {
    this.$input = FlexiconInput_$('.as-flexicon-input-text-input', this);
    this.$iconCtn = FlexiconInput_$('.as-flexicon-input-icon-ctn', this);
    this.$unitCtn = FlexiconInput_$('.as-flexicon-input-unit-ctn', this);
    OOP["a" /* default */].drillProperty(this, this.$input, ['value', 'readonly']);
    this.on('click', function (event) {
        if (event.target != this.$input)
            this.$input.focus();
    }.bind(this));
}

FlexiconInput.prototype.on = function () {
    return this.$input.on.apply(this.$input, arguments);
};

FlexiconInput.prototype.once = function () {
    return this.$input.once.apply(this.$input, arguments);
};

FlexiconInput.prototype.off = function () {
    return this.$input.off.apply(this.$input, arguments);
};

FlexiconInput.tag = 'FlexiconInput'.toLowerCase();
FlexiconInput.render = function () {
    return FlexiconInput_({
        class: 'as-flexicon-input',
        child: [
            {
                class: 'as-flexicon-input-icon-ctn'
            },
            {
                tag: 'input',
                class: 'as-flexicon-input-text-input',
                attr: { type: 'text' },

            },
            {
                class: 'as-flexicon-input-unit-ctn'
            }
        ]
    });
};


FlexiconInput.property = {};

FlexiconInput.property.icon = {
    set: function (value) {
        value = value || null;
        this._icon = value;
        this.$iconCtn.clearChild();
        if (value == null) {
            this.removeClass('as-flexicon-input-has-icon');
        }
        else {
            this.addClass('as-flexicon-input-has-icon');
            this.$iconCtn.addChild(FlexiconInput_(value));
        }
    },
    get: function () {
        return this._icon;
    }
};

FlexiconInput.property.unit = {
    set: function (value) {
        this._unit = value;
        if (this._unit) {
            this.addClass('as-flexicon-input-has-unit');
            this.$unitCtn.clearChild().addChild(FlexiconInput_({ text: value + '' }));
        }
        else {
            this.removeClass('as-flexicon-input-has-unit');
            this.$unitCtn.clearChild();
        }
    },
    get: function () {
        return this._unit;
    }
};

FlexiconInput.property.disabled = {
    set: function (value) {
        value = !!value;
        this.$input.disabled = value;
        if (value) {
            this.addClass('as-disabled');
        }
        else {
            this.removeClass('as-disabled');
        }
    },
    get: function () {
        return this.$input.disabled;
    }
};

ACore["a" /* default */].install(FlexiconInput);

/* harmony default export */ var js_FlexiconInput = (FlexiconInput);
// EXTERNAL MODULE: ./node_modules/absol-acomp/css/frame.css
var css_frame = __webpack_require__(136);

// CONCATENATED MODULE: ./node_modules/absol-acomp/js/Frame.js





var Frame_ = ACore["a" /* default */]._;
var Frame_$ = ACore["a" /* default */].$;

/***
 * @extends AElement
 * @constructor
 */
function Frame() {
    this.$parent = null;// FrameView or TabView
}

Frame.tag = 'frame';

Frame.render = function () {
    return Frame_({
        class: 'absol-frame',
        attr: {
            id: randomIdent(12),
        },
        extendEvent: ['attached', 'detached', 'deactive', 'active']// deactive and active event will be send by parent
    });
};


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);

/* harmony default export */ var js_Frame = (Frame);
// EXTERNAL MODULE: ./node_modules/absol-acomp/css/frameview.css
var frameview = __webpack_require__(138);

// CONCATENATED MODULE: ./node_modules/absol-acomp/js/FrameView.js






var FrameView_ = ACore["a" /* default */]._;
var FrameView_$ = ACore["a" /* default */].$;


/***
 * @extends AElement
 * @constructor
 */
function FrameView() {
    this.$containers = [];
}

FrameView.tag = 'frameview';

FrameView.render = function () {
    return FrameView_({
        class: 'absol-frame-view',
        extendEvent: ['activeframe', 'deactiveframe']

    });
};

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.addLast = function (elt) {
    this.addChild(elt);
    this.activeFrame(elt);
};


FrameView.prototype.removeLast = function () {
    if (this.$containers.length > 0) {
        this.removeChild(this.$containers[this.$containers.length - 1].__elt__);
    }

    if (this.$containers.length > 0) {
        this.activeFrame(this.$containers[this.$containers.length - 1].__elt__);
    }
};


FrameView.prototype.getLength = function () {
    return this.$containers.length;
};


FrameView.prototype.getAllChild = function () {
    return this.$containers.map(function (ctn) {
        return ctn.__elt__;
    });
};


FrameView.prototype.getLast = function () {
    if (this.$containers.length > 0) {
        return (this.$containers[this.$containers.length - 1].__elt__);
    }

    return null;
};

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);
// CONCATENATED MODULE: ./node_modules/absol-acomp/js/TabFrame.js


var TabFrame_$ = ACore["a" /* default */].$;
var TabFrame_ = ACore["a" /* default */]._;

function TabFrame() {

}

TabFrame.tag = 'tabframe';
TabFrame.render = function () {
    return TabFrame_({
        tag: 'frame',
        class: 'absol-tab-frame',
        extendEvent: ['requestremove', 'remove']
    }, true);
}

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;
    }
};


TabFrame.prototype.requestRemove = function () {
    if (this.$parent && this.$parent.removeTab) {
        this.$parent.removeTab(this.id, false);
    }
    else {
        this.selfRemove();
    }
};

ACore["a" /* default */].install(TabFrame);
/* harmony default export */ var js_TabFrame = (TabFrame);
// EXTERNAL MODULE: ./node_modules/absol-acomp/css/tabview.css
var tabview = __webpack_require__(38);

// CONCATENATED MODULE: ./node_modules/absol-acomp/js/TabButton.js





var TabButton_ = ACore["a" /* default */]._;
var TabButton_$ = ACore["a" /* default */].$;


function TabButton() {
    var thisTB = this;
    this.$close = TabButton_$('.absol-tabbar-button-close', this)
    this.$iconCtn = TabButton_$('.absol-tabbar-button-icon-container', this).on('click', function (event) {
        event.tabButtonEventName = 'delete';
        thisTB.emit('close', event);
    });
    this.$modifiedFlag = TabButton_$('.absol-tabbar-button-modified-flag', this)
        .on('click', function (event) {
            event.tabButtonEventName = 'delete';
            thisTB.emit('close', event);
        });

    this.$textView = TabButton_$('.absol-tabbar-button-text', this);
    this.on({
        click: function (event) {
            if (event.tabButtonEventName) return;
            event.tabButtonEventName = 'active';
            thisTB.emit('active', event);
        }
    });
}


TabButton.tag = 'TabButton';

TabButton.render = function () {
    return 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' }
                    },
                    {
                        tag: 'span',
                        class: ['absol-tabbar-button-close-circle', 'mdi-close-circle', 'mdi'],
                        attr: { title: 'Close' }
                    },
                    {
                        tag: 'span',
                        class: ['absol-tabbar-button-modified-flag', 'mdi', 'mdi-checkbox-blank-circle']
                    }
                ]
            }
        ]
    });
};


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 */].install(TabButton);

/* harmony default export */ var js_TabButton = (TabButton);
// CONCATENATED MODULE: ./node_modules/absol-acomp/js/TabBar.js




var TabBar_ = ACore["a" /* default */]._;
var TabBar_$ = ACore["a" /* default */].$;


function TabBar() {
    this.defineEvent(['active', 'close']);
    this.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();
    });
    this._tabs = [];
}

TabBar.tag = 'tabbar';

TabBar.render = function (){
    return TabBar_('hscroller.absol-tabbar');
};

TabBar.prototype.getAllTabButtons = function () {
    var buttons = [];
    TabBar_$('tabbutton', this, function (e) {
        buttons.push(e);
    });
    return buttons;
};

/***
 *
 * @param {string} ident
 * @return {TabButton}
 */
TabBar.prototype.getButtonByIdent = function (ident) {
    return TabBar_$('tabbutton#tabbuton-' + ident, this);
};




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);
    this.requestUpdateSize();
    return tabButton;
};


TabBar.prototype.removeTab = function (id) {
    this._tabs = this._tabs.filter(function (value) {
        return value == id;
    });
    TabBar_$('#tabbuton-' + id, this).remove();
    this.requestUpdateSize();
};


TabBar.prototype.activeTab = function (id) {
    var self = this;
    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;
        setTimeout(function () {
            self.scrollInto(mButton);
        }, 30)
    }

};

TabBar.prototype.setModified = function (ident, flag) {
    var bt = this.getButtonByIdent(ident);
    if (bt) {
        bt.modified = flag;
    }
};


ACore["a" /* default */].install(TabBar);

/* harmony default export */ var js_TabBar = (TabBar);
// CONCATENATED MODULE: ./node_modules/absol-acomp/js/TabView.js





var TabView_ = ACore["a" /* default */]._;
var TabView_$ = ACore["a" /* default */].$;


function TabView() {
    var thisTV = this;
    /***
     *
     * @type {TabBar}
     */
    this.$tabbar = TabView_$('tabbar', this);
    this.$tabbar.on({
        close: TabView.eventHandler.closeTab.bind(thisTV),
        active: TabView.eventHandler.activeTab.bind(thisTV)
    });
    this._frameHolders = [];
    this._history = [];
}

TabView.tag = 'TabView'.toLowerCase();

TabView.render = function () {
    return TabView_({
        class: 'absol-tabview',
        extendEvent: ['activetab', 'deactivetab', 'removetab', 'requestremovetab'],
        child: [
            'tabbar'
        ]
    });
};


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;
    var resPromise = [];
    var needDeactiveHolder = [];
    var needActiveHolder = [];
    this._frameHolders.forEach(function (holder) {
        if (holder.containerElt.containsClass('absol-tabview-container-hidden')) {
            if (holder.id == id) {
                needActiveHolder.push(holder);
            }
        }
        else {
            if (holder.id != id) {
                needDeactiveHolder.push(holder);
            }
        }
    });

    needDeactiveHolder.forEach(function (holder) {
        holder.containerElt.addClass('absol-tabview-container-hidden');
        holder.tabFrame.emit('deactive', {
            type: 'deactive',
            target: holder.tabFrame,
            id: holder.id,
            userActive: !!userActive,
            tabButton: holder.tabButton,
            holder: holder
        }, holder.tabFrame);
    });

    needActiveHolder.forEach(function (holder) {
        self._history.push(holder.id);
        holder.containerElt.removeClass('absol-tabview-container-hidden');
        self.$tabbar.activeTab(holder.id);
        holder.tabFrame.emit('active', {
            type: 'active',
            target: holder.tabFrame,
            id: holder.id,
            userActive: !!userActive,
            tabButton: holder.tabButton,
            holder: holder
        }, holder.tabFrame);
        self.emit('activetab', {
            type: 'activetab',
            target: self,
            id: holder.id,
            userActive: !!userActive,
            tabButton: holder.tabButton,
            holder: holder
        }, self);
    });
};

TabView.prototype.removeTab = function (id, userActive) {
    var self = this;
    var resPromise = [];
    this._frameHolders.forEach(function (holder) {
        if (holder.id == id) {
            var eventData = {
                type: 'requestremove',
                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('requestremove', eventData, holder.tabFrame);
            eventData.type = 'requestremovetab';
            eventData.target = self;
            self.emit('requestremovetab', eventData, self);
            resPromise.push(
                eventData.__promise__.then(function () {
                    //if ok
                    var eventData2 = {
                        type: 'deactive',
                        target: holder.tabFrame,
                        id: holder.id,
                        userActive: !!userActive,
                        tabButton: holder.tabButton,
                        holder: holder
                    };
                    if (!holder.containerElt.containsClass('absol-tabview-container-hidden'))
                        holder.tabFrame.emit('deactive', eventData2, holder.tabFrame);
                    eventData2.type = 'deactivetab';
                    eventData2.target = self;
                    if (!holder.containerElt.containsClass('absol-tabview-container-hidden'))
                        self.emit('deactivetab', eventData2, self);
                    self._frameHolders = self._frameHolders.filter(function (x) {
                        return x.id != id;
                    });
                    holder.tabFrame.notifyDetached();
                    self.$tabbar.removeTab(holder.id);
                    holder.containerElt.remove();

                    eventData2.type = 'remove';
                    eventData2.target = holder.tabFrame;
                    holder.tabFrame.emit('remove', eventData2, holder.tabFrame);
                    eventData2.type = 'removetab';
                    eventData2.target = self;
                    self.emit('removetab', eventData2, self);
                    self.activeLastTab();
                }, function () {
                    //if reject
                })
            );
        }
    });
    return Promise.all(resPromise);

};


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 containerElt = TabView_('.absol-tabview-container.absol-tabview-container-hidden');
        self.appendChild(containerElt);//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 });
        containerElt.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
            },
            containerElt: {
                value: containerElt,
                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[this._history.length - 1];
        if (dict[id]) {
            this.activeTab(id);
            break;
        }
        else {
            this._history.pop();
        }
    }
};

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.getActiveTabHolder = function () {
    var holder = null;
    for (var i = 0; i < this._frameHolders.length; ++i) {
        holder = this._frameHolders[i];
        if (!holder.containerElt.containsClass('absol-tabview-container-hidden')) {
            return holder;
        }
    }
    return null;
};

TabView.prototype.getActiveTab = function () {
    var holder = this.getActiveTabHolder();
    return holder && holder.tabFrame;
};

TabView.prototype.getActiveTabId = function () {
    var holder = this.getActiveTabHolder();
    return holder && holder.id;
};

TabView.prototype.getTabById = function (id) {
    var holder = this.getTabHolderById(id);
    return holder && holder.tabFrame;
};

TabView.prototype.getTabHolderById = function (id) {
    var holder = null;
    for (var i = 0; i < this._frameHolders.length; ++i) {
        holder = this._frameHolders[i];
        if (holder.id === id) {
            return holder;
        }
    }
    return null;
}


TabView.prototype.activeFrame = function (elt) {
    if (typeof elt == "string") {
        return this.activeTab(elt);
    }
    else if (elt && elt.attr) {
        return this.activeTab(elt.attr('id'));
    }
    else {
        throw new Error("Invalid param, must be id or elt!");
    }
};


TabView.property = {};

TabView.property.historyOfTab = {
    get: function () {
        return this._history.slice();
    }
};

ACore["a" /* default */].install('tabview', TabView);

/* harmony default export */ var js_TabView = (TabView);
// EXTERNAL MODULE: ./node_modules/absol-acomp/css/singlepage.css
var singlepage = __webpack_require__(141);

// CONCATENATED MODULE: ./node_modules/absol-acomp/js/SinglePage.js





var SinglePage_ = ACore["a" /* default */]._;
var SinglePage_$ = ACore["a" /* default */].$;

var warned = false;

/***
 * @extends AElement
 * @constructor
 */
function SinglePage() {
    var thisSP = this;
    this.$attachhook = SinglePage_$('attachhook', this)
        .on('error', function () {
            this.updateSize();
            setTimeout(this.updateSize, 20);
            Dom["b" /* default */].addToResizeSystem(this);
        });
    this.$attachhook.updateSize = this.updateSize.bind(this);
    this.$header = null;
    this.$footer = null;
    this.$viewport = SinglePage_$('.absol-single-page-scroller-viewport', this);
    this.$scroller = SinglePage_$('.absol-single-page-scroller', this);
}

SinglePage.tag = 'SinglePage'.toLowerCase();

SinglePage.render = function () {
    return SinglePage_({
        tag: 'tabframe',
        extendEvent: ['sizechange'],
        class: 'absol-single-page',
        child: [{
            class: 'absol-single-page-scroller',
            child: { class: 'absol-single-page-scroller-viewport' }
        },
            'attachhook']
    });
};


SinglePage.prototype.updateSize = function () {
    if (!this.isDescendantOf(document.body)) return;
    var paddingTop = parseFloat(this.getComputedStyleValue('padding-top').replace('px', '')) || 0;

    if (this.$header) {
        var headerBound = this.$header.getBoundingClientRect();
        var headerMarginTop = parseFloat(this.$header.getComputedStyleValue('margin-top').replace('px', '')) || 0;
        var headerMarginBottom = parseFloat(this.$header.getComputedStyleValue('margin-bottom').replace('px', '')) || 0;
        this.$scroller.addStyle('top', (headerBound.height + headerMarginTop + headerMarginBottom + paddingTop) + 'px');
    }
    if (this.$footer) {
        var footerBound = this.$footer.getBoundingClientRect();
        this.$viewport.addStyle('padding-bottom', footerBound.height + 'px');
    }
    if (this.isSupportedEvent('sizechange'))
        this.emit('sizechange', { type: 'sizechange', target: this }, this);
};

SinglePage.prototype.addChild = function (elt) {
    if (elt.classList.contains('absol-single-page-header')) {
        if (this.firstChild) {
            this.addChildBefore(elt, this.firstChild);
        }
        else {
            this.appendChild(elt);
        }
        this.$header = SinglePage_$(elt);
        this.updateSize();
    }
    else if (elt.classList.contains('absol-single-page-footer')) {
        this.$viewport.addChild(elt);
        this.$footer = SinglePage_$(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);

/* harmony default export */ var js_SinglePage = (SinglePage);

// EXTERNAL MODULE: ./node_modules/absol-acomp/css/hexasectionlabel.css
var hexasectionlabel = __webpack_require__(143);

// CONCATENATED MODULE: ./node_modules/absol-acomp/js/HexaSectionLabel.js






var HexaSectionLabel_ = ACore["a" /* default */]._;
var HexaSectionLabel_$ = ACore["a" /* default */].$;

var HexaSectionLabel_g = HTML5_Svg.ShareInstance._;
var HexaSectionLabel_$g = HTML5_Svg.ShareInstance.$;


var HexaSectionLabel_Design = {
    hexaHeight: 425,
    textBoxHeight: 286,
    textHeight: 96,
    indexHeight: 110,
    textBoxPaddingLeft: 127,
    borderWidth: 38
};

var HexaSectionLabel_StyleSheet = {
    '.as-hexa-section-label-text': {
        height: HexaSectionLabel_Design.textBoxHeight / HexaSectionLabel_Design.textHeight + 'em',
        'padding-left': HexaSectionLabel_Design.textBoxPaddingLeft / HexaSectionLabel_Design.textHeight + 'em',
        'line-height': HexaSectionLabel_Design.textBoxHeight / HexaSectionLabel_Design.textHeight + 'em'
    },
    '.as-hexa-section-label-index': {
        'font-size': HexaSectionLabel_Design.indexHeight / HexaSectionLabel_Design.textHeight + 'em',
        height: HexaSectionLabel_Design.hexaHeight / HexaSectionLabel_Design.indexHeight + 'em',
        'line-height': HexaSectionLabel_Design.hexaHeight / HexaSectionLabel_Design.indexHeight + 'em',
        width: ((HexaSectionLabel_Design.hexaHeight + HexaSectionLabel_Design.borderWidth) / Math.cos(Math.PI / 6)) / HexaSectionLabel_Design.indexHeight + 'em'
    },

};

HexaSectionLabel_({
    tag: 'style',
    id: 'hexa-section-label-style',
    props: {
        innerHTML: Object.keys(HexaSectionLabel_StyleSheet).map(function (key) {
            var style = HexaSectionLabel_StyleSheet[key];
            return key + ' {\n'
                + Object.keys(style).map(function (propName) {
                    return propName + ': ' + style[propName] + ';';
                }).join('\n')
                + '}';
        }).join('\n')
    }
}).addTo(document.head);

/***
 * @extends AElement
 * @constructor
 */
function HexaSectionLabel() {
    this.$background = HexaSectionLabel_$('.as-hexa-section-label-background', this);
    this.$index = HexaSectionLabel_$('.as-hexa-section-label-index', this);
    this.$text = HexaSectionLabel_$('.as-hexa-section-label-text', this);
    this.$attachhook = HexaSectionLabel_('attachhook').addTo(this).on('error', function () {
        Dom["b" /* default */].addToResizeSystem(this);
        this.requestUpdateSize();
    });

    this.$attachhook.requestUpdateSize = this.redrawBackground.bind(this);
    this.$svg = HexaSectionLabel_g({
        tag: 'svg',
        attr: {
            width: '0',
            height: '0'
        },
        child: [
            'path.as-hexa-section-label-text-box',
            'path.as-hexa-section-label-index-box'
        ]
    }).addTo(this.$background);
    this.$indexBox = HexaSectionLabel_$g('path.as-hexa-section-label-index-box', this.$svg);
    this.$textBox = HexaSectionLabel_$g('path.as-hexa-section-label-text-box', this.$svg);
}

HexaSectionLabel.prototype.redrawBackground = function () {
    var indexBound = this.$index.getBoundingClientRect();
    var textBound = this.$text.getBoundingClientRect();
    var cHeight = indexBound.height;
    var cWidth = textBound.right - indexBound.left;
    this.$svg.attr({
        height: cHeight + '',
        width: cWidth + '',
        viewBox: [0, 0, cWidth, cHeight].join(' ')
    });

    var borderWidth = cHeight * HexaSectionLabel_Design.borderWidth / HexaSectionLabel_Design.hexaHeight;
    var radius = (cHeight / Math.cos(Math.PI / 6) / 2) - borderWidth / 2;
    var x0 = indexBound.width / 2;
    var y0 = cHeight / 2;


    this.$indexBox.attr('d', Array(6).fill(0).map(function (u, i) {
        var angle = Math.PI / 3 + i * Math.PI / 3;
        var x = radius * Math.cos(angle) + x0;
        var y = radius * Math.sin(angle) + y0;
        return (i == 0 ? 'M' : 'L') + x + ' ' + y;
    }).join(' ') + 'Z')
        .addStyle({
            strokeWidth: borderWidth + ''
        });
    var skewX = 18 / 45;
    var textBoxHeight = textBound.height;
    this.$textBox.attr('d', [
        [x0, (cHeight - textBoxHeight) / 2],
        [cWidth - 1, (cHeight - textBoxHeight) / 2],
        [cWidth - 1 - textBoxHeight * skewX, (cHeight - textBoxHeight) / 2 + textBoxHeight],
        [x0, (cHeight - textBoxHeight) / 2 + textBoxHeight],
    ].map(function (point, i) {
        return (i == 0 ? 'M' : 'L') + point.join(' ')
    }).join(' ') + 'Z')
};

HexaSectionLabel.tag = 'HexaSectionLabel'.toLowerCase();

HexaSectionLabel.render = function () {
    return HexaSectionLabel_({
        class: 'as-hexa-section-label',
        child: [
            {
                class: 'as-hexa-section-label-background'
            },
            '.as-hexa-section-label-index',
            '.as-hexa-section-label-text'
        ]
    });
};

HexaSectionLabel.property = {};
HexaSectionLabel.property.index = {
    set: function (value) {
        this._index = value;
        this.$index.clearChild().addChild(HexaSectionLabel_({ text: value + '' }))
    },
    get: function () {
        return this._index;
    }
};

HexaSectionLabel.property.text = {
    set: function (value) {
        this._text = value;
        this.$text.clearChild().addChild(HexaSectionLabel_({ text: value + '' }))
    },
    get: function () {
        return this._text;
    }
};


ACore["a" /* default */].install(HexaSectionLabel);
/* harmony default export */ var js_HexaSectionLabel = (HexaSectionLabel);
// EXTERNAL MODULE: ./node_modules/absol-acomp/css/vruler.css
var vruler = __webpack_require__(145);

// 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["b" /* 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.tag = 'vruler';

VRuler.render = function () {
    return VRuler_({
        class: 'as-vruler'
    });
};

VRuler.prototype.measureElement = function (elt) {
    if (typeof elt == "string") elt = VRuler_$(elt);
    this.$measureTarget = elt;
    this.update();
};


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/hruler.css
var hruler = __webpack_require__(147);

// CONCATENATED MODULE: ./node_modules/absol-acomp/js/HRuler.js





var HRuler_ = ACore["a" /* default */]._;
var HRuler_$ = ACore["a" /* default */].$;

/***
 * @extends AElement
 * @constructor
 */
function HRuler() {
    var self = this;
    this.$attachHook = HRuler_('attachhook').on('error', function () {
        this.updateSize = self.update.bind(self);
        Dom["b" /* 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.tag = 'hruler';

HRuler.render = function () {
    return HRuler_({
        class: 'as-hruler'
    });
};


HRuler.prototype.measureElement = function (elt) {
    if (typeof elt == "string") elt = HRuler_$(elt);
    this.$measureTarget = elt;
    this.update();
};


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);

/* harmony default export */ var js_HRuler = (HRuler);
// CONCATENATED MODULE: ./node_modules/absol-acomp/js/IconSprite.js



var IconSprite_ = ACore["a" /* default */]._;
var IconSprite_$ = ACore["a" /* default */].$;


function IconSprite() {
    this.$attachhook = IconSprite_('attachhook').addTo(this).on('error', this.eventHandler.attached);
    this.on('frame', this.eventHandler.frame);
    this._checkRootTimeout = 30;
    this.loop = true;
}

IconSprite.tag = 'iconsprite';


IconSprite.render = function () {
    return IconSprite_('sprite', true);
};


/**
 * @type {IconSprite}
 */
IconSprite.eventHandler = {};

IconSprite.eventHandler.attached = function () {
    var thisAS = this;
    this._checkRootTimeout = 30;
    this.afterReady().then(function () {
        thisAS.width = thisAS.texture.naturalWidth;
        thisAS.height = thisAS.width;
        thisAS.frames = {
            type: 'grid',
            col: 1,
            row: thisAS.texture.naturalHeight / thisAS.texture.naturalWidth
        }
        thisAS.drawFrame(0);
        thisAS.play();
    });
};

IconSprite.eventHandler.frame = function () {
    this._checkRootTimeout--;
    if (this._checkRootTimeout == 0){
        if (this.isDescendantOf(document.body)){
            this._checkRootTimeout = 30;
        }
        else{
            this.stop();
            this.remove();
        }
    }
};

ACore["a" /* default */].install(IconSprite);

/* harmony default export */ var js_IconSprite = (IconSprite);
// EXTERNAL MODULE: ./node_modules/absol-acomp/css/linearcolorbar.css
var linearcolorbar = __webpack_require__(149);

// CONCATENATED MODULE: ./node_modules/absol-acomp/js/LinearColorBar.js






var LinearColorBar_ = ACore["a" /* default */]._;
var LinearColorBar_$ = ACore["a" /* default */].$;


var LinearColorBar_g = HTML5_Svg.ShareInstance._;
var LinearColorBar_$g = HTML5_Svg.ShareInstance.$;

var LinearColorBar_Design = {
    textHeight: 56,
    barHeight: 97,
    barBlockWidth: 79,
    barBlockMargin: 19,
    valueTextHeight: 70,
    valueStrokeWidth: 5,
    valueHeight: 99,
    valueWidth: 52,
    valueTripHeight: 32,
    height: 430,
    barY: 201
};

var SyleSheet = {
    '.as-linear-color-bar': {
        height: LinearColorBar_Design.height / LinearColorBar_Design.textHeight + 'em'
    },
    '.as-linear-color-value-text': {
        'font-size': LinearColorBar_Design.valueTextHeight / LinearColorBar_Design.textHeight + 'em'
    }
};


buildCss(SyleSheet);

function LinearColorBar() {
    this._indent = (Math.random() + '').replace(/[^0-9]/g, '_');
    this._extendValue = 0;
    this._value = 0;
    this._valueText = '';
    this.$valueText = LinearColorBar_$('.as-linear-color-value-text', this);
    this.$minValueText = LinearColorBar_$('.as-linear-color-min-value-text', this);
    this.$maxValueText = LinearColorBar_$('.as-linear-color-max-value-text', this);
    this.$background = LinearColorBar_$('svg.as-linear-color-background', this);
    this._attached = false;
    var thisBar = this;
    this.$attachhook = LinearColorBar_('attachhook').addTo(this).on('error', function () {
        thisBar._attached = true;
        Dom["b" /* default */].addToResizeSystem(this);
        this.requestUpdateSize();
    });

    this.$background.attr({
        height: 0,
        width: 0,
    });
    this.$attachhook.requestUpdateSize = this.redraw.bind(this);
    this.$defs = LinearColorBar_g('defs').addTo(this.$background);

    this.$gradient = LinearColorBar_g('linearGradient#gradient_' + this._indent)
        .attr({
            x1: "0%",
            y1: "0%",
            x2: "100%",
            y2: "0%"
        }).addTo(this.$defs);
    this.$rect = LinearColorBar_g('rect.as-linear-color-bar-rect')
        .attr({
            fill: 'url(#gradient_' + this._indent + ')'
        })
        .addTo(this.$background);
    this.$splitLine = LinearColorBar_g('path.as-linear-color-split-line').addTo(this.$background)
    this.$valueArrow = LinearColorBar_g('path.as-linear-color-value-arrow').addTo(this.$background);

    this.colorMapping = 'rainbow';
}

LinearColorBar.prototype.redraw = function () {
    var bBound = this.getBoundingClientRect();
    var cWidth = bBound.width;
    var cHeight = bBound.height;
    var maxTextBound = this.$maxValueText.getBoundingClientRect();
    var minTextBound = this.$minValueText.getBoundingClientRect();
    var valueTextBound = this.$valueText.getBoundingClientRect();

    var valueWidth = LinearColorBar_Design.valueWidth / LinearColorBar_Design.height * cHeight;
    var minValueX = valueWidth / 1.5;
    this.$minValueText.addStyle('left', Math.max((minValueX - minTextBound.width) / 2, 0) + 'px');

    var maxValueX = (cWidth - LinearColorBar_Design.valueWidth) / (1 + this._extendValue);
    var extendX = cWidth - valueWidth / 1.5;
    var valueX = minValueX + this._value * (maxValueX - minValueX);
    this.$valueText.addStyle('left', valueX - valueTextBound.width / 2 + 'px');
    this.$maxValueText.addStyle('left', maxValueX - maxTextBound.width / 2 + 'px');
    var barY = LinearColorBar_Design.barY / LinearColorBar_Design.height * cHeight;
    var barHeight = LinearColorBar_Design.barHeight / LinearColorBar_Design.height * cHeight;
    this.$rect.attr({
        x: '' + minValueX,
        y: '' + barY,
        width: extendX - minValueX + '',
        height: barHeight
    });

    this.$background.attr({
        height: cHeight + '',
        width: cWidth + '',
        viewBox: [0, 0, cWidth, cHeight].join(' ')
    });

    var valueTripHeight = LinearColorBar_Design.valueTripHeight / LinearColorBar_Design.height * cHeight;
    var valueHeight = LinearColorBar_Design.valueHeight / LinearColorBar_Design.height * cHeight;
    this.$valueArrow
        .addStyle('stroke-width', LinearColorBar_Design.valueStrokeWidth / LinearColorBar_Design.height * cHeight + '')
        .attr('d', [
            [
                [valueX, barY],
                [valueX - valueWidth / 2, barY - valueTripHeight],
                [valueX - valueWidth / 2, barY - valueHeight],
                [valueX + valueWidth / 2, barY - valueHeight],
                [valueX + valueWidth / 2, barY - valueTripHeight]

            ]
        ].map(function (point, i) {
            return (i == 0 ? 'M' : 'L') + point.join(' ')
        }).join(' ') + 'Z');

    var splitDistMin = (LinearColorBar_Design.barBlockWidth + LinearColorBar_Design.barBlockMargin) / LinearColorBar_Design.height * cHeight;
    var splitCounts = [100, 50, 20, 10, 5, 2, 1];
    var splitDist = maxValueX - minValueX;
    var splitCount = 1;
    for (var i = 0; i < splitCounts.length; ++i) {
        splitDist = (maxValueX - minValueX) / splitCounts[i];
        if (splitDist >= splitDistMin) {
            splitCount = splitCounts[i];
            break;
        }
    }

    this.$splitLine.addStyle('stroke-width', LinearColorBar_Design.barBlockMargin / LinearColorBar_Design.height * cHeight + '')
        .attr({
            d: Array(splitCount + 1).fill(0).map(function (u, i) {
                return 'M' + (maxValueX - i * splitDist) + ' ' + (barY - 1) + 'v' + (barHeight + 2);
            }).join(' ')
        })
};

LinearColorBar.prototype._updateGradient = function () {
    var barMax = 1 + this._extendValue;
    var gradientElt = this.$gradient.clearChild();
    this._colorMapping.forEach(function (it) {
        LinearColorBar_g({
            tag: 'stop',
            attr: {
                offset: (it.value <= 1 ? it.value / barMax * 100 : 100) + '%'
            },
            style: {
                'stop-color': it.color + '',
                'stop-opacity': '1'
            }
        }).addTo(gradientElt);
    });
};


LinearColorBar.prototype.BUILDIN_COLORS_RANGE = {
    'rainbow': [
        { value: 0, color: 'red' },
        { value: 1 / 6, color: 'orange' },
        { value: 1 / 3, color: 'yellow' },
        { value: 1 / 2, color: 'green' },
        { value: 2 / 3, color: 'blue' },
        { value: 5 / 6, color: 'indigo' },
        { value: 1, color: 'violet' },
        { value: Infinity, color: 'violet' }
    ],
    'rainbow-invert': [
        { value: 0, color: 'violet' },
        { value: 1 / 6, color: 'indigo' },
        { value: 1 / 3, color: 'blue' },
        { value: 1 / 2, color: 'green' },
        { value: 2 / 3, color: 'yellow' },
        { value: 5 / 6, color: 'orange' },
        { value: 1, color: 'red' },
        { value: Infinity, color: 'violet' }
    ],
    'performance': [
        { value: 0, color: 'red' },
        { value: 0.5, color: 'orange' },
        { value: 1, color: 'green' },
        { value: Infinity, color: 'green' }
    ],
    'performance-invert': [
        { value: 0, color: 'green' },
        { value: 0.5, color: 'orange' },
        { value: 1, color: 'red' },
        { value: Infinity, color: 'red' }
    ]
}

LinearColorBar.tag = 'LinearColorBar'.toLowerCase();
LinearColorBar.render = function () {
    return LinearColorBar_({
        class: 'as-linear-color-bar',
        child: [
            'svg.as-linear-color-background',
            '.as-linear-color-value-text',
            '.as-linear-color-min-value-text',
            '.as-linear-color-max-value-text'
        ]
    });
};

LinearColorBar.property = {};
LinearColorBar.property.valueText = {
    set: function (value) {
        value = value + '';
        this._valueText = value;
        this.$valueText.clearChild().addChild(LinearColorBar_({ text: value }));
    },
    get: function () {
        return this._valueText;
    }
};


LinearColorBar.property.minValueText = {
    set: function (value) {
        value = value + '';
        this._minValueText = value;
        this.$minValueText.clearChild().addChild(LinearColorBar_({ text: value }));
    },
    get: function () {
        return this._valueText;
    }
};

LinearColorBar.property.maxValueText = {
    set: function (value) {
        value = value + '';
        this._maxValueText = value;
        this.$maxValueText.clearChild().addChild(LinearColorBar_({ text: value }));
    },
    get: function () {
        return this._valueText;
    }
};

LinearColorBar.property.value = {
    set: function (value) {
        this._value = value;
    },
    get: function () {
        return this._value;
    }
};

LinearColorBar.property.extendValue = {
    set: function (value) {
        this._extendValue = value;
        this._updateGradient();
    },
    get: function () {
        return this._extendValue;
    }
};


LinearColorBar.property.colorMapping = {
    set: function (value) {
        if (typeof (value) == "string") value = this.BUILDIN_COLORS_RANGE[value];
        this._colorMapping = value.slice();
        this._colorMapping.sort(function (a, b) {
            return a.value - b.value;
        })
        this._updateGradient();
    },
    get: function () {
        return this._colorMapping;
    }
};

ACore["a" /* default */].install(LinearColorBar);
/* harmony default export */ var js_LinearColorBar = (LinearColorBar);
// EXTERNAL MODULE: ./node_modules/absol-acomp/css/mediainput.css
var mediainput = __webpack_require__(151);

// 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/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["b" /* default */].ShareInstance._({
                child: { tag: 'br' }
            });
        }
        else {
            return Dom["b" /* 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 Text_measureText(text, font) {
    // re-use canvas object for better performance
    var canvas = Text_measureText.canvas || (Text_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-acomp/js/MediaInput.js











var MediACore = new Dom["b" /* default */]();
MediACore.install(ACore["a" /* default */]);


var MediaInput_ = MediACore._;
var MediaInput_$ = MediACore.$;


function MediaInput_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() {
    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.tag = 'MediaInput'.toLowerCase();

MediaInput.render = function () {
    return 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',
            ]
        }
    });
};



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["b" /* 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, '&nbsp');
};


MediaInput.prototype.unescapeSpace = function (s) {
    return s.replace(/&nbsp/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) {
    MediaInput_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) {
    MediaInput_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["b" /* 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 = HTML5_Svg.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 */].install(MediaInput);


/* harmony default export */ var js_MediaInput = (MediaInput);
// EXTERNAL MODULE: ./node_modules/absol-acomp/css/messageinput.css
var messageinput = __webpack_require__(153);

// 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 () {
            failure && failure(request.status, request.statusText);
            rj(new Error(request.status + request.statusText));
        };
    });
};


XHR.postRepquest = function (url, payload, props, headers, success, failure) {
    return new Promise(function (rs, rj) {
        var method = "POST";
        var shouldBeAsync = true;

        var request = XHR.makeHttpObject();

        request.onreadystatechange = function () {
            if (request.readyState == 4) {
                if (request.status == 200) {
                    success && success(request.response);
                    rs(request.response);
                }
                else if (failure) {
                    failure && failure(request.status, request.statusText);
                    rj({ status: request.status, statusText: request.statusText });
                }
            }
        };

        request.onerror = function () {
            failure && failure(request.status, request.statusText);
            rj(new Error(request.status + request.statusText));
        };

        request.open(method, url, shouldBeAsync);
        if (typeof props == 'string')
            request.responseType = props || '';
        else if (props && (typeof props == 'object')) {
            Object.assign(request, props);
        }
        headers = headers || {};
        headers["Content-Type"] = headers["Content-Type"] || "application/json;charset=UTF-8";
        Object.keys(headers).forEach(function (key) {
            request.setRequestHeader(key, headers[key]);
        });

        request.send(payload);
    });
};

XHR.request = function (method, url, props, headers, body, successCallback, failureCallback) {
    return new Promise(function (rs, rj) {
        var shouldBeAsync = true;
        var request = new XMLHttpRequest();

        request.onreadystatechange = function () {
            if (request.readyState == 4) {
                if (request.status == 200) {
                    successCallback && successCallback(request.response);
                    rs(request.response);
                }
                else {
                    failureCallback && failureCallback(request.status, request.statusText);
                    rj({ status: request.status, statusText: request.statusText });
                }
            }
        };

        request.onerror = function () {
            var error = new Error("Network Error!");
            if (failureCallback) failureCallback(error);
            rj(error);
        };

        request.open(method, url, shouldBeAsync);
        if (typeof props == 'string')
            request.responseType = props || '';
        else if (props && (typeof props == 'object')) {
            Object.assign(request, props);
        }
        headers = headers || {};
        headers["Content-Type"] = headers["Content-Type"] || "application/json;charset=UTF-8";
        Object.keys(headers).forEach(function (key) {
            request.setRequestHeader(key, headers[key]);
        });
        request.send(body);
    });
};

/* harmony default export */ var Network_XHR = (XHR);
// CONCATENATED MODULE: ./node_modules/absol/src/AppPattern/CMDRunner.js
function CMDRunner(_this, commands) {
    this._this = _this;
    this.commands = {};
    this.assign(commands);
}



CMDRunner.prototype.has = function (cmdName) {
    return !!this.commands[cmdName];
};


CMDRunner.prototype.add = function (cmdName, handler) {
    this.commands[cmdName] = handler;
    return this;
};


CMDRunner.prototype.remove = function (cmdName) {
    delete this.commands[cmdName];
    return this;
};

CMDRunner.prototype.assign = function (obj) {
    for (var cmdName in obj) {
        if (typeof obj[cmdName] == 'function') {
            this.add(cmdName, obj[cmdName]);
        }
    }
};

CMDRunner.prototype.invoke = function () {
    if (this.commands[arguments[0]]) {
        var args = Array.prototype.slice.call(arguments, 1);
        return this.commands[arguments[0]].apply(this._this, args);
    }
    else {
        throw new Error('No command: ' + arguments[0]);
    }
};

/* harmony default export */ var AppPattern_CMDRunner = (CMDRunner);


// CONCATENATED MODULE: ./node_modules/absol/src/Input/keyboard.js
function isFnKey(name) {
    return name.match(/^[fF]([2-9]|(1([0-2]?)))$/)
}

function isSpaceKey(name) {
    return name === ' ' || name.match(/^[sS]pace$/);
}

function isCtrlKey(name) {
    return name.match(/(^([cC]ontrol)|ctrl)$/);
}

function isAltKey(name) {
    return name.match(/^[aA]lt$/);
}

function isShiftKey(name) {
    return name.match(/^[sS]hift$/);
}

function isMetaKey(name) {
    return name.toLowerCase().match(/^(command|windows|meta)$/);
}

/***
 *
 * @param {string} text
 * @return {string}
 */
function normalizeKeyBindingIdent(text) {
    var keys = text.trim().toLowerCase().split(/[-+\s_.]+/)
        .filter(function (w) {
            return w.length > 0;
        });
    var values = {
        meta: 1,
        ctrl: 2,
        alt: 3,
        shift: 4
    };
    keys.sort(function (a, b) {
        var va, vb;
        va = values[a] || 100;
        vb = values[b] || 100;
        return va - vb;
    });
    return keys.join('-');
}

/***
 *
 * @param {KeyboardEvent} event
 * @return {string}
 */
function keyboardEventToKeyBindingIdent(event) {
    var keys = [];
    if (event.metaKey) {
        keys.push('meta');
    }
    if (event.ctrlKey)
        keys.push('ctrl');
    if (event.altKey)
        keys.push('alt');
    if (event.shiftKey)
        keys.push('shift');

    if (isSpaceKey(event.key)) {
        keys.push('space');
    }
    else if (isFnKey(event.key)) {
        keys.push(event.key.toLowerCase())
    }
    else if (!isMetaKey(event.key) && !isAltKey(event.key) && !isCtrlKey(event.key) && !isShiftKey(event.key))
        keys.push(event.key.toLowerCase());
    return keys.join('-');
}
// CONCATENATED MODULE: ./node_modules/absol-acomp/js/MessageInput.js













var MessageInput_ = ACore["a" /* default */]._;
var MessageInput_$ = ACore["a" /* default */].$;
var MessageInput_$$ = ACore["a" /* default */].$$;


/***
 *
 * @typedef {{text:string, desc: string, img?:string, file?:string}|string} MessageInputQuote
 */

var iconCatalogCaches = {};

var MODE_NEW = 0;
var MODE_EDIT = 1;

var isMobile = BrowserDetector["a" /* default */].isMobile;

/***
 * @extends AElement
 * @constructor
 */
function MessageInput() {
    this._cmdRunner = new AppPattern_CMDRunner(this);
    this._keyMaps = {};
    this._plugins = [];
    this._mode = MODE_NEW;//edit
    this._editingText = "";
    prepareIcon();
    /**
     * @type {import('./PreInput').default}
     */
    this.$preInput = MessageInput_$('preinput', this);


    this.$preInput.on('change', this.eventHandler.preInputChange)
        .on('keyup', this.eventHandler.preInputKeyUp)
        .on('keydown', this.eventHandler.preInputKeyDown)
        .on('pasteimg', this.eventHandler.preInputPasteImg)
        .on('focus', this.eventHandler.preInputFocus)
        .on('blur', this.eventHandler.preInputBlur);
    // //every can make size change
    this._imageFiles = [];
    this._files = [];


    this._latBound = {};

    this.$quote = MessageInput_$('messagequote.as-message-input-quote', this)
        .on('pressremove', this.eventHandler.clickQuoteRemoveBtn);

    this.$right = MessageInput_$('.as-message-input-right', this);

    this.$attachmentCtn = MessageInput_$('.as-message-input-attachment-ctn', this);
    this.$emojiBtn = MessageInput_$('.as-message-input-plugin-emoji', this)
        .on('click', this.eventHandler.clickEmojiBtn);
    this.$fileBtn = MessageInput_$('.as-message-input-plugin-file', this)
        .on('click', this.openFileDialog.bind(this));
    this.$attachmentAddBtn = MessageInput_$('.as-message-input-attachment-add-btn', this)
        .on('click', this.openFileDialog.bind(this));
    this.$sendBtn = MessageInput_$('.as-message-input-plugin-send', this)
        .on('click', this.notifySend.bind(this));

    this.$cancelBtn = MessageInput_$('.as-message-input-plugin-cancel', this)
        .on('click', this.notifyCancel.bind(this));

    this.$emojiPickerCtn = MessageInput_('.as-message-input-external-tools-popup');
    this.$emojiPicker = MessageInput_('emojipicker').addTo(this.$emojiPickerCtn)
        .on('pick', this.eventHandler.pickEmoji);


    this.$attachhook = MessageInput_('attachhook').addTo(this).on('error', this.notifySizeChange.bind(this));


    this.on('drop', this.eventHandler.drop)
        .on('dragover', this.eventHandler.dragover);

    this.autoSend = false;
    /***
     *
     * @type {MessageInputQuote|null}
     */
    this.quote = null;
}

MessageInput.MODE_EDIT = MODE_EDIT;
MessageInput.MODE_NEW = MODE_NEW;

MessageInput.iconAssetRoot = 'https://absol.cf/exticons/vivid';

MessageInput.tag = 'MessageInput'.toLowerCase();

MessageInput.render = function (data) {
    data = data || {};
    data.iconAssetRoot = data.iconAssetRoot || MessageInput.iconAssetRoot;
    return MessageInput_({
        attr: {
            'data-icon-asset-root': MessageInput.iconAssetRoot
        },
        class: 'as-message-input',
        extendEvent: ['sendtext', 'sendimage', 'sendfile', 'sendquote', 'cancel', 'change', 'sizechange', 'send'],
        child: [
            {
                class: 'as-message-input-right',
                child: [
                    {
                        tag: 'button',
                        class: ['as-message-input-plugin-btn', 'as-message-input-plugin-file'],
                        child: 'span.mdi.mdi-attachment.mdi-rotate-90'
                    },
                    {
                        tag: 'button',
                        class: ['as-message-input-plugin-btn', 'as-message-input-plugin-send'],
                        child: 'span.mdi.mdi-send'
                    },
                    {
                        tag: 'button',
                        class: ['as-message-input-plugin-btn', 'as-message-input-plugin-cancel'],
                        child: 'span.mdi.mdi-close'
                    }
                ]
            },
            {
                class: 'as-message-input-pre-ctn',
                child: [
                    'messagequote.as-message-input-quote.as-removable.as-shorten-text',
                    {
                        class: 'as-message-input-emoji-btn-ctn',
                        child: {
                            tag: 'button',
                            class: ['as-message-input-plugin-btn', 'as-message-input-plugin-emoji'],
                            child: 'span.mdi.mdi-emoticon-happy-outline'
                        }
                    },
                    {
                        class: ['as-message-input-attachment-ctn', 'as-bscroller'],
                        child: [{
                            tag: 'button',
                            class: 'as-message-input-attachment-add-btn',
                            child: [
                                'span.mdi.mdi-arrow-down-bold.as-message-input-attachment-add-btn-drop',
                                {
                                    tag: 'span',
                                    class: 'as-message-input-attachment-add-btn-plus',
                                    child: {
                                        text: "+"
                                    }
                                }

                            ]
                        }]
                    },
                    'preinput.as-message-input-pre.absol-bscroller'
                ]
            }
        ]
    });
};


MessageInput.prototype.toggleEmoji = function () {
    if (this.containsClass('as-message-input-show-emoji'))
        this.closeEmoji();
    else
        this.showEmoji();
};


MessageInput.prototype.showEmoji = function () {
    if (this.containsClass('as-message-input-show-emoji')) return;
    var value = this.$preInput.value;
    this._lastInputSelectPosion = this.$preInput.getSelectPosition() || { start: value.length, end: value.length };
    this.addClass('as-message-input-show-emoji');
    this.addChild(this.$emojiPickerCtn);
    var thisMi = this;
    setTimeout(function () {
        MessageInput_$(document.body).on('mousedown', thisMi.eventHandler.mousedownOutEmoji);
    }, 100);
    this.$preInput.focus();
};


MessageInput.prototype.notifyChange = function () {
    this.emit('change', { name: 'change', target: this }, this);
    if (this.autoSend) {
        if (this.files.length > 0 || this.images.length > 0)
            this.notifySend();
    }
};

MessageInput.prototype.notifySend = function () {
    var eventData = {
        imageRemovePrevented: false,
        fileRemovePrevented: false,
        textRemovePrevented: false,
        quoteRemovePrevented: false,
        target: this,
        files: this.files,
        images: this.images,
        text: this.text
    };
    if (eventData.files.length > 0) {
        this.emit('sendfile', Object.assign(eventData, {
            type: 'sendfile', preventDefault: function () {
                this.fileRemovePrevented = true;
            }
        }), this);
    }

    if (eventData.images.length > 0) {
        this.emit('sendimage', Object.assign(eventData, {
            type: 'sendimage', preventDefault: function () {
                this.imageRemovePrevented = true;
            }
        }), this);
    }

    if ((typeof this.quote === "string") || this.quote) {
        this.emit('sendquote', Object.assign(eventData, {
            type: 'sendquote', preventDefault: function () {
                this.quoteRemovePrevented = true;
            }
        }), this);
    }

    if (this.files.length > 0 || eventData.images.length > 0 || eventData.text || ((typeof this.quote === "string") || this.quote)) {
        if (eventData.text) this.$preInput.focus();
        this.emit('send', Object.assign(eventData, {
            type: 'send', preventDefault: function () {
                this.imageRemovePrevented = true;
                this.fileRemovePrevented = true;
                this.imageRemovePrevented = true;
                this.quoteRemovePrevented = true;

            }
        }), this);
    }
    if (!eventData.fileRemovePrevented) this.files = [];
    if (!eventData.imageRemovePrevented) this.images = [];
    if (!eventData.textRemovePrevented) this.text = '';
    if (!eventData.quoteRemovePrevented) this.quote = null;

};

MessageInput.prototype.notifyCancel = function () {
    this.emit('cancel', {
        type: 'cancel',
        name: 'send', target: this, clearAllContent: this.clearAllContent.bind(this)
    }, this);
};

MessageInput.prototype.clearAllContent = function () {
    this.text = '';
    this.quote = null;
    this.files = [];
    this.images = [];
};

MessageInput.prototype.focus = function () {
    var value = this.$preInput.value;
    var range = this.$preInput.getSelectPosition() || { start: value.length, end: value.length };
    this.$preInput.focus();
    this.$preInput.applyData(value, range);
};

MessageInput.prototype.blur = function () {
    this.$preInput.blur();
};


MessageInput.prototype._updateAttachmentClass = function () {
    if (this._imageFiles.length + this._files.length) {
        this.addClass("as-has-attachment");
    }
    else {
        this.removeClass("as-has-attachment");
    }
};

MessageInput.prototype.addImageFiles = function (imageFiles, urls) {
    var thisMi = this;
    Array.prototype.forEach.call(imageFiles, function (file, index) {
        thisMi._imageFiles.push(file);
        var src;
        if (urls) {
            src = urls[index];
        }
        if (!src) {
            src = URL.createObjectURL(file);
        }
        var itemElt = MessageInput_({
            class: ['as-message-input-attach-preview', 'as-image'],
            attr: {
                title: file.name
            },
            child: [
                {
                    class: 'as-message-input-attach-preview-image',
                    style: {
                        backgroundImage: 'url(' + src + ')'
                    }
                },
                {
                    tag: 'button',
                    class: 'as-message-input-attach-preview-close-btn',
                    child: 'span.mdi.mdi-close',
                    attr: {
                        title: 'remove'
                    },
                    on: {
                        click: function () {
                            thisMi._imageFiles = thisMi._imageFiles.filter(function (it) {
                                return it !== file;
                            });
                            itemElt.remove();
                            thisMi._updateAttachmentClass();
                            thisMi.notifySizeChange();
                            thisMi.notifyChange();
                        }
                    }
                }, {
                    class: ['as-message-input-attach-preview-name'],
                    child: { text: file.name }
                }
            ]
        }).addTo(thisMi.$attachmentCtn);
        thisMi.$attachmentCtn.addChildBefore(itemElt, thisMi.$attachmentAddBtn);

    });
    this._updateAttachmentClass();
    this.notifySizeChange();
};

MessageInput.prototype.addFiles = function (files) {
    var thisMi = this;
    Array.prototype.forEach.call(files, function (file, index) {
        thisMi._files.push(file);
        MessageInput.iconSupportAsync.then(function (ExtensionIcons) {
            var src;
            var ext = file.name.split('.').pop().toLowerCase();
            if (ExtensionIcons.indexOf(ext) > 0) {
                src = MessageInput.iconAssetRoot + '/' + ext + '.svg'
            }
            else {
                src = MessageInput.iconAssetRoot + '/' + 'default' + '.svg'

            }
            var itemElt = MessageInput_({
                class: ['as-message-input-attach-preview', 'as-file'],
                attr: {
                    title: file.name
                },
                child: [
                    {
                        tag: 'img',
                        class: 'as-message-input-attach-preview-file',
                        props: {
                            src: src
                        }
                    },
                    {
                        tag: 'button',
                        class: 'as-message-input-attach-preview-close-btn',
                        child: 'span.mdi.mdi-close',
                        attr: {
                            title: 'remove'
                        },
                        on: {
                            click: function () {
                                thisMi._files = thisMi._files.filter(function (it) {
                                    return it !== file;
                                });
                                itemElt.remove();
                                thisMi._updateAttachmentClass();
                                thisMi.notifySizeChange();
                                thisMi.notifyChange();
                            }
                        }
                    },
                    {
                        class: 'as-message-input-attach-preview-name',
                        child: { text: file.name }
                    }
                ]
            });
            thisMi.$attachmentCtn.addChildBefore(itemElt, thisMi.$attachmentAddBtn);
        });
    });
    this._updateAttachmentClass();
    thisMi.notifySizeChange();
};


MessageInput.prototype.closeEmoji = function () {
    if (!this.containsClass('as-message-input-show-emoji')) return;
    this.removeClass('as-message-input-show-emoji');
    this.removeChild(this.$emojiPickerCtn);
    MessageInput_$(document.body).off('mousedown', this.eventHandler.mousedownOutEmoji);
};


MessageInput.prototype.openFileDialog = function () {
    var thisMi = this;
    openFileDialog({ multiple: true }).then(function (file) {
        if (!thisMi.autoSend) thisMi.$preInput.focus();
        thisMi.handleAddingFileByType(file);
    });
};

MessageInput.prototype.handleAddingFileByType = function (files) {
    if (files.length > 0) {
        var imageFiles = [];
        var otherFiles = [];
        var file;
        for (var i = 0; i < files.length; ++i) {
            file = files[i];
            if (!!file.type && file.type.match && file.type.match(/^image\//)) {
                imageFiles.push(file);
            }
            else {
                otherFiles.push(file);
            }
        }
        this.addImageFiles(imageFiles);
        this.addFiles(otherFiles);
        this.notifyChange();
    }
};


MessageInput.prototype.notifySizeChange = function () {
    var bound = this.getBoundingClientRect();
    if (this._latBound.width != bound.width || this._latBound.height != bound.height) {
        this._latBound.width = bound.width;
        this._latBound.height = bound.height;
        this.emit('sizechange', { name: 'sizechange', bound: bound, target: this }, this);
    }
};

MessageInput.prototype.addPlugin = function (option) {
    var plugin = new this.PluginConstructor(this, option);
    this._plugins.push(plugin);
    this.addStyle('--plugin-buttons-width', this._plugins.length * 45 + 'px');
    return plugin;
};

/***
 *
 * @param {{name?:string, exec:function(_this:MessageInput):void, keyBiding?:string}} option
 */
MessageInput.prototype.addCommand = function (option) {
    option.name = option.name || randomIdent(20);
    this._cmdRunner.add(option.name, option.exec);
    if (option.keyBiding && option.keyBiding.trim) {
        var keyBindingIdent = normalizeKeyBindingIdent(option.keyBiding);
        this._keyMaps[keyBindingIdent] = option.name;
    }
};

MessageInput.prototype.exeCmd = function (name) {
    var args = Array.prototype.slice.call(arguments);
    args[0] = this;
    args.unshift(name);
    this._cmdRunner.invoke.apply(this._cmdRunner, args);
};


MessageInput.prototype._updateQuote = function () {
    this.$quote.data = this._quote;
    if (this._quote)
        this.addClass('as-has-quote');
    else
        this.removeClass('as-has-quote');
    this.notifySizeChange();
};

/**
 * @type {MessageInput}
 */
MessageInput.eventHandler = {};

MessageInput.eventHandler.preInputChange = function (event) {
    var text = this.$preInput.value;
    if (text.length > 0) {
        this.addClass('as-has-text');
    }
    else {
        this.removeClass('as-has-text');
    }

    if (text === this._editingText) {
        this.removeClass('as-text-changed');
    }
    else {
        this.addClass('as-text-changed');

    }
    this.notifySizeChange();
    this.notifyChange();
};

MessageInput.eventHandler.preInputKeyDown = function (event) {
    if (!(event.shiftKey || event.ctrlKey || event.altKey) && event.key === 'Enter') {
        this.notifySend();
        event.preventDefault();
    }
    else if ((event.shiftKey || event.ctrlKey || event.altKey) && event.key === 'Enter') {
        event.preventDefault();
        var text = this.$preInput.value;
        var selectedPos = this.$preInput.getSelectPosition();
        var newText = text.substr(0, selectedPos.start)
            + '\n' + text.substr(selectedPos.end);
        this.$preInput.applyData(newText, selectedPos.start + 1);
        this.notifySizeChange();
        this.$preInput.commitChange(newText, selectedPos.start + 1);
    }
    else if (event.key === "Escape" && this._mode === MODE_EDIT) {
        this.notifyCancel();
        event.preventDefault();
    }
    var keyBindingIdent = keyboardEventToKeyBindingIdent(event);
    if (this._keyMaps[keyBindingIdent]) {
        event.preventDefault();
        this.exeCmd(this._keyMaps[keyBindingIdent]);
    }
    setTimeout(this.notifySizeChange.bind(this), 1);
};

MessageInput.eventHandler.preInputKeyUp = function (event) {
    var value = this.$preInput.value;
    this._lastInputSelectPosion = this.$preInput.getSelectPosition() || { start: value.length, end: value.length };
    this.notifySizeChange();
};

MessageInput.eventHandler.preInputPasteImg = function (event) {
    if (this._mode == 'edit') return;
    this.addImageFiles(event.imageFiles, event.urls);
    this.notifyChange();
};


MessageInput.eventHandler.preInputFocus = function () {
    this.addClass('as-focus');
};

MessageInput.eventHandler.preInputBlur = function () {
    this.removeClass('as-focus');
};


MessageInput.eventHandler.clickEmojiBtn = function () {
    this.toggleEmoji();
};

MessageInput.eventHandler.mousedownOutEmoji = function (event) {
    if (EventEmitter["b" /* default */].hitElement(this.$emojiPicker, event) || EventEmitter["b" /* default */].hitElement(this.$emojiBtn, event)) return;
    this.closeEmoji();
};

MessageInput.eventHandler.pickEmoji = function (event) {
    var text = this.$preInput.value;
    var newText = text.substr(0, this._lastInputSelectPosion.start) + event.key + text.substr(this._lastInputSelectPosion.end);
    var selected = this._lastInputSelectPosion;
    var newOffset = selected.start + event.key.length;
    this._lastInputSelectPosion = { start: newOffset, end: newOffset };
    this.$preInput.focus();
    this.$preInput.applyData(newText, newOffset);
    this.$preInput.commitChange(newText, newOffset);
    this.notifySizeChange();
    this.$preInput.focus();//older firefox version will be lost focus
    // this.notifyChange();//not need
};


MessageInput.eventHandler.dragover = function (event) {
    event.preventDefault();
    this.addClass('as-drag-hover');
    this.notifySizeChange();
    if (this._hoverTimeout > 0)
        clearTimeout(this._hoverTimeout);
    var thisMi = this;
    this._hoverTimeout = setTimeout(function () {
        thisMi._hoverTimeout = -1;
        thisMi.removeClass('as-drag-hover');
        thisMi.notifySizeChange();
    }, 200);
    //todo:
};

MessageInput.eventHandler.drop = function (event) {
    event.preventDefault();
    var imageFiles = [];
    var otherFiles = [];
    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 {
                    if (!!file.type && file.type.match && file.type.match(/^image\//)) {
                        imageFiles.push(file);
                    }
                    else {
                        otherFiles.push(file);
                    }
                }

            }
        }
    }
    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 {
                if (!!file.type && file.type.match && file.type.match(/^image\//)) {
                    imageFiles.push(file);
                }
                else {
                    otherFiles.push(file);
                }
            }
        }
    }

    this.addImageFiles(imageFiles);
    this.addFiles(otherFiles);
    this.notifyChange();
};

MessageInput.eventHandler.clickQuoteRemoveBtn = function () {
    this.quote = null;
    this.notifyChange();
}

MessageInput.property = {};

MessageInput.property.files = {
    set: function (value) {
        MessageInput_$$('.as-file', this.$attachmentCtn).forEach(function (elt) {
            elt.remove();
        });
        value = value || [];
        this._files = [];
        this.addFiles(value);
    },
    get: function () {
        return this._files;
    }
};

MessageInput.property.images = {
    set: function (value) {
        MessageInput_$$('.as-image', this.$attachmentCtn).forEach(function (elt) {
            elt.remove();
        });
        value = value || [];
        this._imageFiles = [];
        this.addImageFiles(value);
    },
    get: function () {
        return this._imageFiles;
    }
};

MessageInput.property.text = {
    set: function (text) {
        this.$preInput.value = '' + text;
        if (text.length > 0) {
            this.addClass('as-has-text');
        }
        else {
            this.removeClass('as-has-text');
        }
        if (this._mode === MODE_EDIT) {
            this._editingText = text;
        }
        this.removeClass('as-text-changed');
    },
    get: function () {
        return this.$preInput.value;
    }
};


/**
 * @type {MessageInput}
 */
MessageInput.property.mode = {
    set: function (value) {
        value = value || MODE_NEW;
        if (value === MODE_EDIT || (value.toLowerCase && value.toLowerCase() === 'edit')) {
            this.addClass('as-mode-edit');
            value = MODE_EDIT;
            this._editingText = this.$preInput.value;
        }
        else {
            value = MODE_NEW;
            this._editingText = '';
            this.removeClass('as-mode-edit');
        }
        this.removeClass('as-text-changed');
        this._mode = value;
    },
    get: function () {
        return this._mode === MODE_EDIT ? 'edit' : 'new';
    }
};

MessageInput.property.autoSend = {
    set: function (value) {
        if (value) {
            this.addClass('as-auto-send');
        }
        else {
            this.removeClass('as-auto-send');
        }
    },
    get: function () {
        return this.containsClass('as-auto-send');
    }
};

MessageInput.property.quote = {
    set: function (quote) {
        this._quote = quote;
        this._updateQuote();
    },
    get: function () {
        return this._quote;
    }
}


ACore["a" /* default */].install(MessageInput);

/* harmony default export */ var js_MessageInput = (MessageInput);


var urlRex = /^(firefox|opera|chrome|https|http|wss|ws):\/\/[^\s]+$/;

function parseMessage(text, data) {
    data = data || {};
    data.emojiAssetRoot = data.emojiAssetRoot || js_EmojiPicker.assetRoot;
    data.staticSize = data.staticSize || 20;
    data.animSize = data.animSize || 60;
    var textLines = text.split(/\r?\n/);
    var lines = textLines.map(function (textLine) {
        var longTokenTexts = textLine.split(/\s/);
        var tokenGroups = longTokenTexts.map(function (longTokenText, longTokenIndex) {
            var tokens = [];
            if (longTokenIndex > 0) tokens.push({
                type: 'text',
                value: ' '
            });

            var emojiKey, emojiKeyTemp;
            var subIndex, subIndexTemp;
            var leftToken;
            var found;
            var emoji;
            while (longTokenText.length > 0) {
                found = false;
                subIndex = 10000000;
                for (var i = 0; i < js_EmojiAnims.length; ++i) {
                    emojiKeyTemp = js_EmojiAnims[i][0];
                    subIndexTemp = longTokenText.indexOf(emojiKeyTemp);
                    if (subIndexTemp >= 0 && subIndexTemp < subIndex) {
                        subIndex = subIndexTemp;
                        emojiKey = emojiKeyTemp;
                        emoji = js_EmojiAnims[i];
                        found = true;
                    }
                }

                if (found) {
                    if (subIndex >= 0) {
                        leftToken = longTokenText.substr(0, subIndex);
                        longTokenText = longTokenText.substr(subIndex + emojiKey.length);
                        if (leftToken.length > 0) {
                            tokens.push({
                                type: 'text',
                                value: leftToken
                            });
                        }
                        tokens.push({
                            type: 'emoji',
                            value: emoji
                        });
                        found = true;
                    }
                }
                else {
                    tokens.push({
                        type: 'text',
                        value: longTokenText
                    });
                    longTokenText = '';
                }
            }

            tokens.forEach(function (token) {
                if (token.type == 'text') {
                    var urlMatched = token.value.match(urlRex);
                    if (urlMatched) {
                        token.type = 'url';
                        token.protocal = urlMatched[1]
                    }
                }
            })
            return tokens;
        });
        var tokens = [];

        for (var i = 0; i < tokenGroups.length; ++i) {
            tokens.push.apply(tokens, tokenGroups[i]);
        }

        return tokens.reduce(function (ac, token) {
                if (token.type == 'text' && ac.last.type == 'text') {
                    ac.last.value += token.value;
                }
                else {
                    ac.last = token;
                    ac.result.push(token);
                }
                return ac;
            },
            { result: [], last: { type: 'null' } })
            .result;
    });
    var res = lines.reduce(function (ac, line, lineIndex, lines) {
        line.reduce(function (ac, token) {
            if (token.type == 'text') {
                ac.push({
                    tag: 'span',
                    child: { text: token.value }
                })
            }
            else if (token.type == 'url') {
                ac.push({
                    tag: 'a',
                    class: 'as-protocal-' + token.protocal,
                    child: { text: token.value },
                    props: {
                        href: token.value
                    }
                })
            }
            else if (token.type == 'emoji') {
                ac.push({
                    tag: 'span',
                    class: 'as-emoji-text',
                    child: { text: token.value[0] }
                });
                ac.push({
                    tag: 'img',
                    class: 'as-emoji',
                    props: {
                        src: data.emojiAssetRoot + '/static/x' + data.staticSize + '/' + token.value[1]
                    }
                })
            }
            return ac;
        }, ac);
        if (lineIndex < lines.length - 1 || line.length == 0)
            ac.push('br');
        return ac;
    }, []);
    if (res.length == 2 && res[1].class == 'as-emoji') {
        res[1].tag = 'iconsprite',
            res[1].props.fps = 30;
        res[1].props.src = res[1].props.src.replace('/static/x' + data.staticSize, '/anim/x' + data.animSize);
    }
    return res;
}

MessageInput.parseMessage = parseMessage;

function prepareIcon() {
    if (!MessageInput.iconSupportAsync) {
        var catalogiUrl = MessageInput.iconAssetRoot + '/catalog.json';
        MessageInput.iconSupportAsync = MessageInput.iconSupportAsync || iconCatalogCaches[catalogiUrl] ? Promise.resolve(iconCatalogCaches[catalogiUrl]) : Network_XHR.getRequest(catalogiUrl).then(function (result) {
            iconCatalogCaches[catalogiUrl] = JSON.parse(result);
            return iconCatalogCaches[catalogiUrl];
        });
    }
    return MessageInput.iconSupportAsync;
}


/***
 * @typedef MessageInputPluginOption
 * @property {string} [id]
 * @property {string|Object|AElement} icon
 * @property {function(_thisAdapter: MessageInputPlugin, _:Dom._, Dom.$):AElement} createContent
 * @property {function(_thisAdapter:MessageInputPlugin):void} onPressTrigger
 */


function MessageQuote() {
    prepareIcon();
    /***
     *
     * @type {null|MessageInputQuote}
     * @private
     */
    this._data = null;
    this.$img = MessageInput_$('.as-message-quote-img', this);
    this.$text = MessageInput_$('.as-message-quote-text', this);
    this.$desc = MessageInput_$('.as-message-quote-desc', this);
    this.$removeBtn = MessageInput_$('.as-message-quote-remove-btn', this)
        .on('click', this.eventHandler.clickRemoveBtn);
    Object.defineProperty(this, '$text', {
        set: function () {
            console.trace();
        },
        get: function () {
            return MessageInput_$('.as-message-quote-text', this);
        }
    })

}

MessageQuote.tag = 'MessageQuote'.toLowerCase();

MessageQuote.render = function () {
    return MessageInput_({
        extendEvent: 'pressremove',
        class: 'as-message-quote-box',
        child: [
            {
                class: 'as-message-quote-img'
            },
            {
                class: 'as-message-quote-sym',
                child: 'span.mdi.mdi-format-quote-open-outline'
            },
            {
                class: 'as-message-quote-content',
                child: [
                    {
                        class: 'as-message-quote-text',
                        child: {
                            text: ''
                        }
                    },
                    {
                        class: 'as-message-quote-desc',
                        child: { text: '' }
                    }
                ]
            },
            {
                tag: 'button',
                class: 'as-message-quote-remove-btn',
                child: 'span.mdi.mdi-close'
            }
        ]
    });
};

MessageQuote.property = {};
MessageQuote.eventHandler = {};

MessageQuote.property.removable = {
    set: function (val) {
        if (val) {
            this.addClass('as-removable');
        }
        else {
            this.removeClass('as-removable');
        }
    },
    get: function () {
        return this.containsClass('as-removable');
    }
};

MessageQuote.property.shortenText = {
    set: function (val) {
        if (val) {
            this.addClass('as-shorten-text');
        }
        else {
            this.removeClass('as-shorten-text');
        }
    },
    get: function () {
        return this.containsClass('as-shorten-text');
    }
};

MessageQuote.property.data = {
    set: function (quote) {
        this._data = quote;
        var text, desc;
        var file, img;
        if (typeof quote === "string") {
            text = quote;
            desc = ''
        }
        else if (quote && (typeof quote === "object")) {
            text = quote.text;
            desc = quote.desc;
            file = quote.file;
            img = quote.img;
        }


        if (text === undefined) {
            this.$text.clearChild();
            this.$desc.firstChild.data = '';
            this.removeClass('as-has-file');
            this.removeClass('as-has-img');
        }
        else {
            if (file) {
                file = file.toLowerCase().split('.').pop();
                MessageInput.iconSupportAsync.then(function (iconSupport) {
                    if (iconSupport.indexOf(file) < 0) file = 'default';
                    this.$img.addStyle('background-image', 'url(' + MessageInput.iconAssetRoot + '/' + file + '.svg)');
                }.bind(this));
                this.addClass('as-has-file');
            }
            else
                this.removeClass('as-has-file');

            if (img) {
                this.$img.addStyle('background-image', 'url(' + img + ')');
                this.addClass('as-has-img');
            }
            else this.removeClass('as-has-img');
            if (this.shortenText) text = text.split(/\r?\n/).shift();
            var parsedText = parseMessage(text);
            var textEltChain = parsedText.map(function (c) {
                return MessageInput_(c);
            });
            this.$text.clearChild().addChild(textEltChain);
            this.$desc.firstChild.data = desc;
        }
    },
    get: function () {
        return this.data;
    }
};

MessageQuote.eventHandler.clickRemoveBtn = function () {
    this.emit('pressremove', { target: this, type: 'pressclose' }, this);
};

ACore["a" /* default */].install(MessageQuote);


/***
 *
 * @param {MessageInput} inputElt
 * @param {MessageInputPluginOption} option
 * @constructor
 */
function MessageInputPlugin(inputElt, option) {
    this.inputElt = inputElt;
    this.icon = option.icon;
    this.id = option.id || randomIdent(16);
    this.$icon = null;
    this.$triggerBtn = null;
    this.$content = null;
    this.$popup = null;
    if (option.createContent) this.createContent = option.createContent;
    if (option.onPressTrigger) this.onPressTrigger = option.onPressTrigger;
    this.ev_pressTrigger = this.ev_pressTrigger.bind(this);
    this.ev_pressOut = this.ev_pressOut.bind(this);
    this.attach();
}


MessageInputPlugin.prototype.attach = function () {
    this.inputElt.$right.addChildBefore(this.getTriggerButton(), this.inputElt.$right.firstChild);
};

MessageInputPlugin.prototype.ev_pressTrigger = function (event) {
    var value = this.inputElt.$preInput.value;
    this._lastInputSelectPosion = this.inputElt.$preInput.getSelectPosition() || {
        start: value.length,
        end: value.length
    };
    if (this.onPressTrigger) {
        this.onPressTrigger(this);
    }
    else {
        if (this.isPopupOpened()) {
            this.closePopup();
        }
        else {
            this.openPopup();
        }
    }
};

MessageInputPlugin.prototype.insertText = function (itext) {
    if (!this._lastInputSelectPosion) {
        throw new Error('Invalid call');
    }

    var text = this.inputElt.$preInput.value;
    var newText = text.substr(0, this._lastInputSelectPosion.start) + itext + text.substr(this._lastInputSelectPosion.end);
    var selected = this._lastInputSelectPosion;
    var newOffset = selected.start + itext.length;
    this.inputElt.$preInput.focus();
    this.inputElt.$preInput.applyData(newText, newOffset);
    this.inputElt.$preInput.commitChange(newText, newOffset);
    this.inputElt.notifySizeChange();
    this.inputElt.$preInput.focus();
};


MessageInputPlugin.prototype.appendText = function (itext) {
    if (!this._lastInputSelectPosion) {
        throw new Error('Invalid call');
    }
    var text = this.inputElt.$preInput.value;
    var newText = text + itext;
    var newOffset = newText.length;
    this.inputElt.$preInput.focus();
    this.inputElt.$preInput.applyData(newText, newOffset);
    this.inputElt.$preInput.commitChange(newText, newOffset);
    this.inputElt.notifySizeChange();
    this.inputElt.$preInput.focus();
}

MessageInputPlugin.prototype.replaceText = function (itext) {
    if (!this._lastInputSelectPosion) {
        throw new Error('Invalid call');
    }
    var newText = itext;
    var newOffset = newText.length;
    this.inputElt.$preInput.focus();
    this.inputElt.$preInput.applyData(newText, newOffset);
    this.inputElt.$preInput.commitChange(newText, newOffset);
    this.inputElt.notifySizeChange();
    this.inputElt.$preInput.focus();
}


MessageInputPlugin.prototype.ev_pressOut = function (event) {
    if (EventEmitter["b" /* default */].hitElement(this.getTriggerButton(), event)) return;
    if (EventEmitter["b" /* default */].hitElement(this.getPopup(), event)) return;
    this.closePopup();
};


MessageInputPlugin.prototype.getIconElt = function () {
    if (!this.$icon)
        this.$icon = MessageInput_(this.icon);
    return this.$icon;
};


MessageInputPlugin.prototype.getTriggerButton = function () {
    if (!this.$triggerBtn) {
        this.$triggerBtn = MessageInput_({
            tag: 'button',
            class: ['as-message-input-plugin-btn', 'as-message-input-plugin-' + this.id],
            child: this.getIconElt(),
            on: {
                click: this.ev_pressTrigger
            }
        });
    }
    return this.$triggerBtn;
};

MessageInputPlugin.prototype.createContent = function (_thisAdapter, _, $) {
    throw  new Error("Not implement!");
};

/***
 *
 * @type {null|function(_thisAdapter:MessageInputPlugin):void}
 */
MessageInputPlugin.prototype.onPressTrigger = null;


MessageInputPlugin.prototype.getContent = function () {
    if (!this.$content)
        this.$content = this.createContent(this.inputElt, MessageInput_, MessageInput_$);
    return this.$content;
};


MessageInputPlugin.prototype.getPopup = function () {
    if (!this.$popup) {
        this.$popup = MessageInput_({
            class: 'as-message-input-external-tools-popup',
            child: this.getContent()
        });
    }
    return this.$popup;
};

MessageInputPlugin.prototype.openPopup = function () {
    if (this.isPopupOpened()) return;
    this.inputElt.appendChild(this.getPopup());
    document.body.addEventListener('click', this.ev_pressOut);
};


MessageInputPlugin.prototype.closePopup = function () {
    if (!this.isPopupOpened()) return;
    this.getPopup().remove();
    document.body.removeEventListener('click', this.ev_pressOut);

};

MessageInputPlugin.prototype.isPopupOpened = function () {
    return !!this.getPopup().parentElement;
};


MessageInput.prototype.PluginConstructor = MessageInputPlugin;

// EXTERNAL MODULE: ./node_modules/absol-acomp/css/numberinput.css
var numberinput = __webpack_require__(155);

// CONCATENATED MODULE: ./node_modules/absol-acomp/js/NumberInput.js








var NumberInput_ = ACore["a" /* default */]._;
var NumberInput_$ = ACore["a" /* default */].$;


function NumberInput() {
    this.eventHandler = OOP["a" /* default */].bindFunctions(this, NumberInput.eventHandler);
    this.$input = NumberInput_$('input', this)
        .on('keydown', this.eventHandler.keydown)
        .on('keyup', this.eventHandler.keyup)
        .on('paste', this.eventHandler.paste)
        .on('change', this.eventHandler.change);
    this.$input.value = 0;
    this._previusValue = 0;//to kwnow whenever the value changed
    this._value = 0;
    this._max = Infinity;
    this._min = -Infinity;
    this.$upBtn = NumberInput_$('.absol-number-input-button-up-container button', this)
        .on('mousedown', this.eventHandler.mouseDownUpBtn);
    this.$downBtn = NumberInput_$('.absol-number-input-button-down-container button', this)
        .on('mousedown', this.eventHandler.mouseDownDownBtn);

    this._decimalSeparator = '.';
    this._thousandsSeparator = '';
    this._floatFixed = -1;// unset
    this._decimalPadding = -1;//unset
}

NumberInput.tag = 'NumberInput'.toLowerCase();

NumberInput.render = function () {
    return 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'
                }
            }

        ]
    });
};


NumberInput.eventHandler = {};

NumberInput.eventHandler.mouseDownUpBtn = function (event) {
    if (EventEmitter["b" /* 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["b" /* 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);


// CONCATENATED MODULE: ./node_modules/absol-acomp/js/NumberSpanInput.js



var NumberSpanInput_ = ACore["a" /* default */]._;
var NumberSpanInput_$ = ACore["a" /* default */].$;


/***
 * @extends  AElement
 * @constructor
 */
function NumberSpanInput() {
    this.ev_keydown = this.ev_keydown.bind(this);
    this.on('keydown', this.ev_keydown, true);
    this.readOnly = false;
    this.value = 0;
    this.on('paste', function (event) {
        event.preventDefault();
    })
}

NumberSpanInput.tag = 'NumberSpanInput'.toLowerCase();
NumberSpanInput.render = function () {
    return NumberSpanInput_({ tag: 'span', child: { text: '' } });
};

NumberSpanInput.prototype.selectAll = function(){
    var sel;
    if (window.getSelection) {
        sel = window.getSelection();
        sel.removeAllRanges();
        var range = document.createRange();
        range.selectNode(this.childNodes[this.childNodes.length - 1]);
        sel.addRange(range);
    } else {
        console.error("TimePicker: Not support!")
    }
};

NumberSpanInput.prototype.selectEnd = function(){
    var sel;
    if (window.getSelection) {
        sel = window.getSelection();
        sel.removeAllRanges();
        this._autoAddZero();
        var length = this.firstChild.data.length;
        var range = document.createRange();
        range.setStart(this.firstChild, length);
        range.setEnd(this.firstChild, length);
        sel.addRange(range);
    } else {
        console.error("TimePicker: Not support!")
    }
};

NumberSpanInput.prototype.selectNone = function(){
    var sel;
    if (document.activeElement === this){
        sel = window.getSelection();
        sel.removeAllRanges();
    }
}

NumberSpanInput.prototype._autoAddZero = function (){
    if (!this.firstChild){
        this.addChild(NumberSpanInput_({text:'0'}));
    }
}

/***
 *
 * @param {KeyboardEvent} event
 */
NumberSpanInput.prototype.ev_keydown = function (event) {
    if (event.key && event.key.length == 1 && !event.ctrlKey && !event.altKey) {
        if (event.key.match(/[0-9]/)) {

        }
        else {
            event.preventDefault();
        }
    }
    else if (event.key == 'Enter'){
        event.preventDefault();
    }
};


NumberSpanInput.property = {};

NumberSpanInput.property.readOnly = {
    set: function (value) {
        this.contentEditable = !value;
    },
    get: function () {
        return this.contentEditable === false|| this.contentEditable === 'false';
    }
};

/***
 *
 * @type {NumberSpanInput}
 */
NumberSpanInput.property.value = {
    set: function (value) {
        this._autoAddZero();
        this.firstChild.data = value + '';
    },
    get: function () {
        return (this.firstChild && this.firstChild.data)||'';
    }
}

ACore["a" /* default */].install(NumberSpanInput);

/* harmony default export */ var js_NumberSpanInput = (NumberSpanInput);
// EXTERNAL MODULE: ./node_modules/absol-acomp/css/onscreenwindow.css
var onscreenwindow = __webpack_require__(157);

// 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/OnsScreenWindow.js







var OnsScreenWindow_ = ACore["a" /* default */]._;
var OnsScreenWindow_$ = ACore["a" /* default */].$;

/***
 * @extends AElement
 * @constructor
 */
function OnScreenWindow() {
    var res = this;
    this._lastSize = {
        width: 0,
        height: 0
    }
    res.$headerbar = OnsScreenWindow_$('.absol-onscreen-window-head-bar', res)
        .on('dragstart', res.eventHandler.beginDragHeaderbar);

    res.$bottomResizer = OnsScreenWindow_$('.absol-onscreen-window-resizer.absol-onscreen-window-resize-bottom', res)
        .on('dragstart', res.eventHandler.beginDragBottom);

    res.$rightResizer = OnsScreenWindow_$('.absol-onscreen-window-resizer.absol-onscreen-window-resize-right', res)
        .on('dragstart', res.eventHandler.beginDragRight);

    res.$topResizer = OnsScreenWindow_$('.absol-onscreen-window-resizer.absol-onscreen-window-resize-top', res)
        .on('dragstart', res.eventHandler.beginDragTop);

    res.$leftResizer = OnsScreenWindow_$('.absol-onscreen-window-resizer.absol-onscreen-window-resize-left', res)
        .on('dragstart', res.eventHandler.beginDragLeft);

    res.$bottomRightResizer = OnsScreenWindow_$('.absol-onscreen-window-resizer.absol-onscreen-window-resize-bottom-right', res)
        .on('dragstart', res.eventHandler.beginDragButtonRight);

    res.$bottomLeftResizer = OnsScreenWindow_$('.absol-onscreen-window-resizer.absol-onscreen-window-resize-bottom-left', res)
        .on('dragstart', res.eventHandler.beginDragBottomLeft);

    res.$topLeftResizer = OnsScreenWindow_$('.absol-onscreen-window-resizer.absol-onscreen-window-resize-top-left', res)
        .on('dragstart', res.eventHandler.beginDragTopLeft);

    res.$topRightResizer = OnsScreenWindow_$('.absol-onscreen-window-resizer.absol-onscreen-window-resize-top-right', res)
        .on('dragstart', 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["b" /* 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);
}

OnScreenWindow.tag = 'OnScreenWindow'.toLowerCase();

OnScreenWindow.render = function () {
    return OnsScreenWindow_({
        extendEvent: ['sizechange', 'drag', 'relocation'],
        class: 'absol-onscreen-window',
        child: {
            class: 'absol-onscreen-window-content',
            child: [
                {
                    tag: 'hanger',
                    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'
                },
                'hanger.absol-onscreen-window-resizer.absol-onscreen-window-resize-bottom',
                'hanger.absol-onscreen-window-resizer.absol-onscreen-window-resize-top',
                'hanger.absol-onscreen-window-resizer.absol-onscreen-window-resize-left',
                'hanger.absol-onscreen-window-resizer.absol-onscreen-window-resize-right',
                'hanger.absol-onscreen-window-resizer.absol-onscreen-window-resize-bottom-right',
                'hanger.absol-onscreen-window-resizer.absol-onscreen-window-resize-bottom-left',
                'hanger.absol-onscreen-window-resizer.absol-onscreen-window-resize-top-left',
                'hanger.absol-onscreen-window-resizer.absol-onscreen-window-resize-top-right'

            ]
        }
    });
};

OnScreenWindow.prototype.maybeSizeChange = function () {
    var bound = this.getBoundingClientRect();
    if (this._lastSize.width !== bound.width || this._lastSize.height !== bound.height) {
        this._lastSize = bound;
        window.dispatchEvent(new Event('resize'));
        this.emit('sizechange', {size: bound, target: this, type: 'sizechange'}, this);
    }
};

OnScreenWindow.eventHandler = {};

OnScreenWindow.eventHandler.beginDragHeaderbar = function (event) {
    if (!EventEmitter["b" /* default */].hitElement(this.$headerButtonCtn, event)) {
        this.$headerbar.on('drag', this.eventHandler.dragHeaderbar);
        this.$headerbar.on('dragend', this.eventHandler.endDragHeaderbar);
        var screenSize = Dom["b" /* 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 d = event.currentPoint.sub(event.startingPoint);
    var dx = d.x;
    var dy = d.y;
    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('dragend', this.eventHandler.endDragHeaderbar);
    this.__moveData__.modal.remove();
    this.__moveData__ = undefined;
    this.emit('relocation', { type: 'relocation', target: this }, this);
};


OnScreenWindow.eventHandler.beginDragBottom = function (event) {
    if (event.target != this.$bottomResizer) return;
    this.$bottomResizer.on('drag', this.eventHandler.dragBottom);
    this.$bottomResizer.on('dragend', this.eventHandler.endDragBottom);
    var screenSize = Dom["b" /* 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 d = event.currentPoint.sub(event.startingPoint);
    var dy = d.y;
    var newHeight = Math.max(this.__moveData__.minHeight, Math.min(this.__moveData__.maxHeight, this.__moveData__.bound.height + dy));
    this.addStyle('height', newHeight + 'px');
    this.maybeSizeChange();
};


OnScreenWindow.eventHandler.endDragBottom = function (event) {
    this.$bottomResizer.off('drag', this.eventHandler.dragBottom);
    this.$bottomResizer.off('dragend', 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('dragend', this.eventHandler.endDragRight);
    var screenSize = Dom["b" /* 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 d = event.currentPoint.sub(event.startingPoint);
    var dx = d.x;
    var newWidth = Math.max(this.__moveData__.minWidth, Math.min(this.__moveData__.maxWidth, this.__moveData__.bound.width + dx));
    this.addStyle('width', newWidth + 'px');
    this.maybeSizeChange();
};


OnScreenWindow.eventHandler.endDragRight = function (event) {
    this.$rightResizer.off('drag', this.eventHandler.dragRight);
    this.$rightResizer.off('dragend', 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('dragend', 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 d = event.currentPoint.sub(event.startingPoint);
    var dy = d.y;
    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('relocation', { type: 'relocation', target: this }, this);
    this.maybeSizeChange();
};


OnScreenWindow.eventHandler.endDragTop = function (event) {
    this.$topResizer.off('drag', this.eventHandler.dragTop);
    this.$topResizer.off('dragend', 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('dragend', 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 d = event.currentPoint.sub(event.startingPoint);
    var dx = d.x;
    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('relocation', { type: 'relocation', target: this }, this);
    this.maybeSizeChange();
};


OnScreenWindow.eventHandler.endDragLeft = function (event) {
    this.$leftResizer.off('drag', this.eventHandler.dragLeft);
    this.$leftResizer.off('dragend', 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('dragend', this.eventHandler.endDragButtonRight);
    var screenSize = Dom["b" /* 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 d = event.currentPoint.sub(event.startingPoint);
    var dx = d.x;
    var dy = d.y;
    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.maybeSizeChange();
};


OnScreenWindow.eventHandler.endDragButtonRight = function (event) {
    this.$bottomRightResizer.off('drag', this.eventHandler.dragButtonRight);
    this.$bottomRightResizer.off('dragend', 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('dragend', this.eventHandler.endDragBottomLeft);
    var bound = this.getBoundingClientRect();
    var minWidth = this.$windowTitle.getBoundingClientRect().right - bound.left + this.$headerButtonCtn.getBoundingClientRect().width;
    var screenSize = Dom["b" /* 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 d = event.currentPoint.sub(event.startingPoint);
    var dx = d.x;
    var dy = d.y;
    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('relocation', { type: 'relocation', target: this }, this);
};


OnScreenWindow.eventHandler.endDragBottomLeft = function (event) {
    this.$bottomLeftResizer.off('drag', this.eventHandler.dragLeft);
    this.$bottomLeftResizer.off('dragend', 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('dragend', 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 d = event.currentPoint.sub(event.startingPoint);
    var dx = d.x;
    var dy = d.y;
    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('relocation', { type: 'relocation', target: this }, this);
    this.maybeSizeChange();
};


OnScreenWindow.eventHandler.endDragTopLeft = function (event) {
    this.$topLeftResizer.off('drag', this.eventHandler.dragTopLeft);
    this.$topLeftResizer.off('dragend', 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('dragend', this.eventHandler.endDragTopRight);
    var screenSize = Dom["b" /* 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 d = event.currentPoint.sub(event.startingPoint);
    var dx = d.x;
    var dy = d.y;
    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('relocation', { type: 'relocation', target: this }, this);
    this.maybeSizeChange();
};


OnScreenWindow.eventHandler.endDragTopRight = function (event) {
    this.$topRightResizer.off('drag', this.eventHandler.dragTopRight);
    this.$topRightResizer.off('dragend', 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["b" /* 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);

/* harmony default export */ var OnsScreenWindow = (OnScreenWindow);
// EXTERNAL MODULE: ./node_modules/absol-acomp/css/pageselector.css
var pageselector = __webpack_require__(159);

// CONCATENATED MODULE: ./node_modules/absol-acomp/js/PageSelector.js




var PageSelector_ = ACore["a" /* default */]._;
var PageSelector_$ = ACore["a" /* default */].$;

function PageSelector() {
    this.$pageInput = PageSelector_$('.absol-page-number-input input', this);
    this.$pageInput.on('keyup', this.eventHandler.pressEnterKey);
    this.$prevBtn = PageSelector_$('li.page-previous', this);
    this.$nextBtn = PageSelector_$('li.page-next', this);
    this.$firstBtn = PageSelector_$('li.page-first', this);
    this.$lastBtn = PageSelector_$('li.page-last', this);
    this.$nextBtn.on('click', this.eventHandler.clickNext);
    this.$prevBtn.on('click', this.eventHandler.clickPrev);
    this.$firstBtn.on('click', this.eventHandler.clickFirst);
    this.$lastBtn.on('click', this.eventHandler.clickLast);
    this.$buttonContainer = PageSelector_$('.absol-page-number-buttons', this);
    this._buttons = [];
    this._pageOffset = 1;
    this._selectedIndex = 1;
    this._pageCount = 1;
    this._pageRange = 1;
    this.$pageInput.value = this._selectedIndex;
}

PageSelector.tag = 'PageSelector'.toLowerCase();

PageSelector.render = function (){
    return PageSelector_({
        class: ['absol-page-selector'],
        extendEvent: ['change'],
        child:
            [
                {
                    class: 'absol-page-number-input',
                    child: [{
                        tag: 'label',
                        child: { text: "Page" }
                    },
                        {
                            tag:'input',
                            attr:{
                                type:'text'
                            }
                        }]
                },

                {
                    tag: 'ul',
                    class: 'absol-page-number-buttons',
                    child: [
                        ' <li class="page-first">\
                        <a aria-controls="dtBasicExample" data-dt-idx="0" tabindex="0" class="absol-page-link">First</a>\
                    </li>',
                        ' <li class="page-previous">\
                        <a aria-controls="dtBasicExample" data-dt-idx="0" tabindex="0" class="absol-page-link">Previous</a>\
                    </li>',

                        '<li class="page-next" >\
                        <a aria-controls="dtBasicExample" data-dt-idx="7" tabindex="0" class="absol-page-link">Next</a>\
                    </li>',
                        ' <li class="page-last">\
                        <a aria-controls="dtBasicExample" data-dt-idx="0" tabindex="0" class="absol-page-link">Last</a>\
                    </li>',
                    ]
                }
            ]
    });
}


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: 'absol-page-number',
        child: {
            tag: 'a',
            attr: {  '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);

/* harmony default export */ var js_PageSelector = (PageSelector);
// EXTERNAL MODULE: ./node_modules/absol-acomp/css/preinput.css
var preinput = __webpack_require__(161);

// CONCATENATED MODULE: ./node_modules/absol-acomp/js/PreInput.js







var PreInput_ = ACore["a" /* default */]._;
var PreInput_$ = ACore["a" /* default */].$;
var textDelay = BrowserDetector["a" /* default */].isSafari ? 100 : 1;


/***
 * @extends AElement
 * @constructor
 */
function PreInput() {
    this.defineEvent(['pasteimg', 'pastetext', 'change']);
    this.on('paste', this.eventHandler.paste);
    this.on('keydown', this.eventHandler.keydown);
    this.history = [];
    this.historyIndex = -1;
    this.commitChange('', 0);
}


PreInput.tag = 'preinput';
PreInput.render = function () {
    return PreInput_({
        tag: 'pre',
        class: 'as-preinput',
        attr: {
            contenteditable: 'true'
        },
        child: 'br'
    });
};

PreInput.prototype.applyData = function (text, offset) {
    var textNode = PreInput_({ text: text });
    this.clearChild()
        .addChild(textNode).addChild(PreInput_('br'));

    if (document.activeElement == this && this.isDescendantOf(document.body)) {
        if (document.getSelection) {
            var sel = document.getSelection();
            sel.removeAllRanges();
            var range = document.createRange();
            if (typeof offset == 'number') {
                range.setStart(textNode, Math.min(text.length, offset));
            }
            else {
                range.setStart(textNode, Math.min(text.length, offset.start));
                range.setEnd(textNode, Math.min(text.length, offset.end));
            }
            sel.addRange(range);
            this.scrollIntoRange(range);

        }
        else {
            console.error("PreInput: Not support!");
        }
    }
};


PreInput.prototype.scrollIntoRange = function (range) {
    var elementBound = range.getBoundingClientRect();

    var viewportBound = this.getBoundingClientRect();
    var dBottom = 0;
    if (range.startContainer && range.startContainer.data && range.startContainer.data.charAt(range.startContainer.data.length - 1) == '\n')
        dBottom += this.getFontSize() * 1.5;
    var currentScrollTop = this.scrollTop;
    var newScrollTop = currentScrollTop;
    if (elementBound.bottom + dBottom > viewportBound.bottom) {
        newScrollTop = currentScrollTop + (elementBound.bottom + dBottom - 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;
    }
};

PreInput.prototype.undo = function () {
    if (this.historyIndex <= 0) return;
    this.historyIndex--;
    var record = this.history[this.historyIndex];
    this.applyData(record.text, record.offset);
    this.emit('change', { target: this, value: record.text, action: 'undo', record: record, type: 'change' }, this);
};


PreInput.prototype.redo = function () {
    if (this.historyIndex + 1 >= this.history.length) return;
    this.historyIndex++;
    var record = this.history[this.historyIndex];
    this.applyData(record.text, record.offset);
    this.emit('change', { target: this, value: record.text, action: 'redo', record: record, type: 'change' }, this);
};


PreInput.prototype.commitChange = function (text, offset) {
    while (this.historyIndex < this.history.length - 1) {
        this.history.pop();
    }
    var lastText = this.history.length > 0 ? this.history[this.history.length - 1].text : null;
    if (text === lastText) {
        if (this.history[this.history.length - 1].offset != offset)
            this.history[this.history.length - 1].offset = offset;
    }
    else {
        this.historyIndex = this.history.length;
        var record = {
            text: text,
            offset: offset
        };
        this.history.push(record);
        this.emit('change', {
            target: this,
            value: record.text,
            action: 'commit',
            record: record,
            type: 'change'
        }, this);
    }
};

PreInput.prototype.waitToCommit = function (text, offset) {
    var thisInput = this;
    if (this._commitTimeout > 0)
        clearTimeout(this._commitTimeout);
    this._commitTimeout = setTimeout(function () {
        thisInput.commitChange(text, offset);
    }, textDelay);
};

PreInput.prototype.getPosition = function (node, offset) {
    if (!node) return NaN;
    if (node == this)
        return offset;
    var parent = node.parentElement;
    if (!parent) return NaN;
    var text = '';
    var child;
    var lastBr = false;
    for (var i = 0; i < parent.childNodes.length; ++i) {
        child = parent.childNodes[i];
        if (child == node) break;
        text += this.stringOf(child);
    }
    return this.getPosition(parent, text.length + offset);
};


PreInput.prototype.getSelectPosition = function () {
    if (window.getSelection) {
        var sel = window.getSelection();
        if (sel.getRangeAt && sel.rangeCount) {
            var range = sel.getRangeAt(0);
            var startOffset = this.getPosition(range.startContainer, range.startOffset);
            var endOffset = this.getPosition(range.endContainer, range.endOffset);
            if (isNaN(startOffset)) return null;
            return {
                start: startOffset, end: endOffset
            }
        }
    }
    else if (document.selection) {
        console.error('May not support!');
    }
};

PreInput.prototype.stringOf = function (node) {
    if (!node) return '';
    if (node.nodeType == 3) {
        return node.data;
    }
    if (node.tagName == 'BR' || node.tagName == 'br') {
        return '\n';
    }
    var thisInput = this;

    return Array.prototype.map.call(node.childNodes, function (cNode, index, arr) {
        if ((cNode.tagName == 'BR' || cNode.tagName == 'br') && (index + 1 >= arr.length)) return '';
        return thisInput.stringOf(cNode);
    }).join('');

}


PreInput.prototype._pasteText = function (text) {
    var sel = window.getSelection();
    var range;
    if (window.getSelection) {

        sel = window.getSelection();
        if (sel.getRangeAt && sel.rangeCount) {
            try {

                range = sel.getRangeAt(0);
                range.deleteContents();

                var textNode = PreInput_({ text: text });
                range.insertNode(textNode);
                if (sel.removeRange) {
                    sel.removeRange(range);
                }
                else {
                    sel.removeAllRanges();
                }
                range = document.createRange();
                range.setStart(textNode, text.length);
                sel.addRange(range);
                this.scrollIntoRange(range);
                this.commitChange(this.stringOf(this), this.getPosition(textNode, text.length));
            } catch (error) {
                alert(error.message)
            }
        }
    }
    else if (document.selection && document.selection.createRange) {
        document.selection.createRange().text = text;
        this.commitChange(this.stringOf(this), this.getPosition(textNode, text.length));
        console.error('May not support!');
    }
};


/**
 * @type {PreInput}
 */
PreInput.eventHandler = {};


PreInput.eventHandler.paste = function (event) {
    var thisIp = this;
    var clipboardData = (event.clipboardData || window.clipboardData);
    /**Safari bug */
    if (clipboardData) {
        if (clipboardData.items) {
            var items = Array.prototype.slice.call(clipboardData.items);
            var imgItems = items.filter(function (item) {
                return item.type.indexOf('image') >= 0;
            });

            var plainTextItems = items.filter(function (item) {
                return item.type.indexOf('text/plain') >= 0;
            });

            if (imgItems.length > 0) {
                var imgFiles = imgItems.map(function (it) {
                    return it.getAsFile();
                });
                this.emit('pasteimg', {
                    target: this,
                    imageFile: imgFiles[0],
                    imageFiles: imgFiles,
                    orginEvent: event
                }, this);
            }
            else if (plainTextItems.length > 0) {

                var plainTextItem = plainTextItems[0];//only one item
                plainTextItem.getAsString(function (text) {
                    thisIp._pasteText(text);
                });
            }
            else {
                window.ABSOL_DEBUG && console.error("Can not handle clipboard data");
            }
            event.preventDefault();
        }
        else {
            var text = event.clipboardData.getData('text/plain');
            if (text) {
                event.preventDefault();
                this._pasteText(text);
            }
            else {
                var currentText = this.stringOf(this);
                var currentSelection = this.getSelectPosition();

                setTimeout(function () {
                    var images = [];
                    PreInput_$('img', thisIp, function (elt) {
                        images.push(elt);
                    });

                    Promise.all(images.map(function (img) {
                        return Dom["b" /* default */].imageToCanvas(img).then(function (canvas) {
                            var dataURI = canvas.toDataURL();
                            var blob = dataURItoBlob(dataURI);
                            var file = blobToFile(blob);
                            return {
                                file: file, blob: blob, url: dataURI
                            }
                        }, function (error) {
                            console.error(error)
                        }).catch(function (error) {
                            console.error(error)
                        });
                    })).then(function (results) {
                        results = results.filter(function (it) {
                            return !!it;
                        });
                        if (results.length > 0) {
                            var imgFiles = results.map(function (it) {
                                return it.file
                            });
                            var urls = results.map(function (it) {
                                return it.url
                            });
                            thisIp.emit('pasteimg', {
                                target: this,
                                imageFile: imgFiles[0],
                                imageFiles: imgFiles,
                                urls: urls,
                                url: urls[0],
                                orginEvent: event
                            }, thisIp);
                        }
                    });
                    thisIp.applyData(currentText, currentSelection);
                }, textDelay);

            }
        }
    }
    else {
        setTimeout(function () {
            if (window.getSelection) {
                var sel = window.getSelection();
                if (sel.getRangeAt && sel.rangeCount) {
                    var range = sel.getRangeAt(0);
                    var text = this.stringOf(this);
                    var offset = this.getPosition(range.startContainer, range.startOffset);
                    this.waitToCommit(text, offset);
                }
            }
            else if (document.selection) {
                console.error('May not support!');
            }
        }.bind(this), textDelay);
    }
};


PreInput.eventHandler.keydown = function (event) {
    if (event.ctrlKey) {
        switch (event.key) {
            case 'z':
                this.undo();
                event.preventDefault();
                break;
            case 'y':
                this.redo();
                event.preventDefault();
                break;

            default:
                break;
        }
    }
    if (!event.ctrlKey && !event.altKey) {
        setTimeout(function () {
            if (window.getSelection) {
                var sel = window.getSelection();
                if (sel.getRangeAt && sel.rangeCount) {
                    var range = sel.getRangeAt(0);
                    var text = this.stringOf(this);
                    var offset = this.getPosition(range.startContainer, range.startOffset);
                    this.waitToCommit(text, offset);
                }
            }
            else if (document.selection) {
                console.error('May not support!');
            }
        }.bind(this), textDelay);
    }
};

PreInput.property = {};

PreInput.property.value = {
    set: function (value) {
        value = value || '';
        this.applyData(value, value.length);
        this.commitChange(value, value.length);
    },
    get: function () {
        return this.stringOf(this);
    }
};


ACore["a" /* default */].install(PreInput);

/* harmony default export */ var js_PreInput = (PreInput);
// EXTERNAL MODULE: ./node_modules/absol-acomp/css/progressbar.css
var progressbar = __webpack_require__(163);

// CONCATENATED MODULE: ./node_modules/absol-acomp/js/ProgressBar.js



var ProgressBar_ = ACore["a" /* default */]._;
var ProgressBar_$ = ACore["a" /* default */].$;


function ProgressBar() {
    this._value = 0;
    this._variant = null;
    this.$value = ProgressBar_$('.as-progress-bar-value', this);
    this._striped = false;
    this._animated = false;
}

ProgressBar.tag = 'ProgressBar'.toLowerCase();
ProgressBar.render = function () {
    return ProgressBar_({
        class: 'as-progress-bar',
        child: {
            class: 'as-progress-bar-value'
        }
    });
};


ProgressBar.property = {};


/**
 * @type {ProgressBar}
 */
ProgressBar.property.variant = {
    set: function (value) {
        if (this._variant) {
            this.removeClass('as-variant-' + this._variant);
        }
        if (value) {
            this.addClass('as-variant-' + value)
        }
        else {
            value = null;
        }
        this._variant = value;
    },
    get: function () {
        return this._variant;
    }

};

/**
 * @type {ProgressBar}
 */
ProgressBar.property.value = {
    set: function (value) {
        value = Math.max(0, Math.min(1, value || 0));
        this._value = value;
        this.$value.addStyle('width', value * 100 + '%');

    },
    get: function () {
        return this._value;
    }
};


ProgressBar.property.animated = {
    set: function (value) {
        value = !!value;
        this._striped = value;
        if (value) {
            this.addClass('as-animated');
        }
        else {
            this.removeClass('as-animated');
        }
    },
    get: function () {
        return this._animated;
    }
}

ProgressBar.property.striped = {
    set: function (value) {
        value = !!value;
        this._striped = value;
        if (value) {
            this.addClass('as-striped');
        }
        else {
            this.removeClass('as-striped');
        }
    },
    get: function () {
        return this._striped;
    }
}


ACore["a" /* default */].install(ProgressBar);


/* harmony default export */ var js_ProgressBar = (ProgressBar);
// EXTERNAL MODULE: ./node_modules/absol-acomp/css/quicklistbutton.css
var quicklistbutton = __webpack_require__(165);

// CONCATENATED MODULE: ./node_modules/absol-acomp/js/FollowerToggler.js




var FollowerToggler_ = ACore["a" /* default */]._;
var FollowerToggler_$ = ACore["a" /* default */].$;

/***
 * @extends AElement
 * @constructor
 */
function FollowerToggler() {
    this.defineEvent(['close', 'open', 'preopen']);
    this.on('click', this.eventHandler.click);
    this.addClass('as-follower-trigger');
    this.$follower = null;
    this._opened = false;
}

FollowerToggler.tag = 'FollowerToggler'.toLowerCase();

FollowerToggler.render = function () {
    return FollowerToggler_('div');
};

FollowerToggler.prototype.toggle = function () {
    if (this._opened) this.close();
    else this.open();
};

FollowerToggler.prototype.open = function () {
    if (this._opened) return;
    this._opened = true;
    this.addClass('as-follower-trigger-open');
    if (!this.$follower) return;
    this.emit('preopen', { name: 'preopen', target: this }, this);
    var thisTg = this;
    setTimeout(function () {
        thisTg.$follower.refollow();
        thisTg.$follower.removeClass('absol-follower-hidden');
        document.body.addEventListener('click', thisTg.eventHandler.clickBody);
        thisTg.emit('open', { name: 'open', target: this }, this);
    }, 1);
};

FollowerToggler.prototype.close = function () {
    if (!this._opened) return;
    this._opened = false;
    this.removeClass('as-follower-trigger-open');
    if (!this.$follower) return;
    this.$follower.unfollow();
    this.$follower.addClass('absol-follower-hidden');
    document.body.removeEventListener('click', this.eventHandler.clickBody);
    this.emit('close', { name: 'close', target: this }, this);
};


FollowerToggler.prototype.bindFollower = function (elt) {
    if (this.$follower) {
        this.$follower.followTarget = null;
    }
    if (elt && elt.refollow) {
        if (this._opened)
            elt.removeClass('absol-follower-hidden');
        else
            elt.addClass('absol-follower-hidden');
        elt.followTarget = this;
        this.$follower = elt;
    }
    else {
        throw new Error("Must be a follower!");
    }
}

FollowerToggler.eventHandler = {};

FollowerToggler.eventHandler.clickBody = function (event) {
    if (EventEmitter["b" /* default */].hitElement(this, event) || EventEmitter["b" /* default */].hitElement(this.$follower, event))
        return;
    this.close();
};


FollowerToggler.eventHandler.click = function () {
    this.toggle();
};

ACore["a" /* default */].install(FollowerToggler);

/* harmony default export */ var js_FollowerToggler = (FollowerToggler);
// CONCATENATED MODULE: ./node_modules/absol-acomp/js/QuickListButton.js




 var QuickListButton_ = ACore["a" /* default */]._;
var QuickListButton_$ = ACore["a" /* default */].$;

/****
 * @extends FollowerToggler
 * @constructor
 */
function QuickListButton() {
    this.$shareFollower = QuickListButton.getFollower();
    QuickListButton_({
        tag: 'followertoggler', elt: this,
        on: {
            preopen: this.eventHandler.preopen,
            close: this.eventHandler.closeFollower
        }
    });
    this.bindFollower(this.$shareFollower);
    this.$iconCtn.remove();
    this.$content.addChild(this.$iconCtn);
    this._items = this._items;
    this._anchor = [];
    this.$list = null;
    this._listUpdated = true;
    this._opened = false;
    this.anchor = [12, 13, 15, 14];//todo: add property
}


QuickListButton.$follower = QuickListButton_('follower.as-quick-list-button-follower');

QuickListButton.getFollower = function () {
    if (!QuickListButton.$follower)
        QuickListButton.$follower = QuickListButton_('follower.as-quick-list-button-follower');
    return QuickListButton.$follower;
};

QuickListButton.tag = 'QuickListButton'.toLowerCase();

QuickListButton.render = function () {
    return QuickListButton_({
        tag: 'flexiconbutton',
        class: 'as-quick-list-button',
        extendEvent: 'select',
        props: {
            text: "+ Thêm",
            icon: 'span.mdi.mdi-menu-down'
        }
    });
};


QuickListButton.property = {};

QuickListButton.property.items = {
    set: function (value) {
        value = value || [];
        this._items = value;
        this._listUpdated = false;
    },
    get: function () {
        return this._items;
    }
};

/**
 * @type {QuickListButton}
 */
QuickListButton.eventHandler = {};


QuickListButton.eventHandler.preopen = function () {
    this.$shareFollower.addTo(document.body);
    this.$shareFollower.anchor = this.anchor;
    if (this.$list == null) {
        this.$list = QuickListButton_('selectlist.absol-bscroller')
            .on('pressitem', this.eventHandler.pressitem);
    }
    if (!this._listUpdated) {
        this._listUpdated = true;
        this.$list.items = this._items;
    }
    this.$shareFollower.addChild(this.$list);
    this.$shareFollower.on({
        preupdateposition: this.eventHandler.preUpdatePosition,
    });

};

QuickListButton.eventHandler.preUpdatePosition = function () {
    var bound = this.getBoundingClientRect();
    var screenSize = Dom["b" /* default */].getScreenSize();
    var maxHeight = Math.max(screenSize.height - bound.bottom, bound.top) - 10;
    this.$list.addStyle('max-height', maxHeight + 'px');
};

QuickListButton.eventHandler.closeFollower = function () {
    this.$shareFollower.off({
        preupdateposition: this.eventHandler.preUpdatePosition
    });
};

QuickListButton.eventHandler.pressitem = function (event) {
    this.close();
    this.emit('select', Object.assign({}, event, { type: 'select', target: this }));
};


ACore["a" /* default */].install(QuickListButton);

/* harmony default export */ var js_QuickListButton = (QuickListButton);
// EXTERNAL MODULE: ./node_modules/absol-acomp/css/selectlist.css
var selectlist = __webpack_require__(51);

// 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 = {};
            this.lastInGroup = false;
            this.isLeaf = false;
            this.selected = false;
        }
        else {
            this.$textValue.data = value.text || '';
            this.$descValue.data = value.desc || '';
            this.level = value.level || 0;

            this.extendClasses = value.extendClasses;
            this.extendStyle = value.extendStyle;
            this.lastInGroup = !!(value.lastInGroup);
            this.isLeaf = !!(value.isLeaf);
            this.selected = !!(value.selected);
        }
    },
    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;
    }
};


SelectListItem.property.lastInGroup = {
    set: function (value) {
        if (value) {
            this.addClass('as-last-in-group');
        }
        else {
            this.removeClass('as-last-in-group');
        }
    },
    get: function () {
        return this.containsClass('as-last-in-group');
    }
};

SelectListItem.property.isLeaf = {
    set: function (value) {
        if (value) {
            this.addClass('as-is-leaf');
        }
        else {
            this.removeClass('as-is-leaf');
        }
    },
    get: function () {
        return this.containsClass('as-is-leaf');
    }
};

SelectListItem.property.selected = {
    set: function (value) {
        if (value) {
            this.addClass('as-selected');
        }
        else {
            this.removeClass('as-selected');
        }
    },
    get: function () {
        return this.containsClass('as-selected');
    }
};

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;
    })();
}

var itemPool = [];

function onMousedownItem(event) {
    if (EventEmitter["b" /* default */].isMouseRight(event)) return;
    var thisSL = this.$parent;
    if (thisSL) {
        thisSL.value = this.value;
        thisSL.emit('pressitem', {
            type: 'pressitem',
            target: thisSL,
            itemElt: this,
            value: this.value,
            data: this.data
        });
    }
}

function makeItem() {
    return SelectList_({
        tag: 'selectlistitem',
        on: {
            mousedown: onMousedownItem
        }
    });
}

function requireItem($parent) {
    var item;
    if (itemPool.length > 0) {
        item = itemPool.pop();
    }
    else {
        item = makeItem();
    }
    item.$parent = $parent;
    return item;
}

function releaseItem(item) {
    item.$parent = null;
    item.removeClass('selected');
    itemPool.push(item);
};


function measureMaxDescriptionWidth(items) {
    var maxDescWidth = 0;
    var maxText = 0;
    var maxEst = 0;
    var est;
    for (var i = 0; i < items.length; ++i) {
        if (items[i].desc) {
            est = estimateWidth14(items[i].desc);
            if (est > maxEst) {
                maxEst = est;
                maxText = items[i].desc;
            }
        }
    }
    if (maxText)
        maxDescWidth = measureText(maxText, 'italic 14px  sans-serif').width;
    return maxDescWidth;
};


function measureMaxTextWidth(items) {
    var maxTextWidth = 0;
    var maxText = 0;
    var maxEst = 0;
    var maxLv = 0;
    var est;
    var text;
    var item;
    for (var i = 0; i < items.length; ++i) {
        item = items[i];
        if (item.text) {
            text = item.text;
            est = estimateWidth14(text) + 14 * 0.9 * (item.level || 0);
            if (est > maxEst) {
                maxEst = est;
                maxText = text;
                maxLv = item.level||0;
            }
        }
    }
    if (maxText)
        maxTextWidth = 14 * 0.9 * maxLv + measureText(maxText, '14px Arial, Helvetica, sans-serif').width + 14;//padding left, right 7px
    return maxTextWidth;
}

function measureListHeight(items) {
    var border = 0;
    var n = items.length - 1;
    return items.length * 20 + border;
}

function measureListSize(items) {
    var descWidth = measureMaxDescriptionWidth(items);
    var textWidth = measureMaxTextWidth(items);
    var width = textWidth;
    if (descWidth > 0) {
        width += descWidth + 14;
    }
    var height = measureListHeight(items);
    return {
        width: width,
        height: height,
        descWidth: descWidth,
        textWidth: textWidth
    };
}

/*global absol*/
/***
 * @extends AElement
 * @constructor
 */
function SelectList() {
    var thisSL = this;
    this.defineEvent(['pressitem', 'cancelasync', 'valuevisibilityasync', 'finishasync', 'sizechangeasync']);
    this.$attachhook = SelectList_('attachhook').addTo(this);
    this.sync = new Promise(function (rs) {
        thisSL.$attachhook.once('error', rs);
    });
    this.$items = [];
    this.$itemByValue = {};//quick find element
    this.$selectedItem = undefined;
    this.measuredSize = {
        width: 0,
        height: 0,
        descWidth: 0,
        textWidth: 0
    };

    this._itemSession = 0;
    this._finished = true;

};

SelectList.tag = "SelectList".toLowerCase();

SelectList.render = function () {
    return SelectList_('.absol-selectlist');
};

SelectList.prototype._updateSelectedItem = function () {
    var newSelectedItemElt = this.$itemByValue[this._selectValue];
    if (newSelectedItemElt != this.$selectedItem) {
        if (this.$selectedItem) {
            this.$selectedItem.removeClass('selected');
        }
        if (newSelectedItemElt) {
            newSelectedItemElt.addClass('selected');
            this.$selectedItem = newSelectedItemElt;
        }
    }
};


SelectList.prototype._requireItems = function (itemCout) {
    var item;
    while (this.$items.length < itemCout) {
        item = requireItem(this);
        this.$items.push(item);
        this.addChild(item);
    }

    while (this.$items.length > itemCout) {
        item = this.$items.pop();
        item.remove();
        releaseItem(item);
    }
};

SelectList.prototype._assignItems = function (from, to) {
    var foundSelected = false;
    var itemElt;
    var item;
    for (var i = from; i < to; ++i) {
        itemElt = this.$items[i];
        item = this._items[i];
        itemElt.data = item;
        itemElt.__index__ = i;
        if (this.$itemByValue[item.value]) {
            console.warn('Value  ' + this.$items[i].value + ' is duplicated!');
        }
        else {
            this.$itemByValue[item.value] = itemElt;
            if (this._selectValue == item.value) {
                itemElt.addClass('selected');
                this.$selectedItem = itemElt;
                foundSelected = true;
            }
            else {
                itemElt.removeClass('selected');
            }
        }
    }
    return foundSelected;
};


SelectList.prototype.setItemsAsync = function (items) {
    //start process
    this._finished = false;
    var session = Math.floor(Math.random() * 1000000);
    this._itemSession = session;
    this._items = items || [];
    this.$itemByValue = {};
    this.measuredSize = measureListSize(items);
    this.style.setProperty('--select-list-desc-width', this.measuredSize.descWidth + 'px'); //addStyle notWork because of convert to cameCase 

    var thisSL = this;
    var i = 0;
    var limit = 20;

    function tick() {
        if (thisSL._itemSession != session) {
            thisSL.emit('cancelasync', { session: session, type: 'cancelasync' }, this);
            return;
        }
        if (i >= items.length) {
            thisSL._updateSelectedItem();
            thisSL._finished = false;
            thisSL.emit('finishasync', { session: session, type: 'finishasync' }, this);
            return;
        }

        var n = Math.min(items.length - i, limit);
        var itemCout = i + n;
        thisSL._requireItems(itemCout);
        i = itemCout;

        var foundSelected = thisSL._assignItems(itemCout - n, itemCout);
        if (foundSelected) {
            thisSL.emit('valuevisibilityasync', {
                session: session,
                type: 'valuevisibilityasync',
                itemElt: thisSL.$items[i]
            }, thisSL);
        }

        thisSL.emit('sizechangeasync', { session: session, type: 'sizechangeasync' }, this);
        setTimeout(tick, 2);
    }

    setTimeout(tick, 2);
    return Object.assign({ session: session }, this.measuredSize);
};


SelectList.prototype.setItems = function (items) {
    this._finished = false;
    var session = Math.floor(Math.random() * 1000000);
    this._itemSession = session;
    this._items = items || [];
    this.$itemByValue = {};
    this.measuredSize = measureListSize(items);
    this.style.setProperty('--select-list-desc-width', this.measuredSize.descWidth + 'px'); //addStyle notWork because of convert to cameCase 
    var itemCount = items.length;
    this._requireItems(itemCount);
    this._assignItems(0, itemCount);

    this._finished = true;
    return {
        session: this._itemSession,
        width: this._descWidth + this._textWidth + 14,
        height: this._height
    }
};


SelectList.property = {};

/**
 * @type {SelectList}
 */
SelectList.property.items = {
    set: function (value) {
        value = value || [];
        this.setItems(value);
    },
    get: function () {
        return this._items || [];
    }
};


SelectList.property.value = {
    set: function (value) {
        this._selectValue = value;
        this._updateSelectedItem();
    },

    get: function () {
        return this._selectValue;
    }
};

SelectList.property.item = {
    get: function () {
        if (this.$selectedItem) return this.$selectedItem.data;
        return undefined;
    }
};


SelectList.property.selectedIndex = {
    get: function () {
        throw new Error("selectedIndex getter is deprecated");
    }
};


SelectList.prototype.init = function (props) {
    props = props || {};
    var value = props.value;
    delete props.value;
    this.super(props);
    if (value !== undefined)
        this.value = value;
};

SelectList.eventHandler = {};

ACore["a" /* default */].install(SelectList);


/* harmony default export */ var js_SelectList = (SelectList);



// 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
    this._contextMenuSync = Promise.resolve();
}

QuickMenu.tag = 'QuickMenu'.toLowerCase();

QuickMenu.render = function () {
    return QuickMenu_({
        tag: 'vmenu',
        extendEvent: 'requestcontextmenu',
        class: [
            'as-quick-menu', 'as-bscroller'
        ],
        style: {
            'overflow-y': 'auto',
            'box-sizing': 'border-box'
        }
    });
};


ACore["a" /* default */].install(QuickMenu);
QuickMenu.PRIORITY_ANCHORS = [0, 3, 7, 4, 1, 2, 6, 5];
QuickMenu.DEFAULT_ANCHOR = 0;

QuickMenu.$elt = QuickMenu_('quickmenu');
QuickMenu.$element = undefined;
QuickMenu.$anchor = QuickMenu_('.absol-context-menu-anchor');
QuickMenu.$anchor.addChild(QuickMenu.$elt);

QuickMenu._acceptAnchors = 0;
QuickMenu._previewAnchor = QuickMenu.DEFAULT_ANCHOR;
QuickMenu._session = Math.random() * 10000000000 >> 0;
QuickMenu._menuListener = undefined;
QuickMenu._scrollOutListener = undefined;

QuickMenu.$elt.on('press', function (event) {
    if (QuickMenu._menuListener) QuickMenu._menuListener(cleanMenuItemProperty(event.menuItem));
});


QuickMenu.updatePosition = function () {

    if (!QuickMenu.$element) return;
    var menu = QuickMenu.$elt;
    var anchor = QuickMenu.$anchor;
    var eBound = QuickMenu.$element.getBoundingClientRect();
    var outBound = Object(Dom["f" /* traceOutBoundingClientRect */])(QuickMenu.$element);

    if (eBound.bottom < outBound.top || eBound.left > outBound.right || eBound.top > outBound.bottom
        || eBound.right < outBound.left) {
        QuickMenu._scrollOutListener && QuickMenu._scrollOutListener();
    }

    var qBound = menu.getBoundingClientRect();
    outBound = Object(Dom["d" /* getScreenSize */])();
    outBound.left = 0;
    outBound.right = outBound.width;
    outBound.top = 0;
    outBound.bottom = outBound.height;
    //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 - qBound.width;
        }

        if (anchor == 3 || anchor == 4) {
            x = eBound.left - qBound.width;
        }

        if (anchor == 4 || anchor == 7) {
            y = eBound.bottom - qBound.height;
        }

        if (anchor == 5 || anchor == 6) {
            y = eBound.top - qBound.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, qBound.width, qBound.height);
        viewSquare = outRect.collapsedSquare(menuRect);

        if (viewSquare - 0.01 > bestSquare) {
            bestSquare = viewSquare;
            pos = cPos;
            QuickMenu._previewAnchor = cAnchor;
            bestRect = outRect.collapsedRect(menuRect);
        }
    }

    anchor.addStyle({
        left: pos.x + 'px',
        top: pos.y + 'px'
    });
};

QuickMenu._scrollEventHandler = QuickMenu.updatePosition.bind(QuickMenu);
QuickMenu.$scrollTrackElements = [];


QuickMenu.show = function (element, menuProps, anchor, menuListener, darkTheme) {
    var menuElt = QuickMenu.$elt;
    var anchorElt = QuickMenu.$anchor;
    //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.$anchor.addTo(document.body)
    Dom["b" /* default */].addToResizeSystem(QuickMenu.$elt);
    QuickMenu.$elt.updateSize = QuickMenu.updatePosition.bind(QuickMenu);
    QuickMenu.$element = element;
    QuickMenu.$element.classList.add('as-quick-menu-attached');
    QuickMenu._menuListener = menuListener;

    Object.assign(menuElt, menuProps);
    if (darkTheme) anchorElt.addClass('dark');
    else anchorElt.removeClass('dark');
    menuElt.removeStyle('visibility');//for prevent size change blink
    QuickMenu.$anchor.addClass('absol-active');

    QuickMenu.updatePosition();
    setTimeout(function () {
        menuElt.addStyle('visibility', 'visible');
    }, BrowserDetector["a" /* default */].isMobile ? 33 : 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._session = Math.random() * 10000000000 >> 0;
    if (QuickMenu.$element)
        QuickMenu.$element.classList.remove('as-quick-menu-attached');
    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 menuElt = QuickMenu.$elt;
    menuElt.removeStyle('visibility');//for prevent size change blink
    menuElt.removeStyle({
        left: true,
        top: true
    });
    QuickMenu.$anchor.removeClass('absol-active');
    QuickMenu.$anchor.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;
            if (QuickMenu._scrollOutListener === finish) QuickMenu._scrollOutListener = undefined;
        };
        QuickMenu._scrollOutListener = finish;

        setTimeout(function () {
            document.body.addEventListener('click', finish, false);
        }, 10)
    };

    res.remove = function () {
        element.removeEventListener('click', clickHandler, false);
        element.classList.remove('as-quick-menu-trigger');

    };

    element.addEventListener('click', clickHandler, false);
    element.classList.add('as-quick-menu-trigger');
    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;
            if (QuickMenu._scrollOutListener === finish) QuickMenu._scrollOutListener = undefined;
        };
        QuickMenu._scrollOutListener = finish;

        setTimeout(function () {
            document.body.addEventListener('click', finish, false);
        }, 10);
    };

    res.remove = function () {
        trigger.removeEventListener('click', clickHandler, false);
        trigger.classList.remove('as-quick-menu-trigger');
    };

    trigger.addEventListener('click', clickHandler, false);
    trigger.classList.add('as-quick-menu-trigger');

    return res;

};


/* harmony default export */ var js_QuickMenu = (QuickMenu);
// EXTERNAL MODULE: ./node_modules/absol-acomp/css/quickpath.css
var quickpath = __webpack_require__(168);

// CONCATENATED MODULE: ./node_modules/absol-acomp/js/QuickPath.js




var QuickPath_ = ACore["a" /* default */]._;
var QuickPath_$ = ACore["a" /* default */].$;

function QuickPath() {
    this._holders = [];
}

/**
 * @type {QuickPath}
 */
QuickPath.eventHandler = {};

QuickPath.eventHandler.click = function (event) {
    var button = this._fileButton(event.target)
    if (button) this.pressButton(button);
};

QuickPath.tag = 'QuickPath'.toLowerCase();

/**
 * @returns {QuickPath}
 */
QuickPath.render = function () {
    return QuickPath_({
        class: 'absol-quick-path',
        extendEvent: ['change', 'press']
    });
};


QuickPath.prototype.updatePath = function () {
    this.clearChild();
    var self = this;
    this._holders = this._path.map(function (data, index) {
        var holder = self._createButton(data, index);
        holder.buttom.addTo(self);
        return holder;
    })


};

QuickPath.prototype._createButton = function (pathItem, index) {
    var buttom = QuickPath_({
        tag: 'expnode',
        class: 'absol-quick-path-btn',
        attr: {
            'data-index': '' + index
        }
    });
    buttom.status = 'close';
    buttom.name = pathItem.name;
    if (pathItem.icon) {
        buttom.icon = pathItem.icon;
    }
    if (pathItem.iconSrc) {
        buttom.icon = { tag: 'img', props: { src: pathItem.iconSrc } };
    }
    var thisQuickpath = this;

    if (pathItem.items) {
        js_QuickMenu.toggleWhenClick(buttom,
            {
                getAnchor: function () {
                    return [1, 2, 6, 5];
                },
                getMenuProps: function () {
                    return {
                        extendStyle: {
                            fontSize: buttom.getComputedStyleValue('font-size')
                        },
                        items: pathItem.items.map(function (it, menuIndex) {
                            var res = {
                                text: it.name,
                                menuIndex: menuIndex,
                                icon: it.iconSrc ? { tag: 'img', props: { src: it.iconSrc } } : (it.icon || undefined),
                                extendStyle: it.extendStyle || {},
                                extendClass: it.extendClass || [],
                            }
                            return res;
                        })
                    }
                },
                onOpen: function () {
                    buttom.status = 'open';
                    thisQuickpath.emit('press', {
                        target: thisQuickpath,
                        pathItem: pathItem,
                        index: index
                    }, thisQuickpath);

                },
                onClose: function () {
                    buttom.status = 'close';
                },
                onSelect: function (item) {
                    var dataItem = pathItem.items[item.menuIndex];
                    thisQuickpath.emit('change', {
                        target: thisQuickpath,
                        pathItem: pathItem,
                        item: dataItem,
                        index: index
                    }, thisQuickpath);
                    thisQuickpath.status = 'close';

                }
            })
    }
    else {
        buttom.on('click', function () {
            this.emit('press', { target: thisQuickpath, pathItem: pathItem, index: index }, thisQuickpath);
        });
    }

    return { buttom: buttom };
}

QuickPath.prototype.push = function (item) {
    this.path.push(item);
    var holder = this._createButton(item, this.path.length - 1);
    this.addChild(holder, buttom);
    this._holders.push(holder);
};

QuickPath.prototype.clear = function () {
    this.path = [];
    this._holders = [];
}


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 {String} icon
 * @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 () {
        return this.path.join('/');
    }
};

ACore["a" /* default */].install('quickpath', QuickPath);

/* harmony default export */ var js_QuickPath = (QuickPath);
// EXTERNAL MODULE: ./node_modules/absol-acomp/css/radiobutton.css
var radiobutton = __webpack_require__(170);

// CONCATENATED MODULE: ./node_modules/absol-acomp/js/RadioButton.js






var RadioButton_ = ACore["a" /* default */]._;
var RadioButton_$ = ACore["a" /* default */].$;


/***
 * @extends AElement
 * @constructor
 */
function RadioButton() {
    var thisRB = this;
    this.defineEvent('change');
    this.$input = RadioButton_$('input', this).on('change', this.notifyChange.bind(this));
    OOP["a" /* default */].drillProperty(this, this.$input, ['value', 'checked']);

}

RadioButton.tag = 'radiobutton';

RadioButton.radioProto = RadioButton_(
    '<svg class="absol-radio-icon" 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>'
)

RadioButton.render = function () {
    return RadioButton_({
        tag:'label',
        class: 'absol-radio-button',
        child: [
            { tag: 'input', attr: { type: 'radio' } },
            RadioButton.radioProto.cloneNode(true)
        ]
    });
};


RadioButton.prototype.notifyChange = function () {
    this.emit('change', { type: 'change', checked: this.checked, target: this }, this);
};


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 = {
    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 = RadioButton.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.autoReplace = function () {
    var placeHolders = Array.prototype.slice.call(document.getElementsByTagName(this.tag));
    var ph;
    var attOfPH;
    var attrs;
    var style;
    var classList;
    var attNode;
    var attrName, attrValue;
    var props;
    for (var i = 0; i < placeHolders.length; ++i) {
        ph = placeHolders[i];
        attOfPH = ph.attributes;
        classList = [];
        style = {};
        attrs = {};
        props = {};
        for (var j = 0; j < attOfPH.length; ++j) {
            attNode = attOfPH[j];
            attrName = attNode.nodeName;
            attrValue = attNode.nodeValue;
            if (attrName == 'style') {
                attrValue.trim().split(';').reduce(function (style, prop) {
                    var p = prop.split(':');
                    if (p.length == 2) {
                        style[p[0].trim()] = p[1].trim();
                    }
                    return style;
                }, style);
            }
            else if (attrName == 'class') {
                classList = attrValue.trim().split(/\s+/);
            }
            else if (attrName == 'onchange') {
                props.onchange = new Function('event', 'sender', attrValue);
            }
            else {
                attrs[attrName] = attrValue;
            }
        }
        var newElt = RadioButton_({
            tag: this.tag,
            attr: attrs,
            class: classList,
            style: style,
            props: props
        });
        RadioButton_$(ph).selfReplace(newElt);
    }
};

RadioButton.initAfterLoad = function (){
    Dom["b" /* default */].documentReady.then(function (){
        RadioButton.autoReplace();
    })
};


ACore["a" /* default */].install('RadioButton'.toLowerCase(), RadioButton);

/* harmony default export */ var js_RadioButton = (RadioButton);
// EXTERNAL MODULE: ./node_modules/absol-acomp/css/radio.css
var css_radio = __webpack_require__(172);

// CONCATENATED MODULE: ./node_modules/absol-acomp/js/Radio.js








var Radio_ = ACore["a" /* default */]._;
var Radio_$ = ACore["a" /* default */].$;
var Radio_$$ = ACore["a" /* default */].$$;
var _svg = HTML5_Svg.ShareInstance._;

/***
 * @extends AElement
 * @constructor
 */
function Radio_Radio() {
    var thisR = this;
    this.defineEvent('change');
    this.$input = Radio_$('input', this)
        .on('change', this.notifyChange.bind(this));
    this.$labels = Radio_$$('span', this);

    OOP["a" /* default */].drillProperty(this, this.$input, ['value', 'checked']);
}

Radio_Radio.tag = 'radio';

Radio_Radio.radioProto = Radio_(
    '<svg class="absol-radio-icon" 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>'
)

Radio_Radio.render = function () {
    return Radio_({
        tag: 'label',
        class: 'absol-radio',
        child: [
            { tag: 'input', attr: { type: 'radio' } },
            { tag: 'span', class: 'absol-radio-left-label' },
            Radio_Radio.radioProto.cloneNode(true),
            { tag: 'span', class: 'absol-radio-right-label' }
        ]
    });
};


Radio_Radio.prototype.notifyChange = function () {
    this.emit('change', { type: 'change', checked: this.checked, target: this }, this);
};


Radio_Radio.prototype.getAllFriend = function () {
    return Radio_Radio.getAllByName(this.name);
};


Radio_Radio.attribute = js_RadioButton.attribute;

Radio_Radio.property = {
    name: {
        set: function (name) {
            this.$input.setAttribute('name', name);

        },
        get: function () {
            return this.$input.getAttribute('name');
        }
    },
    text: {
        set: function (value) {
            value = (value || '').trim();
            this.$labels[0].clearChild();
            this.$labels[1].clearChild();

            if (value) {
                this.$labels[0].addChild(Radio_({ text: value }));
                this.$labels[1].addChild(Radio_({ text: value }));
            }

        },
        get: function () {
            return this.$labels[0].firstChild.data;
        }
    },
    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 */].install(Radio_Radio);

/* harmony default export */ var js_Radio = (Radio_Radio);
// CONCATENATED MODULE: ./node_modules/absol-acomp/js/RemoteSvg.js



var RemoteSvg_ = ACore["a" /* default */]._;
var RemoteSvg_$ = ACore["a" /* default */].$;


function RemoteSvg() {

}

RemoteSvg.tag = 'RemoteSvg'.toLowerCase();

RemoteSvg.render = function () {
    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);


/* harmony default export */ var js_RemoteSvg = (RemoteSvg);
// EXTERNAL MODULE: ./node_modules/absol-acomp/css/resizebox.css
var resizebox = __webpack_require__(174);

// 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;
    this._lastClickTime = 0;
}

ResizeBox.tag = 'ResizeBox'.toLowerCase();

ResizeBox.render = function () {
    return ResizeBox_({
        class: 'as-resize-box',
        extendEvent: ['beginmove', 'endmove', 'moving', 'click', 'dblclick'],//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["b" /* 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["b" /* default */].hitElement(this, event)) {
            this.emit('click', event, this);
            var now = new Date().getTime();
            if (now - this._lastClickTime < 500) {
                this.emit('dblclick', event, this);
                this._lastClickTime = 0;
            }
            this._lastClickTime = now;
        }
    }
};


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);


/* harmony default export */ var js_ResizeBox = (ResizeBox);
// EXTERNAL MODULE: ./node_modules/absol-acomp/css/searcher.css
var searcher = __webpack_require__(176);

// 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;
};


/**
 * @extends {AElement}
 * @constructor
 */
function SearchTextInput() {
    var thisSTI = this;
    this.defineEvent(['change', 'modify', 'stoptyping']);

    this.eventHandler = OOP["a" /* default */].bindFunctions(this, SearchTextInput.eventHandler);
    this.$button = Searcher_$('button', this);
    this.$input = Searcher_$('input', this);

    ['keyup', 'keydown', 'focus', 'blur'].forEach(function (evName){
        thisSTI.defineEvent(evName);
        thisSTI.$input.on(evName, function (event){
            thisSTI.emit(evName, event, thisSTI);
        });
    });

    this.$input.on('change', this.eventHandler.inputChange);
    this.$input.on('keyup', this.eventHandler.inputKeyUp);

    this.$button.on('click', function (event) {
        thisSTI.$input.value = '';
        thisSTI.eventHandler.inputKeyUp(event);
        setTimeout(function () {
            thisSTI.focus();
        }, 50);
    });
}

SearchTextInput.tag = 'SearchTextInput'.toLowerCase();

SearchTextInput.render = function () {
    return Searcher_(
        {
            class: 'absol-search-text-input',
            child: [
                {
                    class: 'absol-search-text-input-container',
                    child: {
                        tag: 'input',
                        attr: {
                            type: 'search',
                            placeholder: 'search...'
                        }
                    }
                },
                {
                    class: 'absol-search-text-button-container',
                    child: {
                        tag: 'button',
                        child: ['find-ico', 'times-circle-ico']
                    }
                }
            ]
        }
    );
};


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/selectbox.css
var selectbox = __webpack_require__(178);

// EXTERNAL MODULE: ./node_modules/absol-acomp/css/selectmenu.css
var selectmenu = __webpack_require__(52);

// EXTERNAL MODULE: ./node_modules/absol-acomp/css/selectlistbox.css
var selectlistbox = __webpack_require__(181);

// 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)] / harmonicMean(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(harmonicMean(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(harmonicMean(m, n), 1);
}


// CONCATENATED MODULE: ./node_modules/absol-acomp/js/list/search.js



var EXTRA_MATCH_SCORE = 7;
var UNCASE_MATCH_SCORE = 4;
var UVN_MATCH_SCORE = 3;
var EQUAL_MATCH_SCORE = 4;
var WORD_MATCH_SCORE = 3;

/***
 *
 * @param {SelectionItem} item
 * @returns {*}
 */
function prepareSearchForItem(item) {
    if (!item.text || !item.text.charAt) item.text = item.text + '';
    var spliter = /\s+/;
    item.__text__ = item.text.replace(/([\s\b\-()\[\]]|&#8239;|&nbsp;|&#xA0;|\s)+/g, ' ').trim();
    item.__words__ = item.__text__.split(spliter);

    item.__textNoneCase__ = item.__text__.toLowerCase();
    item.__wordsNoneCase__ = item.__textNoneCase__.split(spliter);


    item.__nvnText__ = nonAccentVietnamese(item.__text__);
    item.__nvnWords__ = item.__nvnText__.split(spliter);

    item.__nvnTextNoneCase__ = item.__nvnText__.toLowerCase();
    item.__nvnWordsNoneCase__ = item.__nvnTextNoneCase__.split(spliter);
    return item;
}

function prepareSearchForList(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];
        prepareSearchForItem(item);
        if (item.items) prepareSearchForList(item.items);
    }
    return items;
}

function calcItemMatchScore(queryItem, item) {
    var score = 0;
    if (item.__text__ == queryItem.__text__)
        score += EQUAL_MATCH_SCORE * queryItem.__text__.length;

    var extraIndex = item.__text__.indexOf(queryItem.__text__);

    if (extraIndex >= 0) {
        score += EXTRA_MATCH_SCORE * queryItem.__text__.length - extraIndex / item.__text__.length;
    }

    extraIndex = item.__textNoneCase__.indexOf(queryItem.__textNoneCase__);
    if (extraIndex >= 0) {
        score += UNCASE_MATCH_SCORE * queryItem.__text__.length - extraIndex / item.__text__.length;
    }

    extraIndex = item.__nvnTextNoneCase__.indexOf(queryItem.__nvnTextNoneCase__);
    if (extraIndex >= 0) {
        score += UNCASE_MATCH_SCORE * queryItem.__text__.length - extraIndex / item.__text__.length;
    }

    score += wordsMatch(queryItem.__nvnWordsNoneCase__, item.__nvnWordsNoneCase__) / (queryItem.__nvnWordsNoneCase__.length + 1 + item.__nvnWordsNoneCase__.length) * 2 * WORD_MATCH_SCORE;
    score += wordsMatch(queryItem.__wordsNoneCase__, item.__wordsNoneCase__) / (queryItem.__wordsNoneCase__.length + 1 + item.__wordsNoneCase__.length) * 2 * WORD_MATCH_SCORE;
    return score;
}

/***
 *
 * @param  {String} query
 * @param {Array<SelectionItem>} items
 */
function searchListByText(query, items) {
    query = (query || '').trim();
    if (query.length == 0 || items.length == 0)
        return items;
    var queryItem = prepareSearchForItem({ text: query });
    var its = items.map(function (item) {
        return {
            item: item,
            score: calcItemMatchScore(queryItem, item)
        }
    });
    its.sort(function (a, b) {
        if (b.score - a.score == 0) {
            if (b.item.__nvnText__ > a.item.__nvnText__) return -1
            return 1;
        }
        return b.score - a.score;
    });
    var midValue = (its[0].score + its[its.length - 1].score) / 2;
    if (midValue === 0) midValue += 0.1;
    if (midValue < 1) midValue = 1;
    return its.filter(function (it) {
        return it.score >= midValue;
    }).map(function (it) {
        return it.item;
    });
}

/***
 *
 * @param  {String} query
 * @param {Array<SelectionItem>} items
 */
function searchTreeListByText(query, items) {
    query = (query || '').trim();
    if (query.length == 0 || items.length == 0)
        return items;
    var queryItem = prepareSearchForItem({ text: query });
    var gmaxScore = 0;
    var gminScore = 1000;

    function makeScoreRecursive(item) {
        var score = calcItemMatchScore(queryItem, item);
        gmaxScore = Math.max(score, gmaxScore);
        gminScore = Math.min(score, gminScore);

        var children = (item.items || []).map(function (item) {
            return makeScoreRecursive(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 filterItems(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 = filterItems(node.children, medScore);
                    if (res.items.length == 0) delete res.items;
                }
            }
            return res;
        });
    }

    var scoredItems = items.map(makeScoreRecursive);
    var medianScore = (gminScore + gmaxScore) / 2;
    var items = filterItems(scoredItems, medianScore);
    return items;
}


// CONCATENATED MODULE: ./node_modules/absol/src/HTML5/DomSignal.js




/***
 *
 * @extends EventEmitter
 * @param {AElement} attachHookElt
 * @constructor
 */
function DomSignal(attachHookElt) {
    EventEmitter["b" /* default */].call(this);
    this.signals = {};
    this.ev_attached = this.ev_attached.bind(this);
    this.$attachhook = attachHookElt || Dom["b" /* default */].ShareInstance._('attachhook');
    this.$attachhookParent = (attachHookElt && attachHookElt.parentElement) || null;
    this.$attachhook.on('attached', this.ev_attached);
}

Object.defineProperties(DomSignal.prototype, Object.getOwnPropertyDescriptors(EventEmitter["b" /* default */].prototype));
DomSignal.prototype.constructor = DomSignal;


DomSignal.prototype.execSignal = function () {
    var signals = this.signals;
    if (this.$attachhook) {
        this.$attachhook.remove();
        this.$attachhook.resetState();
    }
    this.signals = {};
    for (var name in signals) {
        this.fire.apply(this, [name].concat(signals[name]));
    }
};

DomSignal.prototype.emit = function (name) {
    this.signals[name] = Array.prototype.slice.call(arguments, 1);
    if (!this.$attachhookParent) {
        this.$attachhookParent = document.body;
    }
    if (!this.$attachhook.parentElement) {
        this.$attachhookParent.appendChild(this.$attachhook);
    }
};

DomSignal.prototype.ev_attached = function () {
    this.execSignal();
};

/* harmony default export */ var HTML5_DomSignal = (DomSignal);
// CONCATENATED MODULE: ./node_modules/absol-acomp/js/SelectListBox.js








var SelectListBox_ = ACore["a" /* default */]._;
var SelectListBox_$ = ACore["a" /* default */].$;
var SelectListBox_$$ = ACore["a" /* default */].$$;

var VALUE_HIDDEN = -1;
var VALUE_NORMAL = 1;

/***
 * @extends Follower
 * @constructor
 */
function SelectListBox() {
    this._initDomHook();
    this._initControl();
    this._initScroller();
    this._initProperty();
}

SelectListBox.tag = 'SelectListBox'.toLowerCase();

SelectListBox.render = function () {
    return SelectListBox_({
        tag: 'follower',
        attr: {
            tabindex: 0
        },
        class: 'as-select-list-box',
        extendEvent: ['pressitem'],
        child: [
            {
                class: 'as-select-list-box-search-ctn',
                child: 'searchtextinput'
            },
            {
                class: ['as-bscroller', 'as-select-list-box-scroller'],
                child: [
                    {
                        class: ['as-select-list-box-content'],
                        child: Array(SelectListBox.prototype.preLoadN).fill('.as-select-list-box-page')
                    }
                ]
            },
            'attachhook.as-dom-signal'
        ]
    });
};

SelectListBox.prototype.toLoadNextY = 200;

SelectListBox.prototype.preLoadN = 3;


SelectListBox.prototype._initDomHook = function () {
    this.$domSignal = SelectListBox_$('attachhook.as-dom-signal', this);
    this.domSignal = new HTML5_DomSignal(this.$domSignal);
    this.domSignal.on('viewListAt', this.viewListAt.bind(this));
    this.domSignal.on('viewListAtFirstSelected', this.viewListAtFirstSelected.bind(this));
    this.domSignal.on('viewListAtCurrentScrollTop', this.viewListAtCurrentScrollTop.bind(this));
};

SelectListBox.prototype._initControl = function () {
    this._currentOffset = 0;
    this._startItemIdx = 0;
    this.$searchInput = SelectListBox_$('searchtextinput', this)
        .on('stoptyping', this.eventHandler.searchModify);
};


SelectListBox.prototype._initScroller = function () {
    this.$content = SelectListBox_$('.as-select-list-box-content', this);
    this._estimateHeight = 0;
    this._pageOffsets = Array(this.preLoadN + 1).fill(0);
    this.$listPages = SelectListBox_$$('.as-select-list-box-page', this);
    this.$listScroller = SelectListBox_$('.as-select-list-box-scroller', this)
        .on('scroll', this.eventHandler.scroll);
};


SelectListBox.prototype._initProperty = function () {

    /***
     *   items  =(search, filler)=> filteredItems =(list to list, tree to list)=>  preDisplayItems =(remove hidden item)=> displayItem
     *
     */

    this._items = [];
    this._itemNodeList = [];// use for tree
    this._values = [];
    this._valueDict = {};
    this._itemNodeHolderByValue = {};
    // this._filteredItems = [];// not need , only use when search
    this._preDisplayItems = [];
    this._displayItems = [];
    this._searchCache = {};
    this._displayValue = VALUE_NORMAL;
    this.displayValue = VALUE_NORMAL;
    this.items = [];
};


SelectListBox.prototype._requireItem = function (pageElt, n) {
    var itemElt;
    while (pageElt.childNodes.length > n) {
        itemElt = pageElt.lastChild;
        itemElt.selfRemove();
        releaseItem(itemElt);
    }
    while (pageElt.childNodes.length < n) {
        itemElt = requireItem(this);
        pageElt.addChild(itemElt);
    }
};


SelectListBox.prototype._assignItems = function (pageElt, offset) {
    var n = Math.min(this._displayItems.length - offset, pageElt.childNodes.length);
    var itemElt, value;
    for (var i = 0; i < n; ++i) {
        itemElt = pageElt.childNodes[i];
        itemElt.data = this._displayItems[offset + i];
        value = itemElt.value + '';
    }
};


SelectListBox.prototype._itemsToNodeList = function (items) {
    return items;
};


/***
 *
 * @param {Array<{value:String|Number}>} items
 * @return {Array<{value:String|Number}>}
 */
SelectListBox.prototype._filterDisplayItems = function (items) {
    if (this._displayValue === VALUE_NORMAL) return items;
    var dict = this._valueDict;
    return items.filter(function (item) {
        return !dict[item.value + ''];
    });
};


SelectListBox.prototype._updateSelectedItem = function () {
    var valueDict = this._valueDict;
    this.$listPages.forEach(function (pageElt) {
        Array.prototype.forEach.call(pageElt.childNodes, function (itemElt) {
            var value = itemElt.value + '';
            if (valueDict[value]) {
                itemElt.selected = true;
            }
            else {
                itemElt.selected = false;
            }
        });
    });
};

/***
 *
 * @param {number} offset
 */
SelectListBox.prototype.viewListAt = function (offset) {
    if (!this.isDescendantOf(document.body)) {
        this.domSignal.emit('viewListAt', offset);
        return;
    }
    var fontSize = this.$listScroller.getFontSize() || 14;
    offset = Math.max(0, Math.min(offset, this._displayItems.length - 1));
    var screenSize = Object(Dom["d" /* getScreenSize */])();
    var maxItem = Math.ceil(Math.max(window.screen.height, screenSize.height) / 20);
    var contentBound = this.$content.getBoundingClientRect();

    this._pageOffsets[0] = Math.max(offset - maxItem, 0);
    for (var i = 1; i <= this.preLoadN; ++i) {
        this._pageOffsets[i] = Math.min(this._pageOffsets[i - 1] + maxItem, this._displayItems.length);
    }

    var sIdx, nItem, pageBound;
    var pageElt;
    for (var pageIndex = 0; pageIndex < this.preLoadN; ++pageIndex) {
        sIdx = this._pageOffsets[pageIndex];
        nItem = this._pageOffsets[pageIndex + 1] - sIdx;
        pageElt = this.$listPages[pageIndex];


        pageElt.addStyle('top', this._pageOffsets[pageIndex] * 20 + 'px');
        this._requireItem(pageElt, nItem);
        this._assignItems(pageElt, sIdx);
        pageBound = pageElt.getBoundingClientRect();
    }
    this._updateSelectedItem();
};


SelectListBox.prototype.viewListAtFirstSelected = function () {
    if (!this.isDescendantOf(document.body)) {
        this.domSignal.emit('viewListAtFirstSelected');
        return;
    }
    if (this._displayValue == VALUE_HIDDEN) {
        return false;
    }
    else if (this._values.length > 0) {
        var value = this._values[0];
        var itemHolders = this._displayItemHolderByValue[value + ''];
        if (itemHolders) {
            this.domSignal.once('scrollIntoSelected', function () {
                var holder = itemHolders[0];
                this.viewListAt(holder.idx);
                var itemElt = SelectListBox_$('.as-selected', this.$listScroller);
                if (itemElt) {
                    var scrollBound = this.$listScroller.getBoundingClientRect();
                    var itemBound = itemElt.getBoundingClientRect();
                    this.$listScroller.scrollTop += itemBound.top - scrollBound.top;
                }
            }.bind(this));
            this.domSignal.emit('scrollIntoSelected');
            return true;
        }
        else return false;
    }
    else
        return false;
};

SelectListBox.prototype.viewListAtCurrentScrollTop = function () {
    if (!this.isDescendantOf(document.body)) {
        this.emit('viewListAtCurrentScrollTop');
        return;
    }
    this.viewListAt(Math.floor(this.$listScroller.scrollTop / 20));
};


SelectListBox.prototype.searchItemByText = function (text) {
    text = text.trim();
    if (text.length == 0) return this._items;
    if (this._searchCache[text]) return this._searchCache[text];
    this._searchCache[text] = searchListByText(text, this._items);
    return this._searchCache[text];
};

SelectListBox.prototype.resetSearchState = function () {
    this.$searchInput.value = '';
    this._preDisplayItems = this._itemsToNodeList(this._items);
    this._updateDisplayItem();
    this.domSignal.emit('viewListAt', 0);
    this.$listScroller.scrollTop = 0;
};

SelectListBox.prototype.notifyPressOut = function () {
    this.emit('pressout', { target: this, type: 'pressout' }, this);
};

SelectListBox.prototype.notifyPressClose = function () {
    this.emit('pressclose', { target: this, type: 'pressclose' }, this);
};

SelectListBox.prototype._findFirstPageIdx = function () {
    for (var i = 0; i < this.preLoadN; ++i) {
        if (this._pageOffsets[i + 1] - this._pageOffsets[i] > 0) {
            return i;
        }
    }
    return -1;
};

SelectListBox.prototype._findLastPageIdx = function () {
    for (var i = this.preLoadN - 1; i >= 0; --i) {
        if (this._pageOffsets[i + 1] - this._pageOffsets[i] > 0) {
            return i;
        }
    }
    return -1;
};

SelectListBox.prototype._indexingByValue = function (items, dict) {
    var thisS = this;
    return items.reduce(function (ac, cr, idx) {
        var value = typeof cr === "string" ? cr : cr.value + '';
        ac[value] = ac[value] || [];
        ac[value].push({
            idx: idx,
            item: cr
        });
        return ac;
    }, dict || {});
};

SelectListBox.prototype._depthIndexingByValue = function (items, context) {
    context = context ||{idx: 0, dict: {}};
    var thisS = this;
    return items.reduce(function (ac, cr, idx) {
        var value = typeof cr === "string" ? cr : cr.value + '';
        ac[value] = ac[value] || [];
        ac[value].push({
            idx: context.idx++,
            item: cr
        });
        if (cr && cr.items && cr.items.length >0){
            thisS._depthIndexingByValue(cr.items, context);
        }
        return ac;
    }, context.dict);
};

SelectListBox.prototype._updateDisplayItemIndex = function () {
    this._displayItemHolderByValue = this._indexingByValue(this._displayItems, {});
};

SelectListBox.prototype._updateItemNodeIndex = function () {
    this._itemNodeHolderByValue = this._depthIndexingByValue(this._items)
};

SelectListBox.prototype._updateDisplayItem = function () {
    this._displayItems = this._filterDisplayItems(this._preDisplayItems);
    this._updateDisplayItemIndex();
    this.$content.addStyle({
        'height': this._displayItems.length * 20 + 'px'
    });

};


SelectListBox.prototype._updateItems = function () {
    this._preDisplayItems = this._itemsToNodeList(this._items);
    this._searchCache = {};
    var estimateSize = measureListSize(this._itemNodeList);
    this._estimateSize = estimateSize;
    this._estimateWidth = estimateSize.width;
    this._estimateDescWidth = estimateSize.descWidth;
    this.addStyle('--select-list-estimate-width', estimateSize.width + 'px');
    this.addStyle('--select-list-desc-width', estimateSize.descWidth + 'px')
    this._updateDisplayItem();
};

/***
 *
 * @param value
 * @returns {{idx: number, item:{text:string, value:number|string}}[]}
 */
SelectListBox.prototype.findDisplayItemsByValue = function (value) {
    return (this._displayItemHolderByValue[value] || []).slice();
};

/***
 *
 * @param value
 * @returns {{idx: number, item:{text:string, value:number|string}}[]}
 */
SelectListBox.prototype.findItemsByValue = function (value) {
    return (this._itemNodeHolderByValue[value] || []).slice();
};

SelectListBox.property = {};

/***
 *
 * @type {SelectListBox|{}}
 */
SelectListBox.property.items = {
    set: function (items) {
        items = items || [];
        prepareSearchForList(items);
        this._items = items;
        this._itemNodeList = this._itemsToNodeList(this._items);
        this._updateItemNodeIndex();
        this._updateItems();
        this.viewListAt(0);
    },
    get: function () {
        return this._items;
    }
}


SelectListBox.property.values = {
    set: function (values) {
        values = values || [];
        this._values = values;
        this._valueDict = values.reduce(function (ac, cr) {
            ac[cr + ''] = true;
            return ac;
        }, {});
        this._updateDisplayItem();
        this.viewListAtCurrentScrollTop();
        //todo
        if (this._pageOffsets[this.preLoadN] > this._pageOffsets[0]) this._updateSelectedItem();
    },
    get: function () {
        return this._values;
    }
};

SelectListBox.property.displayValue = {
    set: function (value) {
        this._displayValue = value;
        this._displayItems = this._filterDisplayItems(this._preDisplayItems);
        this._updateItemNodeIndex();
        if (value === VALUE_HIDDEN) {
            this.addClass('as-value-hidden');
        }
        else {
            this.removeClass('as-value-hidden');
        }
    },
    get: function () {
        return this._displayValue;
    }
}

SelectListBox.property.enableSearch = {
    set: function (value) {
        if (value) this.addClass('as-enable-search');
        else this.removeClass('as-enable-search');
    },
    get: function () {
        return this.containsClass('as-enable-search');
    }
};

/***
 *
 * @type {SelectListBox|{}}
 */
SelectListBox.eventHandler = {};


/*
*
* @param {MouseEvent} event
*/
SelectListBox.eventHandler.click = function (event) {
    if (event.target === this)
        this.notifyPressOut();
};

SelectListBox.eventHandler.searchModify = function () {
    var text = this.$searchInput.value;
    var searchedItems = this.searchItemByText(text);
    this._preDisplayItems = this._itemsToNodeList(searchedItems);
    this._displayItems = this._filterDisplayItems(this._preDisplayItems);
    this.$content.addStyle({
        'height': this._displayItems.length * 20 + 'px'
    });
    this._updateItemNodeIndex();
    this.viewListAt(0);
    this.$listScroller.scrollTop = 0;
    this.updatePosition();
};


SelectListBox.eventHandler.scroll = function () {
    var scrollerBound = this.$listScroller.getBoundingClientRect();
    var topIdx = this._findFirstPageIdx();
    var screenSize = Object(Dom["d" /* getScreenSize */])();
    var maxItem = Math.ceil(Math.max(window.screen.height, screenSize.height) / 20);
    var topBound = this.$listPages[topIdx].getBoundingClientRect();
    var botIdx = this._findLastPageIdx();
    var botBound;
    botBound = this.$listPages[botIdx].getBoundingClientRect();
    if (topBound.top > scrollerBound.top || topBound.bottom < scrollerBound.bottom) {
        this.viewListAt(Math.floor(this.$listScroller.scrollTop / 20))
        return;
    }

    if (this._pageOffsets[topIdx] > 0) {
        if (topBound.top + this.toLoadNextY > scrollerBound.top) {
            this._pageOffsets.unshift(this._pageOffsets.pop());
            this.$listPages.unshift(this.$listPages.pop());
            this._pageOffsets[topIdx] = Math.max(0, this._pageOffsets[topIdx + 1] - maxItem);

            this._requireItem(this.$listPages[topIdx], this._pageOffsets[topIdx + 1] - this._pageOffsets[topIdx]);
            this._assignItems(this.$listPages[topIdx], this._pageOffsets[topIdx]);
            this._updateSelectedItem();
            this.$listPages[topIdx].addStyle('top', this._pageOffsets[topIdx] * 20 + 'px');
        }
    }

    if (this._pageOffsets[botIdx + 1] < this._displayItems.length) {
        if (botBound.bottom - this.toLoadNextY < scrollerBound.bottom) {
            this._pageOffsets.push(this._pageOffsets.shift());
            this.$listPages.push(this.$listPages.shift());
            this._pageOffsets[botIdx + 1] = Math.min(this._displayItems.length, this._pageOffsets[botIdx] + maxItem);
            this.$listPages[botIdx].addStyle('top', this._pageOffsets[botIdx] * 20 + 'px');
            this._requireItem(this.$listPages[botIdx], this._pageOffsets[botIdx + 1] - this._pageOffsets[botIdx]);
            this._assignItems(this.$listPages[botIdx], this._pageOffsets[botIdx]);
            this._updateSelectedItem();
        }
    }
}
;

ACore["a" /* default */].install(SelectListBox);

/* harmony default export */ var js_SelectListBox = (SelectListBox);

// CONCATENATED MODULE: ./node_modules/absol-acomp/js/SelectMenu2.js










/*global absol*/
var SelectMenu2_ = ACore["a" /* default */]._;
var SelectMenu2_$ = ACore["a" /* default */].$;

ACore["a" /* default */].creator['dropdown-ico'] = function () {
    return SelectMenu2_([
        '<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(''));
};


/***
 * @extends AElement
 * @constructor
 */
function SelectMenu() {
    var thisSM = this;
    this._items = [];
    this._value = null;
    this._lastValue = null;
    this.$holderItem = SelectMenu2_$('.absol-selectmenu-holder-item', this);
    this.$viewItem = SelectMenu2_$('.absol-selectmenu-holder-item selectlistitem', this);
    /***
     *
     * @type {SelectListBox}
     */
    this.$selectlistBox = SelectMenu2_({
        tag: 'selectlistbox',
        props: {
            anchor: [1, 6, 2, 5]
        },
        on: {
            preupdateposition: this.eventHandler.preUpdateListPosition
        }
    });
    this.$selectlistBox.on('pressitem', this.eventHandler.selectListBoxPressItem);
    this.$selectlistBox.followTarget = this;
    OOP["a" /* default */].drillProperty(this, this.$selectlistBox, 'enableSearch');


    this._lastValue = "NOTHING_VALUE";
    this._isFocus = false;
    this.isFocus = false;

    this.on('mousedown', this.eventHandler.click, true);

}

SelectMenu.tag = 'selectmenu';
SelectMenu.render = function () {
    return SelectMenu2_({
        class: ['absol-selectmenu', 'as-select-menu'],
        extendEvent: ['change'],
        attr: {
            tabindex: '1'
        },
        child: [
            {
                class: 'absol-selectmenu-holder-item',
                child: 'selectlistitem'
            },
            {
                tag: 'button',
                class: 'absol-selectmenu-btn',
                child: ['dropdown-ico']
            }
        ]
    });
};


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;
    }
    var value = props.value;
    delete props.value;
    this.super(props);
    this.value = value;
};


SelectMenu.prototype.updateItem = function () {
    var selectedItems = this.$selectlistBox.findDisplayItemsByValue(this._value);
    if (selectedItems.length >= 1) {
        this.$viewItem.data = selectedItems[0].item;
    }
    else {
        this.$viewItem.data = { text: '', value: null }
    }
};

SelectMenu.property = {};
SelectMenu.property.items = {
    set: function (items) {
        this.$selectlistBox.items = items || [];
        this.addStyle('--select-list-estimate-width', this.$selectlistBox._estimateWidth + 'px');
        this.addStyle( '--select-list-desc-width', this.$selectlistBox._estimateDescWidth + 'px');

        if (items.length == 0) return;
        var selectedItems = this.$selectlistBox.findDisplayItemsByValue(this._value);
        if (selectedItems.length === 0) {
            this.value = items[0].value;
        }
        else if (selectedItems.length > 1) {
            console.warn(this, 'has duplicate item value');
        }
        else {
            this.updateItem();
        }
    },
    get: function () {
        return this.$selectlistBox.items;
    }
};

SelectMenu.property.value = {
    set: function (value) {
        this.$selectlistBox.values = [value];
        this._lastValue = value;
        this._value = value;
        this.updateItem();
    },
    get: function () {
        return this._value;
        //todo
    }
};

/***
 *
 * @type {SelectMenu|{}}
 */
SelectMenu.property.isFocus = {
    set: function (value) {
        var thisSM = this;
        if (!this.items || this.items.length === 0) value = false;//prevent focus
        if (this._isFocus === value) return;
        this._isFocus = !!value;
        if (this._isFocus) {
            document.body.appendChild(this.$selectlistBox);
            this.$selectlistBox.domSignal.$attachhook.emit('attached');
            var bound = this.getBoundingClientRect();
            this.$selectlistBox.addStyle('min-width', bound.width + 'px');
            this.$selectlistBox.refollow();
            this.$selectlistBox.updatePosition();
            setTimeout(function () {
                if (thisSM.enableSearch) {
                    thisSM.$selectlistBox.$searchInput.focus();
                }
                else {
                    thisSM.$selectlistBox.focus();
                }
                SelectMenu2_$(document.body).on('click', thisSM.eventHandler.bodyClick);
            }, 100);
            this.$selectlistBox.viewListAtFirstSelected();
        }
        else {
            SelectMenu2_$(document.body).off('click', thisSM.eventHandler.bodyClick);
            this.$selectlistBox.selfRemove();
            this.$selectlistBox.unfollow();
            this.$selectlistBox.resetSearchState();
        }
    },
    get: function () {
        return this._isFocus;
    }
};


SelectMenu.property.disabled = {
    set: function (value) {
        if (value) {
            this.addClass('as-disabled');
        }
        else {
            this.removeClass('as-disabled');
        }
    },
    get: function () {
        return this.containsClass('as-disabled');
    }
};


SelectMenu.property.hidden = {
    set: function (value) {
        if (value) {
            this.addClass('as-hidden');
        }
        else {
            this.removeClass('as-hidden');
        }
    },
    get: function () {
        return this.addClass('as-hidden');
    }
};

SelectMenu.property.selectedIndex = {
    get: function () {
        var selectedItems = this.$selectlistBox.findDisplayItemsByValue(this._value);
        if (selectedItems.length > 0) {
            return selectedItems[0].idx;
        }
        return -1;
    }
};

/**
 * @type {SelectMenu|{}}
 */
SelectMenu.eventHandler = {};


SelectMenu.eventHandler.click = function (event) {
    if (EventEmitter["b" /* default */].isMouseRight(event)) return;
    if (EventEmitter["b" /* default */].hitElement(this.$selectlistBox, event)) return;
    this.isFocus = !this.isFocus;
};


SelectMenu.eventHandler.bodyClick = function (event) {
    if (!EventEmitter["b" /* default */].hitElement(this, event) && !EventEmitter["b" /* default */].hitElement(this.$selectlistBox, event)) {
        setTimeout(function () {
            this.isFocus = false;
        }.bind(this), 5)
    }
};

SelectMenu.eventHandler.selectListBoxPressItem = function (event) {
    this._value = event.data.value;
    this.$selectlistBox.values = [this._value];
    this.updateItem();
    if (this._lastValue !== this.value) {
        event.lastValue = this._lastValue;
        event.value = this.value;
        setTimeout(function () {
            this.emit('change', event, this);
        }.bind(this), 1)
        this._lastValue = this.value;

    }
    setTimeout(function () {
        this.isFocus = false;
    }.bind(this), 50)
};

SelectMenu.eventHandler.preUpdateListPosition = function () {
    var bound = this.getBoundingClientRect();
    var screenSize = Object(Dom["d" /* getScreenSize */])();
    var availableTop = bound.top - 5;
    var availableBot = screenSize.height - 5 - bound.bottom;
    this.$selectlistBox.addStyle('--max-height', Math.max(availableBot, availableTop) + 'px');
    var outBound = Object(Dom["f" /* traceOutBoundingClientRect */])(this);
    if (bound.bottom < outBound.top || bound.top > outBound.bottom || bound.right < outBound.left || bound.left > outBound.right) {
        this.isFocus = false;
    }
};


ACore["a" /* default */].install(SelectMenu);

/* harmony default export */ var SelectMenu2 = (SelectMenu);

// CONCATENATED MODULE: ./node_modules/absol-acomp/js/SelectBoxItem.js






var SelectBoxItem_ = ACore["a" /* default */]._;
var SelectBoxItem_$ = ACore["a" /* default */].$;


/***
 * @extends AElement
 * @constructor
 */
function SelectBoxItem() {
    this._themeClassName = null;
    this.$text = SelectBoxItem_$('.absol-selectbox-item-text', this);
    this.$close = SelectBoxItem_$('.absol-selectbox-item-close', this);
    this.$close.on('click', this.eventHandler.clickClose);
    this.on('click', this.eventHandler.click);
};

SelectBoxItem.tag = 'SelectBoxItem'.toLowerCase();
SelectBoxItem.render = function () {
    return SelectBoxItem_({
        class: ['absol-selectbox-item'],
        extendEvent: ['close', 'press'],
        child: [
            '.absol-selectbox-item-text',
            {
                class: 'absol-selectbox-item-close',
                child: '<span class="mdi mdi-close"></span>'
            }
        ]
    });
};


SelectBoxItem.eventHandler = {};
SelectBoxItem.eventHandler.clickClose = function (event) {
    this.emit('close', event);
};

SelectBoxItem.eventHandler.click = function (event){
    if (!EventEmitter["b" /* default */].hitElement(this.$close, event)){
        this.emit('press', event, this);
    }
};

SelectBoxItem.property = {};

SelectBoxItem.property.data = {
    set: function (value) {
        this._data = value;
        this.$text.clearChild();
        this.$text.addChild(SelectBoxItem_('<span>' + this.text + '</span>'));
        if (this._themeClassName) this.removeClass(this._themeClassName);
        this._themeClassName = null;
        if (this.theme) {
            this._themeClassName = 'as-theme-' + this.theme;
            this.addClass(this._themeClassName);
        }
    },
    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;
    }
};

SelectBoxItem.property.theme = {
    get: function () {
        return this._data.theme || null;
    }
};

SelectBoxItem.property.active = {
    set: function (value) {
        if (value) {
            this.addClass('as-active');
        }
        else {
            this.removeClass('as-active');
        }
    },
    get: function () {
        return this.containsClass('as-active');
    }
};


ACore["a" /* default */].install(SelectBoxItem);

/* harmony default export */ var js_SelectBoxItem = (SelectBoxItem);
// EXTERNAL MODULE: ./node_modules/absol/src/HTML5/ResizeSystem.js
var ResizeSystem = __webpack_require__(12);

// CONCATENATED MODULE: ./node_modules/absol-acomp/js/SelectBox.js











var SelectBox_ = ACore["a" /* default */]._;
var SelectBox_$ = ACore["a" /* default */].$;


function pressCloseEventHandler(event) {
    var parentElt = this.$parent;
    if (!parentElt) return;
    var value = this.value;
    var data = this.data;
    var currentValues = parentElt.$selectlistBox.values;
    var index = currentValues.indexOf(value);
    if (index >= 0) {
        currentValues.splice(index, 1);
    }

    parentElt.$selectlistBox.values = currentValues;
    parentElt.$selectlistBox.updatePosition();
    parentElt._updateItems();
    parentElt.emit('remove', Object.assign({}, event, {
        type: 'change',
        target: parentElt,
        data: data,
        value: value,
        itemData: data
    }), parentElt);
    parentElt.emit('change', Object.assign({}, event, {
        type: 'change',
        action: 'remove',
        target: parentElt,
        data: data,
        value: value,
        itemData: data
    }), parentElt);
}

function pressHandler(event) {
    var parentElt = this.$parent;
    if (!parentElt) return;
    var value = this.value;
    if (parentElt.itemFocusable) {
        var prevActiveValue = parentElt.activeValue;
        if (value !== prevActiveValue) {

            parentElt.activeValue = value;
            parentElt.emit('activevaluechange', {
                target: parentElt,
                originEvent: event,
                prevActiveValue: prevActiveValue,
                activeValue: value
            }, parentElt);
        }
    }
}

/***
 *
 * @returns {SelectBoxItem}
 */
function SelectBox_makeItem() {
    return SelectBox_({
        tag: 'selectboxitem',
        on: {
            close: pressCloseEventHandler,
            press: pressHandler
        }
    });
}

var SelectBox_itemPool = [];

function SelectBox_requireItem($parent) {
    var item;
    if (SelectBox_itemPool.length > 0) {
        item = SelectBox_itemPool.pop();
    }
    else {
        item = SelectBox_makeItem();
    }
    item.$parent = $parent;
    return item;
}

function SelectBox_releaseItem(item) {
    item.$parent = null;
    SelectBox_itemPool.push(item);
}


/***
 * @extends PositionTracker
 * @return {SelectBox}
 * @constructor
 */
function SelectBox() {
    this.on('click', this.eventHandler.click);
    this.$selectlistBox = SelectBox_({
        tag: 'selectlistbox',
        props: {
            anchor: [1, 6, 2, 5],
            displayValue: VALUE_HIDDEN
        },
        on: {
            preupdateposition: this.eventHandler.preUpdateListPosition,
            pressitem: this.eventHandler.selectListBoxPressItem
        }
    });
    OOP["a" /* default */].drillProperty(this, this.$selectlistBox, 'enableSearch');
    this.$items = [];
    this._values = [];
    this.items = [];
    this.values = [];
    this.$selectlistBox.followTarget = this;
    this.disableClickToFocus = false;
    this.orderly = true;
    this.itemFocusable = false;
    this._activeValue = undefined;
    return this;
}

SelectBox.tag = 'selectbox';
SelectBox.render = function () {
    return SelectBox_({
        tag: 'bscroller',
        class: ['absol-selectbox', 'absol-bscroller'],
        extendEvent: ['change', 'add', 'remove', 'activevaluechange'],
        attr: {
            tabindex: '1'
        }
    }, true);
};


SelectBox.prototype._requireItem = function (n) {
    var itemElt;
    while (this.$items.length < n) {
        itemElt = SelectBox_requireItem(this);
        this.addChild(itemElt);
        this.$items.push(itemElt);
    }

    while (this.$items.length > n) {
        itemElt = this.$items.pop();
        this.removeChild(itemElt);
        SelectBox_releaseItem(itemElt);
    }
};


SelectBox.prototype._assignItems = function (items) {
    for (var i = 0; i < this.$items.length && i < items.length; ++i) {
        this.$items[i].data = items[i];
    }
};

/***
 *
 * @param {string[] | number[]} values
 * @private
 */
SelectBox.prototype._getItemsByValues = function (values) {
    var selectListBoxElt = this.$selectlistBox;
    var itemHolders = values.reduce(function (ac, cr) {
        ac.push.apply(ac, selectListBoxElt.findItemsByValue(cr));
        return ac;
    }, []);
    if (this.orderly) {
        itemHolders.sort(function (a, b) {
            return a.idx - b.idx;
        });
    }

    return itemHolders.map(function (holder) {
        return holder.item;
    })

};


SelectBox.prototype._updateItems = function () {
    var cBound = this.getBoundingClientRect();
    var items = this._getItemsByValues(this._values);
    this._requireItem(items.length);
    this._assignItems(items);
    if (this.itemFocusable) {
        this._updateFocusItem();
    }
    var nBound = this.getBoundingClientRect();
    if (nBound.width != cBound.width || nBound.height != cBound.height) {
        ResizeSystem["a" /* default */].updateUp(this);
    }
};


SelectBox.property = {};
SelectBox.property.disabled = SelectMenu2.property.disabled;
SelectBox.property.hidden = SelectMenu2.property.hidden;
SelectBox.property.isFocus = SelectMenu2.property.isFocus;


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._updateFocusItem = function () {
    for (var i = 0; i < this.$items.length; ++i) {
        this.$items[i].active = this.$items[i].value == this._activeValue;
    }
};


SelectBox.prototype.init = SelectMenu2.prototype.init;


SelectBox.property.items = {
    set: function (items) {
        items = items || [];
        this.$selectlistBox.items = items;
        this.addStyle('--list-min-width', this.$selectlistBox._estimateWidth + 'px');
        this._updateItems();
    },
    get: function () {
        return this.$selectlistBox.items
    }
};

SelectBox.property.values = {
    set: function (values) {
        values = values || [];
        values = (values instanceof Array) ? values : [values];
        this._values = values;
        this.$selectlistBox.values = values;
        this._updateItems();
    },
    get: function () {
        return this._values || [];
    }
};

SelectBox.property.orderly = {
    set: function (value) {
        var needUpdate = this._orderly === this._orderly;
        if (typeof value === 'function'){
            this._orderly;
        }
        else
            this._orderly = !!value;
        if (needUpdate) {
            this.values = this.values;
        }
    },
    get: function () {
        return !!this._orderly;
    }
};

SelectBox.property.disableClickToFocus = {
    set: function (value) {
        if (value) {
            this.addClass('as-disable-click-to-focus');
        }
        else {
            this.removeClass('as-disable-click-to-focus');
        }
    },
    get: function () {
        return this.containsClass('as-disable-click-to-focus');
    }
};

SelectBox.property.itemFocusable = {
    set: function (value) {
        if (value) {
            this.addClass('as-item-focusable');
        }
        else {
            this.removeClass('as-item-focusable');
        }
        this._updateFocusItem();
    },
    get: function () {
        return this.containsClass('as-item-focusable');
    }
};

SelectBox.property.activeValue = {
    set: function (value) {
        this._activeValue = value;
        if (this.itemFocusable) {
            this._updateFocusItem();
            //todo
        }
    },
    get: function () {
        return this._activeValue;
    }
};


SelectBox.eventHandler = Object.assign({}, SelectMenu2.eventHandler);


SelectBox.eventHandler.click = function (event) {
    if (event.target === this && !this.disableClickToFocus) {
        this.isFocus = !this.isFocus;
    }
};


SelectBox.eventHandler.bodyClick = function (event) {
    if (!EventEmitter["b" /* default */].hitElement(this.$selectlistBox, event) && event.target !== this) {
        this.isFocus = false;
    }
};


SelectBox.eventHandler.selectListBoxPressItem = function (event) {
    var data = event.data;
    var currentValues = this.$selectlistBox.values;
    currentValues.push(data.value);
    this.$selectlistBox.values = currentValues;
    this.$selectlistBox.updatePosition();
    this._activeValue = data.value;
    this._updateItems();
    this.isFocus = false;
    this.emit('add', Object.assign({}, event, {
        type: 'add',
        target: this,
        value: data.value,
        data: data,
        itemData: data
    }), this);
    this.emit('change', Object.assign({}, event, {
        type: 'change',
        action: 'add',
        target: this,
        value: data.value,
        data: data,
        values: this.values
    }), this);
};


ACore["a" /* default */].install(SelectBox);

/* harmony default export */ var js_SelectBox = (SelectBox);
// EXTERNAL MODULE: ./node_modules/absol-acomp/css/selecttable.css
var selecttable = __webpack_require__(53);

// CONCATENATED MODULE: ./node_modules/absol-acomp/js/SelectTable.js











var privateDom = new Dom["b" /* default */]().install(ACore["a" /* default */]);
var SelectTable_$ = privateDom.$;
var SelectTable_ = privateDom._;


function SelectTable() {
    var thisST = this;
    this.$attachhook = SelectTable_('attachhook').addTo(this);
    this.sync = new Promise(function (rs) {
        thisST.$attachhook.on('error', rs);
    });
    this.$buttonsContainer = SelectTable_$('.absol-select-table-buttons-container', this);
    this.$searchContainer = SelectTable_$('.absol-select-table-searchtextinput-container', this);
    this.$nonselectedItemsContainer = SelectTable_$('.absol-select-table-nonselected-items-container', this);
    this.$selectedItemsContainer = SelectTable_$('.absol-select-table-selected-items-container', this);

    this.$nonselectedSearchItemsContainer = SelectTable_$('.absol-select-table-nonselected-search-items-container', this);
    this.$selectedSearchItemsContainer = SelectTable_$('.absol-select-table-selected-search-items-container', this);

    this.$removeAllBtn = SelectTable_$('button.remove-all', this).on('click', this.eventHandler.removeAllBtnClick);
    this.$addAllBtn = SelectTable_$('button.add-all', this).on('click', this.eventHandler.addAllBtnClick);
    this.$vscrollerSelected = SelectTable_$('bscroller#selected', this)
    this.$vscrollerNonselected = SelectTable_$('bscroller#nonselected', this);
    this.$body = SelectTable_$('.absol-select-table-body', this);
    this.$header = SelectTable_$('.absol-select-table-header', this);
    /***
     *
     * @type {SearchTextInput}
     */
    this.$searchTextInput = SelectTable_$('searchtextinput', this).on('stoptyping', this.eventHandler.searchTextInputModify);
    this.$addAllBtn.updateSize = function () {
        thisST.updateScroller && thisST.updateScroller();
    };
    Dom["b" /* default */].addToResizeSystem(this.$addAllBtn);
    return this;
}

SelectTable.tag = 'SelectTable'.toLowerCase();

SelectTable.render = function () {
    return 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']

                        }

                    }
                ]
            }
        ]
    });
}


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["b" /* default */].copyEvent(event, {}), this);
    this.updateScroller();
};

SelectTable.eventHandler.removeAllBtnClick = function (event) {
    this.removeAll();
    if (this.searching) {
        this.eventHandler.searchTextInputModify(event);
    }
    this.emit('removeall', EventEmitter["b" /* 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(/((\&nbsp)|(\s))+/g, ' ').trim();
            it.score += text.toLowerCase().indexOf(filterText.toLowerCase()) >= 0 ? 100 : 0;
            text = 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 (nonAccentVietnamese(b.text) > 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(/((\&nbsp)|(\s))+/g, ' ').trim();
            res.score = (phraseMatch(text, filterText)
                + phraseMatch(nonAccentVietnamese(text), nonAccentVietnamese(filterText))) / 2;
            if (nonAccentVietnamese(text).replace(/s/g, '').toLowerCase().indexOf(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 (nonAccentVietnamese(b.text) > 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["b" /* default */].copyEvent(event, { item: item }), self);
                            }
                            else {
                                this.addTo($selectedItemsContainer);
                                self.emit('add', EventEmitter["b" /* 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["b" /* default */].copyEvent(event, { item: item }), self);
                            }
                            else {
                                this.addTo($selectedItemsContainer);
                                self.emit('add', EventEmitter["b" /* 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["b" /* 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["b" /* 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["b" /* 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["b" /* 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["b" /* 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 HTML5_Svg.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 HTML5_Svg.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 */].install(SelectTable);

/* harmony default export */ var js_SelectTable = (SelectTable);
// CONCATENATED MODULE: ./node_modules/absol-acomp/js/SelectTable2.js










var SelectTable2_privateDom = new Dom["b" /* default */]().install(ACore["a" /* default */]).install(js_SelectTable.privateDom);
var SelectTable2_$ = SelectTable2_privateDom.$;
var SelectTable2_ = SelectTable2_privateDom._;


function SelectTable2() {
    var thisST = this;
    this.$attachhook = SelectTable2_('attachhook').addTo(this);
    this.sync = new Promise(function (rs) {
        thisST.$attachhook.on('error', rs);
    });
    this.$buttonsContainer = SelectTable2_$('.absol-select-table-buttons-container', this);
    this.$searchContainer = SelectTable2_$('.absol-select-table-searchtextinput-container', this);
    this.$nonselectedItemsContainer = SelectTable2_$('.absol-select-table-nonselected-items-container', this);
    this.$selectedItemsContainer = SelectTable2_$('.absol-select-table-selected-items-container', this);

    this.$nonselectedSearchItemsContainer = SelectTable2_$('.absol-select-table-nonselected-search-items-container', this);
    this.$selectedSearchItemsContainer = SelectTable2_$('.absol-select-table-selected-search-items-container', this);

    this.$removeAllBtn = SelectTable2_$('button.remove-all', this).on('click', this.eventHandler.removeAllBtnClick);
    this.$addAllBtn = SelectTable2_$('button.add-all', this).on('click', this.eventHandler.addAllBtnClick);
    this.$vscrollerSelected = SelectTable2_$('vscroller#selected', this)
    this.$vscrollerNonselected = SelectTable2_$('vscroller#nonselected', this);
    this.$body = SelectTable2_$('.absol-select-table-body', this);
    this.$searchTextInput = SelectTable2_$('searchtextinput', this).on('stoptyping', this.eventHandler.searchTextInputModify);
};


SelectTable2.tag = 'SelectTable2'.toLowerCase();

SelectTable2.render = function () {
    return SelectTable2_({
        class: ['absol-select-table', 'exclude'],
        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: 'vscroller',
                        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: 'vscroller',
                        attr: { id: 'selected' },
                        class: 'absol-select-table-items-scroller',
                        child: {
                            child: ['.absol-select-table-selected-items-container', '.absol-select-table-selected-search-items-container']

                        }

                    }
                ]
            }
        ]
    });
};


SelectTable2.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');
};

SelectTable2.prototype.addAll = function () {
    Array.apply(null, this.$nonselectedItemsContainer.childNodes).forEach(function (e) {
        e.addTo(this.$selectedItemsContainer);
    }.bind(this));
    this.requestSort();
};

SelectTable2.prototype.removeAll = function () {
    Array.apply(null, this.$selectedItemsContainer.childNodes).forEach(function (e) {
        e.addTo(this.$nonselectedItemsContainer);
    }.bind(this))
    this.requestSort();
};

SelectTable2.prototype.updateScroller = function () {
    var update = function () {
        if (this.style.height) {
            var bodyMargin = parseFloat(this.$body.getComputedStyleValue('margin-top').replace('px', '') || (0.14285714285 * 14 + ''));
            var bound = this.getBoundingClientRect();
            var bodyBound = this.$body.getBoundingClientRect();
            var bodyRBound = this.$body.getBoundingRecursiveRect();
            var availableHeight = bound.bottom - bodyMargin - bodyBound.top;
            var isOverflowHeight = availableHeight < bodyRBound.height;
            if (isOverflowHeight) {
                this.$vscrollerNonselected.addStyle('max-height', availableHeight + 'px');
                this.$vscrollerSelected.addStyle('max-height', availableHeight + 'px');
                this.$vscrollerSelected.addClass('limited-height');
                this.$vscrollerNonselected.addClass('limited-height');
            }
            else {
                this.$vscrollerNonselected.removeStyle('max-height');
                this.$vscrollerSelected.removeStyle('max-height');
                this.$vscrollerSelected.removeClass('limited-height');
                this.$vscrollerSelected.removeClass('limited-height');
                this.$vscrollerNonselected.removeClass('limited-height');
            }
        }
        requestAnimationFrame(this.$vscrollerNonselected.requestUpdateSize.bind(this.$vscrollerNonselected));
        requestAnimationFrame(this.$vscrollerSelected.requestUpdateSize.bind(this.$vscrollerSelected));
    }.bind(this);
    setTimeout(update, 1);
};

SelectTable2.prototype.getAllItemElement = function () {
    var selectedItemElements = Array.apply(null, this.$selectedItemsContainer.childNodes);
    var nonselectedItemElements = Array.apply(null, this.$nonselectedItemsContainer.childNodes);
    return selectedItemElements.concat(nonselectedItemElements);
};

SelectTable2.prototype.init = function (props) {
    this.super(props);
    this.sync = this.sync.then(this.updateButtonsContainerSize.bind(this));
};

SelectTable2.eventHandler = {};
SelectTable2.eventHandler.addAllBtnClick = function (event) {
    this.addAll();
    if (this.searching) {
        this.eventHandler.searchTextInputModify(event);
    }
    this.emit('addall', EventEmitter["b" /* default */].copyEvent(event, {}), this);
    this.updateScroller();
};

SelectTable2.eventHandler.removeAllBtnClick = function (event) {
    this.removeAll();
    if (this.searching) {
        this.eventHandler.searchTextInputModify(event);
    }
    this.emit('removeall', EventEmitter["b" /* default */].copyEvent(event, {}), this);
    this.updateScroller();
};

SelectTable2.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(/((\&nbsp)|(\s))+/g, ' ').trim();
            it.score += text.toLowerCase().indexOf(filterText.toLowerCase()) >= 0 ? 100 : 0;
            text = 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 (nonAccentVietnamese(b.text) > 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(/((\&nbsp)|(\s))+/g, ' ').trim();
            res.score = (phraseMatch(text, filterText)
                + phraseMatch(nonAccentVietnamese(text), nonAccentVietnamese(filterText))) / 2;
            if (nonAccentVietnamese(text).replace(/s/g, '').toLowerCase().indexOf(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 (nonAccentVietnamese(b.text) > 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;
};

SelectTable2.prototype._stringcmp = function (s0, s1) {
    if (s0 == s1) return 0;
    if (s0 > s1) return 1;
    return -1;
};

SelectTable2.prototype._getString = function (item) {
    if (typeof item == "string") return item;
    return item.text;
};

SelectTable2.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]) return false;
    }
    return true;
};


SelectTable2.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;
};

SelectTable2.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;
    }

};

SelectTable2.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;

};


SelectTable2.property = {};

SelectTable2.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');
    }
};

SelectTable2.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'
    }
};

SelectTable2.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'
    }
};

SelectTable2.property.searching = {
    set: function (value) {
        if (value) {
            this.addClass('searching');
        }
        else {
            this.removeClass('searching');
        }
        this.updateScroller();
    },
    get: function () {
        return this.containsClass('searching');
    }
};


SelectTable2.property.sorted = {
    set: function (value) {
        this._sort = value;
        this.requestSort();

    },
    get: function () {
        return this._sort;
    }
};

SelectTable2.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 SelectTable2_({
                    tag: 'item',
                    props: {
                        data: item
                    },
                    on: {
                        requestmove: function (event) {
                            if (this.parentElement == $selectedItemsContainer) {
                                this.addTo($nonselectedItemsContainer);
                                self.emit('remove', EventEmitter["b" /* default */].copyEvent(event, { item: item }), self);
                            }
                            else {
                                this.addTo($selectedItemsContainer);
                                self.emit('add', EventEmitter["b" /* 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;
        });
    }

}

SelectTable2.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 SelectTable2_({
                    tag: 'item',
                    props: {
                        data: item
                    },
                    on: {
                        requestmove: function (event) {
                            if (this.parentElement == $selectedItemsContainer) {
                                this.addTo($nonselectedItemsContainer);
                                self.emit('remove', EventEmitter["b" /* default */].copyEvent(event, { item: item }), self);
                            }
                            else {
                                this.addTo($selectedItemsContainer);
                                self.emit('add', EventEmitter["b" /* 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;
        });
    }
};


SelectTable2.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 SelectTable2_({
                    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["b" /* 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["b" /* 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;
        });
    }

}

SelectTable2.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 SelectTable2_({
                    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["b" /* 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["b" /* 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 SelectTable2_Item() {
    var res = SelectTable2_({
        extendEvent: ['requestmove', 'clickadd', 'clickremove', 'clickexclude'],
        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-row',
                        child: [
                            {
                                attr: {
                                    title: 'Add'
                                },
                                class: ['absol-select-table-item-right-container-cell', 'add'],
                                child: 'addicon'

                            },
                            {
                                attr: {
                                    title: 'Remove'
                                },
                                class: ['absol-select-table-item-right-container-cell', 'remove'],
                                child: 'subicon'

                            },
                            {
                                attr: {
                                    title: 'Exclude'
                                },
                                class: ['absol-select-table-item-right-container-cell', 'exclude'],
                                child: 'excludeico'
                            },
                        ]
                    }
                }

            }
        ]
    });
    res.$text = SelectTable2_$('span', res);
    res.eventHandler = OOP["a" /* default */].bindFunctions(res, SelectTable2_Item.eventHandler);
    res.$rightBtn = SelectTable2_$('.absol-select-table-item-right-container', res);
    res.on('dblclick', res.eventHandler.dblclick);
    res.$addBtn = SelectTable2_$('.absol-select-table-item-right-container-cell.add', res).on('click', res.eventHandler.addBtClick);
    res.$removeBtn = SelectTable2_$('.absol-select-table-item-right-container-cell.remove', res).on('click', res.eventHandler.removeBtClick);
    res.$excludeBtn = SelectTable2_$('.absol-select-table-item-right-container-cell.exclude', res).on('click', res.eventHandler.excludeBtClick);
    return res;
};


SelectTable2_Item.eventHandler = {};
SelectTable2_Item.eventHandler.dblclick = function (event) {
    event.preventDefault();
    if (!EventEmitter["b" /* default */].hitElement(this.$rightBtn, event))
        this.emit('requestmove', event, this);
};

SelectTable2_Item.eventHandler.rightBtClick = function (event) {
    this.emit('requestmove', event, this);
};

SelectTable2_Item.eventHandler.removeBtClick = function (event) {
    this.emit('clickremove', event, this);
};

SelectTable2_Item.eventHandler.addBtClick = function (event) {
    this.emit('clickadd', event, this);
};

SelectTable2_Item.eventHandler.excludeBtClick = function (event) {
    this.emit('clickexclude', event, this);
};


SelectTable2_Item.property = {};
SelectTable2_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;
    }
};

SelectTable2_Item.property.text = {
    get: function () {
        return this._data ? (typeof this._data == 'string' ? this._data : this._data.text) : '';
    }
};


function ExcludeIco() {
    return SelectTable2_(
        '<svg class="exclude-icon" width="24" height="24" viewBox="0 0 24 24">\
            <path  d="M8.27,3L3,8.27V15.73L8.27,21H15.73C17.5,19.24 21,15.73 21,15.73V8.27L15.73,3M9.1,5H14.9L19,9.1V14.9L14.9,19H9.1L5,14.9V9.1M11,15H13V17H11V15M11,7H13V13H11V7" />\
        </svg>');
}


SelectTable2_privateDom.install({
    item: SelectTable2_Item,
    excludeico: ExcludeIco
});

// not completed yet

ACore["a" /* default */].install('selecttable2', SelectTable2);
/* harmony default export */ var js_SelectTable2 = (SelectTable2);
// EXTERNAL MODULE: ./node_modules/absol-acomp/css/spaninput.css
var spaninput = __webpack_require__(184);

// 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 (value) {
    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.tag = 'spaninput';

SpanInput.render = function () {
    return SpanInput_('span.absol-span-input[contenteditable="true"]');
};


ACore["a" /* default */].install(SpanInput);

/* harmony default export */ var js_SpanInput = (SpanInput);
// EXTERNAL MODULE: ./node_modules/absol-acomp/css/statictabbar.css
var statictabbar = __webpack_require__(186);

// CONCATENATED MODULE: ./node_modules/absol-acomp/js/StaticTabbar.js





var StaticTabbar_$ = ACore["a" /* default */].$;
var StaticTabbar_ = ACore["a" /* default */]._;


function StaticTabbar() {
    var thisST = this;
    this.$activeBox = StaticTabbar_$('.absol-static-tabbar-active-box', this)
    this.$hline = StaticTabbar_$('.absol-static-tabbar-hline', this);
    this.$buttons = [];
    this._btDict = {};
    this._activedButton = undefined;
    this.sync = new Promise(function (resolve) {
        StaticTabbar_('attachhook').on('error', function () {
            this.remove();
            resolve();
        }).addTo(thisST);
    });
    return this;
}

StaticTabbar.tag = 'StaticTabbar'.toLowerCase();

StaticTabbar.render = function () {
    return StaticTabbar_({
        class: 'absol-static-tabbar',
        extendEvent: 'change',
        child: [
            {
                class: 'absol-static-tabbar-active-box',
                child: '.absol-static-tabbar-hline'
            }
        ]
    });
};

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);



// EXTERNAL MODULE: ./node_modules/absol-acomp/css/switch.css
var css_switch = __webpack_require__(188);

// CONCATENATED MODULE: ./node_modules/absol-acomp/js/Switch.js




var Switch_ = ACore["a" /* default */]._;
var Switch_$ = ACore["a" /* default */].$;


function Switch() {
    var thisS = this;
    this.$input = Switch_$('input', this);
    this.$input.on('click', function (event) {
        thisS.emit('change', event, thisS);
    });
    OOP["a" /* default */].drillProperty(this, this.$input, 'checked');
    OOP["a" /* default */].drillProperty(this, this.$input, 'isOn', 'checked');
}


Switch.tag = 'switch';

Switch.render = function () {
    return Switch_({
        tag: 'label',
        class: 'absol-switch',
        extendEvent: 'change',
        child: [
            'input[type="checkbox"]',
            'span.absol-switch-slider'
        ]
    });
};

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/checkboxbutton.css
var checkboxbutton = __webpack_require__(190);

// CONCATENATED MODULE: ./node_modules/absol-acomp/js/CheckboxButton.js




ACore["a" /* default */].install('checkboxbutton', CheckBoxInput);
/* harmony default export */ var CheckboxButton = (CheckBoxInput);
// EXTERNAL MODULE: ./node_modules/absol-acomp/css/tablescroller.css
var tablescroller = __webpack_require__(192);

// CONCATENATED MODULE: ./node_modules/absol-acomp/js/TableScroller.js





var TableScroller_$ = ACore["a" /* default */].$;
var TableScroller_ = ACore["a" /* default */]._;


function TableScroller() {
    var thisTS = this;
    this.$content = undefined;
    this.$fixedViewport = TableScroller_$('.absol-table-scroller-fixed-viewport', this);

    this.$leftScroller = TableScroller_$('.absol-table-scroller-left-vscroller', this);
    this.$leftViewport = TableScroller_$('.absol-table-scroller-left-vscroller-viewport', this)
        .on('scroll', thisTS.eventHandler.scrollLeftScrollerViewport);
    ;

    this.$headScroller = TableScroller_$('.absol-table-scroller-header-hscroller', this);
    this.$headScrollerViewport = TableScroller_$('.absol-table-scroller-header-hscroller-viewport', this)
        .on('scroll', this.eventHandler.scrollHeadScrollerViewport);

    this.$attachHook = TableScroller_$('attachhook', this);
    this.$attachHook.requestUpdateSize = this._updateContentSize.bind(this);
    this.$attachHook.on('error', function () {
        Dom["b" /* default */].addToResizeSystem(this);
    });

    this.sync = new Promise(function (rs) {
        thisTS.$attachHook.once('error', rs)
    });

    this.$viewport = TableScroller_$('.absol-table-scroller-viewport', this)
        .on('scroll', this.eventHandler.scrollViewport);

    this.$viewport.scrollInto = js_BScroller.prototype.scrollInto;

    this.$leftLine = TableScroller_$('.absol-table-scroller-left-line', this);
    this.$headLine = TableScroller_$('.absol-table-scroller-head-line', this);

    this.$vscrollbarCtn = TableScroller_$('.absol-table-scroller-vscrollbar-container', this);
    this.$vscrollbar = TableScroller_$('.absol-table-scroller-vscrollbar-container vscrollbar', this)
        .on('scroll', function () {
            thisTS.$viewport.scrollTop = this.innerOffset;
        });


    this.$hscrollbarCtn = TableScroller_$('.absol-table-scroller-hscrollbar-container', this);
    this.$hscrollbar = TableScroller_$('.absol-table-scroller-hscrollbar-container hscrollbar', this)
        .on('scroll', function () {
            thisTS.$viewport.scrollLeft = this.innerOffset;
        });

    this.$vscrollbar.hidden = false;
    this.$hscrollbar.hidden = false;
    this._fixedTableThsVisible = [];
    this._fixedTableTr = [];
    this._fixedTableThs = [];
}

TableScroller.tag = 'TableScroller'.toLowerCase();

TableScroller.render = function () {
    return 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'
                }
            },
            'attachhook'
        ]
    });
};


TableScroller.scrollSize = 17;//default 

Dom["b" /* 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["b" /* default */].updateResizeSystem();
    setTimeout(Dom["b" /* default */].updateResizeSystem.bind(Dom["b" /* 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') {
            elt.classList.add('absol-table-scroller-origin');
            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')
        .removeClass('absol-table-scroller-origin').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))
        .removeClass('absol-table-scroller-origin')
        .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 () {
    if (!this.$fixedTable) return;
    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);

/* harmony default export */ var js_TableScroller = (TableScroller);
// EXTERNAL MODULE: ./node_modules/absol-acomp/css/tablevscroller.css
var tablevscroller = __webpack_require__(194);

// CONCATENATED MODULE: ./node_modules/absol-acomp/js/TableVScroller.js




var TableVScroller_ = ACore["a" /* default */]._;
var TableVScroller_$ = ACore["a" /* default */].$;

function TableVScroller() {
    var thisTS = this;
    this.$attachHook = TableVScroller_$('attachhook', this);
    this.$attachHook.updateSize = this.update.bind(this);

    this.sync = new Promise(function (rs) {
        thisTS.$attachHook.on('error', rs)
    });
    this.$viewport = TableVScroller_$('.absol-table-vscroller-viewport', this);
    this.$attachHook.on('error', function () {
        Dom["b" /* default */].addToResizeSystem(thisTS.$attachHook);
        this.updateSize();
    });
    this.$topTable = TableVScroller_$('.absol-table-vscroller-head', this);
    this.$headLine = TableVScroller_$('.absol-table-vscroller-head-line', this);
}

TableVScroller.tag = 'TableVScroller'.toLowerCase();

TableVScroller.render = function () {
    return TableVScroller_(
        {
            class: 'absol-table-vscroller',
            child: [
                '.absol-table-vscroller-viewport',
                'table.absol-table-vscroller-head',
                '.absol-table-vscroller-head-line',
                'attachhook'
            ]
        }
    );
};

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');
            this.update();
        }
        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();
};

ACore["a" /* default */].install(TableVScroller);

/* harmony default export */ var js_TableVScroller = (TableVScroller);

// EXTERNAL MODULE: ./node_modules/absol-acomp/css/textarea2.css
var textarea2 = __webpack_require__(196);

// 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_SelectMenu() {
    var thisSM = this;
    this._items = [];
    this._value = null;
    this._lastValue = null;
    this.$holderItem = SelectMenu_$('.absol-selectmenu-holder-item', this);

    this.$anchorCtn = SelectMenu_SelectMenu.getAnchorCtn();
    this.$anchor = SelectMenu_('.absol-selectmenu-anchor.absol-disabled').addTo(this.$anchorCtn);
    this.$anchorContentCtn = SelectMenu_('.absol-selectmenu-anchor-content-container').addTo(this.$anchor);

    this.$dropdownBox = SelectMenu_('.absol-selectmenu-dropdown-box').addTo(this.$anchorContentCtn);
    this.$searchTextInput = SelectMenu_('searchtextinput').addStyle('display', 'none').addTo(this.$dropdownBox);
    this.$vscroller = SelectMenu_('bscroller').addTo(this.$dropdownBox);
    this.$selectlist = SelectMenu_('selectlist', this).addTo(this.$vscroller)
        .on('sizechangeasync', this.eventHandler.listSizeChangeAsync)
        .on('valuevisibilityasync', this.eventHandler.listValueVisibility);


    this.$scrollTrackElts = [];
    this.$removableTrackElts = [];

    this._itemsByValue = {};
    this.$searchTextInput.on('stoptyping', this.eventHandler.searchModify);
    this._searchCache = {};
    this.$selectlist.on('pressitem', this.eventHandler.selectlistPressItem, true);
    this.$selectlist.on('pressitem', function () {
        thisSM.isFocus = false;
    }, true);
    this._lastValue = "NOTHING_VALUE";
    this._resourceReady = true;


    this.on('mousedown', this.eventHandler.click, true);
    this.on('blur', this.eventHandler.blur);

    this.selectListBound = { height: 0, width: 0 };
    this.$attachhook = SelectMenu_$('attachhook', this)
        .on('error', this.eventHandler.attached);

    this.sync = new Promise(function (rs) {
        SelectMenu_$('attachhook', this).once('error', function () {
            rs();
        });
    });

    this._selectListScrollSession = null;
    this._itemIdxByValue = null;
    return this;
}

SelectMenu_SelectMenu.tag = 'selectmenu-old';
SelectMenu_SelectMenu.render = function () {
    return 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',
        ]
    });
};

SelectMenu_SelectMenu.optimizeResource = true;

// //will remove after SelectMenu completed
SelectMenu_SelectMenu.getRenderSpace = function () {
    if (!SelectMenu_SelectMenu.getRenderSpace.warned) {
        console.warn('SelectMenu.getRenderSpace() will be removed in next version');
    }
    SelectMenu_SelectMenu.getRenderSpace.warned = true;
    if (!SelectMenu_SelectMenu.$renderSpace) {
        SelectMenu_SelectMenu.$renderSpace = SelectMenu_('.absol-selectmenu-render-space')
            .addTo(document.body);
    }
    return SelectMenu_SelectMenu.$renderSpace;
};


SelectMenu_SelectMenu.getAnchorCtn = function () {
    if (!SelectMenu_SelectMenu.$anchorCtn) {
        SelectMenu_SelectMenu.$anchorCtn = SelectMenu_('.absol-selectmenu-anchor-container')
            .addTo(document.body);
    }
    return SelectMenu_SelectMenu.$anchorCtn;
};


SelectMenu_SelectMenu.prototype.updateItem = function () {
    this.$holderItem.clearChild();
    if (this._itemsByValue[this.value]) {
        var elt = SelectMenu_({ tag: 'selectlistitem', props: { data: this._itemsByValue[this.value] } }).addTo(this.$holderItem);
        elt.$descCtn.addStyle('width', this.$selectlist._descWidth + 'px');
    }
};

SelectMenu_SelectMenu.prototype._dictByValue = function (items) {
    var dict = {};
    var item;
    for (var i = 0; i < items.length; ++i) {
        item = items[i];
        dict[item.value + ''] = item;
    }
    return dict;
};


SelectMenu_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;
    }
    var value = props.value;
    delete props.value;
    this.super(props);
    this.value = value;
};

SelectMenu_SelectMenu.property = {};
SelectMenu_SelectMenu.property.items = {
    set: function (value) {
        this._searchCache = {};
        this._itemIdxByValue = null;
        /**
         * verity data
         */
        if (value) {
            value.forEach(function (it) {
                if (it && it.text) {
                    it.text = it.text + '';
                }
            });
        }

        this._items = value;
        this._itemsByValue = this._dictByValue(value);

        if (!this._itemsByValue[this.value] && value.length > 0) {
            this.value = value[0].value;
        }
        else
            this.updateItem();

        this.$dropdownBox.removeStyle('min-width');
        this.selectListBound = this.$selectlist.setItemsAsync(value || []);
        this.style.setProperty('--select-list-desc-width', this.$selectlist.measuredSize.descWidth + 'px');
        this._resourceReady = true;

        this.addStyle('min-width', this.selectListBound.width + 2 + 23 + 'px');
        this.emit('minwidthchange', {
            target: this,
            value: this.selectListBound.width + 2 + 23,
            type: 'minwidthchange'
        }, this);
    },
    get: function () {
        return this._items || [];
    }
};

SelectMenu_SelectMenu.property.value = {
    set: function (value) {
        this.$selectlist.value = value;
        this._lastValue = value;
        this.updateItem();
    },
    get: function () {
        return this.$selectlist.value;
    }
};


SelectMenu_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_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["b" /* default */].traceOutBoundingClientRect(this);

        if (!this.isFocus || bound.top > outBound.bottom || bound.bottom < outBound.top) {
            this.isFocus = false;
            return;
        }

        var anchorOutBound = Dom["b" /* 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;
            if (this.$dropdownBox.firstChild != this.$searchTextInput) {
                this.$searchTextInput.selfRemove();
                this.$dropdownBox.addChildBefore(this.$searchTextInput, this.$vscroller);
            }
            this.$vscroller.addStyle('max-height', availableBottom + 'px');
        }
        else {
            this.isDropdowUp = true;
            if (this.$dropdownBox.lastChild != this.$searchTextInput) {
                this.$searchTextInput.selfRemove();
                this.$dropdownBox.addChild(this.$searchTextInput);
            }
            this.$vscroller.addStyle('max-height', availableTop + 'px');
        }
        this.$dropdownBox.addStyle('min-width', bound.width + 'px');
    }
    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_SelectMenu.prototype.scrollToSelectedItem = function () {
    var self = this;
    setTimeout(function () {
        if (self.$selectlist.$selectedItem) {
            var fistChildBound = self.$selectlist.childNodes[1].getBoundingClientRect();
            var lastChildBound = self.$selectlist.lastChild.getBoundingClientRect();
            var listBound = {
                top: fistChildBound.top,
                height: lastChildBound.bottom - fistChildBound.top,
                bottom: lastChildBound.bottom
            }
            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), 3);
};


SelectMenu_SelectMenu.prototype.startTrackScroll = function () {
    var trackElt = this.parentElement;
    while (trackElt) {
        if (trackElt.addEventListener) {
            trackElt.addEventListener('scroll', this.eventHandler.scrollParent, false);

        }
        else {
            trackElt.attachEvent('onscroll', this.eventHandler.scrollParent, false);
        }

        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_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_SelectMenu.prototype.startListenRemovable = function () {
    var removableElt = this.parentElement;
    while (removableElt) {
        if (removableElt.isSupportedEvent && removableElt.isSupportedEvent('remove')) {
            removableElt.on('remove', this.eventHandler.removeParent);
        }
        removableElt = removableElt.parentElement;
    }
};

SelectMenu_SelectMenu.prototype.stopListenRemovable = function () {
    var removableElt;
    while (this.$removableTrackElts.length > 0) {
        removableElt = this.$removableTrackElts.pop();
        removableElt.off('remove', this.eventHandler.removeParent);
    }
};

SelectMenu_SelectMenu.prototype._releaseResource = function () {
    this.$selectlist.items = [];
};

SelectMenu_SelectMenu.prototype._requestResource = function () {
    this.$selectlist.items = this._items || [];
};

SelectMenu_SelectMenu.property.isFocus = {
    set: function (value) {
        var self = this;
        value = !!value;
        if (value == this.isFocus) return;
        this._isFocus = value;
        if (value) {
            this.startTrackScroll();
            this.selectListScrollToken = null;//force scroll
            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.scrollToSelectedItem();
            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;
                    self._resourceReady = true;
                    self.$selectlist.removeClass('as-searching');
                }
            }, 100)
            this.updateItem();
        }
    },
    get: function () {
        return !!this._isFocus;
    }
};


SelectMenu_SelectMenu.property.disabled = {
    set: function (value) {
        if (value) {
            this.addClass('disabled');
        }
        else {
            this.removeClass('disabled');
        }
    },
    get: function () {
        return this.containsClass('disabled');
    }
};


SelectMenu_SelectMenu.property.hidden = {
    set: function (value) {
        if (value) {
            this.addClass('hidden');
        }
        else {
            this.removeClass('hidden');
        }
    },
    get: function () {
        return this.addClass('hidden');
    }
};

SelectMenu_SelectMenu.property.selectedIndex = {
    get: function () {
        if (!this._itemIdxByValue) {
            this._itemIdxByValue = {};
            for (var i = 0; i < this._items.length; ++i) {
                this._itemIdxByValue[this._items[i].value] = i;
            }
        }
        var idx = this._itemIdxByValue[this._value];
        return idx >= 0 ? idx : -1;
    }
};

/**
 * @type {SelectMenu}
 */
SelectMenu_SelectMenu.eventHandler = {};

SelectMenu_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["b" /* default */].addToResizeSystem(this.$attachhook);
    this.stopListenRemovable();
    this.startListenRemovable();
    if (!this._resourceReady) {
        this._requestResource();
        this._resourceReady = true;
    }
    this._updateInterval = setInterval(function () {
        if (!this.isDescendantOf(document.body)) {
            clearInterval(this._updateInterval);
            this._updateInterval = undefined;
            this.$anchor.selfRemove();
            this.stopTrackScroll();
            this.stopListenRemovable();
            this.eventHandler.removeParent();
        }
    }.bind(this), 10000);
};


SelectMenu_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.scrollToSelectedItem();
        self._scrollFrameout--;
        if (self._scrollFrameout > 0) requestAnimationFrame(update);
    }

    update();
};

SelectMenu_SelectMenu.eventHandler.removeParent = function (event) {
    this._releaseResource();
    this._resourceReady = false;
};

SelectMenu_SelectMenu.eventHandler.click = function (event) {
    if (EventEmitter["b" /* default */].isMouseRight(event)) return;
    this.isFocus = !this.isFocus;
};


SelectMenu_SelectMenu.eventHandler.bodyClick = function (event) {
    if (!EventEmitter["b" /* default */].hitElement(this, event) && !EventEmitter["b" /* default */].hitElement(this.$anchor, event)) {
        setTimeout(function () {
            this.isFocus = false;
        }.bind(this), 5)
    }
};

SelectMenu_SelectMenu.eventHandler.selectlistPressItem = function (event) {
    this.updateItem();
    if (this._lastValue != this.value) {
        event.lastValue = this._lastValue;
        event.value = this.value;
        setTimeout(function () {
            this.emit('change', event, this);
        }.bind(this), 1)
        this._lastValue = this.value;
    }
};


SelectMenu_SelectMenu.eventHandler.searchModify = function (event) {
    var filterText = this.$searchTextInput.value.replace(/((\&nbsp)|(\s))+/g, ' ').trim();
    if (filterText.length == 0) {
        this._resourceReady = true;
        this.$selectlist.items = this.items;
        this.scrollToSelectedItem();
        this.$selectlist.removeClass('as-searching');
    }
    else {
        this.$selectlist.addClass('as-searching');
        var view = [];
        if (!this._searchCache[filterText]) {
            if (this._items.length > 0 && !this._items[0].__nvnText__) {
                prepareSearchForList(this._items);
            }

            view = searchListByText(filterText, this._items);
            this._searchCache[filterText] = view;
        }
        else {
            view = this._searchCache[filterText];
        }
        this.$selectlist.items = view;
        this._resourceReady = true;
        this.$vscroller.scrollTop = 0;
    }

    this.selectListBound = this.$selectlist.getBoundingClientRect();
    this.updateDropdownPostion(true);
};

SelectMenu_SelectMenu.eventHandler.listSizeChangeAsync = function () {
    this.updateDropdownPostion();
};

SelectMenu_SelectMenu.eventHandler.listValueVisibility = function (event) {
    if (!this.isFocus) return;
    if (this._selectListScrollSession == event.session) return;

    this._selectListScrollSession = event.session;
    this.scrollToSelectedItem();
};


ACore["a" /* default */].install(SelectMenu_SelectMenu);

/* harmony default export */ var js_SelectMenu = (SelectMenu_SelectMenu);

// CONCATENATED MODULE: ./node_modules/absol-acomp/js/TextArea2.js





var TextArea2_ = ACore["a" /* default */]._;
var TextArea2_$ = ACore["a" /* default */].$;


function TextArea2() {
    this.on('keydown', this.eventHandler.keydown);
    this.on('paste', this.eventHandler.paste);
    this.on('cut', this.eventHandler.paste);
}

TextArea2.tag = 'TextArea2'.toLowerCase();

TextArea2.render = function () {
    return TextArea2_('textarea.absol-textarea2');
};


TextArea2.getRenderPre = function () {
    if (!TextArea2.$preSpace) {
        TextArea2.$preSpace = TextArea2_('textarea').addStyle({
            'overflow': 'hidden',
            'height': '12px',
            'resize': 'none'
        }).addTo(js_SelectMenu.getRenderSpace());
    }
    return TextArea2.$preSpace;
};

TextArea2.eventHandler = {};

TextArea2.eventHandler.keydown = function (event) {
    if (event.altKey || event.ctrlKey) return;
    var key = event.key;
    var selectPost = this.getInputSelection();
    var leftText = this.value.substring(0, selectPost.start);
    var rightText = this.value.substring(selectPost.end);


    var middText = '';
    if (key == 'Enter') {
        middText = '\n';
    }
    else if (key == 'Backspace') {
        if (leftText.length > 0) {
            leftText = leftText.substring(0, leftText.length - 1);
        }
    }
    else if (key == 'Delete') {
        if (selectPost.start < selectPost.end) {
            middText = '';
        }
        else if (rightText.length > 0) {
            rightText = rightText.substring(1);
        }
    }
    else if (key.length == 1) {//char
        middText = key;
    }
    else {
        return;
    }
    var newText = leftText + middText + rightText;

    var heightSyle = this._measureHeight(newText);
    this.addStyle('height', heightSyle);
};


TextArea2.eventHandler.paste = function (event) {
    // var text  = 
    var cl = event.clipboardData || window.clipboardData;
    var middText = cl.getData('Text') || '';
    var selectPost = this.getInputSelection();
    var leftText = this.value.substring(0, selectPost.start);
    var rightText = this.value.substring(selectPost.end);
    var newText = leftText + middText + rightText;

    var heightSyle = this._measureHeight(newText);
    this.addStyle('height', heightSyle);

};


TextArea2.eventHandler.cut = function (event) {
    // var text  = 
    var cl = event.clipboardData || window.clipboardData;
    var selectPost = this.getInputSelection();
    var leftText = this.value.substring(0, selectPost.start);
    var rightText = this.value.substring(selectPost.end);
    var newText = leftText + rightText;

    var heightSyle = this._measureHeight(newText);
    this.addStyle('height', heightSyle);

};

TextArea2.prototype._measureHeight = function (text) {
    var pre = TextArea2.getRenderPre();
    pre.addStyle('padding-left', this.getComputedStyleValue('padding-left'))
    pre.addStyle('padding-right', this.getComputedStyleValue('padding-right'))
    pre.addStyle('padding-top', this.getComputedStyleValue('padding-top'))
    pre.addStyle('padding-bottom', this.getComputedStyleValue('padding-bottom'));
    pre.addStyle('width', this.getComputedStyleValue('width'));
    pre.addStyle('height', this.getFontSize() + 'px');
    pre.addStyle('boder', this.getComputedStyleValue('boder'));
    pre.addStyle('font-size', this.getComputedStyleValue('font-size'));
    pre.addStyle('font-family', this.getComputedStyleValue('font-family'));
    pre.value = text;
    var result = pre.scrollHeight + 'px';
    return result;
};

/**
 * Return an object with the selection range or cursor position (if both have the same value)
 * @param {DOMElement} el A dom element of a textarea or input text.
 * @return {Object} reference Object with 2 properties (start and end) with the identifier of the location of the cursor and selected text.
 **/
TextArea2.prototype.getInputSelection = function () {
    var start = 0, end = 0, normalizedValue, range, textInputRange, len, endRange;

    if (typeof this.selectionStart == "number" && typeof this.selectionEnd == "number") {
        start = this.selectionStart;
        end = this.selectionEnd;
    }
    else {
        range = document.selection.createRange();

        if (range && range.parentElement() == this) {
            len = this.value.length;
            normalizedValue = this.value.replace(/\r\n/g, "\n");

            // Create a working TextRange that lives only in the input
            textInputRange = this.createTextRange();
            textInputRange.moveToBookmark(range.getBookmark());

            // Check if the start and end of the selection are at the very end
            // of the input, since moveStart/moveEnd doesn't return what we want
            // in those cases
            endRange = this.createTextRange();
            endRange.collapse(false);

            if (textInputRange.compareEndPoints("StartToEnd", endRange) > -1) {
                start = end = len;
            }
            else {
                start = -textInputRange.moveStart("character", -len);
                start += normalizedValue.slice(0, start).split("\n").length - 1;

                if (textInputRange.compareEndPoints("EndToEnd", endRange) > -1) {
                    end = len;
                }
                else {
                    end = -textInputRange.moveEnd("character", -len);
                    end += normalizedValue.slice(0, end).split("\n").length - 1;
                }
            }
        }
    }

    return {
        start: start,
        end: end
    };
}

ACore["a" /* default */].install(TextArea2);
/* harmony default export */ var js_TextArea2 = (TextArea2);
// EXTERNAL MODULE: ./node_modules/absol-acomp/css/textclipboard.css
var textclipboard = __webpack_require__(198);

// CONCATENATED MODULE: ./node_modules/absol-acomp/js/TextClipboard.js



var TextClipboard_ = ACore["a" /* default */]._;
var TextClipboard_$ = ACore["a" /* default */].$;

function TextClipboard() {
    this.$textarea = TextClipboard_('<textarea class="absol-text-clipboard" wrap="off" autocorrect="off"' +
        ' autocapitalize="off" spellcheck="false"></textarea>').addTo(this);
}

TextClipboard.tag = 'TextClipboard'.toLowerCase();

TextClipboard.render = function () {
    return TextClipboard_({
        style: {
            positon: 'fixed',
            opacity: 0,
            width: '1px',
            height: '1px',
            top: 0,
            left: 0
        }
    });
};

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 */].install(TextClipboard);

/* harmony default export */ var js_TextClipboard = (TextClipboard);
// EXTERNAL MODULE: ./node_modules/absol-acomp/css/timeinput.css
var timeinput = __webpack_require__(200);

// EXTERNAL MODULE: ./node_modules/absol-acomp/css/timepicker.css
var timepicker = __webpack_require__(202);

// CONCATENATED MODULE: ./node_modules/absol-acomp/js/TimePicker.js








//todo: add this to absol
var isTouchDevice = BrowserDetector["a" /* default */].hasTouch && !BrowserDetector["a" /* default */].os.type.match(/windows|X11|Ubuntu|Linux/);
//todo: re select text after click
var TimePicker_ = ACore["a" /* default */]._;
var TimePicker_$ = ACore["a" /* default */].$;

var TimePicker_$g = HTML5_Svg.ShareInstance.$;
var TimePicker_g = HTML5_Svg.ShareInstance._;

function TimePicker() {
    this._hour = 0;
    this._minute = 0;
    this._lastDayOffset = 0;
    this._state = 'none';
    this._mode = 'CLOCK';
    this._latBound = { width: 0, height: 0 };
    var thisPicker = this;
    if (isTouchDevice)
        this.addClass('ac-time-picker-touch');
    this.$attachook = TimePicker_('attachhook').addTo(this).on('error', function () {
        Dom["b" /* default */].addToResizeSystem(this);
        this.requestUpdateSize();
        thisPicker.addStyle('font-size', thisPicker.getComputedStyleValue('font-size'));
    });
    this.$attachook.requestUpdateSize = this.updateSize.bind(this);
    /***
     *
     * @type {NumberSpanInput}
     */
    this.$hour = TimePicker_$('.ac-time-picker-hour', this)
        .on({
            focus: this.eventHandler.focusHour,
            keydown: this.eventHandler.keydownHour,
            blur: this.eventHandler.blurHour
        });
    /***
     *
     * @type {NumberSpanInput}
     */
    this.$minute = TimePicker_$('.ac-time-picker-minute', this)
        .on({
            keydown: this.eventHandler.keydownMinute,
            focus: this.eventHandler.focusMinute,
            blur: this.eventHandler.blurMinute,
        });

    this.$hourInput = TimePicker_$('.ac-time-picker-hour-input', this)
        .on({
            click: this.eventHandler.clickHourInput,
            keydown: this.eventHandler.keydownHourInput,
            blur: this.eventHandler.blurHourInput
        });

    this.$minuteInput = TimePicker_$('.ac-time-picker-minute-input', this)
        .on({
            click: this.eventHandler.clickMinuteInput,
            keydown: this.eventHandler.keydownMinuteInput,
            blur: this.eventHandler.blurMinuteInput
        });

    //only support if is none touch device
    if (isTouchDevice) {
        this.$hour.readOnly = true;
        this.$hour.on('click', this._editHourState.bind(this));
        this.$minute.readOnly = true;
        this.$minute.on('click', this._editMinuteState.bind(this));
    }

    this.$clock = TimePicker_$g('.ac-time-picker-clock', this)
        .on(isTouchDevice ? 'touchstart' : 'mousedown', this.eventHandler.mousedownClock
        );

    this._clockWidth = 400;
    this._clockHeight = 400;
    this._clockRadius = 150;
    this._clockRadiusInner = 100;
    this.$clockContent = TimePicker_$g('.ac-time-picker-clock-content', this);
    this.$clockHourCtn = TimePicker_$g('.ac-time-picker-clock-hour-ctn', this);
    this.$clockMinuteCtn = TimePicker_$g('.ac-time-picker-clock-minute-ctn', this);

    this.$hourNumbers = Array(24).fill(0).map(function (u, i) {
        var h = i;
        if (h == 0)
            h = 12;
        else if (h == 12) h = '00';
        return TimePicker_g({
            tag: 'text',
            attr: {
                'text-anchor': 'middle'
            },
            class: 'ac-time-picker-clock-hour-' + (i < 12 ? 'am' : 'pm'),
            child: { text: h + '' }
        }).addTo(thisPicker.$clockHourCtn);
    });
    this.$minuteNumbers = Array(12).fill(0).map(function (u, i) {
        return TimePicker_g({
            tag: 'text',
            attr: {
                'text-anchor': 'middle'
            },
            class: 'ac-time-picker-clock-minute',
            child: { text: i * 5 + '' }
        }).addTo(thisPicker.$clockMinuteCtn);
    });

    this.$selectCtn = TimePicker_$g('.ac-time-picker-clock-select-ctn', this);
    this.$clockCenter = TimePicker_g({
        tag: 'circle',
        class: 'ac-time-picker-clock-center',
        attr: {
            cx: "0",
            cy: '0'
        }
    }).addTo(this.$selectCtn);
    this.$clockSelectLine = TimePicker_g({
        tag: 'path',
        class: 'ac-time-picker-clock-select-line'
    }).addTo(this.$selectCtn);
    this.$clockSelectCicle = TimePicker_g({
        tag: 'circle',
        class: 'ac-time-picker-clock-select-circle',
        attr: {
            cx: 0,
            cy: 0
        }
    }).addTo(this.$selectCtn);

    this.$clockSelectCenter = TimePicker_g({
        tag: 'circle',
        class: 'ac-time-picker-clock-select-center'
    }).addTo(this.$selectCtn);
    this.$finishBtn = TimePicker_$('.ac-time-picker-finish-btn', this)
        .on('click', this.finishSelect.bind(this));
    this.$cancelBtn = TimePicker_$('.ac-time-picker-cancel-btn', this)
        .on('click', this.cancelSelect.bind(this));
    this.$keyboardBtn = TimePicker_$('.ac-time-picker-keyboard-btn', this)
        .on('click', this.timeMode.bind(this));
    this.$clockBtn = TimePicker_$('.ac-time-picker-clock-btn', this)
        .on('click', this.clockMode.bind(this));
};


TimePicker.prototype.updateSize = function () {
    // var 
    this._fontSize = this.getFontSize();
    var cBound = this.$clock.getBoundingClientRect();
    this._clockWidth = cBound.width;
    this._clockHeight = cBound.height;
    this.$clock.attr({
        width: this._clockWidth,
        height: this._clockHeight,
        viewBox: '0 0 ' + this._clockWidth + ' ' + this._clockHeight
    });

    this.$clockContent.attr('transform', 'translate(' + (this._clockWidth / 2) + ',' + (this._clockHeight / 2) + ')');
    var clockRadius = this._clockWidth / 2 - this._fontSize;
    var clockRadiusInner = clockRadius - this._fontSize * 1.5;
    this._clockRadius = clockRadius;
    this._clockRadiusInner = clockRadiusInner;
    this.$clockCenter.attr('r', this._fontSize / 5);
    this.$clockSelectCicle.attr({ r: this._fontSize * 0.7, cx: clockRadius });
    this.$clockSelectCenter.attr({ r: this._fontSize / 10, cx: clockRadius });
    this.$hourNumbers.forEach(function (elt, i) {
        var angle = Math.PI * (i - 3) / 6;
        var r = i < 12 ? clockRadius : clockRadiusInner;
        var box = elt.getBBox();
        var x = r * Math.cos(angle);
        var y = r * Math.sin(angle) + box.height / 2;
        elt.attr({
            x: x,
            y: y
        });
    });
    this.$minuteNumbers.forEach(function (elt, i) {
        var angle = Math.PI * (i - 3) / 6;
        var box = elt.getBBox();
        var x = clockRadius * Math.cos(angle);
        var y = clockRadius * Math.sin(angle) + box.height / 3;
        elt.attr({
            x: x,
            y: y
        });
    });
    this.updateSelectPosition();
    this.notifySizeChange();
};


TimePicker.prototype.updateSelectPosition = function () {
    var angle, radius;
    if (this._state == "EDIT_MINUTE") {
        angle = Math.PI * (this._minute - 15) / 30;
        radius = this._clockRadius
    }
    else if (this._state == "EDIT_HOUR") {
        angle = Math.PI * (this._hour - 3) / 6;
        if (this._hour > 0 && this._hour <= 12) {
            radius = this._clockRadius;
        }
        else {
            radius = this._clockRadiusInner;
        }
    }
    else {
        return;
    }
    this._drawSelect(radius, angle);
};

TimePicker.prototype.editHour = function () {
    this.clockMode();
    if (this.$hour.readOnly) {
        this._editHourState();
    }
    else {
        this.$hour.focus();
    }
}


TimePicker.prototype._drawSelect = function (radius, angle) {
    var x = radius * Math.cos(angle);
    var y = radius * Math.sin(angle);
    this.$clockSelectCicle.attr({
        cx: x, cy: y
    });
    this.$clockSelectCenter.attr({
        cx: x, cy: y
    });
    this.$clockSelectLine.attr('d', 'M0,0L' + x + ',' + y);
};


TimePicker.prototype.notifyChange = function (force) {
    if (this._lastDayOffset != this.dayOffset || force) {
        this.emit('change', {
            target: this,
            hour: this.hour,
            minute: this.minute,
            dayOffset: this.dayOffset,
            name: 'change'
        }, this);
        this._lastDayOffset = this.dayOffset;
    }
};


TimePicker.prototype.notifySizeChange = function () {
    var bound = this.getBoundingClientRect();
    if (this._latBound.width != bound.width || this._latBound.height != bound.height) {
        this._latBound.width = bound.width;
        this._latBound.height = bound.height;
        this.emit('sizechange', { name: 'sizechange', bound: bound, target: this }, this);
    }
};

TimePicker.tag = 'TimePicker';

TimePicker.render = function () {
    return TimePicker_({
        extendEvent: ['change', 'finish', 'cancel', 'sizechange'],
        class: ['ac-time-picker', 'ac-time-picker-clock-mode'],//clock mode is default
        child: [
            {
                class: 'ac-time-picker-set-clock',
                child: [{
                    class: 'ac-time-picker-set-clock-header',
                    child: [
                        {
                            tag: 'numberspaninput',
                            class: 'ac-time-picker-hour',
                            props: {
                                value: 0,
                                zeroInt: 2
                            }
                        },
                        {
                            tag: 'span',
                            text: ':'
                        },
                        {
                            tag: 'numberspaninput',
                            class: 'ac-time-picker-minute',
                            props: {
                                value: 0,
                                zeroInt: 2
                            }
                        }
                    ]
                },
                    TimePicker_g(
                        {
                            tag: 'svg',
                            class: 'ac-time-picker-clock',
                            child: [
                                {
                                    class: 'ac-time-picker-clock-content',
                                    child: ['.ac-time-picker-clock-select-ctn', '.ac-time-picker-clock-hour-ctn', '.ac-time-picker-clock-minute-ctn']
                                }
                            ]
                        }
                    )]
            },
            {
                class: 'ac-time-picker-set-time',
                child: [
                    {
                        class: 'ac-time-picker-set-time-header',
                        child: { text: 'Set time' }
                    },
                    {
                        class: 'ac-time-picker-set-time-label',
                        child: { text: 'Type in time' }
                    },
                    {
                        class: 'ac-time-picker-set-time-input-group',
                        child: [
                            {
                                class: 'ac-time-picker-set-time-input-hm',
                                child: [
                                    {
                                        tag: 'input',
                                        class: 'ac-time-picker-hour-input',
                                        attr: {
                                            type: 'number',
                                            placeHolder: '00',
                                            tabindex: '2',
                                        }
                                    },
                                    {
                                        tag: 'span',
                                        child: { text: ':' }
                                    },
                                    {
                                        tag: 'input',
                                        class: 'ac-time-picker-minute-input',
                                        attr: {
                                            type: 'number',
                                            placeHolder: '00',
                                            tabindex: '3'
                                        }
                                    }
                                ]
                            },
                            {
                                class: 'ac-time-picker-set-time-input-label-hm',
                                child: [
                                    { tag: 'span', child: { text: 'hour' } },
                                    { tag: 'span', style: { visibility: 'hidden' }, child: { text: ':' } },
                                    { tag: 'span', child: { text: 'minute' } }

                                ]
                            }
                        ]
                    }
                ]
            },
            {
                class: 'ac-time-picker-footer',
                child: [
                    {
                        tag: 'button',
                        class: 'ac-time-picker-keyboard-btn',
                        child: 'span.mdi.mdi-keyboard-outline'
                    },
                    {
                        tag: 'button',
                        class: 'ac-time-picker-clock-btn',
                        child: 'span.mdi.mdi-clock-outline'
                    },
                    {
                        class: 'ac-time-picker-footer-right',
                        child: [
                            {
                                tag: 'button',
                                class: 'ac-time-picker-cancel-btn',
                                attr: { tabindex: '4' },
                                child: { text: 'CANCEL' }
                            },
                            {
                                tag: 'button',
                                attr: { tabindex: '4' },
                                class: 'ac-time-picker-finish-btn',
                                child: { text: 'OK' }
                            }

                        ]
                    }]
            }
        ]
    });
};


TimePicker.prototype.clockMode = function () {
    if (this._mode == "CLOCK") return;
    this._mode = 'CLOCK';
    this.removeClass('ac-time-picker-time-mode')
        .addClass('ac-time-picker-clock-mode');
    this.$hour.value = this._hour < 10 ? '0' + this._hour : this._hour;
    this.$minute.value = this._minute < 10 ? '0' + this._minute : this._minute;
    this._editHourState();
    this.updateSize();
    this._showSelectHour(this._hour);
};


TimePicker.prototype.timeMode = function () {
    if (this._mode == "TIME") return;
    this._mode = 'TIME';
    this.addClass('ac-time-picker-time-mode')
        .removeClass('ac-time-picker-clock-mode');
    this.$hourInput.value = this._hour < 10 ? '0' + this._hour : this._hour;
    this.$minuteInput.value = this._minute < 10 ? '0' + this._minute : this._minute;
    this.editHourInput();
    this.updateSize();
};


TimePicker.prototype._editHourState = function () {
    this._state = "EDIT_HOUR";
    this._preHour = this._hour;
    this.removeClass('ac-time-picker-edit-minute')
        .addClass('ac-time-picker-edit-hour')
        .removeClass('ac-time-picker-edit-hour-input')
        .removeClass('ac-time-picker-edit-minute-input');
    this.updateSize();
};


TimePicker.prototype._editMinuteState = function () {
    this._state = "EDIT_MINUTE";
    this._preMinute = this._minute;
    this.addClass('ac-time-picker-edit-minute')
        .removeClass('ac-time-picker-edit-hour')
        .removeClass('ac-time-picker-edit-hour-input')
        .removeClass('ac-time-picker-edit-minute-input');
    this.updateSize();
};


TimePicker.prototype.editHourInput = function () {
    var thisPicker = this;
    this._state = "EDIT_HOUR_INPUT";
    this._preHour = this._hour;
    this.removeClass('ac-time-picker-edit-minute')
        .removeClass('ac-time-picker-edit-hour')
        .addClass('ac-time-picker-edit-hour-input')
        .removeClass('ac-time-picker-edit-minute-input');
    this.updateSize();
    setTimeout(function () {
        thisPicker.$hourInput.focus();
        thisPicker.$hourInput.select();
    }, 10);
};


TimePicker.prototype.editMinuteInput = function () {
    var thisPicker = this;
    this._state = "EDIT_MINUTE_INPUT";
    this._preMinute = this._minute;
    this.removeClass('ac-time-picker-edit-minute')
        .removeClass('ac-time-picker-edit-hour')
        .removeClass('ac-time-picker-edit-hour-input')
        .addClass('ac-time-picker-edit-minute-input');
    this.updateSize();
    setTimeout(function () {
        thisPicker.$minuteInput.focus();
        thisPicker.$minuteInput.select();
    }, 1)
};


TimePicker.prototype.finishSelect = function () {
    this.emit('finish', {
        target: this,
        hour: this.hour,
        minute: this.minute,
        dayOffset: this.dayOffset,
        name: 'finish'
    }, this);
};


TimePicker.prototype.cancelSelect = function () {
    this.emit('cancel', { target: this, name: 'cancel' }, this);
};


TimePicker.eventHandler = {};

TimePicker.eventHandler.focusHour = function () {
    this._editHourState();
    this.$hour.selectAll();
};


TimePicker.eventHandler.blurHour = function () {
    var newText = this.$hour.value;
    var hour = parseFloat(newText) || 0;
    if (hour < 0 || hour >= 24)
        hour = this._preHour;
    this.$hour.value = hour < 10 ? '0' + hour : hour;
    this._hour = hour;
    this._showSelectHour(hour);
    this.notifyChange();
};


TimePicker.eventHandler.focusMinute = function () {
    this._editMinuteState();
    this.$minute.selectAll();
};


TimePicker.eventHandler.blurMinute = function () {
    var newText = this.$minute.innerHTML;
    var minute = parseFloat(newText) || 0;
    if (minute < 0 || minute >= 60)
        minute = this._preMinute;
    this.$minute.value = minute < 10 ? '0' + minute : minute;
    this._minute = minute;
    this._showSelectByMinuteText();
    this.notifyChange();
};


TimePicker.eventHandler.clickHourInput = function () {
    if (this._state != 'EDIT_HOUR') this.editHourInput();
    else {
        this.$hourInput.focus();
        this.$hourInput.select();
    }
};


TimePicker.eventHandler.clickMinuteInput = function () {
    if (this._state != 'EDIT_MINUTE_INPUT') this.editMinuteInput();
    else {
        this.$minuteInput.focus();
        this.$minuteInput.select();

    }
};

TimePicker.eventHandler.blurHourInput = function () {
    var hour = parseFloat(this.$hourInput.value) || 0;
    if (hour < 0 || hour >= 24)
        hour = this._preHour;
    this.hour = hour;
};

TimePicker.eventHandler.blurMinuteInput = function () {
    var minute = parseFloat(this.$minuteInput.value) || 0;
    if (minute < 0 || minute >= 60)
        minute = this._preMinute;
    this.minute = minute;
};


TimePicker.property = {};


TimePicker.property.hour = {
    set: function (value) {
        value = (value % 24) || 0;
        this._hour = value;
        var text = (value < 10 ? '0' : '') + value + '';
        this.$hour.clearChild().addChild(TimePicker_({ text: text }));
        this.$hourInput.value = text;
        this.updateSelectPosition();
    },
    get: function () {
        return this._hour;
    }
};


TimePicker.property.minute = {
    set: function (value) {
        value = (value % 60) || 0;
        this._minute = value;
        var text = (value < 10 ? '0' : '') + value + '';
        this.$minute.value = text;
        this.$minuteInput.value = text;
        this.updateSelectPosition();
    },
    get: function () {
        return this._minute;
    }
};


TimePicker.property.dayOffset = {
    set: function (value) {
        value = value || 0;
        if (value.getTime)
            value = value.getTime() - beginOfDay(value).getTime();
        else {
            value = value % MILLIS_PER_DAY;
        }

        this.hour = Math.floor(value / MILLIS_PER_HOUR);
        this.minute = Math.floor((value % MILLIS_PER_HOUR) / MILLIS_PER_MINUTE);
    },
    get: function () {
        return this._hour * MILLIS_PER_HOUR + this._minute * MILLIS_PER_MINUTE;
    }
};

TimePicker.prototype._showSelectHour = function (hour) {
    var radius;
    var angle = Math.PI * (hour - 3) / 6;
    if ((hour < 24 && hour > 12) || hour == 0) {
        radius = this._clockRadiusInner;
    }
    else if (hour <= 12) {
        radius = this._clockRadius;
    }
    else {
        return;
    }
    this._drawSelect(radius, angle);
};

TimePicker.prototype._showSelectByHourText = function () {
    var hour = parseFloat(this.$hour.innerHTML) || 0;
    if (hour < 0 || hour >= 24) return;
    this._showSelectHour(hour);
};


TimePicker.prototype._showSelectMinute = function (minute) {
    var angle = Math.PI * (minute - 15) / 30;
    this._drawSelect(this._clockRadius, angle);
}

TimePicker.prototype._showSelectByMinuteText = function () {
    var minute = parseFloat(this.$minute.innerHTML) || 0;
    if (minute < 0 || minute >= 60) return;
    this._showSelectMinute(minute);
};

/***
 *
 * @param {KeyboardEvent} event
 */
TimePicker.eventHandler.keydownHour = function (event) {
    var thisPicker = this;
    if (event.key == 'Enter' || event.key == 'Tab') {
        event.preventDefault();
        this.$hour.blur();
        this._editMinuteState();
        setTimeout(function () {
            thisPicker.$minute.focus();
            thisPicker.$minute.selectAll();
        }, 30);
    }
    else {
        setTimeout(function () {
            var newText = thisPicker.$hour.value;
            var hour = parseFloat(newText) || 0;
            if (hour < 0 || hour >= 24)
                hour = thisPicker._preHour;
            else {
                thisPicker._hour = hour;
                thisPicker._showSelectHour(hour);
            }
        }, 30);
    }
};


TimePicker.eventHandler.keydownMinute = function (event) {
    var thisPicker = this;
    if (event.key == 'Enter') {
        this.$minute.blur();
        event.preventDefault();
        setTimeout(this.finishSelect.bind(this), 30);
    }
    else if (event.key == 'Tab') {
        this.$minute.selectNone();
        this.$finishBtn.focus();
        event.preventDefault();
    }
    else {
        setTimeout(function () {
            var newText = thisPicker.$minute.value;
            var minute = parseFloat(newText) || 0;
            if (minute < 0 || minute >= 60)
                minute = thisPicker._preMinute;
            else {
                thisPicker._minute = minute;
                thisPicker._showSelectMinute(minute);
            }
        }, 30);
    }
};


TimePicker.eventHandler.keydownHourInput = function (event) {
    var thisPicker = this;
    if ((isTouchDevice && event.key == "Unidentified") || (event.key && event.key.length == 1 && !event.ctrlKey && !event.altKey)) {
        if (event.key.match(/[0-9]/)) {
            setTimeout(this.notifyChange.bind(this), 2);
        }
        else {
            event.preventDefault();
        }
    }
    else if (event.key == 'Enter') {
        event.preventDefault();
        this.$hourInput.blur();
        this.editMinuteInput();
    }
    else if (!event.key && !event.key.toLowerCase().match(/arrow|back/)) {
        var cText = this.$hourInput.value;
        setTimeout(function () {
            var newText = thisPicker.$hourInput.value;
            if (cText != newText) {
                var hour = parseFloat(newText) || 0;
                if (hour < 0 || hour >= 24)
                    hour = thisPicker._preHour;
                thisPicker.hour = hour;
                thisPicker.$hourInput.blur();
                thisPicker.editMinuteInput();
                thisPicker.notifyChange();
            }
        }, 1);
    }
};


TimePicker.eventHandler.keydownMinuteInput = function (event) {
    var thisPicker = this;
    if ((isTouchDevice && event.key == "Unidentified") || event.key.length == 1 && !event.ctrlKey && !event.altKey) {
        if ((isTouchDevice && event.key == "Unidentified") || event.key.match(/[0-9]/)) {
            setTimeout(this.notifyChange.bind(this), 2);

        }
        else {
            event.preventDefault();
        }
    }
    else if (event.key == 'Enter') {
        this.$minute.blur();
        this.eventHandler.blurMinuteInput();
        event.preventDefault();

        setTimeout(this.finishSelect.bind(this), 100);
    }
    else if (event.key == "Backspace") {

    }
    else if (event.key != 'Enter') {
        var cText = this.$minuteInput.value;
        setTimeout(function () {
            var newText = thisPicker.$minuteInput.value;
            if (cText != newText) {
                var minute = parseFloat(newText) || 0;
                if (minute < 0 || minute >= 60)
                    minute = thisPicker._preMinute;
                thisPicker.minute = minute;
                thisPicker.$minuteInput.focus();
                thisPicker.$minuteInput.select();
                thisPicker.notifyChange();
            }
        }, 1);
    }
};


TimePicker.eventHandler.dragOnClock = function (event) {
    event = (event.changedTouches && event.changedTouches[0]) || event;
    var cBound = this.$clock.getBoundingClientRect();
    var cx = (cBound.left + cBound.right) / 2;
    var cy = (cBound.top + cBound.bottom) / 2;
    var x = event.clientX - cx;
    var y = event.clientY - cy;
    var angle = Math.atan2(y, x);
    var radius = Math.sqrt(x * x + y * y);

    var index;
    if (this._state == "EDIT_HOUR") {
        angle += Math.PI * 2;
        index = Math.round(angle / (Math.PI / 6));
        var hour = (index + (12 + 3)) % 12;
        if (radius < (this._clockRadiusInner + this._clockRadius) / 2) {
            if (hour != 0) hour += 12;
        }
        else {
            if (hour == 0) hour = 12;
        }
        this._hour = hour;
        this._showSelectHour(hour);
        this.$hour.value = hour < 10 ? '0' + hour : hour;
        this.$hour.selectEnd();
    }
    else if (this._state == "EDIT_MINUTE") {
        radius = this._clockRadius;
        angle += Math.PI * 2;
        index = Math.round(angle / (Math.PI / 30));
        angle = index * (Math.PI / 30);
        var minute = (index + (60 + 15)) % 60;
        this._minute = minute;
        this.$minute.value = minute < 10 ? '0' + minute : minute;
        this._showSelectMinute(minute);
        this.$minute.selectEnd();
        this.notifyChange();
    }
    else {
        return;
    }
};


TimePicker.eventHandler.mousedownClock = function (event) {
    event.preventDefault();
    this.eventHandler.dragOnClock(event);
    document.body.addEventListener(isTouchDevice ? 'touchmove' : 'mousemove', this.eventHandler.mousemoveClock);
    document.body.addEventListener(isTouchDevice ? 'touchend' : 'mouseup', this.eventHandler.mousefinishClock);
    if (!isTouchDevice)
        document.body.addEventListener('mouseleave', this.eventHandler.mousefinishClock);
};


TimePicker.eventHandler.mousemoveClock = function (event) {
    event.preventDefault();
    this.eventHandler.dragOnClock(event);
};


TimePicker.eventHandler.mousefinishClock = function () {
    document.body.removeEventListener('mousemove', this.eventHandler.mousemoveClock);
    document.body.removeEventListener('mouseup', this.eventHandler.mousefinishClock);
    document.body.removeEventListener('mouseleave', this.eventHandler.mousefinishClock);
    if (this._state == 'EDIT_HOUR') {
        if (this.$minute.readOnly) {
            this._editMinuteState();
        }
        else {
            this.$minute.focus();
        }
    }
    else if (this._state == 'EDIT_MINUTE') {
        this.$minute.selectAll();// refocus
    }
};


ACore["a" /* default */].install('timepicker', TimePicker);
/* harmony default export */ var js_TimePicker = (TimePicker);
// CONCATENATED MODULE: ./node_modules/absol-acomp/js/TimeInput.js





var TimeInput_ = ACore["a" /* default */]._;
var TimeInput_$ = ACore["a" /* default */].$;


function TimeInput() {
    this._isOpenPicker = false;
    this._hour = null;
    this._minute = null;
    this.$hour = TimeInput_$('.ac-time-input-hour', this);
    this.$minute = TimeInput_$('.ac-time-input-minute', this);
    /***
     *
     * @type {TimePicker}
     */
    this.$timePicker = TimeInput.getTimePicker();
    this.$timePickerCtn = TimeInput.getTimePickerContainer();
    this.on('click', this.togglePicker.bind(this));
}


TimeInput.getTimePicker = function () {
    if (!TimeInput.$timePickerCtn) {
        TimeInput.$timePickerCtn = TimeInput_((isTouchDevice ? '' : 'follower') + '.ac-time-input-picker-ctn.ac-time-input-picker-ctn-hidden')
            .addTo(document.body);
        TimeInput.$timePicker = TimeInput_('timepicker').addTo(TimeInput.$timePickerCtn);
        TimeInput.$timePicker.on('sizechange', function () {
            if (isTouchDevice) {
                var bound = TimeInput.$timePickerCtn.getBoundingClientRect();
                TimeInput.$timePickerCtn.addStyle({
                    left: 'calc(50vw - ' + (bound.width / 2) + 'px)',
                    top: 'calc(50vh - ' + (bound.height / 2) + 'px)'
                });
            }
            else {
                TimeInput.$timePickerCtn.updatePosition();
            }
        });
    }
    return TimeInput.$timePicker;
};

TimeInput.getTimePickerContainer = function () {
    TimeInput.getTimePicker();
    return TimeInput.$timePickerCtn;
}

TimeInput.tag = 'timeinput';

TimeInput.render = function () {
    return TimeInput_({
        class: 'ac-time-input',
        extendEvent: ['change'],
        child: [
            {
                tag: 'span',
                class: 'ac-time-input-hour',
                child: { text: '--' }
            },
            {
                tag: 'span',
                child: { text: " : " }
            },
            {
                tag: 'span',
                class: 'ac-time-input-minute',
                child: {
                    text: '--'
                }
            }
        ]
    })
};


TimeInput.prototype.togglePicker = function () {
    if (this._isOpenPicker) this.closePicker();
    else this.openPicker();
};


TimeInput.prototype.openPicker = function () {
    if (this._isOpenPicker) return;
    this._isOpenPicker = true;
    if (!isTouchDevice)
        this.$timePickerCtn.followTarget = this;
    this._lastDayOfset = this.dayOffset;
    this.$timePickerCtn.removeClass('ac-time-input-picker-ctn-hidden');
    this.$timePicker.dayOffset = this._lastDayOfset;
    this.$timePicker.clockMode();
    this.$timePicker.editHour();
    this.$timePicker
        .on('finish', this.eventHandler.pickerFinish)
        .on('cancel', this.eventHandler.pickerCancel);
    TimeInput_$(document.body).on('click', this.eventHandler.clickBody);
};

TimeInput.prototype.closePicker = function () {
    if (!this._isOpenPicker) return;
    var thisTI = this;
    this._isOpenPicker = false;
    this.$timePickerCtn.addClass('ac-time-input-picker-ctn-hidden');
    if (!isTouchDevice)
        this.$timePickerCtn.followTarget = null;
    this.$timePicker
        .off('finish', this.eventHandler.pickerFinish)
        .off('cancel', this.eventHandler.pickerCancel);
    setTimeout(function () {
        TimeInput_$(document.body).off('click', thisTI.eventHandler.clickBody);
    }, 100);
};

TimeInput.property = {};

TimeInput.property.hour = {
    set: function (value) {
        if (typeof value == "number") {
            value = (value % 24) || 0;
            this._hour = value;
            var text = (value < 10 ? '0' : '') + value + '';
            this.$hour.firstChild.data = text;
        }
        else {
            this._hour = null;
            this.$hour.firstChild.data = '--';
        }
    },
    get: function () {
        return this._hour;
    }
};


TimeInput.property.minute = {
    set: function (value) {
        if (typeof value == "number") {
            value = (value % 60) || 0;
            this._minute = value;
            var text = (value < 10 ? '0' : '') + value + '';
            this.$minute.firstChild.data = text;
        }
        else {
            this._minute = null;
            this.$minute.firstChild.data = '--';
        }
    },
    get: function () {
        return this._minute;
    }
};


TimeInput.property.dayOffset = {
    set: function (value) {

        if (typeof value == "number" || (value && value.getTime)) {
            value = value || 0;
            if (value.getTime)
                value = value.getTime() - beginOfDay(value).getTime();
            else {
                value = value % MILLIS_PER_DAY;
            }

            this.hour = Math.floor(value / MILLIS_PER_HOUR);
            this.minute = Math.floor((value % MILLIS_PER_HOUR) / MILLIS_PER_MINUTE);
        }
        else {
            this.hour = null;
            this.minute = null;
        }
    },
    get: function () {
        if (this._hour === null || this._minute === null) return null;
        return this._hour * MILLIS_PER_HOUR + this._minute * MILLIS_PER_MINUTE;
    }
};


TimeInput.property.disabled = {
    set: function (value) {
        value = !!value;
        this._disabled = value;
        if (value) this.addClass('as-disabled');
        else this.removeClass('as-disabled');
    },
    get: function () {
        return this._disabled;
    }
}

TimeInput.eventHandler = {};


TimeInput.eventHandler.pickerFinish = function (event) {
    this.closePicker();
    if (this._lastDayOfset != event.dayOffset) {
        this.dayOffset = event.dayOffset;
        this.emit('change', { name: 'change', target: this }, this);
    }
};


TimeInput.eventHandler.pickerCancel = function (event) {
    this.closePicker();
};

TimeInput.eventHandler.clickBody = function (event) {
    if (EventEmitter["b" /* default */].hitElement(this.$timePicker, event) || EventEmitter["b" /* default */].hitElement(this, event)) return;
    this.closePicker();
};

ACore["a" /* default */].install(TimeInput);

/* harmony default export */ var js_TimeInput = (TimeInput);
// EXTERNAL MODULE: ./node_modules/absol-acomp/css/tooltip.css
var tooltip = __webpack_require__(204);

// CONCATENATED MODULE: ./node_modules/absol-acomp/js/Tooltip.js





var Tooltip_ = ACore["a" /* default */]._;
var Tooltip_$ = ACore["a" /* default */].$;

/***
 * @extends AElement
 * @constructor
 */
function ToolTip() {
    this.$content = Tooltip_$('.absol-tooltip-content', this);
    this.$arrow = Tooltip_$('.absol-tooltip-arrow', this);
}

ToolTip.tag = 'ToolTip'.toLowerCase();

ToolTip.render = function () {
    return Tooltip_({
        class: 'absol-tooltip',
        child: [
            { class: 'absol-tooltip-content' },
            '.absol-tooltip-arrow'
        ]
    });
};

['addChild', 'addChildBefore', 'addChildAfter', 'clearChild'].forEach(function (key) {
    ToolTip.prototype[key] = function () {
        return this.$content[key].apply(this.$content, arguments);
    }
});

ACore["a" /* default */].install(ToolTip);

function updateTooltipPosition(toolTipClass) {
    var element = toolTipClass.$element;
    if (!element) return;
    var orientation = toolTipClass._orientation;

    var tBound = toolTipClass.$tooltip.$content.getBoundingClientRect();
    var ebound = element.getBoundingClientRect();
    var screenSize = Object(Dom["d" /* getScreenSize */])();
    var sMargin = Math.round(Math.min(5, screenSize.width/100, screenSize.height));
    screenSize.width = Math.min(screenSize.width, document.body.getBoundingClientRect().width);
    var fontSize = toolTipClass.$tooltip.getFontSize();

    var dx = 0;
    var dy = 0;
    var arrowPos = null;

    var aHCenter = (ebound.left + ebound.width / 2 > tBound.width / 2)
        && (screenSize.width - ebound.left - ebound.width / 2 > tBound.width / 2);
    var aVCenter = (ebound.top + ebound.height / 2 > tBound.height / 2)
        && (screenSize.height - ebound.top - ebound.height / 2 > tBound.height / 2);
    var aTop = (tBound.height < ebound.top - sMargin);
    var aBottom = tBound.height < screenSize.height - sMargin - ebound.bottom;
    var aRight = tBound.width < screenSize.width - sMargin - ebound.right;
    var aLeft = tBound.width < ebound.left - sMargin;

    var aHLeft = (ebound.left + ebound.width / 2 - tBound.width / 2 < sMargin) && (ebound.left + ebound.width / 2 >= sMargin + fontSize / 2);
    var aHRight = (ebound.left + ebound.width / 2 + tBound.width / 2 > screenSize.width - sMargin) && (ebound.left + ebound.width / 2 < screenSize.width - sMargin - fontSize / 2);
    var aVTop = (ebound.top + ebound.width / 2 - tBound.height / 2 < sMargin) && (ebound.top + ebound.height / 2 >= sMargin + fontSize / 2);
    var aVBottom = (ebound.top + ebound.width / 2 + tBound.height / 2 <= screenSize.height - sMargin) && (ebound.top + ebound.height / 2 > screenSize.height - sMargin - fontSize / 2);

    if (orientation === 'auto' && aHCenter) {
        if (aTop) {
            orientation = 'top';
        }
        else if (aBottom) {
            orientation = 'bottom';
        }
    }
    if (orientation === 'auto' && aVCenter) {
        if (aRight) {
            orientation = 'right';
        }
        else if (aLeft) {
            orientation = 'left';
        }
    }


    if ((orientation === 'auto' || orientation === 'top' || orientation === 'bottom') && aHLeft) {
        if (aTop || orientation === 'auto') orientation = "top";
        else if (aBottom || orientation === 'auto') orientation = 'bottom';
        if (aTop || aBottom) {
            dx += tBound.width / 2 - (ebound.left + ebound.width / 2) + sMargin;
            arrowPos = tBound.width / 2 - dx + 'px';
        }
    }
    if ((orientation === 'auto' || orientation === 'top' || orientation === 'bottom') && aHRight) {
        if (aTop || orientation === 'auto') orientation = "top";
        else if (aBottom || orientation === 'auto') orientation = 'bottom';
        if (aTop || aBottom) {
            dx -= tBound.width / 2 - (screenSize.width - (ebound.left + ebound.width / 2)) + sMargin;
            arrowPos = tBound.width / 2 - dx + 'px';
        }
    }


    if ((orientation === 'auto'|| orientation === 'left' || orientation === 'right') && aVTop) {
        if (aLeft || orientation === 'auto') orientation = "left";
        else if (aRight || orientation === 'auto') {
            orientation = 'right';
        }
        if (aLeft || aRight) {
            dy += tBound.height / 2 - (ebound.top + ebound.height / 2) + sMargin;
            arrowPos = tBound.height / 2 - dy + 'px';
        }
    }
    if ((orientation === 'auto'|| orientation === 'left' || orientation === 'right') && aVBottom) {
        if (aLeft || orientation === 'auto') orientation = "left";
        else if (aRight || orientation === 'auto') {
            orientation = 'right';
        }
        if (aLeft || aRight) {
            dy -= tBound.height / 2 - (screenSize.height - (ebound.top + ebound.height / 2)) + sMargin;
            arrowPos = tBound.height / 2 - dx + 'px'
        }
    }

    if (orientation === 'auto') {
        if (aRight) {
            if (aTop) {
                orientation = 'ne';
            }
            else if (aBottom) {
                orientation = 'se';
            }
        }
        else if (aLeft) {
            if (aTop) {
                orientation = 'nw';
            }
            else if (aBottom) {
                orientation = 'sw';
            }
        }
    }
    if (orientation === 'auto') orientation = "error";
    toolTipClass.$tooltip.removeClass('top')
        .removeClass('left')
        .removeClass('right')
        .removeClass('bottom')
        .removeClass('ne')
        .removeClass('nw')
        .removeClass('se')
        .removeClass('sw')
        .addClass(orientation);


    tBound = toolTipClass.$tooltip.getBoundingClientRect();

    if (orientation == 'top') {
        dy += ebound.top - tBound.height;
        dx += ebound.left + ebound.width / 2 - tBound.width / 2;
    }
    else if (orientation == 'left') {
        dy += ebound.top + ebound.height / 2 - tBound.height / 2;
        dx += ebound.left - tBound.width;
    }
    else if (orientation == 'right') {
        dy += ebound.top + ebound.height / 2 - tBound.height / 2;
        dx += ebound.right;
    }
    else if (orientation == 'bottom') {
        dy += ebound.bottom;
        dx += ebound.left + ebound.width / 2 - tBound.width / 2;

    }
    else if (orientation === 'ne') {
        dy += ebound.top - tBound.height;
        dx += ebound.right;
    }
    else if (orientation === 'nw') {
        dy += ebound.top - tBound.height;
        dx += ebound.left - tBound.width;
    }
    else if (orientation === 'se') {
        dy += ebound.bottom;
        dx += ebound.right;
    }
    else if (orientation === 'sw') {
        dy += ebound.bottom;
        dx += ebound.left - tBound.width;
    }
    else {
        throw new Error("Invalid orientation, orientation: ['left', 'right', 'top', 'bottom', 'auto', 'nw', 'ne', 'sw', 'se']");
    }

    if (arrowPos) {
        toolTipClass.$tooltip.addStyle('--tool-tip-arrow-pos', arrowPos);
    }
    else {
        toolTipClass.$tooltip.removeStyle('--tool-tip-arrow-pos')
    }

    toolTipClass.$holder.addStyle({
        top: dy + 'px',
        left: dx + 'px'
    });
}


ToolTip.$holder = Tooltip_('.absol-tooltip-root-holder')
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 () {
    if (!ToolTip.$element) return;
    updateTooltipPosition(ToolTip);
};

ToolTip.$tooltip.$arrow.updateSize = ToolTip.updatePosition.bind(ToolTip);


ToolTip.show = function (element, content, orientation) {
    orientation = orientation || 'auto';
    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["b" /* 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.$holder.addTo(document.body);
    Dom["b" /* default */].addToResizeSystem(ToolTip.$tooltip.$arrow);

    ToolTip.$element = element;
    ToolTip._session = currentSession;
    ToolTip.$content = content;
    ToolTip._orientation = orientation;

    ToolTip.$tooltip.clearChild().addChild(content);
    ToolTip.$holder.removeStyle('visibility');
    ToolTip.$tooltip.removeClass('top')
        .removeClass('left')
        .removeClass('right')
        .removeClass('bottom')
        .removeClass('ne')
        .removeClass('nw')
        .removeClass('auto');
    ToolTip.$tooltip.addClass(orientation);
    ToolTip.updatePosition();
    return currentSession;
};


ToolTip.close = function (session) {
    if (session === true || session === this._session) {
        ToolTip.$holder.addStyle('visibility', 'hidden');
        ToolTip.$tooltip.clearChild();
        ToolTip.$holder.addStyle({
            top: false,
            left: false
        });
    }
};

ToolTip.closeTooltip = ToolTip.close;


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["b" /* 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/treelist.css
var treelist = __webpack_require__(54);

// CONCATENATED MODULE: ./node_modules/absol-acomp/js/TreeListItem.js




var TreeListItem_ = ACore["a" /* default */]._;
var TreeListItem_$ = ACore["a" /* default */].$;

function TreeListItem() {
    var thisTI = this;
    this.$list = TreeListItem_$('treelist', this).on('press', function (event, sender) {
        thisTI.emit('press', event, this);
    });

    this.$parent = TreeListItem_$('.absol-tree-list-item-parent', this).on('mousedown', this.eventHandler.clickParent);
    this.$text = TreeListItem_$('span.absol-tree-list-item-text', this);
    this.$desc = TreeListItem_$('span.absol-tree-list-item-desc', this);
    this.$descCtn = TreeListItem_$('.absol-tree-list-item-desc-container', this);
    this.$list.level = 1;
    OOP["a" /* default */].drillProperty(this, this.$list, 'items');
}

TreeListItem.tag = 'TreeListItem'.toLowerCase();
TreeListItem.render = function () {
    return 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'
        ]
    });
};


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 */].install(TreeListItem);

/* harmony default export */ var js_TreeListItem = (TreeListItem);
// CONCATENATED MODULE: ./node_modules/absol-acomp/js/TreeList.js



var TreeList_ = ACore["a" /* default */]._;
var TreeList_$ = ACore["a" /* default */].$;

function TreeList() {
}

TreeList.tag = 'treelist';
TreeList.render = function () {
    return TreeList_({
        class: 'absol-tree-list',
        extendEvent: 'press'
    });
};


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 */].install(TreeList);

/* harmony default export */ var js_TreeList = (TreeList);

// EXTERNAL MODULE: ./node_modules/absol-acomp/css/selecttreemenu.css
var selecttreemenu = __webpack_require__(207);

// CONCATENATED MODULE: ./node_modules/absol-acomp/js/list/treeListToList.js
/***
 *
 * @param {Array<SelectionItem>} items
 * @returns {Array<SelectionItem>}
 */
function treeListToList(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;
}
// CONCATENATED MODULE: ./node_modules/absol-acomp/js/SelectTreeBox.js




var SelectTreeBox_ = ACore["a" /* default */]._;
var SelectTreeBox_$ = ACore["a" /* default */].$;
var SelectTreeBox_$$ = ACore["a" /* default */].$$;

/***
 * @extends SelectListBox
 * @constructor
 */
function SelectTreeBox() {
    js_SelectListBox.call(this);
}

SelectTreeBox.tag = 'SelectTreeBox'.toLowerCase();

SelectTreeBox.render = function () {
    return js_SelectListBox.render().addClass('as-select-tree-box');
};


Object.assign(SelectTreeBox.prototype, js_SelectListBox.prototype);
SelectTreeBox.property = Object.assign({}, js_SelectListBox.property);
SelectTreeBox.eventHandler = Object.assign({}, js_SelectListBox.eventHandler);

SelectTreeBox.prototype._itemsToNodeList = function (items) {
    return treeListToList(items);
};



//todo
SelectTreeBox.prototype.searchItemByText = function (text) {
    text = text.trim();
    if (text.length == 0) return this._items;
    if (this._searchCache[text]) return this._searchCache[text];
    this._searchCache[text] = searchTreeListByText(text, this._items);
    return this._searchCache[text];
};

ACore["a" /* default */].install(SelectTreeBox);

/* harmony default export */ var js_SelectTreeBox = (SelectTreeBox);

// CONCATENATED MODULE: ./node_modules/absol-acomp/js/SelectTreeMenu.js






var SelectTreeMenu_ = ACore["a" /* default */]._;
var SelectTreeMenu_$ = ACore["a" /* default */].$;


/***
 * @extends SelectMenu
 * @constructor
 */
function SelectTreeMenu() {
    var thisSM = this;
    this._items = [];
    this._value = null;
    this._lastValue = null;
    this.$holderItem = SelectTreeMenu_$('.absol-selectmenu-holder-item', this);
    this.$viewItem = SelectTreeMenu_$('.absol-selectmenu-holder-item selectlistitem', this);
    /***
     *
     * @type {SelectTreeBox}
     */
    this.$selectlistBox = SelectTreeMenu_({
        tag: 'selecttreebox',
        props: {
            anchor: [1, 6, 2, 5]
        },
        on: {
            preupdateposition: this.eventHandler.preUpdateListPosition
        }
    });
    this.$selectlistBox.on('pressitem', this.eventHandler.selectListBoxPressItem);
    this.$selectlistBox.followTarget = this;
    OOP["a" /* default */].drillProperty(this, this.$selectlistBox, 'enableSearch');

    this._lastValue = "NOTHING_VALUE";
    this._isFocus = false;
    this.isFocus = false;

    this.on('mousedown', this.eventHandler.click, true);
}

SelectTreeMenu.tag = 'SelectTreeMenu'.toLowerCase();

SelectTreeMenu.render = function () {
    return SelectMenu2.render().addClass('as-select-tree-menu');
};

SelectTreeMenu.eventHandler = Object.assign({}, SelectMenu2.eventHandler);
SelectTreeMenu.property = Object.assign({}, SelectMenu2.property);


Object.assign(SelectTreeMenu.prototype, SelectMenu2.prototype);


ACore["a" /* default */].install(SelectTreeMenu);

/* harmony default export */ var js_SelectTreeMenu = (SelectTreeMenu);

// EXTERNAL MODULE: ./node_modules/absol-acomp/css/widthheightresizer.css
var widthheightresizer = __webpack_require__(209);

// CONCATENATED MODULE: ./node_modules/absol-acomp/js/WidthHeightSizer.js




//can replace with other module
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.tag = 'WidthHeightResizer'.toLowerCase();

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);
// EXTERNAL MODULE: ./node_modules/absol-acomp/css/modal.css
var modal = __webpack_require__(211);

// CONCATENATED MODULE: ./node_modules/absol-acomp/js/Modal.js



var Modal_$ = ACore["a" /* default */].$;
var Modal_ = ACore["a" /* default */]._;

function Modal() {
    this._contentAlign = [];
    this.contentAlign = 'middle center';
    this.$content = Modal_$('.as-modal-content', this);
}


Modal.tag = 'modal';
Modal.render = function () {
    return Modal_({ class: 'as-modal', child: '.as-modal-content' });
};

['findChildBefore', 'findChildAfter', 'removeChild', 'clearChild', 'addChild'].forEach(function (key) {
    Modal.prototype[key] = function () {
        this.$content[key].apply(this.$content, arguments);
    }
});


Modal.property = {};
Modal.property.show = {
    set: function (value) {
        if (value)
            this.removeClass('as-hidden');
        else
            this.addClass('as-hidden');
    },
    get: function () {
        return !this.containsClass('as-hidden');
    }
};

Modal.property.contentAlign = {
    set: function (value) {
        var thisM = this;
        this._contentAlign.forEach(function (name) {
            thisM.removeClass('as-' + name);
        })
        value = value || '';
        if (typeof value === 'string') {
            this._contentAlign = value.split(/\s+/);
        }
        else if (value instanceof Array) {
            this._contentAlign = value;
        }
        else {
            throw new Error("Invalid contentAlign!");
        }
        var thisM = this;
        this._contentAlign.forEach(function (name) {
            thisM.addClass('as-' + name);
        })
    },
    get: function () {
        return this._contentAlign.join(' ');
    }
}


ACore["a" /* default */].install(Modal);

/* harmony default export */ var js_Modal = (Modal);
// EXTERNAL MODULE: ./node_modules/absol-acomp/css/trackbar.css
var trackbar = __webpack_require__(213);

// CONCATENATED MODULE: ./node_modules/absol-acomp/js/TrackBar.js





var TrackBar_ = ACore["a" /* default */]._;
var TrackBar_$ = ACore["a" /* default */].$;

/***
 * @extends Hanger
 * @constructor
 */
function TrackBar() {
    this.$bar = TrackBar_$('.absol-trackbar', this);
    this.$button = TrackBar_$('.absol-trackbar-button', this);
    this.$line = TrackBar_$('.absol-trackbar-line', this);
    this.on('predrag', this.eventHandler.predrag)
        .on('drag', this.eventHandler.drag);
    this.leftValue = 0;
    this.rightValue = 1;
    this._dragValue = 0;
}

TrackBar.tag = 'trackbar';

TrackBar.render = function () {
    return TrackBar_({
        tag: 'hanger',
        extendEvent: 'change',
        class: 'absol-trackbar',
        child: [{ class: 'absol-trackbar-line', child: '.absol-trackbar-button' }, 'attachhook'],

    });
};

TrackBar.prototype._updateValue = function () {
    var left = int_map(this.value, this.leftValue, this.rightValue, 0, 100);
    this.$button.addStyle('left', left + '%');
}

TrackBar.eventHandler = {};

TrackBar.eventHandler.predrag = function (event) {
    if (event.target === this) {
        event.cancel();
    }
    else {
        event.preventDefault();
        var lineBound = this.$line.getBoundingClientRect();
        var newValue = this.leftValue + (this.rightValue - this.leftValue) * (event.clientX - lineBound.left) / lineBound.width;
        newValue = Math.max(this.leftValue, Math.min(this.rightValue, newValue));
        if (newValue !== this.value) {
            this.value = newValue;
            event.trackbarValue = this.value;
            this._dragValue = this.value;
            this.emit('change', event);
        }
    }
};

TrackBar.eventHandler.drag = function (event) {
    var lineWidth = this.$line.getBoundingClientRect().width;
    var d = event.currentPoint.sub(event.startingPoint);
    var delta = d.x / lineWidth * (this.rightValue - this.leftValue);
    var newValue = Math.max(this.leftValue, Math.min(this.rightValue, this._dragValue + delta));
    if (newValue != this.value) {
        this.value = newValue;
        event.trackbarValue = this.value;
        this.emit('change', event);
    }
};


TrackBar.property = {};

TrackBar.property.value = {
    set: function (value) {
        value = parseFloat(value + '');
        if (isNaN(value)) value = 0;
        this._value = value;
        this._updateValue();
    },

    get: function () {
        return Math.max(this.leftValue, Math.min(this.rightValue, this._value));
    }
};


TrackBar.property.leftValue = {
    set: function (value) {
        value = parseFloat(value + '');
        if (isNaN(value)) value = 0;
        this._leftValue = value;
        this._updateValue();
    },
    get: function () {
        return this._leftValue || 0;
    }
};

TrackBar.property.rightValue = {
    set: function (value) {
        value = parseFloat(value + '');
        if (isNaN(value)) value = 1;
        this._rightValue = value;
        this._updateValue();
    },
    get: function () {
        return this._rightValue || 1;
    }
};

TrackBar.property.disabled = {
    get: function () {
        return this.containsClass('as-disabled');
    },
    set: function (value) {
        if (value) {
            this.addClass('as-disabled');
        }
        else {
            this.removeClass('as-disabled');
        }
    }
};

ACore["a" /* default */].install(TrackBar);

/* harmony default export */ var js_TrackBar = (TrackBar);


// EXTERNAL MODULE: ./node_modules/absol-acomp/css/trackbarinput.css
var trackbarinput = __webpack_require__(215);

// CONCATENATED MODULE: ./node_modules/absol-acomp/js/TrackBarInput.js




var TrackBarInput_ = ACore["a" /* default */]._;
var TrackBarInput_$ = ACore["a" /* default */].$;

/***
 *
 * @extends {AElement}
 * @constructor
 */
function TrackBarInput() {
    var thisTI = this;
    this.$trackbarContainer = TrackBarInput_$('.absol-trackbar-input-trackbar-container', this)
    this.$inputContainer = TrackBarInput_$('.absol-trackbar-input-unit-input-container', this)
    this.$trackbar = TrackBarInput_$('trackbar', this);
    this.$input = TrackBarInput_$('flexiconinput', this);

    absol.OOP.drillProperty(this, this.$input, ['unit', 'icon']);


    this.$trackbar.on('change', function () {
        thisTI.$input.value = thisTI.value + '';
        thisTI.emit('change', thisTI.value);
    });

    this.$input.on('keyup', this.eventHandler.inputChange);
    this.inputTextWidth = 2;
    this.valueFixed = undefined;
    return this;
}


TrackBarInput.tag = 'TrackBarInput'.toLowerCase();

TrackBarInput.render = function () {
    return TrackBarInput_({
        class: 'absol-trackbar-input',
        extendEvent: 'change',
        child: [{
            class: 'absol-trackbar-input-trackbar-container',
            child: 'trackbar'
        },
            {
                class: 'absol-trackbar-input-unit-input-container',
                child: 'flexiconinput'
            }
        ]
    });
};

TrackBarInput.prototype.init = function (props) {
    props = props || {};
    props.leftValue = props.leftValue || 0;
    props.value = props.value || props.leftValue;
    Object.assign(this, props);
    this.value = props.value;
};

TrackBarInput.prototype._calInputTextWidth = function () {
    var l = Math.max(this.leftValue.toFixed(this.valueFixed || 0).length, this.rightValue.toFixed(this.valueFixed || 0).length, 2);
    if (this.valueFixed > 0) {
        l -= 0.8;
    }
    this.inputTextWidth = l;
};

// absol.OOP.drillProperty(this, this.$trackbar, ['leftValue', 'rightValue']);


TrackBarInput.property = {};

TrackBarInput.property.leftValue = {
    set: function (value) {
        this.$trackbar.leftValue = value;
        this._calInputTextWidth();
    },
    get: function () {
        return this.$trackbar.leftValue;
    }
};

TrackBarInput.property.rightValue = {
    set: function (value) {
        this.$trackbar.rightValue = value;
        this._calInputTextWidth();
    },
    get: function () {
        return this.$trackbar.rightValue;
    }
};


TrackBarInput.property.value = {
    set: function (value) {
        this.$trackbar.value = value || 0;
        this.$input.value = this.value + '';
    },
    get: function () {
        return parseFloat((this.valueFixed === undefined ? this.$trackbar.value : this.$trackbar.value.toFixed(this.valueFixed)) + '');
    }
};

TrackBarInput.property.valueFixed = {
    set: function (value) {
        if (value === undefined || value === null) value = undefined;
        this._valueFixed = value;
        this.$input.value = this.value + '';
        this._calInputTextWidth();
    },
    get: function () {
        return this._valueFixed;
    }
};

TrackBarInput.property.inputTextWidth = {
    set: function (value) {
        if (typeof value == 'number') {
            this._inputTextWidth = value;
            this.$inputContainer.addStyle('width', 3 + (value - 2) * 0.42 + 0.3 + 'em');
            this.$trackbarContainer.addStyle('right', 3.5 + (value - 2) * 0.42 + 0.3 + 'em');
        }
        else {
            this._inputTextWidth = value;
            this.$inputContainer.addStyle('width', value);
            this.$trackbarContainer.addStyle('right', value);
        }
    },
    get: function () {
        return this._inputTextWidth;
    }
};

TrackBarInput.property.disabled = {
    get: function () {
        return this.containsClass('as-disabled');
    },
    set: function (value) {
        if (value) {
            this.addClass('as-disabled');
        }
        else {
            this.removeClass('as-disabled');
        }
        this.$input.disabled = !!value;
        this.$trackbar.disabled = !!value;
    }
};

TrackBarInput.eventHandler = {};


TrackBarInput.eventHandler.inputChange = function (event) {
    var newValue = parseFloat(this.$input.value);
    if (!isNaN(newValue)) {
        newValue = Math.max(this.leftValue, Math.min(this.rightValue, newValue));
        this.$trackbar.value = newValue;
        this.emit('change', this.value);
    }
};

/* harmony default export */ var js_TrackBarInput = (TrackBarInput);
// EXTERNAL MODULE: ./node_modules/absol-acomp/css/buttonrange.css
var buttonrange = __webpack_require__(217);

// CONCATENATED MODULE: ./node_modules/absol-acomp/js/ButtonRange.js






var ButtonRange_ = ACore["a" /* default */]._;
var ButtonRange_$ = ACore["a" /* default */].$;


var ChevronLeft = '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Layer_1" x="0px" y="0px" viewBox="0 0 410.258 410.258" style="enable-background:new 0 0 410.258 410.258;" xml:space="preserve">\n' +
    '<polygon points="298.052,24 266.052,0 112.206,205.129 266.052,410.258 298.052,386.258 162.206,205.129 "/>\n' +
    '</svg>';

var ChevronRight = '<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"\n' +
    '\t viewBox="0 0 410.258 410.258" style="enable-background:new 0 0 410.258 410.258;" xml:space="preserve">\n' +
    '<polygon points="144.206,0 112.206,24 248.052,205.129 112.206,386.258 144.206,410.258 298.052,205.129 "/>\n' +
    '</svg>'

/***
 * @extends AElement
 * @constructor
 */
function ButtonRange() {
    this._dict = {};
    this._pool = [];
    this._items = [];
    this.$lastActiveBtn = null;
    this._value = undefined;
    this._lastValue = this._value;
    this.$scroller = ButtonRange_$('.as-button-range-scroller', this)
        .on('wheel', this.eventHandler.wheel);
    this.$prevBtn = ButtonRange_$('.as-button-range-left-btn', this)
        .on('click', this.prevValue.bind(this));
    this.$nextBtn = ButtonRange_$('.as-button-range-right-btn', this)
        .on('click', this.nextValue.bind(this));
    this._scrollTimeout = -1;
    this._scrollToSelected = this._scrollToSelected.bind(this);
    this.$attachhook = ButtonRange_$('attachhook', this).on('error', this.eventHandler.attached);
    this.autoWidth = false;
}

ButtonRange.tag = 'buttonrange';
ButtonRange.render = function () {
    return ButtonRange_({
        extendEvent: ['change'],
        class: 'as-button-range',
        child: [
            {
                class: 'as-button-range-scroller',
            },
            {
                class: 'as-button-range-left-ctn',
                child: {
                    tag: 'button',
                    class: 'as-button-range-left-btn',
                    child: ChevronLeft
                }
            },
            {
                class: 'as-button-range-right-ctn',
                child: {
                    tag: 'button',
                    class: 'as-button-range-right-btn',
                    child: ChevronRight
                }
            },
            'attachhook'
        ]
    });
};

ButtonRange.prototype._updateUnderlinePosition = function () {
    if (!this.$lastActiveBtn) return;
    var scrollerFirstBound = this.$scroller.firstChild.getBoundingClientRect();
    if (scrollerFirstBound.width === 0) return;
    var activeBound = this.$lastActiveBtn.getBoundingClientRect();
    this.addStyle({
        '--underline-left': activeBound.left - scrollerFirstBound.left + 'px',
        '--underline-width': activeBound.width + 'px'
    });

};

ButtonRange.prototype.updateSize = function () {
    if (this.autoWidth) {
        if (this.$scroller.childNodes.length > 0) {
            var left = this.$scroller.firstChild.getBoundingClientRect().left;
            var right = this.$scroller.lastChild.getBoundingClientRect().right;
            if (left < right) {
                var fontSize = this.getFontSize() || 14;
                this.addStyle('width', (right - left + 2) / fontSize + 2 + 'em')
            }
        }
    }
    this._updateUnderlinePosition();
    this._scrollToSelected();
};

ButtonRange.prototype._newButton = function () {
    var button = ButtonRange_({
        tag: 'button',
        class: 'as-button-range-item',
        child: { text: 'null' }
    });
    button.on('click', this.eventHandler.clickItem.bind(this, button));
    return button;
};

ButtonRange.prototype._requestButton = function (items) {
    var button;
    if (this._pool.length > 0) {
        button = this._pool.pop();
    }
    else {
        button = this._newButton();
    }
    return button;
};

ButtonRange.prototype._assignButton = function (button, data) {
    button._data = data;
    button.childNodes[0].data = data.text;
};

ButtonRange.prototype._releaseButton = function (button) {
    this._pool.push(button);
};

ButtonRange.prototype._requireButton = function (n) {
    var child;
    while (this.$scroller.childNodes.length > n) {
        child = this.$scroller.lastChild;
        this._releaseButton(child);
        this.$scroller.removeChild(child);
    }

    while (this.$scroller.childNodes.length < n) {
        this.$scroller.addChild(this._requestButton());
    }
};

ButtonRange.prototype._assignButtonList = function (items) {
    var item;
    for (var i = 0; i < items.length; ++i) {
        item = this._getFullFormat(items[i]);
        this._assignButton(this.$scroller.childNodes[i], item);
        this._dict[item.ident] = {
            elt: this.$scroller.childNodes[i],
            data: item
        }
    }
};

ButtonRange.prototype._scrollToSelected = function () {
    if (this._scrollTimeout >= 0) return;
    if (!this.$lastActiveBtn) return;
    var scrollerBound = this.$scroller.getBoundingClientRect();
    if (scrollerBound.width === 0) return;
    var activeBound = this.$lastActiveBtn.getBoundingClientRect();
    var dx, speed;
    if (activeBound.left < scrollerBound.left - 1) {
        dx = activeBound.left - scrollerBound.left;
        if (dx < -500) dx = -500;
        speed = Math.sqrt(-dx * 2 + 4);
        this.$scroller.scrollLeft -= speed;
    }
    else if (activeBound.right - 1 > scrollerBound.right) {
        dx = activeBound.right - scrollerBound.right;
        if (dx > 500) dx = 500;
        speed = Math.sqrt(dx * 2 + 4);
        this.$scroller.scrollLeft += speed;
    }
    else {
        return;
    }
    var thisBR = this;
    this._scrollTimeout = setTimeout(function () {
        thisBR._scrollTimeout = -1;
        thisBR._scrollToSelected();
    }, 20);
};

ButtonRange.prototype.nextValue = function (userAction) {
    var currentIndex = this._findActiveIndex();
    var nextIndex;
    var nextValue;
    if (currentIndex < 0) {
        nextIndex = 0;
    }
    else {
        nextIndex = Math.min(this._items.length - 1, currentIndex + 1);
    }
    if (nextIndex >= 0) {
        nextValue = this._getFullFormat(this._items[nextIndex]).value;
        this.value = nextValue;
        if (userAction) this.notifyChange();
    }
};


ButtonRange.prototype.prevValue = function (userAction) {
    var currentIndex = this._findActiveIndex();
    var prevIndex;
    var prevValue;
    if (currentIndex < 0) {
        prevIndex = 0;
    }
    else {
        prevIndex = Math.max(0, currentIndex - 1);
    }
    if (prevIndex >= 0 && prevIndex < this._items.length && prevIndex != currentIndex) {
        prevValue = this._getFullFormat(this._items[prevIndex]).value;
        this.value = prevValue;
        if (userAction) this.notifyChange();
    }
};

ButtonRange.prototype._findActiveIndex = function () {
    var item;
    var value = this._value;
    for (var i = 0; i < this._items.length; ++i) {
        item = this._items[i];
        if (item === value || (item && item.value === value))
            return i;
    }
    return -1;
}


ButtonRange.prototype._getFullFormat = function (item) {
    var res = {};
    if ((typeof item == 'string') || (typeof item == 'number') || (typeof item == 'boolean') || (item === null) || (item === undefined)) {
        res.ident = item + '';
        res.value = item;
        res.text = item + '';
    }
    else if (item && (typeof item == 'object')) {
        res.value = item.value;
        res.ident = res.value + '';
        res.text = item.text;
    }
    return res;
};

ButtonRange.prototype.notifyChange = function () {
    this.emit('change', { target: this, value: this.value, type: 'change' }, this);
}


ButtonRange.property = {};

/**
 * @type {ButtonRange}
 */
ButtonRange.property.items = {
    set: function (items) {
        items = items || [];
        this._items = items;
        this._requireButton(items.length);
        this._assignButtonList(items);
        if (items.length > 0) {
            if (!this._dict[this._value + '']) {
                this._value = this._getFullFormat(items[0]).value;
            }
        }
        this.value = this._value;
        this.updateSize();
    },
    get: function () {
        return this._items;
    }
};

ButtonRange.property.value = {
    set: function (value) {
        this._value = value;
        this._lastValue = this._value;
        if (this.$lastActiveBtn) {
            this.$lastActiveBtn.removeClass('as-active');
            this.$lastActiveBtn = null;
        }
        var hodler = this._dict[value + ''];
        if (hodler) {
            hodler.elt.addClass('as-active');
            this.$lastActiveBtn = hodler.elt;
        }
        var activeIndex = this._findActiveIndex();
        this.$prevBtn.disabled = activeIndex === 0;
        this.$nextBtn.disabled = activeIndex === this._items.length - 1;
        this._updateUnderlinePosition();
        this._scrollToSelected();
    },
    get: function () {
        return this._value;
    }
};


ButtonRange.eventHandler = {};

ButtonRange.eventHandler.clickItem = function (item, event) {
    if (this._lastValue != item._data.value) {
        this.value = item._data.value;
        this.notifyChange();
    }
};

ButtonRange.eventHandler.attached = function () {
    if (this.style.width === 'auto') this.autoWidth = true;
    Dom["b" /* default */].addToResizeSystem(this.$attachHook);
    this.updateSize();
};


ButtonRange.eventHandler.wheel = function (event) {
    var prevLeft = this.$scroller.scrollLeft;
    if (event.deltaY < 0) {
        this.$scroller.scrollLeft -= 100;
    }
    else if (event.deltaY > 0) {
        this.$scroller.scrollLeft += 100;
    }
    if (prevLeft !== this.$scroller.scrollLeft)
        event.preventDefault();
};


ACore["a" /* default */].install(ButtonRange);

/* harmony default export */ var js_ButtonRange = (ButtonRange);
// EXTERNAL MODULE: ./node_modules/absol-acomp/css/dropzone.css
var dropzone = __webpack_require__(219);

// CONCATENATED MODULE: ./node_modules/absol-acomp/js/DropZone.js





var DropZone_ = ACore["a" /* default */]._;
var DropZone_$ = ACore["a" /* default */].$;

/***
 * @extends AElement
 * @constructor
 */
function DropZone() {
    this.defineEvent(['fileenter', 'fileleave', 'filedrop']);
    this.addClass('as-drop-zone');
    this.on('dragover', this.eventHandler.dragZoneFileOver)
        .on('drop', this.eventHandler.dropZoneFileDrop);
    this._fileOverTimeout = -1;
}

DropZone.tag = 'dropzone';

DropZone.render = function () {
    return DropZone_('div');
};

DropZone.eventHandler = {};
DropZone.eventHandler.dragZoneFileOver = function (event) {
    event.preventDefault();
    if (this._fileOverTimeout > 0) {
        clearTimeout(this._fileOverTimeout);
    }
    else {
        this.addClass('as-drag-over');
        this.emit('fileenter', event, this);
    }
    this._fileOverTimeout = setTimeout(this.eventHandler.dragZoneFileOverEnd, 100);
};

/***
 *
 * @param {DragEvent} event
 */
DropZone.eventHandler.dropZoneFileDrop = function (event) {
    if (this._fileOverTimeout > 0) {
        clearTimeout(this._fileOverTimeout);
        this._fileOverTimeout = -1;
    }
    event.preventDefault();
    this.removeClass('as-drag-over');
    event._files = null;
    Object.defineProperty(event, 'files',{
        get: function (){
            if (this._files) return  this._files;
            var files = [];
            var file;
            if (event.dataTransfer.items) {
                for (var i = 0; i < event.dataTransfer.items.length; i++) {
                    if (event.dataTransfer.items[i].kind === 'file') {
                        file = event.dataTransfer.items[i].getAsFile();
                        files.push(file);
                    }
                }
            } else {
                // Use DataTransfer interface to access the file(s)
                for (var i = 0; i < event.dataTransfer.files.length; i++) {
                    files.push(event.dataTransfer.files[i]);
                }
            }
            this._files = files;
            return this._files;
        }
    });

    this.emit('filedrop', event, this);
};

DropZone.eventHandler.dragZoneFileOverEnd = function () {
    this._fileOverTimeout = -1;
    this.removeClass('as-drag-over');
    this.emit('fileleave', { type: 'fileleave' }, this);
};

ACore["a" /* default */].install(DropZone);

/* harmony default export */ var js_DropZone = (DropZone);
// EXTERNAL MODULE: ./node_modules/absol-acomp/css/radioinput.css
var radioinput = __webpack_require__(221);

// CONCATENATED MODULE: ./node_modules/absol-acomp/js/RadioInput.js




//new tech, not working version

var RadioInput_ = ACore["a" /* default */]._;
var RadioInput_$ = ACore["a" /* default */].$;

/***
 * @extends Element
 * @constructor
 */
function RadioInput() {
    this.$input = RadioInput_$('input', this)
        .on('change', this.notifyChange.bind(this));
    this.checked = false;
    this.disabled = false;
    this.on('click', this.eventHandler.click);
    this.onchange = null;
}

RadioInput.tag = "RadioInput".toLowerCase();

RadioInput.render = function (data) {
    return RadioInput_({
            tag: 'label',
            extendEvent: 'change',
            class: 'as-radio-input',
            child: [
                {
                    elt: data && data.$input,
                    tag: 'input',
                    class: 'as-radio-input-value',
                    attr: {
                        type: 'radio'
                    }
                },
                {
                    class: ['as-radio-input-check-mark']
                }
            ]
        }
    )
};

/***
 * as normal, change event will be fired when radio change by system
 */
RadioInput.prototype.notifyChange = function () {
    var event = { checked: this.checked };
    this.emit('change', event, this);
};

RadioInput.prototype._updateCheckedClass = function () {
    if (this.checked) {
        this.addClass('as-checked');
    }
    else {
        this.removeClass('as-checked');
    }
};


RadioInput.property = {};

RadioInput.property.disabled = {
    set: function (value) {
        if (value) {
            this.addClass('as-disabled');
        }
        else {
            this.removeClass('as-disabled');
        }
        this.$input.disabled = !!value;
    },
    get: function () {
        this.$input.disabled;
    }
};

/***
 *
 * @type {RadioInput}
 */
RadioInput.property.checked = {
    set: function (value) {
        this.$input.checked = !!value;
        this._updateCheckedClass();
    },
    get: function () {
        return this.$input.checked;
    }
}

RadioInput.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;
        }
    }
};

/***
 *
 * @type {RadioInput}
 */
RadioInput.eventHandler = {};

RadioInput.eventHandler.click = function () {
    this._updateCheckedClass();
};


ACore["a" /* default */].install(RadioInput);


RadioInput.autoReplace = function () {
    var placeHolders = Array.prototype.slice.call(document.getElementsByTagName(this.tag));
    var ph;
    var attOfPH;
    var attrs;
    var style;
    var classList;
    var attNode;
    var attrName, attrValue;
    var props;
    for (var i = 0; i < placeHolders.length; ++i) {
        ph = placeHolders[i];
        attOfPH = ph.attributes;
        classList = [];
        style = {};
        attrs = {};
        props = {};
        for (var j = 0; j < attOfPH.length; ++j) {
            attNode = attOfPH[j];
            attrName = attNode.nodeName;
            attrValue = attNode.nodeValue;
            if (attrName == 'style') {
                attrValue.trim().split(';').reduce(function (style, prop) {
                    var p = prop.split(':');
                    if (p.length == 2) {
                        style[p[0].trim()] = p[1].trim();
                    }
                    return style;
                }, style);
            }
            else if (attrName == 'class') {
                classList = attrValue.trim().split(/\s+/);
            }
            else if (attrName == 'onchange') {
                props.onchange = new Function('event', 'sender', attrValue);
            }
            else {
                attrs[attrName] = attrValue;
            }
        }
        var newElt = RadioInput_({
            tag: this.tag,
            attr: attrs,
            class: classList,
            style: style,
            props: props
        });
        RadioInput_$(ph).selfReplace(newElt);
    }
};

RadioInput.initAfterLoad = function (){
    Dom["b" /* default */].documentReady.then(function (){
        RadioInput.autoReplace();
    })
};


/* harmony default export */ var js_RadioInput = (RadioInput);
// EXTERNAL MODULE: ./node_modules/absol-acomp/css/onscreenwidget.css
var onscreenwidget = __webpack_require__(223);

// CONCATENATED MODULE: ./node_modules/absol-acomp/js/OnScreenWidget.js







var OnScreenWidget_ = ACore["a" /* default */]._;
var OnScreenWidget_$ = ACore["a" /* default */].$;
var OnScreenWidget_$$ = ACore["a" /* default */].$$;


/***
 * @extends Hanger
 * @constructor
 */
function OnScreenWidget() {
    this.id = 'unset-id-' + randomIdent();
    this.on({
        dragstart: this.eventHandler.widgetStartDrag,
        drag: this.eventHandler.widgetDrag,
        dragend: this.eventHandler.widgetDragEnd
    });

    this.addEventListener('click', function (event) {
        if (!this._preventClick)
            this.emit('click', event, this);
    });
    this.$attachhook = OnScreenWidget_('attachhook').addTo(this);
    this.$attachhook.on('attached', this.eventHandler.attached);
    this.config = null;
}

OnScreenWidget.tag = 'OnScreenWidget'.toLowerCase();

OnScreenWidget.render = function () {
    return OnScreenWidget_({
        tag: 'hanger',
        extendEvent: 'click',
        class: 'as-onscreen-widget',
        style: {
            visibility: 'hidden'
        }
    });
};

OnScreenWidget.prototype.configPrefix = 'on-screen-widget-';

OnScreenWidget.prototype._genConfig = function () {
    this._widgetBound = this.getBoundingClientRect();
    var screenSize = Object(Dom["d" /* getScreenSize */])();
    return {
        cx: (this._widgetBound.left + this._widgetBound.width / 2) * 100 / screenSize.width,
        cy: (this._widgetBound.top + this._widgetBound.height / 2) * 100 / screenSize.height
    }

}

OnScreenWidget.prototype._saveConfig = function () {
    var id = this.id || '';
    if (id.startsWith('unset-id-') || !this.config) return;
    localStorage.setItem(this.configPrefix + id, JSON.stringify(this.config));
};

OnScreenWidget.prototype._loadConfig = function () {
    var id = this.id || '';
    if (id.startsWith('unset-id-')) return;
    var config = null;
    try {
        config = JSON.parse(localStorage.getItem(this.configPrefix + id));
        if ((typeof config !== "object") || (typeof config.cx !== "number") || (typeof config.cy !== 'number')) {
            config = this.config || this._genConfig();
        }
    } catch (error) {
        config = this.config || this._genConfig();
    }

    var cx = config.cx || 0;
    var cy = config.cy || 0;
    this.addStyle({
        '--cx': cx / 100,
        '--cy': cy / 100
    });
    this.config = config;
};


OnScreenWidget.prototype._updateCSSSize = function () {
    var bound = this.getBoundingClientRect();
    this.addStyle({
        '--client-height': bound.height + 'px',
        '--client-width': bound.width + 'px'
    });
    this.removeStyle('visibility');
};

/***
 *
 * @type {OnScreenWidget|{}}
 */
OnScreenWidget.eventHandler = {};

OnScreenWidget.eventHandler.attached = function () {
    var images = OnScreenWidget_$$('img', this);
    var syncs = images.map(function (img) {
        if (img.classList.contains('absol-attachhook')) return Promise.resolve();
        return Object(Dom["g" /* waitImageLoaded */])(img, 100);
    });
    var thisW = this;
    Promise.all(syncs).then(function () {
        thisW._updateCSSSize();
        thisW._loadConfig();
    });
};

OnScreenWidget.eventHandler.widgetStartDrag = function (event) {
    this._widgetBound = this.getBoundingClientRect();
    this._preventClick = true;
};

OnScreenWidget.eventHandler.widgetDrag = function (event) {
    event.preventDefault();
    var screenSize = Object(Dom["d" /* getScreenSize */])();
    var p0 = new Math_Vec2(this._widgetBound.left, this._widgetBound.top);
    var dv = event.currentPoint.sub(event.startingPoint);
    var p1 = p0.add(dv);
    var cx = (p1.x - 2) * 100 / (screenSize.width - this._widgetBound.width - 4);
    var cy = (p1.y - 2) * 100 / (screenSize.height - this._widgetBound.height - 4);
    cx = Math.max(0, Math.min(100, cx));
    cy = Math.max(0, Math.min(100, cy));
    this.addStyle({
        '--cx': cx / 100,
        '--cy': cy / 100
    });
    if (this.config) {
        this.config.cx = cx;
        this.config.cy = cy;
    }
};

OnScreenWidget.eventHandler.widgetDragEnd = function () {
    var thisWG = this;
    setTimeout(function () {
        thisWG._preventClick = false;
    }, 100);
    this._saveConfig();
};

ACore["a" /* default */].install(OnScreenWidget);

/* harmony default export */ var js_OnScreenWidget = (OnScreenWidget);
// EXTERNAL MODULE: ./node_modules/absol-acomp/css/ribbonsplitbutton.css
var ribbonsplitbutton = __webpack_require__(225);

// CONCATENATED MODULE: ./node_modules/absol-acomp/js/RibbonSplitButton.js






var RibbonSplitButton_ = ACore["a" /* default */]._;
var RibbonSplitButton_$ = ACore["a" /* default */].$;


/***
 * @extends AElement
 * @constructor
 */
function RibbonSplitButton() {
    this.$icon = null;
    this._icon = null;
    this.$text = RibbonSplitButton_$('.as-ribbon-split-button-text', this);
    this.$textNode = this.$text.firstChild;
    this.$primaryBtn = RibbonSplitButton_$('.as-ribbon-split-button-primary', this)
        .on('click', this.eventHandler.clickPrimaryBtn);
    this.$extendBtn = RibbonSplitButton_$('.as-ribbon-split-button-extend', this);
    this._menuHolder = null;
}

RibbonSplitButton.tag = 'RibbonSplitButton'.toLowerCase();

RibbonSplitButton.render = function () {
    return RibbonSplitButton_({
        extendEvent: ['press', 'select'],
        attr: {
            'tabindex': '0'
        },
        class: ['as-ribbon-split-button', 'as-no-dropdown'],
        child: {
            class: 'as-ribbon-split-button-content',
            child: [
                {
                    tag: 'button',
                    attr: {
                        'tabindex': '-1'
                    },
                    class: 'as-ribbon-split-button-primary',
                    child: { tag: 'span', class: 'as-ribbon-split-button-text', child: { text: '' } }
                },
                {
                    tag: 'button',
                    attr: {
                        'tabindex': '-1'
                    },
                    class: 'as-ribbon-split-button-extend',
                    child: 'span.mdi.mdi-chevron-down'
                }
            ]
        }
    });
};

RibbonSplitButton.property = {};

RibbonSplitButton.property.items = {
    set: function (items) {
        var thisB = this;
        this._items = items || [];
        if (this._items && this._items.length > 0) {
            if (!this._menuHolder) {
                this.removeClass('as-no-dropdown');
                this._menuHolder = js_QuickMenu.toggleWhenClick(this.$extendBtn || this, {
                    getMenuProps: function () {
                        return {
                            items: thisB._items
                        }
                    },
                    getFlowedElement: function () {
                        return thisB;
                    },
                    anchor: [1, 2, 6, 5],
                    onSelect: function (item) {
                        thisB.emit('select', { item: cleanMenuItemProperty(item), type: 'select', target: thisB });
                    }
                });
            }
        }
        else {
            if (this._menuHolder) {
                this.addClass('as-no-dropdown');
                this._menuHolder.remove();
                this._menuHolder = null;
            }
        }
    },
    get: function () {
        return this._items;
    }
};

RibbonSplitButton.property.text = {
    set: function (value) {
        value = value || '';
        this.$textNode.data = value;
    },
    get: function () {
        return this.$textNode.data;
    }
};


RibbonSplitButton.property.icon = {
    set: function (icon) {
        icon = icon || null;
        this._icon = icon;
        if (this.$icon) this.$primaryBtn.removeChild(this.$icon);
        if (icon) {
            this.$icon = RibbonSplitButton_(icon);
            this.$primaryBtn.addChildBefore(this.$icon, this.$text);
            if (this.$icon.addClass) this.$icon.addClass('as-ribbon-split-button-icon');
        }
        else {
            this.$icon = null;
        }
    },
    get: function () {
        return this._icon;
    }
};


RibbonSplitButton.eventHandler = {};

RibbonSplitButton.eventHandler.clickPrimaryBtn = function () {
    this.emit('press', { type: 'press', target: this, item: cleanMenuItemProperty(this) })
}

ACore["a" /* default */].install(RibbonSplitButton);

/* harmony default export */ var js_RibbonSplitButton = (RibbonSplitButton);
// EXTERNAL MODULE: ./node_modules/absol-acomp/css/ribbonbutton.css
var ribbonbutton = __webpack_require__(227);

// CONCATENATED MODULE: ./node_modules/absol-acomp/js/RibbonButton.js





var RibbonButton_ = ACore["a" /* default */]._;
var RibbonButton_$ = ACore["a" /* default */].$;


/***
 * @extends AElement
 * @constructor
 */
function RibbonButton() {
    this.$icon = null;
    this._icon = null;
    this.$text = RibbonButton_$('.as-ribbon-button-text', this);
    this.$textNode = this.$text.firstChild;
    this._menuHolder = null;
}

RibbonButton.tag = 'RibbonButton'.toLowerCase();

RibbonButton.render = function () {
    return RibbonButton_({
        tag: 'button',
        extendEvent: ['select'],
        attr: {
            'tabindex': '0'
        },
        class: ['as-ribbon-button', 'as-no-dropdown'],
        child: [
            {
                tag: 'span', class: 'as-ribbon-button-text',
                child: { text: '' }
            },
            'span.mdi.mdi-chevron-down'
        ]
    });
};

RibbonButton.property = Object.assign({}, js_RibbonSplitButton.property);


RibbonButton.property.icon = {
    set: function (icon) {
        icon = icon || null;
        this._icon = icon;
        if (this.$icon) this.removeChild(this.$icon);
        if (icon) {
            this.$icon = RibbonButton_(icon);
            this.addChildBefore(this.$icon, this.$text);
            if (this.$icon.addClass) this.$icon.addClass('as-ribbon-button-icon');
        }
        else {
            this.$icon = null;
        }
    },
    get: function () {
        return this._icon;
    }
};


RibbonButton.eventHandler = {};

ACore["a" /* default */].install(RibbonButton);

/* harmony default export */ var js_RibbonButton = (RibbonButton);
// EXTERNAL MODULE: ./node_modules/absol-acomp/css/timeselectinput.css
var timeselectinput = __webpack_require__(229);

// CONCATENATED MODULE: ./node_modules/absol-acomp/js/TimeSelectInput.js











var TimeSelectInput_ = ACore["a" /* default */]._;
var TimeSelectInput_$ = ACore["a" /* default */].$;


/***
 * @extends AElement
 * @constructor
 */
function TimeSelectInput() {
    /***
     *
     * @type {SelectListBox}
     */
    this.$selectlistBox = TimeSelectInput_({
        tag: 'selectlistbox',
        props: {
            anchor: [1, 6, 2, 5]
        },
        on: {
            preupdateposition: this.eventHandler.preUpdateListPosition
        }
    });
    this.$text = TimeSelectInput_$('.as-time-select-input-text', this)
        .on('change', this.eventHandler.textChange)
        .on('keyup', this.eventHandler.textKeyUp)
        .on('keydown', this.eventHandler.textKeyDown);


    this.$toggleBtn = TimeSelectInput_$('absol-selectmenu-btn', this);
    this.$selectlistBox.on('pressitem', this.eventHandler.selectListBoxPressItem);
    this.$selectlistBox.followTarget = this;
    this._makeTimeList(0, MILLIS_PER_DAY, MILLIS_PER_MINUTE * 15);
    this._hour = 0;
    this._minute = 0;
    this._lastDayOffset = 0;
    this.dayOffset = 0;
    this.on('click', this.eventHandler.click);

}

TimeSelectInput.tag = 'TimeSelectInput'.toLowerCase();

TimeSelectInput.render = function () {
    return TimeSelectInput_({
        class: 'as-time-select-input',
        extendEvent: 'change',
        attr: {
            tabindex: 0
        },
        child: [
            {
                tag: 'input',
                class: 'as-time-select-input-text',
                attr: {
                    type: 'text'
                }
            },
            {
                tag: 'button',
                class: 'absol-selectmenu-btn',
                child: ['dropdown-ico']
            }
        ]
    });
};


TimeSelectInput.prototype._makeTimeList = function (start, end, step) {
    var items = [];
    for (var t = 0; t < end; t += step) {
        items.push({
            text: this._mil2Text(t),
            value: t
        });
    }
    this.$selectlistBox.items = items;
    this.addStyle('--list-min-width', this.$selectlistBox._estimateWidth + 'px');
};

TimeSelectInput.prototype.textRegx = /^((1[0-2])|[1-9]):([0-5][0-9]) (AM|PM)$/;

TimeSelectInput.prototype._mil2Text = function (mil) {
    if (mil < 0) {
        mil = mil + Math.ceil(-mil / MILLIS_PER_DAY) * MILLIS_PER_DAY;
    }
    var min = Math.floor(mil / (MILLIS_PER_MINUTE));
    var hour = Math.floor(min / 60) % 24;
    min = min % 60;
    return (hour % 12 == 0 ? 12 : (hour % 12)) + ':' + (min < 10 ? '0' : '') + min + ' ' + (hour < 12 ? 'AM' : 'PM');
};

/***
 *
 * @param {string} s
 * @private
 */
TimeSelectInput.prototype._text2mil = function (s) {
    s = s.toLowerCase();
    var nums = s.match(/[0-9]+/g) || [0, 0];
    while (nums.length < 2) {
        nums.push(0);
    }
    var h = positiveIntMod(parseInt(nums[0]), 24);
    var m = positiveIntMod(parseInt(nums[1]), 60);
    var pm = s.indexOf('pm') > 0 || h > 12;
    if (pm) {
        if (h < 12) h += 12;
    }
    else {
        if (h == 12) h = 0;
    }
    return h * MILLIS_PER_HOUR + m * MILLIS_PER_MINUTE;
};


TimeSelectInput.prototype.isActive = function () {
    return document.activeElement == this || AElement["a" /* default */].prototype.isDescendantOf.call(document.activeElement, this)
        || AElement["a" /* default */].prototype.isDescendantOf.call(document.activeElement, this.$selectlistBox);
};

TimeSelectInput.prototype._updateValueText = function () {
    this.$text.value = this._mil2Text(this.dayOffset);
};

TimeSelectInput.prototype.notifyCanBeChange = function () {
    var dayOffset = this.dayOffset;
    if (this._lastDayOffset !== dayOffset) {
        this.emit('change', {
            type: 'change',
            lastDayOffset: this._lastDayOffset,
            dayOffset: dayOffset,
            target: this
        }, this);
        this._lastDayOffset = dayOffset;
    }
};


TimeSelectInput.property = {};

TimeSelectInput.property.isFocus = {
    get: function () {
        return this.containsClass('as-focus');
    },
    set: function (value) {
        value = !!value;
        if (this.isFocus == value) return;
        if (value) {
            this.addClass('as-focus');
        }
        else {
            this.removeClass('as-focus');
        }
        var thisI = this;
        if (value) {
            document.body.appendChild(this.$selectlistBox);
            this.$selectlistBox.domSignal.$attachhook.emit('attached');
            var bound = this.getBoundingClientRect();
            this.$selectlistBox.addStyle('min-width', bound.width + 'px');
            this.$selectlistBox.refollow();
            this.$selectlistBox.updatePosition();
            setTimeout(function () {
                if (thisI.enableSearch) {
                    thisI.$selectlistBox.$searchInput.focus();
                }
                TimeSelectInput_$(document.body).on('click', thisI.eventHandler.bodyClick);
            }, 1);
            this.$selectlistBox.viewListAtFirstSelected();
        }
        else {
            TimeSelectInput_$(document.body).off('click', thisI.eventHandler.bodyClick);
            this.$selectlistBox.selfRemove();
            this.$selectlistBox.unfollow();
            this.$selectlistBox.resetSearchState();
        }
    }
};


TimeSelectInput.property.hour = {
    set: function (value) {
        this._hour = positiveIntMod(value, 24);
        this._lastDayOffset = this.dayOffset;
        this._updateValueText();
    },
    get: function () {
        return this._hour;
    }
};

TimeSelectInput.property.minute = {
    set: function (value) {
        this._minute = positiveIntMod(value, 60);
        this._lastDayOffset = this.dayOffset;
        this._updateValueText();
    },
    get: function () {
        return this._minute;
    }
};

TimeSelectInput.property.dayOffset = js_TimeInput.property.dayOffset;
TimeSelectInput.property.disabled = {
    set: function (value) {
        this.$text.disabled = !!value;
        if (value) {
            this.addClass('as-disabled');
        }
        else {
            this.removeClass('as-disabled');
        }
    }
    ,
    get: function () {
        return this.containsClass('as-disabled');
    }
};


/***
 *
 * @type {{}|TimeSelectInput}
 */
TimeSelectInput.eventHandler = {};

TimeSelectInput.eventHandler.selectListBoxPressItem = function (event) {
    var lastValue = this._lastDayOffset;
    var value = event.value;
    var text = this._mil2Text(value);
    this.dayOffset = value;
    this.$selectlistBox.values = [value];
    this.focus();
    setTimeout(function () {
        this.isFocus = false;
    }.bind(this), 100);
    this._lastDayOffset = lastValue;// restore last value after set dayOffset
    this.notifyCanBeChange();
};

TimeSelectInput.eventHandler.preUpdateListPosition = function () {
    var bound = this.getBoundingClientRect();
    var screenSize = Object(Dom["d" /* getScreenSize */])();
    var availableTop = bound.top - 5;
    var availableBot = screenSize.height - 5 - bound.bottom;
    this.$selectlistBox.addStyle('--max-height', Math.max(availableBot, availableTop) + 'px');
    var outBound = Object(Dom["f" /* traceOutBoundingClientRect */])(this);
    if (bound.bottom < outBound.top || bound.top > outBound.bottom || bound.right < outBound.left || bound.left > outBound.right) {
        this.isFocus = false;
    }
};

TimeSelectInput.eventHandler.textChange = function () {
    setTimeout(function () {
        if (!this.textRegx.test(this.$text.value)) {
            this.$text.value = this._mil2Text(this.dayOffset);
        }
    }.bind(this), 10);
};

/***
 *
 * @param {KeyboardEvent} event
 */
TimeSelectInput.eventHandler.textKeyDown = function (event) {
    if (event.key == 'Enter') {
        this.isFocus = false;
        this.$text.blur();
        this.notifyCanBeChange();
    }
};


TimeSelectInput.eventHandler.textKeyUp = function (event) {
    var s = this.$text.value;
    var mil = this._text2mil(s);
    this._hour = Math.floor(mil / MILLIS_PER_HOUR);
    this._minute = Math.floor(mil / MILLIS_PER_MINUTE) % 60;
    this.$selectlistBox.values = [mil];
    this.$selectlistBox.viewListAtFirstSelected();
};

TimeSelectInput.eventHandler.click = function (event) {
    if (!EventEmitter["b" /* default */].hitElement(this.$text, event)) {
        this.isFocus = !this.isFocus;
        setTimeout(function () {
            if (this.isFocus && this.$text != document.activeElement) {
                this.$text.select();
            }
        }.bind(this), 1)
    }
    else {
        if (!this.isFocus) this.isFocus = true;
    }
};

TimeSelectInput.eventHandler.bodyClick = function (event) {
    if (EventEmitter["b" /* default */].hitElement(this, event) || EventEmitter["b" /* default */].hitElement(this.$selectlistBox, event)) return;
    this.isFocus = false;
};


ACore["a" /* default */].install(TimeSelectInput);

/* harmony default export */ var js_TimeSelectInput = (TimeSelectInput);
// EXTERNAL MODULE: ./node_modules/absol-acomp/css/snackbar.css
var snackbar = __webpack_require__(231);

// CONCATENATED MODULE: ./node_modules/absol-acomp/js/Snackbar.js





var Snackbar_ = ACore["a" /* default */]._;
var Snackbar_$ = ACore["a" /* default */].$;

var t = document.createElement;

/***
 * @extends AElement
 * @constructor
 */
function SnackBar() {
    OOP["a" /* default */].drillProperty(this, this.firstChild, 'message', 'data');

}

SnackBar.tag = 'SnackBar'.toLowerCase();

SnackBar.render = function () {
    return Snackbar_({
        class: 'as-snackbar',
        child: { text: '' }
    })
};

ACore["a" /* default */].install(SnackBar);

SnackBar.$instance = Snackbar_('snackbar');
SnackBar._removeTimeout = -1;

SnackBar.show = function (message) {
    if (SnackBar._removeTimeout > 0) {
        clearTimeout(SnackBar._removeTimeout);
    }
    if (!SnackBar.$instance.parentElement) document.body.appendChild(SnackBar.$instance);
    SnackBar.$instance.removeClass('as-hiding');
    SnackBar._removeTimeout = setTimeout(function (){
        SnackBar.$instance.addClass('as-show');
        SnackBar.$instance.message = message;
        SnackBar._removeTimeout = setTimeout(function () {
            SnackBar.$instance.removeClass('as-show').addClass('as-hiding');
            SnackBar._removeTimeout = setTimeout(function () {
                SnackBar.$instance.remove();
                SnackBar._removeTimeout = -1;
                SnackBar.$instance.removeClass('as-hiding');
            }, 500);
        }, 3000);
    }, 1);
}


/* harmony default export */ var Snackbar = (SnackBar);
// EXTERNAL MODULE: ./node_modules/absol-acomp/css/multiselectmenu.css
var multiselectmenu = __webpack_require__(233);

// CONCATENATED MODULE: ./node_modules/absol-acomp/js/MultiSelectMenu.js












var MultiSelectMenu_ = ACore["a" /* default */]._;
var MultiSelectMenu_$ = ACore["a" /* default */].$;


/***
 * @extends PositionTracker
 * @constructor
 */
function MultiSelectMenu() {
    this.on('click', this.eventHandler.click);
    this.$selectlistBox = MultiSelectMenu_({
        tag: 'selectlistbox',
        props: {
            anchor: [1, 6, 2, 5],
            displayValue: VALUE_HIDDEN
        },
        on: {
            preupdateposition: this.eventHandler.preUpdateListPosition,
            pressitem: this.eventHandler.selectListBoxPressItem
        }
    });

    this.$itemCtn = MultiSelectMenu_$('.as-multi-select-menu-item-ctn', this);
    this.$attachhook = MultiSelectMenu_$('attachhook', this)
        .on('attached', this.eventHandler.attached);

    OOP["a" /* default */].drillProperty(this, this.$selectlistBox, 'enableSearch');
    this.$items = [];
    this._values = [];
    this.items = [];
    this.values = [];
    this.$selectlistBox.followTarget = this;
    this.disableClickToFocus = false;
    this.orderly = true;
    this.itemFocusable = false;
    this._activeValue = undefined;
}

MultiSelectMenu.tag = 'MultiSelectMenu'.toLowerCase();
MultiSelectMenu.render = function () {
    return MultiSelectMenu_({
        class: ['as-multi-select-menu'],
        extendEvent: ['change', 'add', 'remove', 'activevaluechange'],
        attr: {
            tabindex: '1'
        },
        child: [
            {
                class: ['as-multi-select-menu-item-ctn', 'as-bscroller']
            },
            {
                tag: 'button',
                class: 'as-multi-select-menu-toggle-btn',
                child: 'dropdown-ico'
            },
            'attachhook'
        ]
    });
};


MultiSelectMenu.prototype._requireItem = function (n) {
    var itemElt;
    while (this.$items.length < n) {
        itemElt = SelectBox_requireItem(this);
        this.$itemCtn.addChild(itemElt);
        this.$items.push(itemElt);
    }

    while (this.$items.length > n) {
        itemElt = this.$items.pop();
        this.$itemCtn.removeChild(itemElt);
        SelectBox_releaseItem(itemElt);
    }
};


MultiSelectMenu.prototype._assignItems = function (items) {
    for (var i = 0; i < this.$items.length && i < items.length; ++i) {
        this.$items[i].data = items[i];
    }
};

/***
 *
 * @param {string[] | number[]} values
 * @private
 */
MultiSelectMenu.prototype._getItemsByValues = function (values) {
    var selectListBoxElt = this.$selectlistBox;
    var itemHolders = values.reduce(function (ac, cr) {
        ac.push.apply(ac, selectListBoxElt.findItemsByValue(cr));
        return ac;
    }, []);
    if (this.orderly) {
        if (typeof this.orderly === 'function') {
            itemHolders.sort(this.orderly);
        }
        else {
            itemHolders.sort(function(a, b) {
                return a.idx - b.idx;
            });
        }
    }

    return itemHolders.map(function (holder) {
        return holder.item;
    })

};


MultiSelectMenu.prototype._updateItems = function () {
    var cBound = this.getBoundingClientRect();
    var items = this._getItemsByValues(this._values);
    this._requireItem(items.length);
    this._assignItems(items);
    if (this.itemFocusable) {
        this._updateFocusItem();
    }
    var nBound = this.getBoundingClientRect();
    if (nBound.width != cBound.width || nBound.height != cBound.height) {
        ResizeSystem["a" /* default */].updateUp(this);
    }
};


MultiSelectMenu.property = {};
MultiSelectMenu.property.disabled = SelectMenu2.property.disabled;
MultiSelectMenu.property.hidden = SelectMenu2.property.hidden;
MultiSelectMenu.property.isFocus = SelectMenu2.property.isFocus;


MultiSelectMenu.prototype.init = function (props) {
    props = props || [];
    Object.keys(props).forEach(function (key) {
        if (props[key] === undefined) delete props[key];
    });
    this.super(props);
};

MultiSelectMenu.prototype._updateFocusItem = function () {
    for (var i = 0; i < this.$items.length; ++i) {
        this.$items[i].active = this.$items[i].value == this._activeValue;
    }
};


MultiSelectMenu.prototype.init = SelectMenu2.prototype.init;


MultiSelectMenu.property.items = {
    set: function (items) {
        items = items || [];
        this.$selectlistBox.items = items;
        this.addStyle('--list-min-width', this.$selectlistBox._estimateWidth + 'px');
        this._updateItems();
    },
    get: function () {
        return this.$selectlistBox.items
    }
};

MultiSelectMenu.property.values = {
    set: function (values) {
        values = values || [];
        values = (values instanceof Array) ? values : [values];
        this._values = values;
        this.$selectlistBox.values = values;
        this._updateItems();
    },
    get: function () {
        return this._values || [];
    }
};

MultiSelectMenu.property.orderly = {
    set: function (value) {
       var needUpdate = this._orderly === this._orderly;
       if (typeof value === 'function') {
           this._orderly;
       }
       else
           this._orderly = !!value;
       if (needUpdate) {
           this.values = this.values;
       }
    },
    get: function () {
        return !!this._orderly;
    }
};

MultiSelectMenu.property.disableClickToFocus = {
    set: function (value) {
        if (value) {
            this.addClass('as-disable-click-to-focus');
        }
        else {
            this.removeClass('as-disable-click-to-focus');
        }
    },
    get: function () {
        return this.containsClass('as-disable-click-to-focus');
    }
};

MultiSelectMenu.property.itemFocusable = {
    set: function (value) {
        if (value) {
            this.addClass('as-item-focusable');
        }
        else {
            this.removeClass('as-item-focusable');
        }
        this._updateFocusItem();
    },
    get: function () {
        return this.containsClass('as-item-focusable');
    }
};

MultiSelectMenu.property.activeValue = {
    set: function (value) {
        this._activeValue = value;
        if (this.itemFocusable) {
            this._updateFocusItem();
            //todo
        }
    },
    get: function () {
        return this._activeValue;
    }
};


MultiSelectMenu.eventHandler = Object.assign({}, SelectMenu2.eventHandler);

MultiSelectMenu.eventHandler.attached = function () {
    var maxHeightStyle = this.getComputedStyleValue('max-height') || 'none';
    if (maxHeightStyle.match(/[0-9-]+px/)) {
        this.addStyle('--multi-select-menu-max-height', maxHeightStyle);
        this.addStyle('max-height', 'unset');
    }
    else if (maxHeightStyle !== 'none') {
        console.warn('Can not adapt max-height:', maxHeightStyle);
    }
};


MultiSelectMenu.eventHandler.click = function (event) {
    if ((event.target === this || event.target === this.$itemCtn) && !this.disableClickToFocus) {
        this.isFocus = !this.isFocus;
    }
};


MultiSelectMenu.eventHandler.bodyClick = function (event) {
    if (!EventEmitter["b" /* default */].hitElement(this.$selectlistBox, event) && event.target !== this && event.target !== this.$itemCtn) {
        this.isFocus = false;
    }
};


MultiSelectMenu.eventHandler.selectListBoxPressItem = function (event) {
    var data = event.data;
    var currentValues = this.$selectlistBox.values;
    currentValues.push(data.value);
    this.$selectlistBox.values = currentValues;
    this.$selectlistBox.updatePosition();
    this._activeValue = data.value;
    this._updateItems();
    this.isFocus = false;
    this.emit('add', Object.assign({}, event, {
        type: 'add',
        target: this,
        value: data.value,
        data: data,
        itemData: data
    }), this);
    this.emit('change', Object.assign({}, event, {
        type: 'change',
        action: 'add',
        target: this,
        value: data.value,
        data: data,
        values: this.values
    }), this);
};


ACore["a" /* default */].install(MultiSelectMenu);

/* harmony default export */ var js_MultiSelectMenu = (MultiSelectMenu);
// EXTERNAL MODULE: ./node_modules/absol-acomp/css/countdownclock.css
var countdownclock = __webpack_require__(235);

// CONCATENATED MODULE: ./node_modules/absol-acomp/js/CountdownClock.js






var CountdownClock_ = ACore["a" /* default */]._;
var CountdownClock_$ = ACore["a" /* default */].$;


/***
 * @extends AElement
 * @constructor
 */
function CountdownClock() {
    var thisC = this;
    this.$attachhook = CountdownClock_('attachhook').addTo(this)
        .on('attached', function () {
            ResizeSystem["a" /* default */].add(this);
            this.requestUpdateSize();
            if (thisC.autoStart) {
                thisC.start();
            }
        });

    this.$attachhook.requestUpdateSize = this._updateBorder.bind(this);
    this._tick = this._tick.bind(this);
    this.$border = CountdownClock_$(".as-countdown-clock-border", this);
    this.$min = CountdownClock_$(".as-countdown-clock-min", this);
    this.$sec = CountdownClock_$(".as-countdown-clock-sec", this);
    this._prevText = -1;
    this._startTime = new Date().getTime();
    this._totalSecond = 60;
    this._remainSecond = 0;

    this.totalSecond = 60;
    this.remainSecond = 0;
    this._intvId = -1;

}

CountdownClock.tag = 'CountdownClock'.toLowerCase();

CountdownClock.render = function () {
    return CountdownClock_({
        extendEvent: ['finish', 'update'],
        class: 'as-countdown-clock',
        child: [
            {
                class: 'as-countdown-clock-text',
                child: [
                    { tag: 'span', class: 'as-countdown-clock-min', child: { text: 0 } },
                    { text: ':' },
                    { tag: 'span', class: 'as-countdown-clock-sec', child: { text: '60' } }
                ]
            },
            {
                class: 'as-countdown-clock-border-wrapper',
                child: {
                    class: 'as-countdown-clock-border'
                }
            }
        ]
    });
};


CountdownClock.prototype._makePolygon = function (end) {
    var n = Math.ceil(Math.max(end / 0.2, 2));
    var fan = Array(n).fill(0).map(function (u, i) {
        var angle = -Math.PI / 2 + end * i / n;
        return [numberAutoFixed(50 + 60 * Math.cos(angle), 5) + '%', numberAutoFixed(50 + 60 * Math.sin(angle), 5) + '%'].join(' ')
    });
    fan.push('50% 50%');
    return 'polygon('+fan.join(', ')+')';

};


CountdownClock.prototype._setBorderValue = function (val) {
    if (val >= 1 || !isFinite(val)) {
        this.$border.removeStyle("clip-path");
        return;
    }
    var bound = this.$border.getBoundingClientRect();
    var angle = val * Math.PI * 2;
    this.$border.addStyle("-webkit-clip-path", this._makePolygon(angle));
    this.$border.addStyle("clip-path", this._makePolygon(angle));

};

CountdownClock.prototype._updateBorder = function () {
    this._setBorderValue(this._remainSecond / Math.max(0.001, this._totalSecond));
};

CountdownClock.prototype._updateText = function () {
    if (this._prevText === this.remainSecond) return;
    var remainSecond = this.remainSecond;
    var min = Math.floor(remainSecond / 60);
    var sec = remainSecond % 60;
    this.$sec.innerHTML = (sec < 10 ? "0" : "") + sec;
    this.$min.innerHTML = min;
}

CountdownClock.prototype._tick = function () {
    var now = new Date().getTime();
    var prevSec = this.remainSecond;
    this.remainSecond = Math.max(0, Math.ceil(this.totalSecond - (now - this._startTime) / 1000));
    if (prevSec !== this.remainSecond) {
        this._updateText();
        this.emit('update', { target: this, type: 'update' }, this);
        if (this.remainSecond === 0) {
            clearInterval(this._intvId);
            this._intvId = -1;
            this.emit('finish', { target: this, type: 'finish' }, this);
        }
    }

};

CountdownClock.prototype.start = function () {
    if (this.remainSecond == 0) this.remainSecond = this.totalSecond;
    this._startTime = new Date().getTime() - (this.totalSecond - this.remainSecond) * 1000;
    this.resume();
};

CountdownClock.prototype.resume = function () {
    if (this._intvId > 0) return;
    this._intvId = setInterval(this._tick, 200);
};

CountdownClock.prototype.pause = function () {
    if (this._intvId > 0) {
        clearInterval(this._intvId);
        this._intvId = -1;
    }
};

CountdownClock.prototype.stop = function () {
    this.pause();
    this.remainSecond = 0;
};

CountdownClock.prototype.reset = function () {
    this.remainSecond = this.totalSecond;
    this._startTime = new Date().getTime();
}


CountdownClock.property = {};

CountdownClock.property.totalSecond = {
    set: function (value) {
        if (!(value >= 0)) {
            value = 0;
        }
        this._totalSecond = value;
        this._updateBorder();
    },
    get: function () {
        return this._totalSecond;
    }
};


CountdownClock.property.remainSecond = {
    set: function (value) {
        if (!(value >= 0)) {
            value = 0;
        }
        this._remainSecond = value;
        this._updateBorder();
        this._updateText();
    },
    get: function () {
        return this._remainSecond;
    }
}


ACore["a" /* default */].install(CountdownClock);

/* harmony default export */ var js_CountdownClock = (CountdownClock);
// EXTERNAL MODULE: ./node_modules/absol-acomp/css/toast.css
var toast = __webpack_require__(237);

// EXTERNAL MODULE: ./node_modules/absol-acomp/css/variantcolors.css
var variantcolors = __webpack_require__(239);

// CONCATENATED MODULE: ./node_modules/absol-acomp/js/VariantColors.js



function VariantColor() {
    this.keys = ['primary', 'secondary',
        'success', 'info',
        'warning', 'error', 'danger',
        'light', 'dark',
        'link',
        'note'];
    this.base = {
        primary: "#007bff",
        secondary: "#6c757d",
        success: "#28a745",
         info: "#17a2b8",
        warning: "#ffc107",
        error: "#ff4052",
        danger: "#dc3545",
        light: "#f8f9fa",
        dark: "#343a40",
        link: "#007bff",
        note: '#ffff88'
    };
    this.mediumContract = {
        primary: '#e2edd5',
        secondary: '#fca75b',
        success: '#fce8e8',
        info: '#fcf5e8',
        warning: '#5e5a75',
        error: '#e0dfce',
        danger: "#e5e8d5",
        light: '#7a5b3c',
        dark: "#bf7d3b",
        link: "#dde8c9",
        note: '#1e1ec8'
    }
    Dom["b" /* default */].documentReady.then(this.loadFromCss.bind(this));
}

VariantColor.prototype.has = function (name) {
    return this.keys.indexOf(name) >= 0;
};

VariantColor.prototype.loadFromCss = function () {
    this.base = this.keys.reduce(function (ac, name) {
        var style = window.getComputedStyle(document.body);
        ac[name] = style.getPropertyValue('--variant-color-' + name);
        return ac;
    }, {});
    this.mediumContract = this.keys.reduce(function (ac, name) {
        var style = window.getComputedStyle(document.body);
        ac[name] = style.getPropertyValue('--variant-medium-contract-color-' + name);
        return ac;
    }, {});
};

/* harmony default export */ var VariantColors = (new VariantColor());
// CONCATENATED MODULE: ./node_modules/absol/src/JSMaker/TemplateString.js
function TemplateString(props) {
    this.parts = props.parts;
}




TemplateString.prototype.toJSCode = function () {
    return this.parts.map(function (e) {
        if (e.type == TemplateString.TYPE_EXPRESSION) {
            return '(' + e.data + ')';
        }
        else {
            return JSON.stringify(e.data);
        }
    }).join('+');
};


TemplateString.__partRegex = /(\{\{(([^\}]|(\}[^\}]))*)\}\})|(([^\{]|(\{[^\{]))+)/g;

/**
 *  @param  {String} text 
 */
TemplateString.__matchExpression = function (text) {
    if (text[0] == '{' && text[1] == '{' && text[text.length - 1] == '}' && text[text.length - 2] == '}') {
        return [text, text.substr(2, text.length - 4).trim()];
    }
    else {
        return false;
    }
};

TemplateString.TYPE_STRING = 0;
TemplateString.TYPE_EXPRESSION = 1;


TemplateString.parse = function (text) {
    text = text+'';
    var matchedParts = text.match(this.__partRegex);
    if (matchedParts) {
        var parts = matchedParts.map(function (e) {
            var matchedExp = this.__matchExpression(e);
            if (matchedExp) {
                return {
                    type: this.TYPE_EXPRESSION,
                    data: matchedExp[1]
                };
            }
            else {
                return {
                    type: this.TYPE_STRING,
                    data: e
                };
            }
        }.bind(this));
        return new TemplateString({ parts: parts });
    }
    else {
        return undefined;
    }
};

/* harmony default export */ var JSMaker_TemplateString = (TemplateString);
// CONCATENATED MODULE: ./node_modules/absol/src/Color/Color.js


function Color(rgba) {
    this.rgba = rgba.slice();
}


Color.prototype.toHex6 = function () {
    return this.rgba.slice(0, 3).map(function (b) {
        b = b * 255 >> 0;
        return (b < 16 ? '0' : '') + b.toString(16);
    }).join('');
};

Color.prototype.toHex8 = function () {
    return this.rgba.map(function (b) {
        b = b * 255 >> 0;
        return (b < 16 ? '0' : '') + b.toString(16);
    }).join('');
};

Color.prototype.toHex3 = function () {
    return this.rgba.slice(0, 3).map(function (b) {
        b = b * 255 / 17 >> 0;
        return b.toString(16);
    }).join('');
};

Color.prototype.toHex4 = function () {
    return this.rgba.map(function (b) {
        b = b * 255 / 17 >> 0;
        return b.toString(16);
    }).join('');
};


Color.prototype.toHSLA = function () {
    return Color.rgbaToHSLA(this.rgba);
};


Color.prototype.toHSBA = function () {
    return Color.rgbaToHSBA(this.rgba);
};

Color.prototype.toHWBA = function () {
    return Color.rgbaToHWBA(this.rgba);
};


Color.prototype.getHightContrastColor = function () {
    var hsba = this.toHSBA();
    var h, s, b;
    h = hsba[0] > 0.5 ? hsba[0] - 0.5 : hsba[0] + 0.5;
    s = hsba[1] > 0.5 ? hsba[1] - 0.5 : hsba[1] + 0.5;
    b = hsba[2] > 0.5 ? hsba[2] - 0.5 : hsba[2] + 0.5;
    return Color.fromHSB(h, s, b);
};


Color.prototype.getContrastYIQ = function () {
    var r = this.rgba[0] * 255;
    var g = this.rgba[1] * 255;
    var b = this.rgba[2] * 255;
    var yiq = ((r * 299) + (g * 587) + (b * 114)) / 1000;
    return (yiq >= 128) ? new Color([0, 0, 0, 1]) : new Color([1, 1, 1, 1]);
};

Color.prototype.clone = function () {
    return new Color(this.rgba.slice());
};

Color.prototype.toString = function (mode) {
    mode = mode || 'rgba';
    mode = mode.toLocaleLowerCase();
    return Color.templates[mode](this);
};

/***
 *
 */
Color.prototype.nearestNamedColor = function (notStandard, hsbWeight) {
    hsbWeight = hsbWeight ||[5, 3, 1]
    var hsba = this.toHSBA();
    var bestMatch = null;
    var dist = 1000;
    Object.keys(Color.namedColors).concat(notStandard ? Object.keys(Color.nonStandarNamedColors) : []).forEach(function (name) {
        var c = Color.parse(Color.namedColors[name] || Color.nonStandarNamedColors[name]);
        var cHSBA = c.toHSBA();
        var cDist = Math.abs(hsba[0] - cHSBA[0]) * hsbWeight[0] + Math.abs(hsba[1] - cHSBA[1]) *  hsbWeight[1] + Math.abs(hsba[2] - cHSBA[2])*  hsbWeight[2];
        if (cDist < dist) {
            dist = cDist;
            bestMatch = name;
        }
    });
    return bestMatch;
};

Color.templates = [
    ['rgba', 'rgba', 'rgba({{x[0]*255>>0}}, {{x[1]*255>>0}}, {{x[2]*255>>0}}, {{x[3]}})'],
    ['rgb', 'rgba', 'rgb({{x[0]*255>>0}}, {{x[1]*255>>0}}, {{x[2]*255>>0}})'],
    ['hsl', 'toHSLA()', 'hsl({{x[0] * 360}}, {{x[1] * 100}}%, {{x[2] * 100}}%)'],
    ['hsla', 'toHSLA()', 'hsla({{x[0] * 360}}, {{x[1] * 100}}%, {{x[2] * 100}}%, {{x[3]}})'],
    ['hsb', 'toHSBA()', 'hsb({{x[0] * 360}}, {{x[1] * 100}}%, {{x[2] * 100}}%)'],
    ['hsba', 'toHSBA()', 'hsba({{x[0] * 360}}, {{x[1] * 100}}%, {{x[2] * 100}}%, {{x[3]}})'],
    ['hex3', 'toHex3()', '#{{x}}'],
    ['hex4', 'toHex4()', '#{{x}}'],
    ['hex6', 'toHex6()', '#{{x}}'],
    ['hex8', 'toHex8()', '#{{x}}'],
    ['hwb', 'toHWBA()', 'hwb({{x[0] * 360}}, {{x[1] * 100}}%, {{x[2] * 100}}%)'],
    ['hwba', 'toHWBA()', 'hwba({{x[0] * 360}}, {{x[1] * 100}}%, {{x[2] * 100}}%, {{x[3]}})']
].reduce(function (ac, cr) {
    ac[cr[0]] = new Function('color', [
        'var x = color.' + cr[1] + ';',
        'return ' + JSMaker_TemplateString.parse(cr[2]).toJSCode() + ';'
    ].join('\n'));
    return ac;
}, {});


Color.regexes = {
    whiteSpace: /\s*/, // Match zero or more whitespace characters.
    integer: /(\d{1,3})/, // Match integers: 79, 255, etc.
    decimal: /((?:\d+(?:\.\d+)?)|(?:\.\d+))/, // Match 129.6, 79, .9, etc.
    percent: /((?:\d+(?:\.\d+)?)|(?:\.\d+))%/, // Match 12.9%, 79%, .9%, etc.
    hex3: /^#([a-f0-9])([a-f0-9])([a-f0-9])$/i,

    // Match colors in format #XXXX, e.g. #5123.
    hex4: /^#([a-f0-9])([a-f0-9])([a-f0-9])([a-f0-9])$/i,

    // Match colors in format #XXXXXX, e.g. #b4d455.
    hex6: /^#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})$/i,

    // Match colors in format #XXXXXXXX, e.g. #b4d45535.
    hex8: /^#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})$/i
};


Color.regexes.percent = new RegExp(Color.regexes.decimal.source + '%');

Color.regexes.rgb = new RegExp(
    [
        '^rgb\\(',
        Color.regexes.integer.source,
        ',',
        Color.regexes.integer.source,
        ',',
        Color.regexes.integer.source,
        '\\)$'
    ].join(Color.regexes.whiteSpace.source),
    'i'
);

Color.regexes.rgbPercent = new RegExp(
    [
        '^rgb\\(',
        Color.regexes.percent.source,
        ',',
        Color.regexes.percent.source,
        ',',
        Color.regexes.percent.source,
        '\\)$'
    ].join(Color.regexes.whiteSpace.source),
    'i'
);

// Match colors in format rgb(R, G, B, A), e.g. rgb(255, 0, 128, 0.25).
Color.regexes.rgba = new RegExp(
    [
        '^rgba\\(',
        Color.regexes.integer.source,
        ',',
        Color.regexes.integer.source,
        ',',
        Color.regexes.integer.source,
        ',',
        Color.regexes.decimal.source,
        '\\)$'
    ].join(Color.regexes.whiteSpace.source),
    'i'
);

// Match colors in format rgb(R%, G%, B%, A), e.g. rgb(100%, 0%, 28.9%, 0.5).
Color.regexes.rgbaPercent = new RegExp(
    [
        '^rgba\\(',
        Color.regexes.percent.source,
        ',',
        Color.regexes.percent.source,
        ',',
        Color.regexes.percent.source,
        ',',
        Color.regexes.decimal.source,
        '\\)$'
    ].join(Color.regexes.whiteSpace.source),
    'i'
);
// Match colors in format hsla(H, S%, L%), e.g. hsl(100, 40%, 28.9%).
Color.regexes.hsl = new RegExp(
    [
        '^hsl\\(',
        Color.regexes.integer.source,
        '[deg]*',
        ',',
        Color.regexes.percent.source,
        ',',
        Color.regexes.percent.source,
        '\\)$'
    ].join(Color.regexes.whiteSpace.source),
    'i'
);

// Match colors in format hsla(H, S%, L%, A), e.g. hsla(100, 40%, 28.9%, 0.5).
Color.regexes.hsla = new RegExp(
    [
        '^hsla\\(',
        Color.regexes.integer.source,
        '[deg]*',
        ',',
        Color.regexes.percent.source,
        ',',
        Color.regexes.percent.source,
        ',',
        Color.regexes.decimal.source,
        '\\)$'
    ].join(Color.regexes.whiteSpace.source),
    'i'
);

// Match colors in format hsb(H, S%, B%), e.g. hsb(100, 40%, 28.9%).
Color.regexes.hsb = new RegExp(
    [
        '^hsb\\(',
        Color.regexes.integer.source,
        '[deg]*',
        ',',
        Color.regexes.percent.source,
        ',',
        Color.regexes.percent.source,
        '\\)$'
    ].join(Color.regexes.whiteSpace.source),
    'i'
);

// Match colors in format hsba(H, S%, B%, A), e.g. hsba(100, 40%, 28.9%, 0.5).
Color.regexes.hsba = new RegExp(
    [
        '^hsba\\(',
        Color.regexes.integer.source,
        '[deg]*',
        ',',
        Color.regexes.percent.source,
        ',',
        Color.regexes.percent.source,
        ',',
        Color.regexes.decimal.source,
        '\\)$'
    ].join(Color.regexes.whiteSpace.source),
    'i'
);

Color.regexes.hwb = new RegExp(
    [
        '^hwb\\(',
        Color.regexes.integer.source,
        '[deg]*',
        ',',
        Color.regexes.percent.source,
        ',',
        Color.regexes.percent.source,
        '\\)$'
    ].join(Color.regexes.whiteSpace.source),
    'i'
);

// Match colors in format hsba(H, S%, B%, A), e.g. hsba(100, 40%, 28.9%, 0.5).
Color.regexes.hwba = new RegExp(
    [
        '^hwba\\(',
        Color.regexes.integer.source,
        '[deg]*',
        ',',
        Color.regexes.percent.source,
        ',',
        Color.regexes.percent.source,
        ',',
        Color.regexes.decimal.source,
        '\\)$'
    ].join(Color.regexes.whiteSpace.source),
    'i'
);


Color.fromInt = function (code, bits) {
    var r, g, b, a;
    if (bits == 32) {
        b = (code & 0xff) / 255;
        g = ((code & 0xff00) >> 8) / 255;
        r = ((code & 0xff0000) >> 16) / 255;
        a = (code >> 24) / 255;
    }
    else if (bits == 24) {
        b = (code & 0xff) / 255;
        g = ((code & 0xff00) >> 8) / 255;
        r = ((code & 0xff0000) >> 16) / 255;
        a = 1;
    }
    else if (bits == 16) {
        b = (code & 0x1f) / 0x1f;
        g = ((code & 0x7e0) >> 5) / 0x3f;
        b = (code >> 10) / 0x1f;
        a = 1;
    }
    else if (bits == 8) {//gray-scale
        b = (code & 0x3) / 0x3;
        g = ((code & 0x1c) >> 2) / 0x7;
        b = (code >> 5) / 0x7;
        a = 1;
    }

    return new Color([r, g, b, a]);
};


Color.fromRGB = function (r, g, b) {
    return new Color([r, g, b, 1]);
};

Color.fromRGBA = function (r, g, b, a) {
    return new Color([r, g, b, a]);
};

Color.fromHSL = function (h, s, l) {
    var rgba = this.hslaToRGBA([h, s, l, 1]);
    return new Color(rgba);
};

Color.fromHSLA = function (h, s, l, a) {
    var rgba = this.hslaToRGBA([h, s, l, a]);
    return new Color(rgba);
};

Color.fromHSB = function (h, s, b) {
    var rgba = this.hsbaToRGBA([h, s, b, 1]);
    return new Color(rgba);
};

Color.fromHSBA = function (h, s, b, a) {
    var rgba = this.hsbaToRGBA([h, s, b, a]);
    return new Color(rgba);
};

Color.fromHWB = function (h, s, b) {
    var rgba = this.hwbaToRGBA([h, s, b, 1]);
    return new Color(rgba);
};

Color.fromHWBA = function (h, s, b, a) {
    var rgba = this.hwbaToRGBA([h, s, b, a]);
    return new Color(rgba);
};


/**
 * @param {String} text
 * @returns {Color}
 */
Color.parse = function (text) {
    if (this.namedColors[text]) text = this.namedColors[text];
    if (this.nonStandarNamedColors[text]) text = this.nonStandarNamedColors[text];
    if (this.regexes.hex8.test(text)) {
        return this.fromRGBA.apply(this,
            this.regexes.hex8.exec(text)
                .slice(1)
                .map(function (v) {
                    return parseInt(v, 16) / 255;
                }));
    }
    else if (this.regexes.hex6.test(text)) {
        return this.fromRGB.apply(this,
            this.regexes.hex6.exec(text)
                .slice(1)
                .map(function (v) {
                    return parseInt(v, 16) / 255;
                }));
    }
    else if (this.regexes.hex4.test(text)) {
        return this.fromRGBA.apply(this,
            this.regexes.hex4.exec(text)
                .slice(1)
                .map(function (v) {
                    return parseInt(v + v, 16) / 255;
                }));
    }
    else if (this.regexes.hex3.test(text)) {
        return this.fromRGB.apply(this,
            this.regexes.hex3.exec(text)
                .slice(1)
                .map(function (v) {
                    return parseInt(v + v, 16) / 255;
                }));
    }
    else if (this.regexes.rgba.test(text)) {
        return this.fromRGBA.apply(this,
            this.regexes.rgba.exec(text)
                .slice(1)
                .map(function (v, i) {
                    return i < 3 ? parseFloat(v, 10) / 255 : parseFloat(v, 10);
                }));
    }
    else if (this.regexes.rgb.test(text)) {
        return this.fromRGB.apply(this,
            this.regexes.rgb.exec(text)
                .slice(1)
                .map(function (v, i) {
                    return parseFloat(v, 10) / 255;
                }));
    }
    else if (this.regexes.rgbPercent.test(text)) {
        return this.fromRGB.apply(this,
            this.regexes.rgbPercent.exec(text)
                .slice(1)
                .map(function (v, i) {
                    return parseFloat(v, 10) / 100;
                }));
    }
    else if (this.regexes.rgbaPercent.test(text)) {
        return this.fromRGBA.apply(this,
            this.regexes.rgbaPercent.exec(text)
                .slice(1)
                .map(function (v, i) {
                    return parseFloat(v, 10) / (i < 3 ? 100 : 1);
                }));
    }
    else if (this.regexes.hsl.test(text)) {
        return this.fromHSL.apply(this,
            this.regexes.hsl.exec(text)
                .slice(1)
                .map(function (v, i) {
                    return parseFloat(v, 10) / (i == 0 ? 360 : 100);
                }));
    }
    else if (this.regexes.hsla.test(text)) {
        return this.fromHSLA.apply(this,
            this.regexes.hsla.exec(text)
                .slice(1)
                .map(function (v, i) {
                    return parseFloat(v, 10) / (i == 0 ? 360 : i < 3 ? 100 : 1);
                }));
    }
    else if (this.regexes.hsb.test(text)) {
        return this.fromHSB.apply(this,
            this.regexes.hsb.exec(text)
                .slice(1)
                .map(function (v, i) {
                    return parseFloat(v, 10) / (i == 0 ? 360 : 100);
                }));
    }
    else if (this.regexes.hsba.test(text)) {
        return this.fromHSBA.apply(this,
            this.regexes.hsba.exec(text)
                .slice(1)
                .map(function (v, i) {
                    return parseFloat(v, 10) / (i == 0 ? 360 : i < 3 ? 100 : 1);
                }));
    }
    else if (this.regexes.hwb.test(text)) {
        return this.fromHWB.apply(this,
            this.regexes.hwb.exec(text)
                .slice(1)
                .map(function (v, i) {
                    return parseFloat(v, 10) / (i == 0 ? 360 : 100);
                }));
    }
    else if (this.regexes.hwba.test(text)) {
        return this.fromHWBA.apply(this,
            this.regexes.hwba.exec(text)
                .slice(1)
                .map(function (v, i) {
                    return parseFloat(v, 10) / (i == 0 ? 360 : i < 3 ? 100 : 1);
                }));
    }
    else {
        throw new Error("Fail to parse " + text);
    }
};

/***
 * @typedef {"aliceblue"|"antiquewhite"|"aqua"|"aquamarine"|"azure"|"beige"|"bisque"|"black"|"blanchedalmond"|"blue"|"blueviolet"|"brown"|"burlywood"|"cadetblue"|"chartreuse"|"chocolate"|"coral"|"cornflowerblue"|"cornsilk"|"crimson"|"cyan"|"darkblue"|"darkcyan"|"darkgoldenrod"|"darkgray"|"darkgreen"|"darkgrey"|"darkkhaki"|"darkmagenta"|"darkolivegreen"|"darkorange"|"darkorchid"|"darkred"|"darksalmon"|"darkseagreen"|"darkslateblue"|"darkslategray"|"darkslategrey"|"darkturquoise"|"darkviolet"|"deeppink"|"deepskyblue"|"dimgray"|"dimgrey"|"dodgerblue"|"firebrick"|"floralwhite"|"forestgreen"|"fuchsia"|"gainsboro"|"ghostwhite"|"gold"|"goldenrod"|"gray"|"green"|"greenyellow"|"grey"|"honeydew"|"hotpink"|"indianred"|"indigo"|"ivory"|"khaki"|"lavender"|"lavenderblush"|"lawngreen"|"lemonchiffon"|"lightblue"|"lightcoral"|"lightcyan"|"lightgoldenrodyellow"|"lightgray"|"lightgreen"|"lightgrey"|"lightpink"|"lightsalmon"|"lightseagreen"|"lightskyblue"|"lightslategray"|"lightslategrey"|"lightsteelblue"|"lightyellow"|"lime"|"limegreen"|"linen"|"magenta"|"maroon"|"mediumaquamarine"|"mediumblue"|"mediumorchid"|"mediumpurple"|"mediumseagreen"|"mediumslateblue"|"mediumspringgreen"|"mediumturquoise"|"mediumvioletred"|"midnightblue"|"mintcream"|"mistyrose"|"moccasin"|"navajowhite"|"navy"|"oldlace"|"olive"|"olivedrab"|"orange"|"orangered"|"orchid"|"palegoldenrod"|"palegreen"|"paleturquoise"|"palevioletred"|"papayawhip"|"peachpuff"|"peru"|"pink"|"plum"|"powderblue"|"purple"|"red"|"rosybrown"|"royalblue"|"saddlebrown"|"salmon"|"sandybrown"|"seagreen"|"seashell"|"sienna"|"silver"|"skyblue"|"slateblue"|"slategray"|"slategrey"|"snow"|"springgreen"|"steelblue"|"tan"|"teal"|"thistle"|"tomato"|"turquoise"|"violet"|"wheat"|"white"|"whitesmoke"|"yellow"|"yellowgreen"|"transparent"} NamedColor
 */

Color.namedColors = {
    aliceblue: '#f0f8ff',
    antiquewhite: '#faebd7',
    aqua: '#00ffff',
    aquamarine: '#7fffd4',
    azure: '#f0ffff',
    beige: '#f5f5dc',
    bisque: '#ffe4c4',
    black: '#000000',
    blanchedalmond: '#ffebcd',
    blue: '#0000ff',
    blueviolet: '#8a2be2',
    brown: '#a52a2a',
    burlywood: '#deb887',
    cadetblue: '#5f9ea0',
    chartreuse: '#7fff00',
    chocolate: '#d2691e',
    coral: '#ff7f50',
    cornflowerblue: '#6495ed',
    cornsilk: '#fff8dc',
    crimson: '#dc143c',
    cyan: '#00ffff',
    darkblue: '#00008b',
    darkcyan: '#008b8b',
    darkgoldenrod: '#b8860b',
    darkgray: '#a9a9a9',
    darkgreen: '#006400',
    darkgrey: '#a9a9a9',
    darkkhaki: '#bdb76b',
    darkmagenta: '#8b008b',
    darkolivegreen: '#556b2f',
    darkorange: '#ff8c00',
    darkorchid: '#9932cc',
    darkred: '#8b0000',
    darksalmon: '#e9967a',
    darkseagreen: '#8fbc8f',
    darkslateblue: '#483d8b',
    darkslategray: '#2f4f4f',
    darkslategrey: '#2f4f4f',
    darkturquoise: '#00ced1',
    darkviolet: '#9400d3',
    deeppink: '#ff1493',
    deepskyblue: '#00bfff',
    dimgray: '#696969',
    dimgrey: '#696969',
    dodgerblue: '#1e90ff',
    firebrick: '#b22222',
    floralwhite: '#fffaf0',
    forestgreen: '#228b22',
    fuchsia: '#ff00ff',
    gainsboro: '#dcdcdc',
    ghostwhite: '#f8f8ff',
    gold: '#ffd700',
    goldenrod: '#daa520',
    gray: '#808080',
    green: '#008000',
    greenyellow: '#adff2f',
    grey: '#808080',
    honeydew: '#f0fff0',
    hotpink: '#ff69b4',
    indianred: '#cd5c5c',
    indigo: '#4b0082',
    ivory: '#fffff0',
    khaki: '#f0e68c',
    lavender: '#e6e6fa',
    lavenderblush: '#fff0f5',
    lawngreen: '#7cfc00',
    lemonchiffon: '#fffacd',
    lightblue: '#add8e6',
    lightcoral: '#f08080',
    lightcyan: '#e0ffff',
    lightgoldenrodyellow: '#fafad2',
    lightgray: '#d3d3d3',
    lightgreen: '#90ee90',
    lightgrey: '#d3d3d3',
    lightpink: '#ffb6c1',
    lightsalmon: '#ffa07a',
    lightseagreen: '#20b2aa',
    lightskyblue: '#87cefa',
    lightslategray: '#778899',
    lightslategrey: '#778899',
    lightsteelblue: '#b0c4de',
    lightyellow: '#ffffe0',
    lime: '#00ff00',
    limegreen: '#32cd32',
    linen: '#faf0e6',
    magenta: '#ff00ff',
    maroon: '#800000',
    mediumaquamarine: '#66cdaa',
    mediumblue: '#0000cd',
    mediumorchid: '#ba55d3',
    mediumpurple: '#9370db',
    mediumseagreen: '#3cb371',
    mediumslateblue: '#7b68ee',
    mediumspringgreen: '#00fa9a',
    mediumturquoise: '#48d1cc',
    mediumvioletred: '#c71585',
    midnightblue: '#191970',
    mintcream: '#f5fffa',
    mistyrose: '#ffe4e1',
    moccasin: '#ffe4b5',
    navajowhite: '#ffdead',
    navy: '#000080',
    oldlace: '#fdf5e6',
    olive: '#808000',
    olivedrab: '#6b8e23',
    orange: '#ffa500',
    orangered: '#ff4500',
    orchid: '#da70d6',
    palegoldenrod: '#eee8aa',
    palegreen: '#98fb98',
    paleturquoise: '#afeeee',
    palevioletred: '#db7093',
    papayawhip: '#ffefd5',
    peachpuff: '#ffdab9',
    peru: '#cd853f',
    pink: '#ffc0cb',
    plum: '#dda0dd',
    powderblue: '#b0e0e6',
    purple: '#800080',
    red: '#ff0000',
    rosybrown: '#bc8f8f',
    royalblue: '#4169e1',
    saddlebrown: '#8b4513',
    salmon: '#fa8072',
    sandybrown: '#f4a460',
    seagreen: '#2e8b57',
    seashell: '#fff5ee',
    sienna: '#a0522d',
    silver: '#c0c0c0',
    skyblue: '#87ceeb',
    slateblue: '#6a5acd',
    slategray: '#708090',
    slategrey: '#708090',
    snow: '#fffafa',
    springgreen: '#00ff7f',
    steelblue: '#4682b4',
    tan: '#d2b48c',
    teal: '#008080',
    thistle: '#d8bfd8',
    tomato: '#ff6347',
    turquoise: '#40e0d0',
    violet: '#ee82ee',
    wheat: '#f5deb3',
    white: '#ffffff',
    whitesmoke: '#f5f5f5',
    yellow: '#ffff00',
    yellowgreen: '#9acd32',
    transparent: '#00000000'
};

Color.nonStandarNamedColors = {
    night: '#0C090A',
    gunmetal: '#2C3539',
    midnight: '#2B1B17',
    charcoal: '#34282C',
    oil: '#3B3131',
    blackcat: '#413839',
    iridium: '#3D3C3A',
    blackeel: '#463E3F',
    blackcow: '#4C4646',
    graywolf: '#504A4B',
    vampiregray: '#565051',
    graydolphin: '#5C5858',
    carbongray: '#625D5D',
    ashgray: '#666362',
    cloudygray: '#6D6968',
    smokeygray: '#726E6D',
    granite: '#837E7C',
    battleshipgray: '#848482',
    graycloud: '#B6B6B4',
    graygoose: '#D1D0CE',
    platinum: '#E5E4E2',
    metallicsilver: '#BCC6CC',
    bluegray: '#98AFC7',
    raven: '#657383',
    jetgray: '#616D7E',
    mistblue: '#646D7E',
    marbleblue: '#566D7E',
    shipcove: '#737CA1',
    mariner: '#4863A0',
    bluejay: '#2B547E',
    biscay: '#2B3856',
    navyblue: '#000080',
    bluewhale: '#342D7E',
    lapisblue: '#15317E',
    denimdarkblue: '#151B8D',
    earthblue: '#0000A0',
    cobaltblue: '#0020C2',
    blueberryblue: '#0041C2',
    sapphireblue: '#2554C7',
    blueeyes: '#1569C7',
    blueorchid: '#1F45FC',
    bluelotus: '#6960EC',
    lightslateblue: '#736AFF',
    windowsblue: '#357EC7',
    glacialblueice: '#368BC1',
    silkblue: '#488AC7',
    blueivy: '#3090C7',
    bluekoi: '#659EC7',
    columbiablue: '#87AFC7',
    babyblue: '#95B9C7',
    oceanblue: '#2B65EC',
    blueribbon: '#306EFF',
    bluedress: '#157DEC',
    butterflyblue: '#38ACEC',
    iceberg: '#56A5EC',
    crystalblue: '#5CB3FF',
    denimblue: '#79BAEC',
    dayskyblue: '#82CAFF',
    jeansblue: '#A0CFEC',
    blueangel: '#B7CEEC',
    pastelblue: '#B4CFEC',
    seablue: '#C2DFFF',
    coralblue: '#AFDCEC',
    robineggblue: '#BDEDFF',
    palebluelily: '#CFECEC',
    water: '#EBF4FA',
    lightslate: '#CCFFFF',
    lightaquamarine: '#93FFE8',
    electricblue: '#9AFEFF',
    cyanoraqua: '#00FFFF',
    tronblue: '#7DFDFE',
    bluezircon: '#57FEFF',
    bluelagoon: '#8EEBEC',
    celeste: '#50EBEC',
    bluediamond: '#4EE2EC',
    tiffanyblue: '#81D8D0',
    cyanopaque: '#92C7C7',
    bluehosta: '#77BFC7',
    northernlightsblue: '#78C7C7',
    jellyfish: '#46C7C7',
    bluegreen: '#7BCCB5',
    macawbluegreen: '#43BFC7',
    seaturtlegreen: '#438D80',
    greenishblue: '#307D7E',
    grayishturquoise: '#5E7D7E',
    beetlegreen: '#4C787E',
    camouflagegreen: '#78866B',
    sagegreen: '#848b79',
    hazelgreen: '#617C58',
    venomgreen: '#728C00',
    ferngreen: '#667C26',
    darkforestgreen: '#254117',
    mediumforestgreen: '#347235',
    seaweedgreen: '#437C17',
    pinegreen: '#387C44',
    junglegreen: '#347C2C',
    shamrockgreen: '#347C17',
    greenonion: '#6AA121',
    clovergreen: '#3EA055',
    greensnake: '#6CBB3C',
    aliengreen: '#6CC417',
    greenapple: '#4CC417',
    kellygreen: '#4CC552',
    zombiegreen: '#54C571',
    froggreen: '#99C68E',
    greenpeas: '#89C35C',
    dollarbillgreen: '#85BB65',
    iguanagreen: '#9CB071',
    avocadogreen: '#B2C248',
    pistachiogreen: '#9DC209',
    saladgreen: '#A1C935',
    hummingbirdgreen: '#7FE817',
    nebulagreen: '#59E817',
    stoplightgogreen: '#57E964',
    algaegreen: '#64E986',
    jadegreen: '#5EFB6E',
    emeraldgreen: '#5FFB17',
    dragongreen: '#6AFB92',
    mintgreen: '#98FF98',
    greenthumb: '#B5EAAA',
    lightjade: '#C3FDB8',
    teagreen: '#CCFB5D',
    slimegreen: '#BCE954',
    harvestgold: '#EDE275',
    sunyellow: '#FFE87C',
    cornyellow: '#FFF380',
    parchment: '#FFFFC2',
    cream: '#FFFFCC',
    blonde: '#FBF6D9',
    champagne: '#F7E7CE',
    vanilla: '#F3E5AB',
    tanbrown: '#ECE5B6',
    peach: '#FFE5B4',
    mustard: '#FFDB58',
    rubberduckyyellow: '#FFD801',
    brightgold: '#FDD017',
    goldenbrown: '#EAC117',
    macaroniandcheese: '#F2BB66',
    saffron: '#FBB917',
    beer: '#FBB117',
    cantaloupe: '#FFA62F',
    beeyellow: '#E9AB17',
    brownsugar: '#E2A76F',
    deeppeach: '#FFCBA4',
    gingerbrown: '#C9BE62',
    schoolbusyellow: '#E8A317',
    fallleafbrown: '#C8B560',
    orangegold: '#D4A017',
    sand: '#C2B280',
    cookiebrown: '#C7A317',
    caramel: '#C68E17',
    brass: '#B5A642',
    camelbrown: '#C19A6B',
    bronze: '#CD7F32',
    tigerorange: '#C88141',
    cinnamon: '#C58917',
    bulletshell: '#AF9B60',
    copper: '#B87333',
    wood: '#966F33',
    oakbrown: '#806517',
    armybrown: '#827B60',
    sandstone: '#786D5F',
    mocha: '#493D26',
    taupe: '#483C32',
    coffee: '#6F4E37',
    brownbear: '#835C3B',
    reddirt: '#7F5217',
    sepia: '#7F462C',
    orangesalmon: '#C47451',
    rust: '#C36241',
    redfox: '#C35817',
    sedona: '#CC6600',
    papayaorange: '#E56717',
    halloweenorange: '#E66C2C',
    pumpkinorange: '#F87217',
    constructionconeorange: '#F87431',
    sunriseorange: '#E67451',
    mangoorange: '#FF8040',
    basketballorange: '#F88158',
    tangerine: '#E78A61',
    beanred: '#F75D59',
    valentinered: '#E55451',
    shockingorange: '#E55B3C',
    scarlet: '#FF2400',
    rubyred: '#F62217',
    ferrarired: '#F70D1A',
    fireenginered: '#F62817',
    lavared: '#E42217',
    lovered: '#E41B17',
    grapefruit: '#DC381F',
    chestnutred: '#C34A2C',
    cherryred: '#C24641',
    mahogany: '#C04000',
    chillipepper: '#C11B17',
    cranberry: '#9F000F',
    redwine: '#990012',
    burgundy: '#8C001A',
    chestnut: '#954535',
    bloodred: '#7E3517',
    sangria: '#7E3817',
    plumpie: '#7D0541',
    velvetmaroon: '#7E354D',
    plumvelvet: '#7D0552',
    rosyfinch: '#7F4E52',
    puce: '#7F5A58',
    dullpurple: '#7F525D',
    khakirose: '#C5908E',
    pinkbow: '#C48189',
    lipstickpink: '#C48793',
    rose: '#E8ADAA',
    rosegold: '#ECC5C0',
    desertsand: '#EDC9AF',
    pigpink: '#FDD7E4',
    cottoncandy: '#FCDFFF',
    pinkbubblegum: '#FFDFDD',
    flamingopink: '#F9A7B0',
    pinkrose: '#E7A1B0',
    pinkdaisy: '#E799A3',
    cadillacpink: '#E38AAE',
    carnationpink: '#F778A1',
    blushred: '#E56E94',
    watermelonpink: '#FC6C85',
    violetred: '#F6358A',
    pinkcupcake: '#E45E9D',
    pinklemonade: '#E4287C',
    neonpink: '#F535AA',
    dimorphothecamagenta: '#E3319D',
    brightneonpink: '#F433FF',
    tulippink: '#C25A7C',
    roguepink: '#C12869',
    burntpink: '#C12267',
    bashfulpink: '#C25283',
    darkcarnationpink: '#C12283',
    violapurple: '#7E587E',
    purpleiris: '#571B7E',
    plumpurple: '#583759',
    purplemonster: '#461B7E',
    purplehaze: '#4E387E',
    eggplant: '#614051',
    grape: '#5E5A80',
    purplejam: '#6A287E',
    purpleflower: '#A74AC7',
    purpleamethyst: '#6C2DC7',
    purplesagebush: '#7A5DC7',
    lovelypurple: '#7F38EC',
    aztechpurple: '#893BFF',
    jasminepurple: '#A23BEC',
    purpledaffodil: '#B041FF',
    tyrianpurple: '#C45AEC',
    crocuspurple: '#9172EC',
    purplemimosa: '#9E7BFF',
    heliotropepurple: '#D462FF',
    purpledragon: '#C38EC7',
    lilac: '#C8A2C8',
    blushpink: '#E6A9EC',
    mauve: '#E0B0FF',
    wisteriapurple: '#C6AEC7',
    blossompink: '#F9B7FF',
    periwinkle: '#E9CFEC',
    lavenderpinocchio: '#EBDDE2',
    lavenderblue: '#E3E4FA',
    pearl: '#FDEEF4',
    milkwhite: '#FEFCFF'
};

/********************** COLOR CONVERTER *******************/


Color.rgbToHex = function (rgb) {
    return '#' + rgb.slice(0, 3).map(function (c) {
        var res = ((c * 255) >> 0).toString(16);
        if (res < 10) res = '0' + res;
        return res.toUpperCase();
    }).join('');
};

Color.rgbaToHex = function (rgb) {
    return '#' + rgb.map(function (c) {
        var res = ((c * 255) >> 0).toString(16);
        if (res < 10) res = '0' + res;
        return res.toUpperCase();
    }).join('');
};

Color.hsbaToText = function (hsba) {
    return 'hsba(' + (hsba[0] * 360 >> 0) + 'deg, ' + (hsba[1] * 100 >> 0) + '%, ' + (hsba[2] * 100 >> 0) + '%, ' + (hsba[3].toFixed(3)) + ')';
};

Color.hslaToText = function (hsla) {
    return 'hsla(' + (hsla[0] * 360 >> 0) + 'deg, ' + (hsla[1] * 100 >> 0) + '%, ' + (hsla[2] * 100 >> 0) + '%, ' + (hsla[3].toFixed(3)) + ')';
};

Color.rgbaToText = function (rgba) {
    return 'rgba(' + (rgba[0] * 255 >> 0) + ', ' + (rgba[1] * 255 >> 0) + ', ' + (rgba[2] * 255 >> 0) + ', ' + (rgba[3].toFixed(3)) + ')';
};

Color.hsbToText = function (hsba) {
    return 'hsb(' + (hsba[0] * 360 >> 0) + 'deg, ' + (hsba[1] * 100 >> 0) + '%, ' + (hsba[2] * 100 >> 0) + '%)';
};

Color.hslToText = function (hsl) {
    return 'hsl(' + (hsl[0] * 360 >> 0) + 'deg, ' + (hsl[1] * 100 >> 0) + '%, ' + (hsl[2] * 100 >> 0) + '%)';
};

Color.rgbToText = function (rgba) {
    return 'rgb(' + (rgba[0] * 255 >> 0) + ', ' + (rgba[1] * 255 >> 0) + ', ' + (rgba[2] * 255 >> 0) + ')';
};


Color.hsbaToHSLA = function (hsba) {
    var hue = hsba[0];
    var sat = hsba[1];
    var val = hsba[2];

    // Calculate lightness.
    var li = (2 - sat) * val / 2;

    // Convert saturation.
    if (li !== 0) {
        if (li === 1) {
            sat = 0;
        }
        else if (li < 0.5) {
            sat = sat / (2 - sat);
        }
        else {
            sat = sat * val / (2 - li * 2);
        }
    }

    // Hue and alpha stay the same.
    return [hue, sat, li, hsba[3]];
};

Color.hsbaToRGBA = function (hsba) {
    var hue = hsba[0] * 6; // We will split hue into 6 sectors.
    var sat = hsba[1];
    var val = hsba[2];

    var RGBA = [];

    if (sat === 0) {
        RGBA = [val, val, val, hsba[3]]; // Return early if grayscale.
    }
    else {
        var sector = Math.floor(hue);
        var tint1 = val * (1 - sat);
        var tint2 = val * (1 - sat * (hue - sector));
        var tint3 = val * (1 - sat * (1 + sector - hue));
        var red, green, blue;
        if (sector === 1) {
            // Yellow to green.
            red = tint2;
            green = val;
            blue = tint1;
        }
        else if (sector === 2) {
            // Green to cyan.
            red = tint1;
            green = val;
            blue = tint3;
        }
        else if (sector === 3) {
            // Cyan to blue.
            red = tint1;
            green = tint2;
            blue = val;
        }
        else if (sector === 4) {
            // Blue to magenta.
            red = tint3;
            green = tint1;
            blue = val;
        }
        else if (sector === 5) {
            // Magenta to red.
            red = val;
            green = tint1;
            blue = tint2;
        }
        else {
            // Red to yellow (sector could be 0 or 6).
            red = val;
            green = tint3;
            blue = tint1;
        }
        RGBA = [red, green, blue, hsba[3]];
    }
    return RGBA;
};


Color.hslaToHSBA = function (hsla) {
    var hue = hsla[0];
    var sat = hsla[1];
    var li = hsla[2];

    // Calculate brightness.
    var val;
    if (li < 0.5) {
        val = (1 + sat) * li;
    }
    else {
        val = li + sat - li * sat;
    }

    // Convert saturation.
    sat = 2 * (val - li) / val;

    // Hue and alpha stay the same.
    return [hue, sat, val, hsla[3]];
};

Color.hslaToRGBA = function (hsla) {
    var hue = hsla[0] * 6; // We will split hue into 6 sectors.
    var sat = hsla[1];
    var li = hsla[2];

    var RGBA = [];

    if (sat === 0) {
        RGBA = [li, li, li, hsla[3]]; // Return early if grayscale.
    }
    else {
        // Calculate brightness.
        var val;
        if (li < 0.5) {
            val = (1 + sat) * li;
        }
        else {
            val = li + sat - li * sat;
        }

        // Define zest.
        var zest = 2 * li - val;

        // Implement projection (project onto green by default).
        var hzvToRGB = function (hue, zest, val) {
            if (hue < 0) {
                // Hue must wrap to allow projection onto red and blue.
                hue += 6;
            }
            else if (hue >= 6) {
                hue -= 6;
            }
            if (hue < 1) {
                // Red to yellow (increasing green).
                return zest + (val - zest) * hue;
            }
            else if (hue < 3) {
                // Yellow to cyan (greatest green).
                return val;
            }
            else if (hue < 4) {
                // Cyan to blue (decreasing green).
                return zest + (val - zest) * (4 - hue);
            }
            else {
                // Blue to red (least green).
                return zest;
            }
        };

        // Perform projections, offsetting hue as necessary.
        RGBA = [
            hzvToRGB(hue + 2, zest, val),
            hzvToRGB(hue, zest, val),
            hzvToRGB(hue - 2, zest, val),
            hsla[3]
        ];
    }

    return RGBA;
};


Color.rgbaToHSBA = function (rgba) {
    var red = rgba[0];
    var green = rgba[1];
    var blue = rgba[2];

    var val = Math.max(red, green, blue);
    var chroma = val - Math.min(red, green, blue);

    var hue, sat;
    if (chroma === 0) {
        // Return early if grayscale.
        hue = 0;
        sat = 0;
    }
    else {
        sat = chroma / val;
        if (red === val) {
            // Magenta to yellow.
            hue = (green - blue) / chroma;
        }
        else if (green === val) {
            // Yellow to cyan.
            hue = 2 + (blue - red) / chroma;
        }
        else if (blue === val) {
            // Cyan to magenta.
            hue = 4 + (red - green) / chroma;
        }
        if (hue < 0) {
            // Confine hue to the interval [0, 1).
            hue += 6;
        }
        else if (hue >= 6) {
            hue -= 6;
        }
    }

    return [hue / 6, sat, val, rgba[3]];
};

Color.rgbaToHSLA = function (rgba) {
    var red = rgba[0];
    var green = rgba[1];
    var blue = rgba[2];

    var val = Math.max(red, green, blue);
    var min = Math.min(red, green, blue);
    var li = val + min; // We will halve this later.
    var chroma = val - min;

    var hue, sat;
    if (chroma === 0) {
        // Return early if grayscale.
        hue = 0;
        sat = 0;
    }
    else {
        if (li < 1) {
            sat = chroma / li;
        }
        else {
            sat = chroma / (2 - li);
        }
        if (red === val) {
            // Magenta to yellow.
            hue = (green - blue) / chroma;
        }
        else if (green === val) {
            // Yellow to cyan.
            hue = 2 + (blue - red) / chroma;
        }
        else if (blue === val) {
            // Cyan to magenta.
            hue = 4 + (red - green) / chroma;
        }
        if (hue < 0) {
            // Confine hue to the interval [0, 1).
            hue += 6;
        }
        else if (hue >= 6) {
            hue -= 6;
        }
    }

    return [hue / 6, sat, li / 2, rgba[3]];
};


Color.hwbaToHSBA = function (hwba) {
    return [hwba[0], 1 - hwba[1] / (1 - hwba[2]), 1 - hwba[2], hwba[3]];
};

Color.hsbaToHWBA = function (hsla) {
    return [hsla[0], (1 - hsla[1]) * hsla[2], 1 - hsla[2], hsla[3]];
};

Color.rgbaToHWBA = function (rgba) {
    return this.hsbaToHWBA(this.rgbaToHSBA(rgba));
};

Color.hwbaToRGBA = function (hwba) {
    return this.hsbaToRGBA(this.hwbaToHSBA(hwba));
};

/* harmony default export */ var Color_Color = (Color);
// CONCATENATED MODULE: ./node_modules/absol-acomp/js/Toast.js










var Toast_$ = ACore["a" /* default */].$;
var Toast_ = ACore["a" /* default */]._;

var toastBg = {
    success: "#a4f3b6",
    info: "#67d5e7"
}

var toastTextColor = {
    success: '#454040',
    info: '#48433b'
}

buildCss(VariantColors.keys.reduce(function (ac, cr) {
    var color = Color_Color.parse(toastBg[cr] || VariantColors.base[cr]);
    var textColor = color.getContrastYIQ();
    var headerColor = toastTextColor[cr] || VariantColors.mediumContract[cr] || color.getHightContrastColor();
    ac['.as-toast.as-variant-' + cr + ' .as-toast-variant-color'] = {
        'background-color': color.toString('hex6')
    }
    ac['.as-toast.as-variant-background.as-variant-' + cr] = {
        'background-color': color.toString('hex6'),
        color: textColor.toString('hex6')
    }

    ac['.as-toast.as-variant-background.as-variant-' + cr + ' .as-toast-header'] = {
        color: headerColor.toString('hex6')
    }

    return ac;
}, {}));


/***
 * @extends {AElement}
 * @constructor
 */
function Toast() {
    this._state = 0;
    this.$closeBtn = Toast_$('.as-toast-close-btn', this)
        .on('click', this.disappear.bind(this));
    this.$title = Toast_$('.as-toast-title', this);
    this.$timeText = Toast_$('.as-toast-time-text', this);
    this.$body = Toast_$('.toast-body', this);
    this.$attachhook = Toast_$('attachhook', this)
        .on('attached', this.appear.bind(this));
    OOP["a" /* default */].drillProperty(this, this.$title.firstChild, 'htitle', 'data');
    this._message = null;
    this.$message = null;
    this.disappearTimeout = 0;
    this.htitle = 'Toast.htitle';
    this.timeText = new Date();
    this.message = null;
    this.variant = null;
}

Toast.tag = 'toast';

['addChild', 'removeChild', 'clearChild', 'addChildBefore', 'addChildAfter'].forEach(function (key) {
    Toast.prototype[key] = function () {
        this.$body[key].apply(this.$body, arguments);
    };
});

Toast.render = function () {
    return Toast_({
        extendEvent: ['appeared', 'disappeared'],
        class: ['as-toast', 'as-not-appeared'],
        child: [
            {
                class: 'as-toast-header',
                child: [
                    '.as-toast-variant-color',
                    {
                        tag: 'strong',
                        class: 'as-toast-title',
                        child: { text: "Absol Js" }
                    },
                    {
                        tag: 'smal',
                        class: 'as-toast-time-text',
                        child: { text: '20 mis ago' }
                    },
                    {
                        tag: 'button',
                        class: 'as-toast-close-btn',
                        child: { tag: 'span', child: { text: '×' } }
                    }
                ]
            },
            {
                class: 'toast-body'
            },
            'attachhook'
        ]
    });
};

Toast.prototype.disappear = function () {
    if (this._state !== 2) return;
    this._state = 3;
    this.addClass('as-disappearing');
    setTimeout(function () {
        this.removeClass('as-disappeared')
            .removeClass('as-disappearing')
            .addClass('as-not-appeared');
        this.remove();
        this.emit('disappeared', { target: this, type: 'disappeared' }, this);
    }.bind(this), 500);
};

Toast.prototype.appear = function () {
    if (this._state !== 0) return;
    this._state = 1;
    this.addClass('as-appearing');
    setTimeout(function () {
        this.removeClass('as-not-appeared')
            .addClass('as-appeared')
            .removeClass('as-appearing');
        this._state = 2;
        this.emit('appeared', { target: this, type: 'appeared' }, this);
        if (this.disappearTimeout > 0 && this.disappearTimeout < Infinity) {
            setTimeout(this.disappear.bind(this), this.disappearTimeout);
        }
    }.bind(this), 100);
};


Toast.property = {};

Toast.property.variant = {
    set: function (value) {
        if (this._variant && this._variant !== value) {
            this.removeClass('as-variant-' + this._variant);
        }
        if (VariantColors.has(value) || (['sticky-note'].indexOf(value) >= 0)) {
            this._variant = value;
            this.addClass('as-variant-' + this._variant);
        }
    },
    get: function () {
        return this._variant;
    }
};

Toast.property.message = {
    set: function (value) {
        if (typeof value !== "string" || value.length === 0) {
            value = null;
        }
        if (value) {
            if (!this.$message) {
                this.$message = Toast_({
                    class: 'as-toast-message',
                    child: { text: '' }
                });
            }
            if (!this.$message.parentElement)
                this.$body.addChild(this.$message);
            this.$message.firstChild.data = value;
        }
        else {
            if (this.$message && this.$message.parentElement) {
                this.$message.remove();
            }
        }
        this._message = value;
    },
    get: function () {
        return this._message;
    }
};


Toast.property.timeText = {
    set: function (value) {
        if (value instanceof Date) {
            value = value.toLocaleTimeString();

        }
        else {
            value = value + '';
        }
        this.$timeText.firstChild.data = value;

    },
    get: function () {
        return this.$timeText.firstChild.data;
    }
};

Toast.$toastList = Toast_('.as-toast-list.as-se.as-bscroller');
Toast.$toastList4Pos = {
    se: Toast.$toastList,
    sw: Toast_('.as-toast-list.as-sw.as-bscroller'),
    nw: Toast_('.as-toast-list.as-nw.as-bscroller'),
    ne: Toast_('.as-toast-list.as-ne.as-bscroller'),
};

Dom["b" /* default */].documentReady.then(function () {
    Toast.$toastList.addTo(document.body);
    Toast.$toastList4Pos.sw.addTo(document.body);
    Toast.$toastList4Pos.nw.addTo(document.body);
    Toast.$toastList4Pos.ne.addTo(document.body);
});

/***
 *
 * @param {AbsolConstructDescriptor|{}} aObject,
 * @param {"se"|"sw"|"ne"|"nw" } [pos="se"]
 * @return {AElementNS|AElement|Text}
 */
Toast.make = function (aObject, pos) {
    pos = pos || 'se';
    aObject = aObject || {};
    if (typeof aObject !== "object") throw  new Error("param must be AbsolConstructDescriptor object!");

    if (Object(Dom["e" /* isDomNode */])(aObject)) {

    }
    else {
        aObject.tag = aObject.tag || 'toast';

    }
    var toastElt = Toast_(aObject);
    var toastListElt = Toast.$toastList4Pos[pos] || Toast.$toastList4Pos;
    toastListElt.addChild(toastElt);
    return toastElt;
};


ACore["a" /* default */].install(Toast);

/* harmony default export */ var js_Toast = (Toast);


// CONCATENATED MODULE: ./node_modules/absol-acomp/assets/icon/spinner.tpl
/* harmony default export */ var spinner = ("<svg class=\"as-spinner-ico\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" style=\"margin:auto;background:#fff;display:block;\" width=\"200px\" height=\"200px\" viewBox=\"0 0 100 100\" preserveAspectRatio=\"xMidYMid\">\r\n    <g><circle cx=\"73.801\" cy=\"68.263\" fill=\"#e15b64\" r=\"4\">\r\n        <animateTransform attributeName=\"transform\" type=\"rotate\" calcMode=\"spline\" values=\"0 50 50;360 50 50\" times=\"0;1\" keySplines=\"0.5 0 0.5 1\" repeatCount=\"indefinite\" dur=\"1.4925373134328357s\" begin=\"0s\"></animateTransform>\r\n    </circle><circle cx=\"68.263\" cy=\"73.801\" fill=\"#f47e60\" r=\"4\">\r\n        <animateTransform attributeName=\"transform\" type=\"rotate\" calcMode=\"spline\" values=\"0 50 50;360 50 50\" times=\"0;1\" keySplines=\"0.5 0 0.5 1\" repeatCount=\"indefinite\" dur=\"1.4925373134328357s\" begin=\"-0.062s\"></animateTransform>\r\n    </circle><circle cx=\"61.481\" cy=\"77.716\" fill=\"#f8b26a\" r=\"4\">\r\n        <animateTransform attributeName=\"transform\" type=\"rotate\" calcMode=\"spline\" values=\"0 50 50;360 50 50\" times=\"0;1\" keySplines=\"0.5 0 0.5 1\" repeatCount=\"indefinite\" dur=\"1.4925373134328357s\" begin=\"-0.125s\"></animateTransform>\r\n    </circle><circle cx=\"53.916\" cy=\"79.743\" fill=\"#abbd81\" r=\"4\">\r\n        <animateTransform attributeName=\"transform\" type=\"rotate\" calcMode=\"spline\" values=\"0 50 50;360 50 50\" times=\"0;1\" keySplines=\"0.5 0 0.5 1\" repeatCount=\"indefinite\" dur=\"1.4925373134328357s\" begin=\"-0.187s\"></animateTransform>\r\n    </circle><circle cx=\"46.084\" cy=\"79.743\" fill=\"#849b87\" r=\"4\">\r\n        <animateTransform attributeName=\"transform\" type=\"rotate\" calcMode=\"spline\" values=\"0 50 50;360 50 50\" times=\"0;1\" keySplines=\"0.5 0 0.5 1\" repeatCount=\"indefinite\" dur=\"1.4925373134328357s\" begin=\"-0.25s\"></animateTransform>\r\n    </circle><circle cx=\"38.519\" cy=\"77.716\" fill=\"#6492ac\" r=\"4\">\r\n        <animateTransform attributeName=\"transform\" type=\"rotate\" calcMode=\"spline\" values=\"0 50 50;360 50 50\" times=\"0;1\" keySplines=\"0.5 0 0.5 1\" repeatCount=\"indefinite\" dur=\"1.4925373134328357s\" begin=\"-0.312s\"></animateTransform>\r\n    </circle><circle cx=\"31.737\" cy=\"73.801\" fill=\"#637cb5\" r=\"4\">\r\n        <animateTransform attributeName=\"transform\" type=\"rotate\" calcMode=\"spline\" values=\"0 50 50;360 50 50\" times=\"0;1\" keySplines=\"0.5 0 0.5 1\" repeatCount=\"indefinite\" dur=\"1.4925373134328357s\" begin=\"-0.375s\"></animateTransform>\r\n    </circle><circle cx=\"26.199\" cy=\"68.263\" fill=\"#6a63b6\" r=\"4\">\r\n        <animateTransform attributeName=\"transform\" type=\"rotate\" calcMode=\"spline\" values=\"0 50 50;360 50 50\" times=\"0;1\" keySplines=\"0.5 0 0.5 1\" repeatCount=\"indefinite\" dur=\"1.4925373134328357s\" begin=\"-0.437s\"></animateTransform>\r\n    </circle><animateTransform attributeName=\"transform\" type=\"rotate\" calcMode=\"spline\" values=\"0 50 50;0 50 50\" times=\"0;1\" keySplines=\"0.5 0 0.5 1\" repeatCount=\"indefinite\" dur=\"1.4925373134328357s\"></animateTransform></g>\r\n</svg>");
// CONCATENATED MODULE: ./node_modules/absol-acomp/js/Icons.js


function SpinnerIco(){
    return ACore["a" /* default */]._(spinner);
}

SpinnerIco.tag = 'SpinnerIco'.toLowerCase();

ACore["a" /* default */].install(SpinnerIco);
// EXTERNAL MODULE: ./node_modules/absol-acomp/css/emojipickertooltip.css
var emojipickertooltip = __webpack_require__(241);

// EXTERNAL MODULE: ./node_modules/absol-acomp/css/pageindicator.css
var pageindicator = __webpack_require__(243);

// CONCATENATED MODULE: ./node_modules/absol-acomp/js/PageIndicator.js



var PageIndicator_ = ACore["a" /* default */]._;
var PageIndicator_$ = ACore["a" /* default */].$;

/***
 * @extends AElement
 * @constructor
 */
function PageIndicator() {
    this._idx = -1;
    this.length = 0;
    this.idx = -1;

}


PageIndicator.tag = 'PageIndicator'.toLowerCase();

PageIndicator.render = function () {
    return PageIndicator_({
        class: 'as-page-indicator',
        child: []
    });
};

PageIndicator.property = {};

PageIndicator.property.length = {
    set: function (value) {
        value = value || 0;
        value = Math.max(0, value);
        while (this.childNodes.length < value) {
            this.addChild(PageIndicator_('button.as-page-indicator-item'));
        }
        while (this.childNodes.length > value) {
            this.removeChild(this.childNodes[this.childNodes.length - 1]);
        }
        this.idx = this._idx;//update
    },
    get: function () {
        return this.childNodes.length;
    }
};

PageIndicator.property.idx = {
    set: function (value) {
        var activeElt = this.childNodes[this._idx];
        if (activeElt) activeElt.removeClass('as-active');
        this._idx = value;
        activeElt = this.childNodes[this._idx];
        if (activeElt) activeElt.addClass('as-active');
    },
    get: function () {
        return this._idx;
    }
};


ACore["a" /* default */].install(PageIndicator);

/* harmony default export */ var js_PageIndicator = (PageIndicator);
// CONCATENATED MODULE: ./node_modules/absol-acomp/js/EmojiPickerTooltip.js














var EmojiPickerTooltip_ = ACore["a" /* default */]._;
var EmojiPickerTooltip_$ = ACore["a" /* default */].$;
var EmojiPickerTooltip_isMobile = BrowserDetector["a" /* default */].isMobile;

/***
 * @augments Tooltip
 * @augments AElement
 * @augments Hanger
 * @constructor
 */
function EmojiPickerTooltip() {
    if (EmojiPickerTooltip_isMobile) {
        EmojiPickerTooltip_({
            tag: js_Hanger.tag,
            elt: this,
            on: {
                predrag: this.eventHandler.preDragTT,
                dragstart: this.eventHandler.dragStartTT,
                drag: this.eventHandler.dragTT,
                dragend: this.eventHandler.dragEndTT
            }
        })
    }
    this.$iconList = EmojiPickerTooltip_$('.as-emoji-picker-tooltip-icon-list', this);
    this.$leftBtn = EmojiPickerTooltip_$('.as-emoji-picker-tooltip-left-btn', this)
        .on('click', this.eventHandler.clickLeft);
    this.$scroller = EmojiPickerTooltip_$('.as-emoji-picker-tooltip-scroller', this);

    this.$rightBtn = EmojiPickerTooltip_$('.as-emoji-picker-tooltip-right-btn', this)
        .on('click', this.eventHandler.clickRight);
    this.$removeBtn = EmojiPickerTooltip_$('.as-emoji-picker-tooltip-remove-btn', this)
        .on('click', this.eventHandler.clickRemove);
    this.$pageIndicatior = EmojiPickerTooltip_$('pageindicator', this);
    this._iconButtonCache = {};
    this._icons = [];
    this.icons = EmojiPickerTooltip.defaultIcons;
}

EmojiPickerTooltip.tag = 'EmojiPickerTooltip'.toLowerCase();


EmojiPickerTooltip.defaultIcons = [';(', '(sarcastic)', ':O', '(cwl)', '(heart)', '(y)', '(n)', '(rock)', '(facepalm)', '(xd)', ':$', '(waiting)', '(headbang)', '(ghost)', '(clap)', '(punch)', '(ok)', '(angry)'];
EmojiPickerTooltip.emojiDict = js_EmojiAnims.reduce(function (ac, cr) {
    ac[cr[0]] = {
        imageFileName: cr[1],
        text: cr[0],
        desc: cr[2]
    };
    return ac;
}, {});

EmojiPickerTooltip.render = function () {
    return EmojiPickerTooltip_({
        tag: 'tooltip',
        extendEvent: ['pick'],
        class: ['as-emoji-picker-tooltip'].concat(EmojiPickerTooltip_isMobile ? ['as-mobile'] : []),
        child: [
            {
                tag: 'button',
                class: 'as-emoji-picker-tooltip-left-btn',
                child: 'span.mdi.mdi-chevron-left'
            },
            {
                class: 'as-emoji-picker-tooltip-scroller',
                child: {
                    class: 'as-emoji-picker-tooltip-icon-list',
                }
            },
            {
                tag: 'button',
                class: 'as-emoji-picker-tooltip-right-btn',
                child: 'span.mdi.mdi-chevron-right'
            },
            {
                tag: 'button',
                attr: {
                    title: 'Remove Emoji'
                },
                class: 'as-emoji-picker-tooltip-remove-btn',
                child: 'span.mdi.mdi-close'
            },
            {
                tag: 'pageindicator',
                class: 'as-emoji-picker-tooltip-page-indicator',
                props: {
                    length: 3,
                    idx: 0
                }
            }
        ]


    }, true);
};

/*var */


EmojiPickerTooltip.prototype._makeIconBtn = function (iconText) {

    var icon = EmojiPickerTooltip.emojiDict[iconText];
    var url = js_EmojiPicker.assetRoot + '/anim/x40/' + icon.imageFileName;
    var spriteElt = EmojiPickerTooltip_({
        tag: 'sprite',
        class: 'as-emoji-picker-tooltip-icon',
        attr: {
            title: icon.desc
        },
        props: {
            src: url,
            loop: true,
            fps: 30,
            debug: true
        },
        on: {
            ready: function () {
                this.frames = {
                    type: 'grid',
                    col: 1,
                    row: this.texture.naturalHeight / this.texture.naturalWidth
                };
                this.frameIndex = 0;
            }
        }
    });
    var buttonElt = EmojiPickerTooltip_({
        tag: 'button',
        class: 'as-emoji-picker-tooltip-icon-btn',
        child: spriteElt,
        on: {
            click: this.eventHandler.clickIconBtn.bind(null, icon)
        }
    });

    buttonElt.on('mouseenter', function () {
        spriteElt.play();
    }).on('mouseleave', function () {
        spriteElt.stop();
        spriteElt.frameIndex = 0;
    });

    return buttonElt;

};

EmojiPickerTooltip.prototype._updateIconList = function () {
    this.$iconList.clearChild();
    var iconText;
    for (var i = 0; i < this._icons.length; ++i) {
        iconText = this._icons[i];
        this._iconButtonCache[iconText] = this._iconButtonCache[iconText] || this._makeIconBtn(iconText);
        this.$iconList.addChild(this._iconButtonCache[iconText])
    }
};

EmojiPickerTooltip.property = {};

EmojiPickerTooltip.property.icons = {
    set: function (icons) {
        this._icons = icons || [];
        this._updateIconList();
        this.viewOffset = 0;
        this.$pageIndicatior.length = Math.ceil(this._icons.length / 6);
    },
    get: function () {
        return this._icons;
    }
};

EmojiPickerTooltip.property.viewOffset = {
    set: function (value) {
        this._viewOffset = Math.max(0, Math.min(value, this._icons.length - 6));
        this.$iconList.addStyle('left', -(100 * this._viewOffset/6) + '%');
        this.$leftBtn.disabled = this._viewOffset === 0;
        this.$rightBtn.disabled = this._viewOffset === this._icons.length - 6;
        this.$pageIndicatior.idx = Math.floor(this._viewOffset / 6);
    },
    get: function () {
        return this._viewOffset;
    }
};

EmojiPickerTooltip.eventHandler = {};

EmojiPickerTooltip.eventHandler.clickLeft = function () {
    this.viewOffset -= 6;
};


EmojiPickerTooltip.eventHandler.clickRight = function () {
    this.viewOffset += 6;
};

EmojiPickerTooltip.eventHandler.clickIconBtn = function (icon) {
    if (this._preventClick) return;
    this.emit('pick', Object.assign({ type: 'pick', icon: icon, target: this }, icon), this);
};

EmojiPickerTooltip.eventHandler.clickRemove = function () {
    this.emit('pick', Object.assign({ type: 'pressremove', icon: "REMOVE", target: this }), this);
};

EmojiPickerTooltip.eventHandler.preDragTT = function (event) {
    var scrollerBound = this.$scroller.getBoundingClientRect();
    var listBound = this.$iconList.getBoundingClientRect();
    this._scrollData = {
        left: listBound.left - scrollerBound.left,
        scrollerWidth: scrollerBound.width,
        newLeft: listBound.left - scrollerBound.left
    };
};

EmojiPickerTooltip.eventHandler.dragStartTT = function () {
    this.addClass('as-scrolling');
    this._preventClick = true;

};

EmojiPickerTooltip.eventHandler.dragTT = function (event) {
    event.preventDefault();
    var dx = event.currentPoint.sub(event.startingPoint).x;
    var newLeft = Math.min(0, Math.max(-this._scrollData.scrollerWidth * 2, this._scrollData.left + dx));
    this._scrollData.newLeft = newLeft;
    this.$iconList.addStyle('left', newLeft + 'px');
};

EmojiPickerTooltip.eventHandler.dragEndTT = function (event) {
    event.preventDefault();
    this.removeClass('as-scrolling');
    var dOffset = (this._scrollData.left - this._scrollData.newLeft) / this._scrollData.scrollerWidth;
    if (dOffset > 0.25) {
        dOffset = 1;
    }
    else if (dOffset < -0.25) {
        dOffset = -1;
    }
    else {
        dOffset = 0;
    }
    this.viewOffset += dOffset * 6;
    setTimeout(function () {
        this._preventClick = false;
    }.bind(this), 5)
};

ACore["a" /* default */].install(EmojiPickerTooltip);


EmojiPickerTooltip.$holder = EmojiPickerTooltip_('.absol-tooltip-root-holder')
EmojiPickerTooltip.$tooltip = EmojiPickerTooltip_('emojipickertooltip.top').addTo(EmojiPickerTooltip.$holder)
    .on('pick', function (event) {
        EmojiPickerTooltip._listener && EmojiPickerTooltip._listener(event.icon);
    });
/***
 *
 * @type {PositionTracker|undefined}
 */
EmojiPickerTooltip.$element = undefined;
EmojiPickerTooltip.$content = undefined;
EmojiPickerTooltip._orientation = 'auto';
EmojiPickerTooltip._session = Math.random() * 10000000000 >> 0;
EmojiPickerTooltip._listener = undefined;
EmojiPickerTooltip._scrollOutListener = undefined;


EmojiPickerTooltip.updatePosition = function () {
    if (!EmojiPickerTooltip.$element) return;
    var outBound = Math_Rectangle.fromClientRect(Object(Dom["f" /* traceOutBoundingClientRect */])(EmojiPickerTooltip.$element));
    var eBound = Math_Rectangle.fromClientRect(EmojiPickerTooltip.$element.getBoundingClientRect());
    if (!outBound.isCollapse(eBound, 0)) {
        EmojiPickerTooltip._scrollOutListener && EmojiPickerTooltip._scrollOutListener();
    }
    updateTooltipPosition(EmojiPickerTooltip);
};

EmojiPickerTooltip.updatePosition = EmojiPickerTooltip.updatePosition.bind(EmojiPickerTooltip);
EmojiPickerTooltip.$tooltip.$arrow.updateSize = EmojiPickerTooltip.updatePosition;

EmojiPickerTooltip.show = function (element, menuListener, orientation) {
    if (EmojiPickerTooltip.$element) {
        EmojiPickerTooltip.$element.stopTrackPosition();
        EmojiPickerTooltip.$element.off('positionchange', EmojiPickerTooltip.updatePosition);
    }
    if (!element.startTrackPosition) {
        EmojiPickerTooltip_({
            tag: js_PositionTracker.tag,
            elt: element
        })
    }
    element.startTrackPosition();
    EmojiPickerTooltip.$element = element;
    EmojiPickerTooltip.$element.on('positionchange', EmojiPickerTooltip.updatePosition);
    EmojiPickerTooltip._listener = menuListener;
    EmojiPickerTooltip._session = Math.random() * 10000000000 >> 0;
    EmojiPickerTooltip._orientation = orientation || 'auto';
    EmojiPickerTooltip.$holder.addTo(document.body);
    ResizeSystem["a" /* default */].add(EmojiPickerTooltip.$tooltip.$arrow);
    EmojiPickerTooltip.$tooltip.viewOffset = 0;
    EmojiPickerTooltip.$tooltip.addClass('top')
        .removeClass('left')
        .removeClass('right')
        .removeClass('bottom')
        .removeClass('ne')
        .removeClass('nw')
        .removeClass('auto');
    EmojiPickerTooltip.updatePosition();

    return EmojiPickerTooltip._session;
};


EmojiPickerTooltip.close = function (token) {
    if (EmojiPickerTooltip._session !== token) return;
    if (EmojiPickerTooltip.$element) {
        EmojiPickerTooltip.$element.stopTrackPosition();
        EmojiPickerTooltip.$element.off('positionchange', EmojiPickerTooltip.updatePosition);
    }
    EmojiPickerTooltip.$element = undefined;
    EmojiPickerTooltip._listener = undefined;
    EmojiPickerTooltip._session = Math.random() * 10000000000 >> 0;
    EmojiPickerTooltip.$holder.remove();
};


EmojiPickerTooltip.toggleWhenClick = function (trigger, adaptor) {
    var res = {
        trigger: trigger,
        adaptor: adaptor,
        currentSession: undefined,
    };

    function clickHandler(event) {
        if (res.currentSession === EmojiPickerTooltip._session) return;

        res.currentSession = EmojiPickerTooltip.show(res.adaptor.getFlowedElement ? res.adaptor.getFlowedElement() : trigger,
            res.adaptor.onSelect,
            res.adaptor.orientation || 'auto'
        );
        if (res.adaptor.onOpen) res.adaptor.onOpen();

        var finish = function (event) {
            if (event && (Object(EventEmitter["d" /* hitElement */])(EmojiPickerTooltip.$tooltip.$leftBtn, event) || Object(EventEmitter["d" /* hitElement */])(EmojiPickerTooltip.$tooltip.$rightBtn, event))
                || (event && event.target && event.target.classList.contains('absol-tooltip-content'))) return;
            document.body.removeEventListener('click', finish, false);
            EmojiPickerTooltip.close(res.currentSession);
            if (adaptor.onClose) adaptor.onClose();
            res.currentSession = undefined;
            if (EmojiPickerTooltip._scrollOutListener === EmojiPickerTooltip) EmojiPickerTooltip._scrollOutListener = undefined;
        };
        EmojiPickerTooltip._scrollOutListener = finish;

        setTimeout(function () {
            document.body.addEventListener('click', finish, false);
        }, 10);
    }

    res.remove = function () {
        trigger.removeEventListener('click', clickHandler, false);
        trigger.classList.remove('as-emoji-picker-tooltip-trigger');
    };

    trigger.addEventListener('click', clickHandler, false);
    trigger.classList.add('as-emoji-picker-tooltip-trigger');
    return res;
};

/* harmony default export */ var js_EmojiPickerTooltip = (EmojiPickerTooltip);


// EXTERNAL MODULE: ./node_modules/absol-acomp/css/emojicounter.css
var emojicounter = __webpack_require__(245);

// EXTERNAL MODULE: ./node_modules/absol-acomp/css/emojiuserlisttooltip.css
var emojiuserlisttooltip = __webpack_require__(247);

// CONCATENATED MODULE: ./node_modules/absol-acomp/js/EmojiUserListTooltip.js






var EmojiUserListTooltip_ = ACore["a" /* default */]._;
var EmojiUserListTooltip_$ = ACore["a" /* default */].$;

/***
 * @augments ToolTip
 * @augments AElement
 * @constructor
 */
function EmojiUserListTooltip() {
    this._text = null;
    this._users = [];
    this.$sprite = EmojiUserListTooltip_({
        tag: 'sprite',
        class: 'as-emoji-user-list-tooltip-emoji',
        props: {
            fps: 30,
            loop: true
        },
        on: {
            ready: function () {
                this.frames = {
                    type: 'grid',
                    col: 1,
                    row: this.texture.naturalHeight / this.texture.naturalWidth
                };
            }
        }
    });
    this.appendChild(this.$sprite);

    this.text = '(heart)'
    this.user = [];
}

EmojiUserListTooltip.tag = 'EmojiUserListTooltip'.toLowerCase();

EmojiUserListTooltip.render = function () {
    return EmojiUserListTooltip_({
        tag: 'tooltip',
        class: 'as-emoji-user-list-tooltip'
    }, true);
};


EmojiUserListTooltip.prototype._updateUsers = function () {
    var thisT = this;
    this.$content.clearChild();
    this._users.forEach(function (user) {
        var elt = EmojiUserListTooltip_({
            class: 'as-emoji-user-list-tooltip-user',
            child: [
                {
                    class: 'as-emoji-user-list-tooltip-avatar',
                    style: {
                        backgroundImage: 'url(' + user.avatar + ')'
                    }
                },
                {
                    class: 'as-emoji-user-list-tooltip-name',
                    child: { text: user.name }
                }
            ]
        });
        if (user.onclick) {
            elt.addClass('as-clickable');
            elt.on('click', user.onclick.bind(user));
        }
        thisT.$content.addChild(elt);
    })
};

EmojiUserListTooltip.prototype.playEmoji = function () {
    this.$sprite.afterReady().then(this.$sprite.play.bind(this.$sprite));
};

EmojiUserListTooltip.prototype.stopEmoji = function () {
    this.$sprite.stop();
};

EmojiUserListTooltip.property = {};

EmojiUserListTooltip.property.users = {
    set: function (users) {
        this._users = users || [];
        this._updateUsers();
    },
    get: function () {
        return this._users;
    }
};

EmojiUserListTooltip.property.text = {
    set: function (value) {
        if (value === this._text) return;
        var icon = js_EmojiPickerTooltip.emojiDict[value];
        if (!value) return;
        var url = js_EmojiPicker.assetRoot + '/anim/x60/' + icon.imageFileName;
        this._text = value;
        this.$sprite.src = url;
    },
    get: function () {
        return this._text;
    }
};

ACore["a" /* default */].install(EmojiUserListTooltip);


/* harmony default export */ var js_EmojiUserListTooltip = (EmojiUserListTooltip);
// CONCATENATED MODULE: ./node_modules/absol-acomp/js/EmojiCounter.js










var EmojiCounter_$ = ACore["a" /* default */].$;
var EmojiCounter_ = ACore["a" /* default */]._;

var EmojiCounter_isMobile = BrowserDetector["a" /* default */].isMobile;

/***
 * @extends AElement
 * @constructor
 */
function EmojiCounter() {
    /***
     *
     * @type {Sprite}
     */
    this.$sprite = EmojiCounter_$('sprite', this);
    this.$num = EmojiCounter_$('.as-emoji-counter-num', this);
    this.$numText = this.$num.firstChild;
    this._text = '(heart)';
    this.text = this._text;
    this._count = 0;
    this.count = 0;
    this._checkInterval = -1;
    if (EmojiCounter_isMobile) {
        this.attr('tabindex', '1');
        this.on('focus', this.eventHandler.mouseEnter);
    }
    else {
        this.on('mouseenter', this.eventHandler.mouseEnter);
    }
    this._tooltipSession = null;
    this._tooltipFinishTimeout = -1;
}

EmojiCounter.tag = 'EmojiCounter'.toLowerCase();

EmojiCounter.render = function () {
    var icon = js_EmojiPickerTooltip.emojiDict['(heart)'];
    var url = js_EmojiPicker.assetRoot + '/anim/x40/' + icon.imageFileName;
    return EmojiCounter_({
            class: 'as-emoji-counter',
            child: [
                {
                    tag: 'sprite',
                    class: 'as-emoji-counter-sprite',
                    props: {
                        src: url,
                        loop: true,
                        fps: 30,
                        debug: true
                    },
                    on: {
                        ready: function () {
                            this.frames = {
                                type: 'grid',
                                col: 1,
                                row: this.texture.naturalHeight / this.texture.naturalWidth
                            };
                            this.frameIndex = 0;
                        }
                    }
                },
                {
                    tag: 'span',
                    class: 'as-emoji-counter-num',
                    child: { text: '0' }
                }
            ]
        }
    );
};


EmojiCounter.property = {};

EmojiCounter.property.text = {
    set: function (value) {
        var icon = js_EmojiPickerTooltip.emojiDict[value];
        if (!icon) return;
        if (this._text === value) return;
        this.$sprite.src = js_EmojiPicker.assetRoot + '/anim/x40/' + icon.imageFileName;
        this._text = value;
    },
    get: function () {
        return this._text;
    }
};

EmojiCounter.property.count = {
    set: function (value) {
        this.$numText.data = value + '';
        if (value === 1 && this._count != 1) {
            this.$numText.remove();
        }
        else if (value != 1 && this._count == 1) {
            this.$num.addChild(this.$numText);
        }
        if (value == 0) this.addClass('as-zero');
        else this.removeClass('as-zero');
        this._count = value;
    },
    get: function () {
        return this._count;
    }
}

ACore["a" /* default */].install(EmojiCounter);

EmojiCounter.eventHandler = {};

EmojiCounter.eventHandler.loop = function () {
    if (!this.isDescendantOf(document.body))
        this.eventHandler.finishHover();
    if (this.getBoundingClientRect().width === 0)
        this.eventHandler.finishHover();
};

EmojiCounter.eventHandler.mouseEnter = function () {
    if (this._tooltipFinishTimeout > 0) {
        clearTimeout(this._tooltipFinishTimeout);
    }
    if (this._checkInterval > 0) return;
    this.$sprite.play();
    this._checkInterval = setInterval(this.eventHandler.loop, 1000);
    this.on('mouseleave', this.eventHandler.finishHover);

    if (this.users && this.users.length > 0) {
        EmojiCounter._session = Math.random() * 10000000000 >> 0;
        this._tooltipSession = EmojiCounter._session;
        EmojiCounter.$element = this;
        EmojiCounter.$holder.addTo(this);
        EmojiCounter.$tooltip.text = this.text;
        EmojiCounter.$tooltip.users = this.users;
        EmojiCounter.$tooltip.playEmoji();
        updateTooltipPosition(EmojiCounter);
    }
};

EmojiCounter.eventHandler.finishHover = function () {
    if (this._tooltipFinishTimeout > 0) {
        clearTimeout(this._tooltipFinishTimeout);
    }

    this._tooltipFinishTimeout = setTimeout(function () {
        this._tooltipFinishTimeout = -1;
        this.$sprite.stop();
        this.off('mouseleave', this.eventHandler.finishHover);
        if (this._checkInterval > 0) {
            clearInterval(this._checkInterval);
            this._checkInterval = -1;
        }
        if (this._tooltipSession === EmojiCounter._session) {
            EmojiCounter._session = Math.random() * 10000000000 >> 0;
            EmojiCounter.$holder.remove();
            EmojiCounter.$tooltip.stopEmoji();
        }
    }.bind(this), 500);
};


EmojiCounter.$holder = EmojiCounter_('.absol-tooltip-root-holder');
EmojiCounter.$tooltip = EmojiCounter_('EmojiUserListTooltip.top'.toLowerCase()).addTo(EmojiCounter.$holder);
EmojiCounter._scrollOutListener = undefined;
EmojiCounter._orientation = 'top';
EmojiCounter._session = Math.random() * 10000000000 >> 0;
js_EmojiPickerTooltip._listener = undefined;
EmojiCounter.$element = null;

EmojiCounter.updatePosition = function () {
    if (!EmojiCounter.$element) return;
    var outBound = Math_Rectangle.fromClientRect(Object(Dom["f" /* traceOutBoundingClientRect */])(EmojiCounter.$element));
    var eBound = Math_Rectangle.fromClientRect(EmojiCounter.$element.getBoundingClientRect());
    if (!outBound.isCollapse(eBound, 0)) {
        js_EmojiPickerTooltip._scrollOutListener && EmojiCounter._scrollOutListener();
    }
    updateTooltipPosition(EmojiCounter);
};


EmojiCounter.updatePosition = EmojiCounter.updatePosition.bind(EmojiCounter);
EmojiCounter.$tooltip.$arrow.updateSize = EmojiCounter.updatePosition;


/* harmony default export */ var js_EmojiCounter = (EmojiCounter);
// CONCATENATED MODULE: ./node_modules/absol-acomp/js/EmojiCounterList.js



var EmojiCounterList_ = ACore["a" /* default */]._;
var EmojiCounterList_$ = ACore["a" /* default */].$;

/***
 * @extends AElement
 * @constructor
 */
function EmojiCounterList() {
    this._counters = [];
    this.counters = [];
}

EmojiCounterList.tag = 'EmojiCounterList'.toLowerCase();

EmojiCounterList.render = function () {
    return EmojiCounterList_({
        class: 'as-emoji-counter-list'
    });
};

EmojiCounterList.iconOrdering = js_EmojiPickerTooltip.defaultIcons.reduce(function (ac, cr, idx) {
    ac[cr] = idx + 1;
    return ac;
}, {});

EmojiCounterList.prototype._updateCounters = function () {
    var newCounters = this._counters;
    var newCounterNameArr = Object.keys(newCounters);
    newCounterNameArr.sort(function (a, b) {
        return (EmojiCounterList.iconOrdering[a] || 1000) - (EmojiCounterList.iconOrdering[b] || 1000);
    })

    var counterElements = Array.prototype.filter.call(this.childNodes, function (e) {
        return e.containsClass && e.containsClass('as-emoji-counter');
    });

    var newCounterElements = [];
    var elt, name;
    var oe, on;
    while (counterElements.length > 0 || newCounterNameArr.length > 0) {
        elt = counterElements[0];
        name = newCounterNameArr[0];

        if (elt && name) {
            if (elt.text === name) {
                newCounterElements.push(elt);
                counterElements.shift();
                newCounterNameArr.shift();
            }
            else {
                oe = EmojiCounterList.iconOrdering[elt.text];
                on = EmojiCounterList.iconOrdering[name];
                if (oe < on) {
                    newCounterElements.push(elt);
                    counterElements.shift();
                }
                else {
                    newCounterElements.push(name);
                    newCounterNameArr.shift();
                }
            }
        }
        else if (elt) {
            newCounterElements.push(elt);
            counterElements.shift();
        }
        else {
            newCounterElements.push(name);
            newCounterNameArr.shift();
        }
    }

    var cElt, prevElt;
    while (newCounterElements.length > 0) {
        cElt = newCounterElements.pop();
        if (typeof cElt === "string") {
            cElt = EmojiCounterList_({
                tag: 'emojicounter',
                props: {
                    text: cElt,
                    users: newCounters[cElt].users || [],
                    count: newCounters[cElt].count
                }
            });
            if (!prevElt) {
                this.addChild(cElt);
            }
            else {
                this.addChildBefore(cElt, prevElt);
            }
            prevElt = cElt;
        }
        else {
            if (newCounters[cElt.text]) {
                cElt.count = newCounters[cElt.text].count;
                cElt.users = newCounters[cElt.text].users || [];
                prevElt = cElt;
            }
            else {
                cElt.remove();
            }
        }

    }

};

EmojiCounterList.property = {};

EmojiCounterList.property.counters = {
    set: function (counters) {
        this._counters = Object.keys(counters || {}).reduce(function (ac, key) {
            var counter = counters[key];
            if (typeof counter === "object") {
                if (counter.count > 0 && js_EmojiPickerTooltip.emojiDict[key]) {
                    ac[key] = counter;
                }
            }
            return ac;
        }, {})
        this._updateCounters();
    },
    get: function () {
        return this._counters;
    }
}

ACore["a" /* default */].install(EmojiCounterList);

/* harmony default export */ var js_EmojiCounterList = (EmojiCounterList);
// CONCATENATED MODULE: ./node_modules/absol-acomp/js/dom/install.js

































































































var publicCreators = [
    js_AutoCompleteInput,
    js_BoardTable,
    js_Board,
    js_BScroller,
    js_ButtonArray,
    js_ButtonRange,
    js_CalendarInput,
    OldCalendarInput,
    CheckBoxInput,
    js_CheckBox,
    CheckboxButton,
    js_ChromeCalendar,
    js_CircleSectionLabel,
    js_CountdownClock,
    js_DropZone,
    js_EmojiPickerTooltip,
    Scrollbar,
    VScrollbar,
    HScrollbar,
    VScroller,
    HScroller,
    ContextMenu,
    HMenu,
    VMenuItem,
    VMenu,
    Dropright,
    VMenuLine,
    Dropdown,
    HMenuItem,
    VMenu,
    VRootMenu,
    MenuButton,
    js_DateInput2,
    js_Hanger,
    js_DraggableHStack,
    js_DraggableVStack,
    js_DropPanel,
    js_DropPanelStack,
    js_EditableText,
    js_EmojiPicker,
    js_EmojiCounter,
    js_EmojiCounterList,
    js_Sprite,
    ExpNode,
    js_ExpTree,
    ExpGroup,
    js_FlexiconButton,
    js_FlexiconInput,
    js_Follower,
    js_FollowerToggler,
    js_Frame,
    js_FrameView,
    js_TabFrame,
    js_TabView,
    js_SinglePage,
    js_HexaSectionLabel,
    js_VRuler,
    js_HRuler,
    js_IconSprite,
    js_LinearColorBar,
    js_MediaInput,
    js_MessageInput,
    MessageQuote,
    js_Modal,
    js_NumberInput,
    js_NumberSpanInput,
    OnsScreenWindow,
    js_OnScreenWidget,
    js_PageIndicator,
    js_PageSelector,
    js_PreInput,
    js_ProgressBar,
    js_QuickListButton,
    js_QuickMenu,
    js_QuickPath,
    js_Radio,
    js_RadioButton,
    js_RadioInput,
    js_RibbonSplitButton,
    js_RibbonButton,
    js_SelectList,
    js_RemoteSvg,
    js_ResizeBox,
    Searcher,
    js_SelectListBox,
    js_SelectTreeBox,
    SelectMenu2,
    js_SelectBox,
    js_MultiSelectMenu,
    js_SelectBoxItem,
    js_SelectTable,
    js_SelectTable2,
    js_SelectTreeMenu,
    js_SpanInput,
    Snackbar,
    js_StaticTabbar,
    js_Switch,
    js_TableScroller,
    js_TableVScroller,
    js_TextArea2,
    js_TextClipboard,
    js_TimeInput,
    js_TimeSelectInput,
    js_TimePicker,
    Tooltip,
    js_Toast,
    js_TreeList,
    js_TreeListItem,
    WidthHeightSizer,
    js_TrackBar,
    js_TrackBarInput,
    SpinnerIco
];

/***
 *
 * @param {Dom} core
 */
function install(core) {
    core.install(publicCreators);
    core.install('checkboxbutton', CheckBoxInput);
    core.install('selectbox', js_MultiSelectMenu);
}

/* harmony default export */ var dom_install = (install);
// EXTERNAL MODULE: ./node_modules/absol-mobile/css/mleftnavigator.css
var mleftnavigator = __webpack_require__(249);

// EXTERNAL MODULE: ./node_modules/absol-acomp/js/DebugTask.js
var DebugTask = __webpack_require__(33);

// EXTERNAL MODULE: ./node_modules/absol-acomp/css/debugtask.css
var debugtask = __webpack_require__(251);

// CONCATENATED MODULE: ./node_modules/absol-acomp/js/EmojiChars.js
var EmojiChars = [["Smileys & Emotion", [["face-smiling", [[["U+1F600"], "😀", "grinning face"], [["U+1F603"], "😃", "grinning face with big eyes"], [["U+1F604"], "😄", "grinning face with smiling eyes"], [["U+1F601"], "😁", "beaming face with smiling eyes"], [["U+1F606"], "😆", "grinning squinting face"], [["U+1F605"], "😅", "grinning face with sweat"], [["U+1F923"], "🤣", "rolling on the floor laughing"], [["U+1F602"], "😂", "face with tears of joy"], [["U+1F642"], "🙂", "slightly smiling face"], [["U+1F643"], "🙃", "upside-down face"], [["U+1F609"], "😉", "winking face"], [["U+1F60A"], "😊", "smiling face with smiling eyes"], [["U+1F607"], "😇", "smiling face with halo"]]], ["face-affection", [[["U+1F970"], "🥰", "smiling face with hearts"], [["U+1F60D"], "😍", "smiling face with heart-eyes"], [["U+1F929"], "🤩", "star-struck"], [["U+1F618"], "😘", "face blowing a kiss"], [["U+1F617"], "😗", "kissing face"], [["U+263A"], "☺", "smiling face"], [["U+1F61A"], "😚", "kissing face with closed eyes"], [["U+1F619"], "😙", "kissing face with smiling eyes"], [["U+1F972"], "🥲", "⊛ smiling face with tear"]]], ["face-tongue", [[["U+1F60B"], "😋", "face savoring food"], [["U+1F61B"], "😛", "face with tongue"], [["U+1F61C"], "😜", "winking face with tongue"], [["U+1F92A"], "🤪", "zany face"], [["U+1F61D"], "😝", "squinting face with tongue"], [["U+1F911"], "🤑", "money-mouth face"]]], ["face-hand", [[["U+1F917"], "🤗", "hugging face"], [["U+1F92D"], "🤭", "face with hand over mouth"], [["U+1F92B"], "🤫", "shushing face"], [["U+1F914"], "🤔", "thinking face"]]], ["face-neutral-skeptical", [[["U+1F910"], "🤐", "zipper-mouth face"], [["U+1F928"], "🤨", "face with raised eyebrow"], [["U+1F610"], "😐", "neutral face"], [["U+1F611"], "😑", "expressionless face"], [["U+1F636"], "😶", "face without mouth"], [["U+1F60F"], "😏", "smirking face"], [["U+1F612"], "😒", "unamused face"], [["U+1F644"], "🙄", "face with rolling eyes"], [["U+1F62C"], "😬", "grimacing face"], [["U+1F925"], "🤥", "lying face"]]], ["face-sleepy", [[["U+1F60C"], "😌", "relieved face"], [["U+1F614"], "😔", "pensive face"], [["U+1F62A"], "😪", "sleepy face"], [["U+1F924"], "🤤", "drooling face"], [["U+1F634"], "😴", "sleeping face"]]], ["face-unwell", [[["U+1F637"], "😷", "face with medical mask"], [["U+1F912"], "🤒", "face with thermometer"], [["U+1F915"], "🤕", "face with head-bandage"], [["U+1F922"], "🤢", "nauseated face"], [["U+1F92E"], "🤮", "face vomiting"], [["U+1F927"], "🤧", "sneezing face"], [["U+1F975"], "🥵", "hot face"], [["U+1F976"], "🥶", "cold face"], [["U+1F974"], "🥴", "woozy face"], [["U+1F635"], "😵", "dizzy face"], [["U+1F92F"], "🤯", "exploding head"]]], ["face-hat", [[["U+1F920"], "🤠", "cowboy hat face"], [["U+1F973"], "🥳", "partying face"], [["U+1F978"], "🥸", "⊛ disguised face"]]], ["face-glasses", [[["U+1F60E"], "😎", "smiling face with sunglasses"], [["U+1F913"], "🤓", "nerd face"], [["U+1F9D0"], "🧐", "face with monocle"]]], ["face-concerned", [[["U+1F615"], "😕", "confused face"], [["U+1F61F"], "😟", "worried face"], [["U+1F641"], "🙁", "slightly frowning face"], [["U+2639"], "☹", "frowning face"], [["U+1F62E"], "😮", "face with open mouth"], [["U+1F62F"], "😯", "hushed face"], [["U+1F632"], "😲", "astonished face"], [["U+1F633"], "😳", "flushed face"], [["U+1F97A"], "🥺", "pleading face"], [["U+1F626"], "😦", "frowning face with open mouth"], [["U+1F627"], "😧", "anguished face"], [["U+1F628"], "😨", "fearful face"], [["U+1F630"], "😰", "anxious face with sweat"], [["U+1F625"], "😥", "sad but relieved face"], [["U+1F622"], "😢", "crying face"], [["U+1F62D"], "😭", "loudly crying face"], [["U+1F631"], "😱", "face screaming in fear"], [["U+1F616"], "😖", "confounded face"], [["U+1F623"], "😣", "persevering face"], [["U+1F61E"], "😞", "disappointed face"], [["U+1F613"], "😓", "downcast face with sweat"], [["U+1F629"], "😩", "weary face"], [["U+1F62B"], "😫", "tired face"], [["U+1F971"], "🥱", "yawning face"]]], ["face-negative", [[["U+1F624"], "😤", "face with steam from nose"], [["U+1F621"], "😡", "pouting face"], [["U+1F620"], "😠", "angry face"], [["U+1F92C"], "🤬", "face with symbols on mouth"], [["U+1F608"], "😈", "smiling face with horns"], [["U+1F47F"], "👿", "angry face with horns"], [["U+1F480"], "💀", "skull"], [["U+2620"], "☠", "skull and crossbones"]]], ["face-costume", [[["U+1F4A9"], "💩", "pile of poo"], [["U+1F921"], "🤡", "clown face"], [["U+1F479"], "👹", "ogre"], [["U+1F47A"], "👺", "goblin"], [["U+1F47B"], "👻", "ghost"], [["U+1F47D"], "👽", "alien"], [["U+1F47E"], "👾", "alien monster"], [["U+1F916"], "🤖", "robot"]]], ["cat-face", [[["U+1F63A"], "😺", "grinning cat"], [["U+1F638"], "😸", "grinning cat with smiling eyes"], [["U+1F639"], "😹", "cat with tears of joy"], [["U+1F63B"], "😻", "smiling cat with heart-eyes"], [["U+1F63C"], "😼", "cat with wry smile"], [["U+1F63D"], "😽", "kissing cat"], [["U+1F640"], "🙀", "weary cat"], [["U+1F63F"], "😿", "crying cat"], [["U+1F63E"], "😾", "pouting cat"]]], ["monkey-face", [[["U+1F648"], "🙈", "see-no-evil monkey"], [["U+1F649"], "🙉", "hear-no-evil monkey"], [["U+1F64A"], "🙊", "speak-no-evil monkey"]]], ["emotion", [[["U+1F48B"], "💋", "kiss mark"], [["U+1F48C"], "💌", "love letter"], [["U+1F498"], "💘", "heart with arrow"], [["U+1F49D"], "💝", "heart with ribbon"], [["U+1F496"], "💖", "sparkling heart"], [["U+1F497"], "💗", "growing heart"], [["U+1F493"], "💓", "beating heart"], [["U+1F49E"], "💞", "revolving hearts"], [["U+1F495"], "💕", "two hearts"], [["U+1F49F"], "💟", "heart decoration"], [["U+2763"], "❣", "heart exclamation"], [["U+1F494"], "💔", "broken heart"], [["U+2764"], "❤", "red heart"], [["U+1F9E1"], "🧡", "orange heart"], [["U+1F49B"], "💛", "yellow heart"], [["U+1F49A"], "💚", "green heart"], [["U+1F499"], "💙", "blue heart"], [["U+1F49C"], "💜", "purple heart"], [["U+1F90E"], "🤎", "brown heart"], [["U+1F5A4"], "🖤", "black heart"], [["U+1F90D"], "🤍", "white heart"], [["U+1F4AF"], "💯", "hundred points"], [["U+1F4A2"], "💢", "anger symbol"], [["U+1F4A5"], "💥", "collision"], [["U+1F4AB"], "💫", "dizzy"], [["U+1F4A6"], "💦", "sweat droplets"], [["U+1F4A8"], "💨", "dashing away"], [["U+1F573"], "🕳", "hole"], [["U+1F4A3"], "💣", "bomb"], [["U+1F4AC"], "💬", "speech balloon"], [["U+1F441", "U+FE0F", "U+200D", "U+1F5E8", "U+FE0F"], "👁️‍🗨️", "eye in speech bubble"], [["U+1F5E8"], "🗨", "left speech bubble"], [["U+1F5EF"], "🗯", "right anger bubble"], [["U+1F4AD"], "💭", "thought balloon"], [["U+1F4A4"], "💤", "zzz"]]]]], ["People & Body", [["hand-fingers-open", [[["U+1F44B"], "👋", "waving hand"], [["U+1F91A"], "🤚", "raised back of hand"], [["U+1F590"], "🖐", "hand with fingers splayed"], [["U+270B"], "✋", "raised hand"], [["U+1F596"], "🖖", "vulcan salute"]]], ["hand-fingers-partial", [[["U+1F44C"], "👌", "OK hand"], [["U+1F90C"], "🤌", "⊛ pinched fingers"], [["U+1F90F"], "🤏", "pinching hand"], [["U+270C"], "✌", "victory hand"], [["U+1F91E"], "🤞", "crossed fingers"], [["U+1F91F"], "🤟", "love-you gesture"], [["U+1F918"], "🤘", "sign of the horns"], [["U+1F919"], "🤙", "call me hand"]]], ["hand-single-finger", [[["U+1F448"], "👈", "backhand index pointing left"], [["U+1F449"], "👉", "backhand index pointing right"], [["U+1F446"], "👆", "backhand index pointing up"], [["U+1F595"], "🖕", "middle finger"], [["U+1F447"], "👇", "backhand index pointing down"], [["U+261D"], "☝", "index pointing up"]]], ["hand-fingers-closed", [[["U+1F44D"], "👍", "thumbs up"], [["U+1F44E"], "👎", "thumbs down"], [["U+270A"], "✊", "raised fist"], [["U+1F44A"], "👊", "oncoming fist"], [["U+1F91B"], "🤛", "left-facing fist"], [["U+1F91C"], "🤜", "right-facing fist"]]], ["hands", [[["U+1F44F"], "👏", "clapping hands"], [["U+1F64C"], "🙌", "raising hands"], [["U+1F450"], "👐", "open hands"], [["U+1F932"], "🤲", "palms up together"], [["U+1F91D"], "🤝", "handshake"], [["U+1F64F"], "🙏", "folded hands"]]], ["hand-prop", [[["U+270D"], "✍", "writing hand"], [["U+1F485"], "💅", "nail polish"], [["U+1F933"], "🤳", "selfie"]]], ["body-parts", [[["U+1F4AA"], "💪", "flexed biceps"], [["U+1F9BE"], "🦾", "mechanical arm"], [["U+1F9BF"], "🦿", "mechanical leg"], [["U+1F9B5"], "🦵", "leg"], [["U+1F9B6"], "🦶", "foot"], [["U+1F442"], "👂", "ear"], [["U+1F9BB"], "🦻", "ear with hearing aid"], [["U+1F443"], "👃", "nose"], [["U+1F9E0"], "🧠", "brain"], [["U+1F9B7"], "🦷", "tooth"], [["U+1F9B4"], "🦴", "bone"], [["U+1F440"], "👀", "eyes"], [["U+1F441"], "👁", "eye"], [["U+1F445"], "👅", "tongue"], [["U+1F444"], "👄", "mouth"]]], ["person", [[["U+1F476"], "👶", "baby"], [["U+1F9D2"], "🧒", "child"], [["U+1F466"], "👦", "boy"], [["U+1F467"], "👧", "girl"], [["U+1F9D1"], "🧑", "person"], [["U+1F471"], "👱", "person: blond hair"], [["U+1F468"], "👨", "man"], [["U+1F9D4"], "🧔", "man: beard"], [["U+1F468", "U+200D", "U+1F9B0"], "👨‍🦰", "man: red hair"], [["U+1F468", "U+200D", "U+1F9B1"], "👨‍🦱", "man: curly hair"], [["U+1F468", "U+200D", "U+1F9B3"], "👨‍🦳", "man: white hair"], [["U+1F468", "U+200D", "U+1F9B2"], "👨‍🦲", "man: bald"], [["U+1F469"], "👩", "woman"], [["U+1F469", "U+200D", "U+1F9B0"], "👩‍🦰", "woman: red hair"], [["U+1F9D1", "U+200D", "U+1F9B0"], "🧑‍🦰", "person: red hair"], [["U+1F469", "U+200D", "U+1F9B1"], "👩‍🦱", "woman: curly hair"], [["U+1F9D1", "U+200D", "U+1F9B1"], "🧑‍🦱", "person: curly hair"], [["U+1F469", "U+200D", "U+1F9B3"], "👩‍🦳", "woman: white hair"], [["U+1F9D1", "U+200D", "U+1F9B3"], "🧑‍🦳", "person: white hair"], [["U+1F469", "U+200D", "U+1F9B2"], "👩‍🦲", "woman: bald"], [["U+1F9D1", "U+200D", "U+1F9B2"], "🧑‍🦲", "person: bald"], [["U+1F471", "U+200D", "U+2640", "U+FE0F"], "👱‍♀️", "woman: blond hair"], [["U+1F471", "U+200D", "U+2642", "U+FE0F"], "👱‍♂️", "man: blond hair"], [["U+1F9D3"], "🧓", "older person"], [["U+1F474"], "👴", "old man"], [["U+1F475"], "👵", "old woman"]]], ["person-gesture", [[["U+1F64D"], "🙍", "person frowning"], [["U+1F64D", "U+200D", "U+2642", "U+FE0F"], "🙍‍♂️", "man frowning"], [["U+1F64D", "U+200D", "U+2640", "U+FE0F"], "🙍‍♀️", "woman frowning"], [["U+1F64E"], "🙎", "person pouting"], [["U+1F64E", "U+200D", "U+2642", "U+FE0F"], "🙎‍♂️", "man pouting"], [["U+1F64E", "U+200D", "U+2640", "U+FE0F"], "🙎‍♀️", "woman pouting"], [["U+1F645"], "🙅", "person gesturing NO"], [["U+1F645", "U+200D", "U+2642", "U+FE0F"], "🙅‍♂️", "man gesturing NO"], [["U+1F645", "U+200D", "U+2640", "U+FE0F"], "🙅‍♀️", "woman gesturing NO"], [["U+1F646"], "🙆", "person gesturing OK"], [["U+1F646", "U+200D", "U+2642", "U+FE0F"], "🙆‍♂️", "man gesturing OK"], [["U+1F646", "U+200D", "U+2640", "U+FE0F"], "🙆‍♀️", "woman gesturing OK"], [["U+1F481"], "💁", "person tipping hand"], [["U+1F481", "U+200D", "U+2642", "U+FE0F"], "💁‍♂️", "man tipping hand"], [["U+1F481", "U+200D", "U+2640", "U+FE0F"], "💁‍♀️", "woman tipping hand"], [["U+1F64B"], "🙋", "person raising hand"], [["U+1F64B", "U+200D", "U+2642", "U+FE0F"], "🙋‍♂️", "man raising hand"], [["U+1F64B", "U+200D", "U+2640", "U+FE0F"], "🙋‍♀️", "woman raising hand"], [["U+1F9CF"], "🧏", "deaf person"], [["U+1F9CF", "U+200D", "U+2642", "U+FE0F"], "🧏‍♂️", "deaf man"], [["U+1F9CF", "U+200D", "U+2640", "U+FE0F"], "🧏‍♀️", "deaf woman"], [["U+1F647"], "🙇", "person bowing"], [["U+1F647", "U+200D", "U+2642", "U+FE0F"], "🙇‍♂️", "man bowing"], [["U+1F647", "U+200D", "U+2640", "U+FE0F"], "🙇‍♀️", "woman bowing"], [["U+1F926"], "🤦", "person facepalming"], [["U+1F926", "U+200D", "U+2642", "U+FE0F"], "🤦‍♂️", "man facepalming"], [["U+1F926", "U+200D", "U+2640", "U+FE0F"], "🤦‍♀️", "woman facepalming"], [["U+1F937"], "🤷", "person shrugging"], [["U+1F937", "U+200D", "U+2642", "U+FE0F"], "🤷‍♂️", "man shrugging"], [["U+1F937", "U+200D", "U+2640", "U+FE0F"], "🤷‍♀️", "woman shrugging"]]], ["person-role", [[["U+1F9D1", "U+200D", "U+2695", "U+FE0F"], "🧑‍⚕️", "health worker"], [["U+1F468", "U+200D", "U+2695", "U+FE0F"], "👨‍⚕️", "man health worker"], [["U+1F469", "U+200D", "U+2695", "U+FE0F"], "👩‍⚕️", "woman health worker"], [["U+1F9D1", "U+200D", "U+1F393"], "🧑‍🎓", "student"], [["U+1F468", "U+200D", "U+1F393"], "👨‍🎓", "man student"], [["U+1F469", "U+200D", "U+1F393"], "👩‍🎓", "woman student"], [["U+1F9D1", "U+200D", "U+1F3EB"], "🧑‍🏫", "teacher"], [["U+1F468", "U+200D", "U+1F3EB"], "👨‍🏫", "man teacher"], [["U+1F469", "U+200D", "U+1F3EB"], "👩‍🏫", "woman teacher"], [["U+1F9D1", "U+200D", "U+2696", "U+FE0F"], "🧑‍⚖️", "judge"], [["U+1F468", "U+200D", "U+2696", "U+FE0F"], "👨‍⚖️", "man judge"], [["U+1F469", "U+200D", "U+2696", "U+FE0F"], "👩‍⚖️", "woman judge"], [["U+1F9D1", "U+200D", "U+1F33E"], "🧑‍🌾", "farmer"], [["U+1F468", "U+200D", "U+1F33E"], "👨‍🌾", "man farmer"], [["U+1F469", "U+200D", "U+1F33E"], "👩‍🌾", "woman farmer"], [["U+1F9D1", "U+200D", "U+1F373"], "🧑‍🍳", "cook"], [["U+1F468", "U+200D", "U+1F373"], "👨‍🍳", "man cook"], [["U+1F469", "U+200D", "U+1F373"], "👩‍🍳", "woman cook"], [["U+1F9D1", "U+200D", "U+1F527"], "🧑‍🔧", "mechanic"], [["U+1F468", "U+200D", "U+1F527"], "👨‍🔧", "man mechanic"], [["U+1F469", "U+200D", "U+1F527"], "👩‍🔧", "woman mechanic"], [["U+1F9D1", "U+200D", "U+1F3ED"], "🧑‍🏭", "factory worker"], [["U+1F468", "U+200D", "U+1F3ED"], "👨‍🏭", "man factory worker"], [["U+1F469", "U+200D", "U+1F3ED"], "👩‍🏭", "woman factory worker"], [["U+1F9D1", "U+200D", "U+1F4BC"], "🧑‍💼", "office worker"], [["U+1F468", "U+200D", "U+1F4BC"], "👨‍💼", "man office worker"], [["U+1F469", "U+200D", "U+1F4BC"], "👩‍💼", "woman office worker"], [["U+1F9D1", "U+200D", "U+1F52C"], "🧑‍🔬", "scientist"], [["U+1F468", "U+200D", "U+1F52C"], "👨‍🔬", "man scientist"], [["U+1F469", "U+200D", "U+1F52C"], "👩‍🔬", "woman scientist"], [["U+1F9D1", "U+200D", "U+1F4BB"], "🧑‍💻", "technologist"], [["U+1F468", "U+200D", "U+1F4BB"], "👨‍💻", "man technologist"], [["U+1F469", "U+200D", "U+1F4BB"], "👩‍💻", "woman technologist"], [["U+1F9D1", "U+200D", "U+1F3A4"], "🧑‍🎤", "singer"], [["U+1F468", "U+200D", "U+1F3A4"], "👨‍🎤", "man singer"], [["U+1F469", "U+200D", "U+1F3A4"], "👩‍🎤", "woman singer"], [["U+1F9D1", "U+200D", "U+1F3A8"], "🧑‍🎨", "artist"], [["U+1F468", "U+200D", "U+1F3A8"], "👨‍🎨", "man artist"], [["U+1F469", "U+200D", "U+1F3A8"], "👩‍🎨", "woman artist"], [["U+1F9D1", "U+200D", "U+2708", "U+FE0F"], "🧑‍✈️", "pilot"], [["U+1F468", "U+200D", "U+2708", "U+FE0F"], "👨‍✈️", "man pilot"], [["U+1F469", "U+200D", "U+2708", "U+FE0F"], "👩‍✈️", "woman pilot"], [["U+1F9D1", "U+200D", "U+1F680"], "🧑‍🚀", "astronaut"], [["U+1F468", "U+200D", "U+1F680"], "👨‍🚀", "man astronaut"], [["U+1F469", "U+200D", "U+1F680"], "👩‍🚀", "woman astronaut"], [["U+1F9D1", "U+200D", "U+1F692"], "🧑‍🚒", "firefighter"], [["U+1F468", "U+200D", "U+1F692"], "👨‍🚒", "man firefighter"], [["U+1F469", "U+200D", "U+1F692"], "👩‍🚒", "woman firefighter"], [["U+1F46E"], "👮", "police officer"], [["U+1F46E", "U+200D", "U+2642", "U+FE0F"], "👮‍♂️", "man police officer"], [["U+1F46E", "U+200D", "U+2640", "U+FE0F"], "👮‍♀️", "woman police officer"], [["U+1F575"], "🕵", "detective"], [["U+1F575", "U+FE0F", "U+200D", "U+2642", "U+FE0F"], "🕵️‍♂️", "man detective"], [["U+1F575", "U+FE0F", "U+200D", "U+2640", "U+FE0F"], "🕵️‍♀️", "woman detective"], [["U+1F482"], "💂", "guard"], [["U+1F482", "U+200D", "U+2642", "U+FE0F"], "💂‍♂️", "man guard"], [["U+1F482", "U+200D", "U+2640", "U+FE0F"], "💂‍♀️", "woman guard"], [["U+1F977"], "🥷", "⊛ ninja"], [["U+1F477"], "👷", "construction worker"], [["U+1F477", "U+200D", "U+2642", "U+FE0F"], "👷‍♂️", "man construction worker"], [["U+1F477", "U+200D", "U+2640", "U+FE0F"], "👷‍♀️", "woman construction worker"], [["U+1F934"], "🤴", "prince"], [["U+1F478"], "👸", "princess"], [["U+1F473"], "👳", "person wearing turban"], [["U+1F473", "U+200D", "U+2642", "U+FE0F"], "👳‍♂️", "man wearing turban"], [["U+1F473", "U+200D", "U+2640", "U+FE0F"], "👳‍♀️", "woman wearing turban"], [["U+1F472"], "👲", "person with skullcap"], [["U+1F9D5"], "🧕", "woman with headscarf"], [["U+1F935"], "🤵", "person in tuxedo"], [["U+1F935", "U+200D", "U+2642", "U+FE0F"], "🤵‍♂️", "⊛ man in tuxedo"], [["U+1F935", "U+200D", "U+2640", "U+FE0F"], "🤵‍♀️", "⊛ woman in tuxedo"], [["U+1F470"], "👰", "person with veil"], [["U+1F930"], "🤰", "pregnant woman"], [["U+1F931"], "🤱", "breast-feeding"]]], ["person-fantasy", [[["U+1F47C"], "👼", "baby angel"], [["U+1F385"], "🎅", "Santa Claus"], [["U+1F936"], "🤶", "Mrs. Claus"], [["U+1F9B8"], "🦸", "superhero"], [["U+1F9B8", "U+200D", "U+2642", "U+FE0F"], "🦸‍♂️", "man superhero"], [["U+1F9B8", "U+200D", "U+2640", "U+FE0F"], "🦸‍♀️", "woman superhero"], [["U+1F9B9"], "🦹", "supervillain"], [["U+1F9B9", "U+200D", "U+2642", "U+FE0F"], "🦹‍♂️", "man supervillain"], [["U+1F9B9", "U+200D", "U+2640", "U+FE0F"], "🦹‍♀️", "woman supervillain"], [["U+1F9D9"], "🧙", "mage"], [["U+1F9D9", "U+200D", "U+2642", "U+FE0F"], "🧙‍♂️", "man mage"], [["U+1F9D9", "U+200D", "U+2640", "U+FE0F"], "🧙‍♀️", "woman mage"], [["U+1F9DA"], "🧚", "fairy"], [["U+1F9DA", "U+200D", "U+2642", "U+FE0F"], "🧚‍♂️", "man fairy"], [["U+1F9DA", "U+200D", "U+2640", "U+FE0F"], "🧚‍♀️", "woman fairy"], [["U+1F9DB"], "🧛", "vampire"], [["U+1F9DB", "U+200D", "U+2642", "U+FE0F"], "🧛‍♂️", "man vampire"], [["U+1F9DB", "U+200D", "U+2640", "U+FE0F"], "🧛‍♀️", "woman vampire"], [["U+1F9DC"], "🧜", "merperson"], [["U+1F9DC", "U+200D", "U+2642", "U+FE0F"], "🧜‍♂️", "merman"], [["U+1F9DC", "U+200D", "U+2640", "U+FE0F"], "🧜‍♀️", "mermaid"], [["U+1F9DD"], "🧝", "elf"], [["U+1F9DD", "U+200D", "U+2642", "U+FE0F"], "🧝‍♂️", "man elf"], [["U+1F9DD", "U+200D", "U+2640", "U+FE0F"], "🧝‍♀️", "woman elf"], [["U+1F9DE"], "🧞", "genie"], [["U+1F9DE", "U+200D", "U+2642", "U+FE0F"], "🧞‍♂️", "man genie"], [["U+1F9DE", "U+200D", "U+2640", "U+FE0F"], "🧞‍♀️", "woman genie"], [["U+1F9DF"], "🧟", "zombie"], [["U+1F9DF", "U+200D", "U+2642", "U+FE0F"], "🧟‍♂️", "man zombie"], [["U+1F9DF", "U+200D", "U+2640", "U+FE0F"], "🧟‍♀️", "woman zombie"]]], ["person-activity", [[["U+1F486"], "💆", "person getting massage"], [["U+1F486", "U+200D", "U+2642", "U+FE0F"], "💆‍♂️", "man getting massage"], [["U+1F486", "U+200D", "U+2640", "U+FE0F"], "💆‍♀️", "woman getting massage"], [["U+1F487"], "💇", "person getting haircut"], [["U+1F487", "U+200D", "U+2642", "U+FE0F"], "💇‍♂️", "man getting haircut"], [["U+1F487", "U+200D", "U+2640", "U+FE0F"], "💇‍♀️", "woman getting haircut"], [["U+1F6B6"], "🚶", "person walking"], [["U+1F6B6", "U+200D", "U+2642", "U+FE0F"], "🚶‍♂️", "man walking"], [["U+1F6B6", "U+200D", "U+2640", "U+FE0F"], "🚶‍♀️", "woman walking"], [["U+1F9CD"], "🧍", "person standing"], [["U+1F9CD", "U+200D", "U+2642", "U+FE0F"], "🧍‍♂️", "man standing"], [["U+1F9CD", "U+200D", "U+2640", "U+FE0F"], "🧍‍♀️", "woman standing"], [["U+1F9CE"], "🧎", "person kneeling"], [["U+1F9CE", "U+200D", "U+2642", "U+FE0F"], "🧎‍♂️", "man kneeling"], [["U+1F9CE", "U+200D", "U+2640", "U+FE0F"], "🧎‍♀️", "woman kneeling"], [["U+1F9D1", "U+200D", "U+1F9AF"], "🧑‍🦯", "person with white cane"], [["U+1F468", "U+200D", "U+1F9AF"], "👨‍🦯", "man with white cane"], [["U+1F469", "U+200D", "U+1F9AF"], "👩‍🦯", "woman with white cane"], [["U+1F9D1", "U+200D", "U+1F9BC"], "🧑‍🦼", "person in motorized wheelchair"], [["U+1F468", "U+200D", "U+1F9BC"], "👨‍🦼", "man in motorized wheelchair"], [["U+1F469", "U+200D", "U+1F9BC"], "👩‍🦼", "woman in motorized wheelchair"], [["U+1F9D1", "U+200D", "U+1F9BD"], "🧑‍🦽", "person in manual wheelchair"], [["U+1F468", "U+200D", "U+1F9BD"], "👨‍🦽", "man in manual wheelchair"], [["U+1F469", "U+200D", "U+1F9BD"], "👩‍🦽", "woman in manual wheelchair"], [["U+1F3C3"], "🏃", "person running"], [["U+1F3C3", "U+200D", "U+2642", "U+FE0F"], "🏃‍♂️", "man running"], [["U+1F3C3", "U+200D", "U+2640", "U+FE0F"], "🏃‍♀️", "woman running"], [["U+1F483"], "💃", "woman dancing"], [["U+1F57A"], "🕺", "man dancing"], [["U+1F574"], "🕴", "person in suit levitating"], [["U+1F46F"], "👯", "people with bunny ears"], [["U+1F46F", "U+200D", "U+2642", "U+FE0F"], "👯‍♂️", "men with bunny ears"], [["U+1F46F", "U+200D", "U+2640", "U+FE0F"], "👯‍♀️", "women with bunny ears"], [["U+1F9D6"], "🧖", "person in steamy room"], [["U+1F9D6", "U+200D", "U+2642", "U+FE0F"], "🧖‍♂️", "man in steamy room"], [["U+1F9D6", "U+200D", "U+2640", "U+FE0F"], "🧖‍♀️", "woman in steamy room"], [["U+1F9D7"], "🧗", "person climbing"], [["U+1F9D7", "U+200D", "U+2642", "U+FE0F"], "🧗‍♂️", "man climbing"], [["U+1F9D7", "U+200D", "U+2640", "U+FE0F"], "🧗‍♀️", "woman climbing"]]], ["person-sport", [[["U+1F93A"], "🤺", "person fencing"], [["U+1F3C7"], "🏇", "horse racing"], [["U+26F7"], "⛷", "skier"], [["U+1F3C2"], "🏂", "snowboarder"], [["U+1F3CC"], "🏌", "person golfing"], [["U+1F3CC", "U+FE0F", "U+200D", "U+2642", "U+FE0F"], "🏌️‍♂️", "man golfing"], [["U+1F3CC", "U+FE0F", "U+200D", "U+2640", "U+FE0F"], "🏌️‍♀️", "woman golfing"], [["U+1F3C4"], "🏄", "person surfing"], [["U+1F3C4", "U+200D", "U+2642", "U+FE0F"], "🏄‍♂️", "man surfing"], [["U+1F3C4", "U+200D", "U+2640", "U+FE0F"], "🏄‍♀️", "woman surfing"], [["U+1F6A3"], "🚣", "person rowing boat"], [["U+1F6A3", "U+200D", "U+2642", "U+FE0F"], "🚣‍♂️", "man rowing boat"], [["U+1F6A3", "U+200D", "U+2640", "U+FE0F"], "🚣‍♀️", "woman rowing boat"], [["U+1F3CA"], "🏊", "person swimming"], [["U+1F3CA", "U+200D", "U+2642", "U+FE0F"], "🏊‍♂️", "man swimming"], [["U+1F3CA", "U+200D", "U+2640", "U+FE0F"], "🏊‍♀️", "woman swimming"], [["U+26F9"], "⛹", "person bouncing ball"], [["U+26F9", "U+FE0F", "U+200D", "U+2642", "U+FE0F"], "⛹️‍♂️", "man bouncing ball"], [["U+26F9", "U+FE0F", "U+200D", "U+2640", "U+FE0F"], "⛹️‍♀️", "woman bouncing ball"], [["U+1F3CB"], "🏋", "person lifting weights"], [["U+1F3CB", "U+FE0F", "U+200D", "U+2642", "U+FE0F"], "🏋️‍♂️", "man lifting weights"], [["U+1F3CB", "U+FE0F", "U+200D", "U+2640", "U+FE0F"], "🏋️‍♀️", "woman lifting weights"], [["U+1F6B4"], "🚴", "person biking"], [["U+1F6B4", "U+200D", "U+2642", "U+FE0F"], "🚴‍♂️", "man biking"], [["U+1F6B4", "U+200D", "U+2640", "U+FE0F"], "🚴‍♀️", "woman biking"], [["U+1F6B5"], "🚵", "person mountain biking"], [["U+1F6B5", "U+200D", "U+2642", "U+FE0F"], "🚵‍♂️", "man mountain biking"], [["U+1F6B5", "U+200D", "U+2640", "U+FE0F"], "🚵‍♀️", "woman mountain biking"], [["U+1F938"], "🤸", "person cartwheeling"], [["U+1F938", "U+200D", "U+2642", "U+FE0F"], "🤸‍♂️", "man cartwheeling"], [["U+1F938", "U+200D", "U+2640", "U+FE0F"], "🤸‍♀️", "woman cartwheeling"], [["U+1F93C"], "🤼", "people wrestling"], [["U+1F93C", "U+200D", "U+2642", "U+FE0F"], "🤼‍♂️", "men wrestling"], [["U+1F93C", "U+200D", "U+2640", "U+FE0F"], "🤼‍♀️", "women wrestling"], [["U+1F93D"], "🤽", "person playing water polo"], [["U+1F93D", "U+200D", "U+2642", "U+FE0F"], "🤽‍♂️", "man playing water polo"], [["U+1F93D", "U+200D", "U+2640", "U+FE0F"], "🤽‍♀️", "woman playing water polo"], [["U+1F93E"], "🤾", "person playing handball"], [["U+1F93E", "U+200D", "U+2642", "U+FE0F"], "🤾‍♂️", "man playing handball"], [["U+1F93E", "U+200D", "U+2640", "U+FE0F"], "🤾‍♀️", "woman playing handball"], [["U+1F939"], "🤹", "person juggling"], [["U+1F939", "U+200D", "U+2642", "U+FE0F"], "🤹‍♂️", "man juggling"], [["U+1F939", "U+200D", "U+2640", "U+FE0F"], "🤹‍♀️", "woman juggling"]]], ["person-resting", [[["U+1F9D8"], "🧘", "person in lotus position"], [["U+1F9D8", "U+200D", "U+2642", "U+FE0F"], "🧘‍♂️", "man in lotus position"], [["U+1F9D8", "U+200D", "U+2640", "U+FE0F"], "🧘‍♀️", "woman in lotus position"], [["U+1F6C0"], "🛀", "person taking bath"], [["U+1F6CC"], "🛌", "person in bed"]]], ["family", [[["U+1F9D1", "U+200D", "U+1F91D", "U+200D", "U+1F9D1"], "🧑‍🤝‍🧑", "people holding hands"], [["U+1F46D"], "👭", "women holding hands"], [["U+1F46B"], "👫", "woman and man holding hands"], [["U+1F46C"], "👬", "men holding hands"], [["U+1F48F"], "💏", "kiss"], [["U+1F469", "U+200D", "U+2764", "U+FE0F", "U+200D", "U+1F48B", "U+200D", "U+1F468"], "👩‍❤️‍💋‍👨", "kiss: woman, man"], [["U+1F468", "U+200D", "U+2764", "U+FE0F", "U+200D", "U+1F48B", "U+200D", "U+1F468"], "👨‍❤️‍💋‍👨", "kiss: man, man"], [["U+1F469", "U+200D", "U+2764", "U+FE0F", "U+200D", "U+1F48B", "U+200D", "U+1F469"], "👩‍❤️‍💋‍👩", "kiss: woman, woman"], [["U+1F491"], "💑", "couple with heart"], [["U+1F469", "U+200D", "U+2764", "U+FE0F", "U+200D", "U+1F468"], "👩‍❤️‍👨", "couple with heart: woman, man"], [["U+1F468", "U+200D", "U+2764", "U+FE0F", "U+200D", "U+1F468"], "👨‍❤️‍👨", "couple with heart: man, man"], [["U+1F469", "U+200D", "U+2764", "U+FE0F", "U+200D", "U+1F469"], "👩‍❤️‍👩", "couple with heart: woman, woman"], [["U+1F46A"], "👪", "family"], [["U+1F468", "U+200D", "U+1F469", "U+200D", "U+1F466"], "👨‍👩‍👦", "family: man, woman, boy"], [["U+1F468", "U+200D", "U+1F469", "U+200D", "U+1F467"], "👨‍👩‍👧", "family: man, woman, girl"], [["U+1F468", "U+200D", "U+1F469", "U+200D", "U+1F467", "U+200D", "U+1F466"], "👨‍👩‍👧‍👦", "family: man, woman, girl, boy"], [["U+1F468", "U+200D", "U+1F469", "U+200D", "U+1F466", "U+200D", "U+1F466"], "👨‍👩‍👦‍👦", "family: man, woman, boy, boy"], [["U+1F468", "U+200D", "U+1F469", "U+200D", "U+1F467", "U+200D", "U+1F467"], "👨‍👩‍👧‍👧", "family: man, woman, girl, girl"], [["U+1F468", "U+200D", "U+1F468", "U+200D", "U+1F466"], "👨‍👨‍👦", "family: man, man, boy"], [["U+1F468", "U+200D", "U+1F468", "U+200D", "U+1F467"], "👨‍👨‍👧", "family: man, man, girl"], [["U+1F468", "U+200D", "U+1F468", "U+200D", "U+1F467", "U+200D", "U+1F466"], "👨‍👨‍👧‍👦", "family: man, man, girl, boy"], [["U+1F468", "U+200D", "U+1F468", "U+200D", "U+1F466", "U+200D", "U+1F466"], "👨‍👨‍👦‍👦", "family: man, man, boy, boy"], [["U+1F468", "U+200D", "U+1F468", "U+200D", "U+1F467", "U+200D", "U+1F467"], "👨‍👨‍👧‍👧", "family: man, man, girl, girl"], [["U+1F469", "U+200D", "U+1F469", "U+200D", "U+1F466"], "👩‍👩‍👦", "family: woman, woman, boy"], [["U+1F469", "U+200D", "U+1F469", "U+200D", "U+1F467"], "👩‍👩‍👧", "family: woman, woman, girl"], [["U+1F469", "U+200D", "U+1F469", "U+200D", "U+1F467", "U+200D", "U+1F466"], "👩‍👩‍👧‍👦", "family: woman, woman, girl, boy"], [["U+1F469", "U+200D", "U+1F469", "U+200D", "U+1F466", "U+200D", "U+1F466"], "👩‍👩‍👦‍👦", "family: woman, woman, boy, boy"], [["U+1F469", "U+200D", "U+1F469", "U+200D", "U+1F467", "U+200D", "U+1F467"], "👩‍👩‍👧‍👧", "family: woman, woman, girl, girl"], [["U+1F468", "U+200D", "U+1F466"], "👨‍👦", "family: man, boy"], [["U+1F468", "U+200D", "U+1F466", "U+200D", "U+1F466"], "👨‍👦‍👦", "family: man, boy, boy"], [["U+1F468", "U+200D", "U+1F467"], "👨‍👧", "family: man, girl"], [["U+1F468", "U+200D", "U+1F467", "U+200D", "U+1F466"], "👨‍👧‍👦", "family: man, girl, boy"], [["U+1F468", "U+200D", "U+1F467", "U+200D", "U+1F467"], "👨‍👧‍👧", "family: man, girl, girl"], [["U+1F469", "U+200D", "U+1F466"], "👩‍👦", "family: woman, boy"], [["U+1F469", "U+200D", "U+1F466", "U+200D", "U+1F466"], "👩‍👦‍👦", "family: woman, boy, boy"], [["U+1F469", "U+200D", "U+1F467"], "👩‍👧", "family: woman, girl"], [["U+1F469", "U+200D", "U+1F467", "U+200D", "U+1F466"], "👩‍👧‍👦", "family: woman, girl, boy"], [["U+1F469", "U+200D", "U+1F467", "U+200D", "U+1F467"], "👩‍👧‍👧", "family: woman, girl, girl"]]], ["person-symbol", [[["U+1F5E3"], "🗣", "speaking head"], [["U+1F464"], "👤", "bust in silhouette"], [["U+1F465"], "👥", "busts in silhouette"], [["U+1FAC2"], "🫂", "⊛ people hugging"], [["U+1F463"], "👣", "footprints"]]]]], ["Component", [["hair-style", [[["U+1F9B0"], "🦰", "red hair"], [["U+1F9B1"], "🦱", "curly hair"], [["U+1F9B3"], "🦳", "white hair"], [["U+1F9B2"], "🦲", "bald"]]]]], ["Animals & Nature", [["animal-mammal", [[["U+1F435"], "🐵", "monkey face"], [["U+1F412"], "🐒", "monkey"], [["U+1F98D"], "🦍", "gorilla"], [["U+1F9A7"], "🦧", "orangutan"], [["U+1F436"], "🐶", "dog face"], [["U+1F415"], "🐕", "dog"], [["U+1F9AE"], "🦮", "guide dog"], [["U+1F415", "U+200D", "U+1F9BA"], "🐕‍🦺", "service dog"], [["U+1F429"], "🐩", "poodle"], [["U+1F43A"], "🐺", "wolf"], [["U+1F98A"], "🦊", "fox"], [["U+1F99D"], "🦝", "raccoon"], [["U+1F431"], "🐱", "cat face"], [["U+1F408"], "🐈", "cat"], [["U+1F981"], "🦁", "lion"], [["U+1F42F"], "🐯", "tiger face"], [["U+1F405"], "🐅", "tiger"], [["U+1F406"], "🐆", "leopard"], [["U+1F434"], "🐴", "horse face"], [["U+1F40E"], "🐎", "horse"], [["U+1F984"], "🦄", "unicorn"], [["U+1F993"], "🦓", "zebra"], [["U+1F98C"], "🦌", "deer"], [["U+1F42E"], "🐮", "cow face"], [["U+1F402"], "🐂", "ox"], [["U+1F403"], "🐃", "water buffalo"], [["U+1F404"], "🐄", "cow"], [["U+1F437"], "🐷", "pig face"], [["U+1F416"], "🐖", "pig"], [["U+1F417"], "🐗", "boar"], [["U+1F43D"], "🐽", "pig nose"], [["U+1F40F"], "🐏", "ram"], [["U+1F411"], "🐑", "ewe"], [["U+1F410"], "🐐", "goat"], [["U+1F42A"], "🐪", "camel"], [["U+1F42B"], "🐫", "two-hump camel"], [["U+1F999"], "🦙", "llama"], [["U+1F992"], "🦒", "giraffe"], [["U+1F418"], "🐘", "elephant"], [["U+1F98F"], "🦏", "rhinoceros"], [["U+1F99B"], "🦛", "hippopotamus"], [["U+1F42D"], "🐭", "mouse face"], [["U+1F401"], "🐁", "mouse"], [["U+1F400"], "🐀", "rat"], [["U+1F439"], "🐹", "hamster"], [["U+1F430"], "🐰", "rabbit face"], [["U+1F407"], "🐇", "rabbit"], [["U+1F43F"], "🐿", "chipmunk"], [["U+1F994"], "🦔", "hedgehog"], [["U+1F987"], "🦇", "bat"], [["U+1F43B"], "🐻", "bear"], [["U+1F43B", "U+200D", "U+2744", "U+FE0F"], "🐻‍❄️", "⊛ polar bear"], [["U+1F428"], "🐨", "koala"], [["U+1F43C"], "🐼", "panda"], [["U+1F9A5"], "🦥", "sloth"], [["U+1F9A6"], "🦦", "otter"], [["U+1F9A8"], "🦨", "skunk"], [["U+1F998"], "🦘", "kangaroo"], [["U+1F9A1"], "🦡", "badger"], [["U+1F43E"], "🐾", "paw prints"]]], ["animal-bird", [[["U+1F983"], "🦃", "turkey"], [["U+1F414"], "🐔", "chicken"], [["U+1F413"], "🐓", "rooster"], [["U+1F423"], "🐣", "hatching chick"], [["U+1F424"], "🐤", "baby chick"], [["U+1F425"], "🐥", "front-facing baby chick"], [["U+1F426"], "🐦", "bird"], [["U+1F427"], "🐧", "penguin"], [["U+1F54A"], "🕊", "dove"], [["U+1F985"], "🦅", "eagle"], [["U+1F986"], "🦆", "duck"], [["U+1F9A2"], "🦢", "swan"], [["U+1F989"], "🦉", "owl"], [["U+1FAB6"], "🪶", "⊛ feather"], [["U+1F9A9"], "🦩", "flamingo"], [["U+1F99A"], "🦚", "peacock"], [["U+1F99C"], "🦜", "parrot"]]], ["animal-amphibian", [[["U+1F438"], "🐸", "frog"]]], ["animal-reptile", [[["U+1F40A"], "🐊", "crocodile"], [["U+1F422"], "🐢", "turtle"], [["U+1F98E"], "🦎", "lizard"], [["U+1F40D"], "🐍", "snake"], [["U+1F432"], "🐲", "dragon face"], [["U+1F409"], "🐉", "dragon"], [["U+1F995"], "🦕", "sauropod"], [["U+1F996"], "🦖", "T-Rex"]]], ["animal-marine", [[["U+1F433"], "🐳", "spouting whale"], [["U+1F40B"], "🐋", "whale"], [["U+1F42C"], "🐬", "dolphin"], [["U+1F41F"], "🐟", "fish"], [["U+1F420"], "🐠", "tropical fish"], [["U+1F421"], "🐡", "blowfish"], [["U+1F988"], "🦈", "shark"], [["U+1F419"], "🐙", "octopus"], [["U+1F41A"], "🐚", "spiral shell"]]], ["animal-bug", [[["U+1F40C"], "🐌", "snail"], [["U+1F98B"], "🦋", "butterfly"], [["U+1F41B"], "🐛", "bug"], [["U+1F41C"], "🐜", "ant"], [["U+1F41D"], "🐝", "honeybee"], [["U+1F41E"], "🐞", "lady beetle"], [["U+1F997"], "🦗", "cricket"], [["U+1F577"], "🕷", "spider"], [["U+1F578"], "🕸", "spider web"], [["U+1F982"], "🦂", "scorpion"], [["U+1F99F"], "🦟", "mosquito"], [["U+1F9A0"], "🦠", "microbe"]]], ["plant-flower", [[["U+1F490"], "💐", "bouquet"], [["U+1F338"], "🌸", "cherry blossom"], [["U+1F4AE"], "💮", "white flower"], [["U+1F3F5"], "🏵", "rosette"], [["U+1F339"], "🌹", "rose"], [["U+1F940"], "🥀", "wilted flower"], [["U+1F33A"], "🌺", "hibiscus"], [["U+1F33B"], "🌻", "sunflower"], [["U+1F33C"], "🌼", "blossom"], [["U+1F337"], "🌷", "tulip"]]], ["plant-other", [[["U+1F331"], "🌱", "seedling"], [["U+1FAB4"], "🪴", "⊛ potted plant"], [["U+1F332"], "🌲", "evergreen tree"], [["U+1F333"], "🌳", "deciduous tree"], [["U+1F334"], "🌴", "palm tree"], [["U+1F335"], "🌵", "cactus"], [["U+1F33E"], "🌾", "sheaf of rice"], [["U+1F33F"], "🌿", "herb"], [["U+2618"], "☘", "shamrock"], [["U+1F340"], "🍀", "four leaf clover"], [["U+1F341"], "🍁", "maple leaf"], [["U+1F342"], "🍂", "fallen leaf"], [["U+1F343"], "🍃", "leaf fluttering in wind"]]]]], ["Food & Drink", [["food-fruit", [[["U+1F347"], "🍇", "grapes"], [["U+1F348"], "🍈", "melon"], [["U+1F349"], "🍉", "watermelon"], [["U+1F34A"], "🍊", "tangerine"], [["U+1F34B"], "🍋", "lemon"], [["U+1F34C"], "🍌", "banana"], [["U+1F34D"], "🍍", "pineapple"], [["U+1F96D"], "🥭", "mango"], [["U+1F34E"], "🍎", "red apple"], [["U+1F34F"], "🍏", "green apple"], [["U+1F350"], "🍐", "pear"], [["U+1F351"], "🍑", "peach"], [["U+1F352"], "🍒", "cherries"], [["U+1F353"], "🍓", "strawberry"], [["U+1FAD0"], "🫐", "⊛ blueberries"], [["U+1F95D"], "🥝", "kiwi fruit"], [["U+1F345"], "🍅", "tomato"], [["U+1FAD2"], "🫒", "⊛ olive"], [["U+1F965"], "🥥", "coconut"]]], ["food-vegetable", [[["U+1F951"], "🥑", "avocado"], [["U+1F346"], "🍆", "eggplant"], [["U+1F954"], "🥔", "potato"], [["U+1F955"], "🥕", "carrot"], [["U+1F33D"], "🌽", "ear of corn"], [["U+1F336"], "🌶", "hot pepper"], [["U+1F952"], "🥒", "cucumber"], [["U+1F96C"], "🥬", "leafy green"], [["U+1F966"], "🥦", "broccoli"], [["U+1F9C4"], "🧄", "garlic"], [["U+1F9C5"], "🧅", "onion"], [["U+1F344"], "🍄", "mushroom"], [["U+1F95C"], "🥜", "peanuts"], [["U+1F330"], "🌰", "chestnut"]]], ["food-prepared", [[["U+1F35E"], "🍞", "bread"], [["U+1F950"], "🥐", "croissant"], [["U+1F956"], "🥖", "baguette bread"], [["U+1FAD3"], "🫓", "⊛ flatbread"], [["U+1F968"], "🥨", "pretzel"], [["U+1F96F"], "🥯", "bagel"], [["U+1F95E"], "🥞", "pancakes"], [["U+1F9C7"], "🧇", "waffle"], [["U+1F9C0"], "🧀", "cheese wedge"], [["U+1F356"], "🍖", "meat on bone"], [["U+1F357"], "🍗", "poultry leg"], [["U+1F969"], "🥩", "cut of meat"], [["U+1F953"], "🥓", "bacon"], [["U+1F354"], "🍔", "hamburger"], [["U+1F35F"], "🍟", "french fries"], [["U+1F355"], "🍕", "pizza"], [["U+1F32D"], "🌭", "hot dog"], [["U+1F96A"], "🥪", "sandwich"], [["U+1F32E"], "🌮", "taco"], [["U+1F32F"], "🌯", "burrito"], [["U+1FAD4"], "🫔", "⊛ tamale"], [["U+1F959"], "🥙", "stuffed flatbread"], [["U+1F9C6"], "🧆", "falafel"], [["U+1F95A"], "🥚", "egg"], [["U+1F373"], "🍳", "cooking"], [["U+1F958"], "🥘", "shallow pan of food"], [["U+1F372"], "🍲", "pot of food"], [["U+1FAD5"], "🫕", "⊛ fondue"], [["U+1F963"], "🥣", "bowl with spoon"], [["U+1F957"], "🥗", "green salad"], [["U+1F37F"], "🍿", "popcorn"], [["U+1F9C8"], "🧈", "butter"], [["U+1F9C2"], "🧂", "salt"], [["U+1F96B"], "🥫", "canned food"]]], ["food-asian", [[["U+1F371"], "🍱", "bento box"], [["U+1F358"], "🍘", "rice cracker"], [["U+1F359"], "🍙", "rice ball"], [["U+1F35A"], "🍚", "cooked rice"], [["U+1F35B"], "🍛", "curry rice"], [["U+1F35C"], "🍜", "steaming bowl"], [["U+1F35D"], "🍝", "spaghetti"], [["U+1F360"], "🍠", "roasted sweet potato"], [["U+1F362"], "🍢", "oden"], [["U+1F363"], "🍣", "sushi"], [["U+1F364"], "🍤", "fried shrimp"], [["U+1F365"], "🍥", "fish cake with swirl"], [["U+1F96E"], "🥮", "moon cake"], [["U+1F361"], "🍡", "dango"], [["U+1F95F"], "🥟", "dumpling"], [["U+1F960"], "🥠", "fortune cookie"], [["U+1F961"], "🥡", "takeout box"]]], ["food-marine", [[["U+1F980"], "🦀", "crab"], [["U+1F99E"], "🦞", "lobster"], [["U+1F990"], "🦐", "shrimp"], [["U+1F991"], "🦑", "squid"], [["U+1F9AA"], "🦪", "oyster"]]], ["food-sweet", [[["U+1F366"], "🍦", "soft ice cream"], [["U+1F367"], "🍧", "shaved ice"], [["U+1F368"], "🍨", "ice cream"], [["U+1F369"], "🍩", "doughnut"], [["U+1F36A"], "🍪", "cookie"], [["U+1F382"], "🎂", "birthday cake"], [["U+1F370"], "🍰", "shortcake"], [["U+1F9C1"], "🧁", "cupcake"], [["U+1F967"], "🥧", "pie"], [["U+1F36B"], "🍫", "chocolate bar"], [["U+1F36C"], "🍬", "candy"], [["U+1F36D"], "🍭", "lollipop"], [["U+1F36E"], "🍮", "custard"], [["U+1F36F"], "🍯", "honey pot"]]], ["drink", [[["U+1F37C"], "🍼", "baby bottle"], [["U+1F95B"], "🥛", "glass of milk"], [["U+2615"], "☕", "hot beverage"], [["U+1F375"], "🍵", "teacup without handle"], [["U+1F376"], "🍶", "sake"], [["U+1F37E"], "🍾", "bottle with popping cork"], [["U+1F377"], "🍷", "wine glass"], [["U+1F378"], "🍸", "cocktail glass"], [["U+1F379"], "🍹", "tropical drink"], [["U+1F37A"], "🍺", "beer mug"], [["U+1F37B"], "🍻", "clinking beer mugs"], [["U+1F942"], "🥂", "clinking glasses"], [["U+1F943"], "🥃", "tumbler glass"], [["U+1F964"], "🥤", "cup with straw"], [["U+1F9CB"], "🧋", "⊛ bubble tea"], [["U+1F9C3"], "🧃", "beverage box"], [["U+1F9C9"], "🧉", "mate"], [["U+1F9CA"], "🧊", "ice"]]], ["dishware", [[["U+1F962"], "🥢", "chopsticks"], [["U+1F37D"], "🍽", "fork and knife with plate"], [["U+1F374"], "🍴", "fork and knife"], [["U+1F944"], "🥄", "spoon"], [["U+1F52A"], "🔪", "kitchen knife"], [["U+1F3FA"], "🏺", "amphora"]]]]], ["Travel & Places", [["place-map", [[["U+1F30D"], "🌍", "globe showing Europe-Africa"], [["U+1F30E"], "🌎", "globe showing Americas"], [["U+1F30F"], "🌏", "globe showing Asia-Australia"], [["U+1F310"], "🌐", "globe with meridians"], [["U+1F5FA"], "🗺", "world map"], [["U+1F5FE"], "🗾", "map of Japan"], [["U+1F9ED"], "🧭", "compass"]]], ["place-geographic", [[["U+1F3D4"], "🏔", "snow-capped mountain"], [["U+26F0"], "⛰", "mountain"], [["U+1F30B"], "🌋", "volcano"], [["U+1F5FB"], "🗻", "mount fuji"], [["U+1F3D5"], "🏕", "camping"], [["U+1F3D6"], "🏖", "beach with umbrella"], [["U+1F3DC"], "🏜", "desert"], [["U+1F3DD"], "🏝", "desert island"], [["U+1F3DE"], "🏞", "national park"]]], ["place-building", [[["U+1F3DF"], "🏟", "stadium"], [["U+1F3DB"], "🏛", "classical building"], [["U+1F3D7"], "🏗", "building construction"], [["U+1F9F1"], "🧱", "brick"], [["U+1FAA8"], "🪨", "⊛ rock"], [["U+1FAB5"], "🪵", "⊛ wood"], [["U+1F3D8"], "🏘", "houses"], [["U+1F3DA"], "🏚", "derelict house"], [["U+1F3E0"], "🏠", "house"], [["U+1F3E1"], "🏡", "house with garden"], [["U+1F3E2"], "🏢", "office building"], [["U+1F3E3"], "🏣", "Japanese post office"], [["U+1F3E4"], "🏤", "post office"], [["U+1F3E5"], "🏥", "hospital"], [["U+1F3E6"], "🏦", "bank"], [["U+1F3E8"], "🏨", "hotel"], [["U+1F3E9"], "🏩", "love hotel"], [["U+1F3EA"], "🏪", "convenience store"], [["U+1F3EB"], "🏫", "school"], [["U+1F3EC"], "🏬", "department store"], [["U+1F3ED"], "🏭", "factory"], [["U+1F3EF"], "🏯", "Japanese castle"], [["U+1F3F0"], "🏰", "castle"], [["U+1F492"], "💒", "wedding"], [["U+1F5FC"], "🗼", "Tokyo tower"], [["U+1F5FD"], "🗽", "Statue of Liberty"]]], ["place-religious", [[["U+26EA"], "⛪", "church"], [["U+1F54C"], "🕌", "mosque"], [["U+1F6D5"], "🛕", "hindu temple"], [["U+1F54D"], "🕍", "synagogue"], [["U+26E9"], "⛩", "shinto shrine"], [["U+1F54B"], "🕋", "kaaba"]]], ["place-other", [[["U+26F2"], "⛲", "fountain"], [["U+26FA"], "⛺", "tent"], [["U+1F301"], "🌁", "foggy"], [["U+1F303"], "🌃", "night with stars"], [["U+1F3D9"], "🏙", "cityscape"], [["U+1F304"], "🌄", "sunrise over mountains"], [["U+1F305"], "🌅", "sunrise"], [["U+1F306"], "🌆", "cityscape at dusk"], [["U+1F307"], "🌇", "sunset"], [["U+1F309"], "🌉", "bridge at night"], [["U+2668"], "♨", "hot springs"], [["U+1F3A0"], "🎠", "carousel horse"], [["U+1F3A1"], "🎡", "ferris wheel"], [["U+1F3A2"], "🎢", "roller coaster"], [["U+1F488"], "💈", "barber pole"], [["U+1F3AA"], "🎪", "circus tent"]]], ["transport-ground", [[["U+1F682"], "🚂", "locomotive"], [["U+1F683"], "🚃", "railway car"], [["U+1F684"], "🚄", "high-speed train"], [["U+1F685"], "🚅", "bullet train"], [["U+1F686"], "🚆", "train"], [["U+1F687"], "🚇", "metro"], [["U+1F688"], "🚈", "light rail"], [["U+1F689"], "🚉", "station"], [["U+1F68A"], "🚊", "tram"], [["U+1F69D"], "🚝", "monorail"], [["U+1F69E"], "🚞", "mountain railway"], [["U+1F68B"], "🚋", "tram car"], [["U+1F68C"], "🚌", "bus"], [["U+1F68D"], "🚍", "oncoming bus"], [["U+1F68E"], "🚎", "trolleybus"], [["U+1F690"], "🚐", "minibus"], [["U+1F691"], "🚑", "ambulance"], [["U+1F692"], "🚒", "fire engine"], [["U+1F693"], "🚓", "police car"], [["U+1F694"], "🚔", "oncoming police car"], [["U+1F695"], "🚕", "taxi"], [["U+1F696"], "🚖", "oncoming taxi"], [["U+1F697"], "🚗", "automobile"], [["U+1F698"], "🚘", "oncoming automobile"], [["U+1F699"], "🚙", "sport utility vehicle"], [["U+1F69A"], "🚚", "delivery truck"], [["U+1F69B"], "🚛", "articulated lorry"], [["U+1F69C"], "🚜", "tractor"], [["U+1F3CE"], "🏎", "racing car"], [["U+1F3CD"], "🏍", "motorcycle"], [["U+1F6F5"], "🛵", "motor scooter"], [["U+1F9BD"], "🦽", "manual wheelchair"], [["U+1F9BC"], "🦼", "motorized wheelchair"], [["U+1F6FA"], "🛺", "auto rickshaw"], [["U+1F6B2"], "🚲", "bicycle"], [["U+1F6F4"], "🛴", "kick scooter"], [["U+1F6F9"], "🛹", "skateboard"], [["U+1F6FC"], "🛼", "⊛ roller skate"], [["U+1F68F"], "🚏", "bus stop"], [["U+1F6E3"], "🛣", "motorway"], [["U+1F6E4"], "🛤", "railway track"], [["U+1F6E2"], "🛢", "oil drum"], [["U+26FD"], "⛽", "fuel pump"], [["U+1F6A8"], "🚨", "police car light"], [["U+1F6A5"], "🚥", "horizontal traffic light"], [["U+1F6A6"], "🚦", "vertical traffic light"], [["U+1F6D1"], "🛑", "stop sign"], [["U+1F6A7"], "🚧", "construction"]]], ["transport-water", [[["U+2693"], "⚓", "anchor"], [["U+26F5"], "⛵", "sailboat"], [["U+1F6F6"], "🛶", "canoe"], [["U+1F6A4"], "🚤", "speedboat"], [["U+1F6F3"], "🛳", "passenger ship"], [["U+26F4"], "⛴", "ferry"], [["U+1F6E5"], "🛥", "motor boat"], [["U+1F6A2"], "🚢", "ship"]]], ["transport-air", [[["U+2708"], "✈", "airplane"], [["U+1F6E9"], "🛩", "small airplane"], [["U+1F6EB"], "🛫", "airplane departure"], [["U+1F6EC"], "🛬", "airplane arrival"], [["U+1FA82"], "🪂", "parachute"], [["U+1F4BA"], "💺", "seat"], [["U+1F681"], "🚁", "helicopter"], [["U+1F69F"], "🚟", "suspension railway"], [["U+1F6A0"], "🚠", "mountain cableway"], [["U+1F6A1"], "🚡", "aerial tramway"], [["U+1F6F0"], "🛰", "satellite"], [["U+1F680"], "🚀", "rocket"], [["U+1F6F8"], "🛸", "flying saucer"]]], ["hotel", [[["U+1F6CE"], "🛎", "bellhop bell"], [["U+1F9F3"], "🧳", "luggage"]]], ["time", [[["U+231B"], "⌛", "hourglass done"], [["U+23F3"], "⏳", "hourglass not done"], [["U+231A"], "⌚", "watch"], [["U+23F0"], "⏰", "alarm clock"], [["U+23F1"], "⏱", "stopwatch"], [["U+23F2"], "⏲", "timer clock"], [["U+1F570"], "🕰", "mantelpiece clock"], [["U+1F55B"], "🕛", "twelve o’clock"], [["U+1F567"], "🕧", "twelve-thirty"], [["U+1F550"], "🕐", "one o’clock"], [["U+1F55C"], "🕜", "one-thirty"], [["U+1F551"], "🕑", "two o’clock"], [["U+1F55D"], "🕝", "two-thirty"], [["U+1F552"], "🕒", "three o’clock"], [["U+1F55E"], "🕞", "three-thirty"], [["U+1F553"], "🕓", "four o’clock"], [["U+1F55F"], "🕟", "four-thirty"], [["U+1F554"], "🕔", "five o’clock"], [["U+1F560"], "🕠", "five-thirty"], [["U+1F555"], "🕕", "six o’clock"], [["U+1F561"], "🕡", "six-thirty"], [["U+1F556"], "🕖", "seven o’clock"], [["U+1F562"], "🕢", "seven-thirty"], [["U+1F557"], "🕗", "eight o’clock"], [["U+1F563"], "🕣", "eight-thirty"], [["U+1F558"], "🕘", "nine o’clock"], [["U+1F564"], "🕤", "nine-thirty"], [["U+1F559"], "🕙", "ten o’clock"], [["U+1F565"], "🕥", "ten-thirty"], [["U+1F55A"], "🕚", "eleven o’clock"], [["U+1F566"], "🕦", "eleven-thirty"]]], ["sky & weather", [[["U+1F311"], "🌑", "new moon"], [["U+1F312"], "🌒", "waxing crescent moon"], [["U+1F313"], "🌓", "first quarter moon"], [["U+1F314"], "🌔", "waxing gibbous moon"], [["U+1F315"], "🌕", "full moon"], [["U+1F316"], "🌖", "waning gibbous moon"], [["U+1F317"], "🌗", "last quarter moon"], [["U+1F318"], "🌘", "waning crescent moon"], [["U+1F319"], "🌙", "crescent moon"], [["U+1F31A"], "🌚", "new moon face"], [["U+1F31B"], "🌛", "first quarter moon face"], [["U+1F31C"], "🌜", "last quarter moon face"], [["U+1F321"], "🌡", "thermometer"], [["U+2600"], "☀", "sun"], [["U+1F31D"], "🌝", "full moon face"], [["U+1F31E"], "🌞", "sun with face"], [["U+1FA90"], "🪐", "ringed planet"], [["U+2B50"], "⭐", "star"], [["U+1F31F"], "🌟", "glowing star"], [["U+1F320"], "🌠", "shooting star"], [["U+1F30C"], "🌌", "milky way"], [["U+2601"], "☁", "cloud"], [["U+26C5"], "⛅", "sun behind cloud"], [["U+26C8"], "⛈", "cloud with lightning and rain"], [["U+1F324"], "🌤", "sun behind small cloud"], [["U+1F325"], "🌥", "sun behind large cloud"], [["U+1F326"], "🌦", "sun behind rain cloud"], [["U+1F327"], "🌧", "cloud with rain"], [["U+1F328"], "🌨", "cloud with snow"], [["U+1F329"], "🌩", "cloud with lightning"], [["U+1F32A"], "🌪", "tornado"], [["U+1F32B"], "🌫", "fog"], [["U+1F32C"], "🌬", "wind face"], [["U+1F300"], "🌀", "cyclone"], [["U+1F308"], "🌈", "rainbow"], [["U+1F302"], "🌂", "closed umbrella"], [["U+2602"], "☂", "umbrella"], [["U+2614"], "☔", "umbrella with rain drops"], [["U+26F1"], "⛱", "umbrella on ground"], [["U+26A1"], "⚡", "high voltage"], [["U+2744"], "❄", "snowflake"], [["U+2603"], "☃", "snowman"], [["U+26C4"], "⛄", "snowman without snow"], [["U+2604"], "☄", "comet"], [["U+1F525"], "🔥", "fire"], [["U+1F4A7"], "💧", "droplet"], [["U+1F30A"], "🌊", "water wave"]]]]], ["Activities", [["event", [[["U+1F383"], "🎃", "jack-o-lantern"], [["U+1F384"], "🎄", "Christmas tree"], [["U+1F386"], "🎆", "fireworks"], [["U+1F387"], "🎇", "sparkler"], [["U+1F9E8"], "🧨", "firecracker"], [["U+2728"], "✨", "sparkles"], [["U+1F388"], "🎈", "balloon"], [["U+1F389"], "🎉", "party popper"], [["U+1F38A"], "🎊", "confetti ball"], [["U+1F38B"], "🎋", "tanabata tree"], [["U+1F38D"], "🎍", "pine decoration"], [["U+1F38E"], "🎎", "Japanese dolls"], [["U+1F38F"], "🎏", "carp streamer"], [["U+1F390"], "🎐", "wind chime"], [["U+1F391"], "🎑", "moon viewing ceremony"], [["U+1F9E7"], "🧧", "red envelope"], [["U+1F380"], "🎀", "ribbon"], [["U+1F381"], "🎁", "wrapped gift"], [["U+1F397"], "🎗", "reminder ribbon"], [["U+1F39F"], "🎟", "admission tickets"], [["U+1F3AB"], "🎫", "ticket"]]], ["award-medal", [[["U+1F396"], "🎖", "military medal"], [["U+1F3C6"], "🏆", "trophy"], [["U+1F3C5"], "🏅", "sports medal"], [["U+1F947"], "🥇", "1st place medal"], [["U+1F948"], "🥈", "2nd place medal"], [["U+1F949"], "🥉", "3rd place medal"]]], ["sport", [[["U+26BD"], "⚽", "soccer ball"], [["U+26BE"], "⚾", "baseball"], [["U+1F94E"], "🥎", "softball"], [["U+1F3C0"], "🏀", "basketball"], [["U+1F3D0"], "🏐", "volleyball"], [["U+1F3C8"], "🏈", "american football"], [["U+1F3C9"], "🏉", "rugby football"], [["U+1F3BE"], "🎾", "tennis"], [["U+1F94F"], "🥏", "flying disc"], [["U+1F3B3"], "🎳", "bowling"], [["U+1F3CF"], "🏏", "cricket game"], [["U+1F3D1"], "🏑", "field hockey"], [["U+1F3D2"], "🏒", "ice hockey"], [["U+1F94D"], "🥍", "lacrosse"], [["U+1F3D3"], "🏓", "ping pong"], [["U+1F3F8"], "🏸", "badminton"], [["U+1F94A"], "🥊", "boxing glove"], [["U+1F94B"], "🥋", "martial arts uniform"], [["U+1F945"], "🥅", "goal net"], [["U+26F3"], "⛳", "flag in hole"], [["U+26F8"], "⛸", "ice skate"], [["U+1F3A3"], "🎣", "fishing pole"], [["U+1F93F"], "🤿", "diving mask"], [["U+1F3BD"], "🎽", "running shirt"], [["U+1F3BF"], "🎿", "skis"], [["U+1F6F7"], "🛷", "sled"], [["U+1F94C"], "🥌", "curling stone"]]], ["game", [[["U+1F3AF"], "🎯", "direct hit"], [["U+1FA80"], "🪀", "yo-yo"], [["U+1FA81"], "🪁", "kite"], [["U+1F3B1"], "🎱", "pool 8 ball"], [["U+1F52E"], "🔮", "crystal ball"], [["U+1FA84"], "🪄", "⊛ magic wand"], [["U+1F9FF"], "🧿", "nazar amulet"], [["U+1F3AE"], "🎮", "video game"], [["U+1F579"], "🕹", "joystick"], [["U+1F3B0"], "🎰", "slot machine"], [["U+1F3B2"], "🎲", "game die"], [["U+1F9E9"], "🧩", "puzzle piece"], [["U+1F9F8"], "🧸", "teddy bear"], [["U+1FA85"], "🪅", "⊛ piñata"], [["U+1FA86"], "🪆", "⊛ nesting dolls"], [["U+2660"], "♠", "spade suit"], [["U+2665"], "♥", "heart suit"], [["U+2666"], "♦", "diamond suit"], [["U+2663"], "♣", "club suit"], [["U+265F"], "♟", "chess pawn"], [["U+1F0CF"], "🃏", "joker"], [["U+1F004"], "🀄", "mahjong red dragon"], [["U+1F3B4"], "🎴", "flower playing cards"]]], ["arts & crafts", [[["U+1F3AD"], "🎭", "performing arts"], [["U+1F5BC"], "🖼", "framed picture"], [["U+1F3A8"], "🎨", "artist palette"], [["U+1F9F5"], "🧵", "thread"], [["U+1FAA1"], "🪡", "⊛ sewing needle"], [["U+1F9F6"], "🧶", "yarn"], [["U+1FAA2"], "🪢", "⊛ knot"]]]]], ["Objects", [["clothing", [[["U+1F453"], "👓", "glasses"], [["U+1F576"], "🕶", "sunglasses"], [["U+1F97D"], "🥽", "goggles"], [["U+1F97C"], "🥼", "lab coat"], [["U+1F9BA"], "🦺", "safety vest"], [["U+1F454"], "👔", "necktie"], [["U+1F455"], "👕", "t-shirt"], [["U+1F456"], "👖", "jeans"], [["U+1F9E3"], "🧣", "scarf"], [["U+1F9E4"], "🧤", "gloves"], [["U+1F9E5"], "🧥", "coat"], [["U+1F9E6"], "🧦", "socks"], [["U+1F457"], "👗", "dress"], [["U+1F458"], "👘", "kimono"], [["U+1F97B"], "🥻", "sari"], [["U+1FA71"], "🩱", "one-piece swimsuit"], [["U+1FA72"], "🩲", "briefs"], [["U+1FA73"], "🩳", "shorts"], [["U+1F459"], "👙", "bikini"], [["U+1F45A"], "👚", "woman’s clothes"], [["U+1F45B"], "👛", "purse"], [["U+1F45C"], "👜", "handbag"], [["U+1F45D"], "👝", "clutch bag"], [["U+1F6CD"], "🛍", "shopping bags"], [["U+1F392"], "🎒", "backpack"], [["U+1FA74"], "🩴", "⊛ thong sandal"], [["U+1F45E"], "👞", "man’s shoe"], [["U+1F45F"], "👟", "running shoe"], [["U+1F97E"], "🥾", "hiking boot"], [["U+1F97F"], "🥿", "flat shoe"], [["U+1F460"], "👠", "high-heeled shoe"], [["U+1F461"], "👡", "woman’s sandal"], [["U+1FA70"], "🩰", "ballet shoes"], [["U+1F462"], "👢", "woman’s boot"], [["U+1F451"], "👑", "crown"], [["U+1F452"], "👒", "woman’s hat"], [["U+1F3A9"], "🎩", "top hat"], [["U+1F393"], "🎓", "graduation cap"], [["U+1F9E2"], "🧢", "billed cap"], [["U+1FA96"], "🪖", "⊛ military helmet"], [["U+26D1"], "⛑", "rescue worker’s helmet"], [["U+1F4FF"], "📿", "prayer beads"], [["U+1F484"], "💄", "lipstick"], [["U+1F48D"], "💍", "ring"], [["U+1F48E"], "💎", "gem stone"]]], ["sound", [[["U+1F507"], "🔇", "muted speaker"], [["U+1F508"], "🔈", "speaker low volume"], [["U+1F509"], "🔉", "speaker medium volume"], [["U+1F50A"], "🔊", "speaker high volume"], [["U+1F4E2"], "📢", "loudspeaker"], [["U+1F4E3"], "📣", "megaphone"], [["U+1F4EF"], "📯", "postal horn"], [["U+1F514"], "🔔", "bell"], [["U+1F515"], "🔕", "bell with slash"]]], ["music", [[["U+1F3BC"], "🎼", "musical score"], [["U+1F3B5"], "🎵", "musical note"], [["U+1F3B6"], "🎶", "musical notes"], [["U+1F399"], "🎙", "studio microphone"], [["U+1F39A"], "🎚", "level slider"], [["U+1F39B"], "🎛", "control knobs"], [["U+1F3A4"], "🎤", "microphone"], [["U+1F3A7"], "🎧", "headphone"], [["U+1F4FB"], "📻", "radio"]]], ["musical-instrument", [[["U+1F3B7"], "🎷", "saxophone"], [["U+1FA97"], "🪗", "⊛ accordion"], [["U+1F3B8"], "🎸", "guitar"], [["U+1F3B9"], "🎹", "musical keyboard"], [["U+1F3BA"], "🎺", "trumpet"], [["U+1F3BB"], "🎻", "violin"], [["U+1FA95"], "🪕", "banjo"], [["U+1F941"], "🥁", "drum"], [["U+1FA98"], "🪘", "⊛ long drum"]]], ["phone", [[["U+1F4F1"], "📱", "mobile phone"], [["U+1F4F2"], "📲", "mobile phone with arrow"], [["U+260E"], "☎", "telephone"], [["U+1F4DE"], "📞", "telephone receiver"], [["U+1F4DF"], "📟", "pager"], [["U+1F4E0"], "📠", "fax machine"]]], ["computer", [[["U+1F50B"], "🔋", "battery"], [["U+1F50C"], "🔌", "electric plug"], [["U+1F4BB"], "💻", "laptop"], [["U+1F5A5"], "🖥", "desktop computer"], [["U+1F5A8"], "🖨", "printer"], [["U+2328"], "⌨", "keyboard"], [["U+1F5B1"], "🖱", "computer mouse"], [["U+1F5B2"], "🖲", "trackball"], [["U+1F4BD"], "💽", "computer disk"], [["U+1F4BE"], "💾", "floppy disk"], [["U+1F4BF"], "💿", "optical disk"], [["U+1F4C0"], "📀", "dvd"], [["U+1F9EE"], "🧮", "abacus"]]], ["light & video", [[["U+1F3A5"], "🎥", "movie camera"], [["U+1F39E"], "🎞", "film frames"], [["U+1F4FD"], "📽", "film projector"], [["U+1F3AC"], "🎬", "clapper board"], [["U+1F4FA"], "📺", "television"], [["U+1F4F7"], "📷", "camera"], [["U+1F4F8"], "📸", "camera with flash"], [["U+1F4F9"], "📹", "video camera"], [["U+1F4FC"], "📼", "videocassette"], [["U+1F50D"], "🔍", "magnifying glass tilted left"], [["U+1F50E"], "🔎", "magnifying glass tilted right"], [["U+1F56F"], "🕯", "candle"], [["U+1F4A1"], "💡", "light bulb"], [["U+1F526"], "🔦", "flashlight"], [["U+1F3EE"], "🏮", "red paper lantern"], [["U+1FA94"], "🪔", "diya lamp"]]], ["book-paper", [[["U+1F4D4"], "📔", "notebook with decorative cover"], [["U+1F4D5"], "📕", "closed book"], [["U+1F4D6"], "📖", "open book"], [["U+1F4D7"], "📗", "green book"], [["U+1F4D8"], "📘", "blue book"], [["U+1F4D9"], "📙", "orange book"], [["U+1F4DA"], "📚", "books"], [["U+1F4D3"], "📓", "notebook"], [["U+1F4D2"], "📒", "ledger"], [["U+1F4C3"], "📃", "page with curl"], [["U+1F4DC"], "📜", "scroll"], [["U+1F4C4"], "📄", "page facing up"], [["U+1F4F0"], "📰", "newspaper"], [["U+1F5DE"], "🗞", "rolled-up newspaper"], [["U+1F4D1"], "📑", "bookmark tabs"], [["U+1F516"], "🔖", "bookmark"], [["U+1F3F7"], "🏷", "label"]]], ["money", [[["U+1F4B0"], "💰", "money bag"], [["U+1FA99"], "🪙", "⊛ coin"], [["U+1F4B4"], "💴", "yen banknote"], [["U+1F4B5"], "💵", "dollar banknote"], [["U+1F4B6"], "💶", "euro banknote"], [["U+1F4B7"], "💷", "pound banknote"], [["U+1F4B8"], "💸", "money with wings"], [["U+1F4B3"], "💳", "credit card"], [["U+1F9FE"], "🧾", "receipt"], [["U+1F4B9"], "💹", "chart increasing with yen"]]], ["mail", [[["U+2709"], "✉", "envelope"], [["U+1F4E7"], "📧", "e-mail"], [["U+1F4E8"], "📨", "incoming envelope"], [["U+1F4E9"], "📩", "envelope with arrow"], [["U+1F4E4"], "📤", "outbox tray"], [["U+1F4E5"], "📥", "inbox tray"], [["U+1F4E6"], "📦", "package"], [["U+1F4EB"], "📫", "closed mailbox with raised flag"], [["U+1F4EA"], "📪", "closed mailbox with lowered flag"], [["U+1F4EC"], "📬", "open mailbox with raised flag"], [["U+1F4ED"], "📭", "open mailbox with lowered flag"], [["U+1F4EE"], "📮", "postbox"], [["U+1F5F3"], "🗳", "ballot box with ballot"]]], ["writing", [[["U+270F"], "✏", "pencil"], [["U+2712"], "✒", "black nib"], [["U+1F58B"], "🖋", "fountain pen"], [["U+1F58A"], "🖊", "pen"], [["U+1F58C"], "🖌", "paintbrush"], [["U+1F58D"], "🖍", "crayon"], [["U+1F4DD"], "📝", "memo"]]], ["office", [[["U+1F4BC"], "💼", "briefcase"], [["U+1F4C1"], "📁", "file folder"], [["U+1F4C2"], "📂", "open file folder"], [["U+1F5C2"], "🗂", "card index dividers"], [["U+1F4C5"], "📅", "calendar"], [["U+1F4C6"], "📆", "tear-off calendar"], [["U+1F5D2"], "🗒", "spiral notepad"], [["U+1F5D3"], "🗓", "spiral calendar"], [["U+1F4C7"], "📇", "card index"], [["U+1F4C8"], "📈", "chart increasing"], [["U+1F4C9"], "📉", "chart decreasing"], [["U+1F4CA"], "📊", "bar chart"], [["U+1F4CB"], "📋", "clipboard"], [["U+1F4CC"], "📌", "pushpin"], [["U+1F4CD"], "📍", "round pushpin"], [["U+1F4CE"], "📎", "paperclip"], [["U+1F587"], "🖇", "linked paperclips"], [["U+1F4CF"], "📏", "straight ruler"], [["U+1F4D0"], "📐", "triangular ruler"], [["U+2702"], "✂", "scissors"], [["U+1F5C3"], "🗃", "card file box"], [["U+1F5C4"], "🗄", "file cabinet"], [["U+1F5D1"], "🗑", "wastebasket"]]], ["lock", [[["U+1F512"], "🔒", "locked"], [["U+1F513"], "🔓", "unlocked"], [["U+1F50F"], "🔏", "locked with pen"], [["U+1F510"], "🔐", "locked with key"], [["U+1F511"], "🔑", "key"], [["U+1F5DD"], "🗝", "old key"]]], ["tool", [[["U+1F528"], "🔨", "hammer"], [["U+1FA93"], "🪓", "axe"], [["U+26CF"], "⛏", "pick"], [["U+2692"], "⚒", "hammer and pick"], [["U+1F6E0"], "🛠", "hammer and wrench"], [["U+1F5E1"], "🗡", "dagger"], [["U+2694"], "⚔", "crossed swords"], [["U+1F52B"], "🔫", "pistol"], [["U+1FA83"], "🪃", "⊛ boomerang"], [["U+1F3F9"], "🏹", "bow and arrow"], [["U+1F6E1"], "🛡", "shield"], [["U+1F527"], "🔧", "wrench"], [["U+1FA9B"], "🪛", "⊛ screwdriver"], [["U+1F529"], "🔩", "nut and bolt"], [["U+2699"], "⚙", "gear"], [["U+1F5DC"], "🗜", "clamp"], [["U+2696"], "⚖", "balance scale"], [["U+1F9AF"], "🦯", "white cane"], [["U+1F517"], "🔗", "link"], [["U+26D3"], "⛓", "chains"], [["U+1FA9D"], "🪝", "⊛ hook"], [["U+1F9F0"], "🧰", "toolbox"], [["U+1F9F2"], "🧲", "magnet"], [["U+1FA9C"], "🪜", "⊛ ladder"]]], ["science", [[["U+2697"], "⚗", "alembic"], [["U+1F9EA"], "🧪", "test tube"], [["U+1F9EB"], "🧫", "petri dish"], [["U+1F9EC"], "🧬", "dna"], [["U+1F52C"], "🔬", "microscope"], [["U+1F52D"], "🔭", "telescope"], [["U+1F4E1"], "📡", "satellite antenna"]]], ["medical", [[["U+1F489"], "💉", "syringe"], [["U+1FA78"], "🩸", "drop of blood"], [["U+1F48A"], "💊", "pill"], [["U+1FA79"], "🩹", "adhesive bandage"], [["U+1FA7A"], "🩺", "stethoscope"]]], ["household", [[["U+1F6AA"], "🚪", "door"], [["U+1F6D7"], "🛗", "⊛ elevator"], [["U+1F6CF"], "🛏", "bed"], [["U+1F6CB"], "🛋", "couch and lamp"], [["U+1FA91"], "🪑", "chair"], [["U+1F6BD"], "🚽", "toilet"], [["U+1FAA0"], "🪠", "⊛ plunger"], [["U+1F6BF"], "🚿", "shower"], [["U+1F6C1"], "🛁", "bathtub"], [["U+1FA92"], "🪒", "razor"], [["U+1F9F4"], "🧴", "lotion bottle"], [["U+1F9F7"], "🧷", "safety pin"], [["U+1F9F9"], "🧹", "broom"], [["U+1F9FA"], "🧺", "basket"], [["U+1F9FB"], "🧻", "roll of paper"], [["U+1FAA3"], "🪣", "⊛ bucket"], [["U+1F9FC"], "🧼", "soap"], [["U+1FAA5"], "🪥", "⊛ toothbrush"], [["U+1F9FD"], "🧽", "sponge"], [["U+1F9EF"], "🧯", "fire extinguisher"], [["U+1F6D2"], "🛒", "shopping cart"]]], ["other-object", [[["U+1F6AC"], "🚬", "cigarette"], [["U+26B0"], "⚰", "coffin"], [["U+26B1"], "⚱", "funeral urn"], [["U+1F5FF"], "🗿", "moai"], [["U+1FAA7"], "🪧", "⊛ placard"]]]]], ["Symbols", [["transport-sign", [[["U+1F3E7"], "🏧", "ATM sign"], [["U+1F6AE"], "🚮", "litter in bin sign"], [["U+1F6B0"], "🚰", "potable water"], [["U+267F"], "♿", "wheelchair symbol"], [["U+1F6B9"], "🚹", "men’s room"], [["U+1F6BA"], "🚺", "women’s room"], [["U+1F6BB"], "🚻", "restroom"], [["U+1F6BC"], "🚼", "baby symbol"], [["U+1F6BE"], "🚾", "water closet"], [["U+1F6C2"], "🛂", "passport control"], [["U+1F6C3"], "🛃", "customs"], [["U+1F6C4"], "🛄", "baggage claim"], [["U+1F6C5"], "🛅", "left luggage"]]], ["warning", [[["U+26A0"], "⚠", "warning"], [["U+1F6B8"], "🚸", "children crossing"], [["U+26D4"], "⛔", "no entry"], [["U+1F6AB"], "🚫", "prohibited"], [["U+1F6B3"], "🚳", "no bicycles"], [["U+1F6AD"], "🚭", "no smoking"], [["U+1F6AF"], "🚯", "no littering"], [["U+1F6B1"], "🚱", "non-potable water"], [["U+1F6B7"], "🚷", "no pedestrians"], [["U+1F4F5"], "📵", "no mobile phones"], [["U+1F51E"], "🔞", "no one under eighteen"], [["U+2622"], "☢", "radioactive"], [["U+2623"], "☣", "biohazard"]]], ["arrow", [[["U+2B06"], "⬆", "up arrow"], [["U+2197"], "↗", "up-right arrow"], [["U+27A1"], "➡", "right arrow"], [["U+2198"], "↘", "down-right arrow"], [["U+2B07"], "⬇", "down arrow"], [["U+2199"], "↙", "down-left arrow"], [["U+2B05"], "⬅", "left arrow"], [["U+2196"], "↖", "up-left arrow"], [["U+2195"], "↕", "up-down arrow"], [["U+2194"], "↔", "left-right arrow"], [["U+21A9"], "↩", "right arrow curving left"], [["U+21AA"], "↪", "left arrow curving right"], [["U+2934"], "⤴", "right arrow curving up"], [["U+2935"], "⤵", "right arrow curving down"], [["U+1F503"], "🔃", "clockwise vertical arrows"], [["U+1F504"], "🔄", "counterclockwise arrows button"], [["U+1F519"], "🔙", "BACK arrow"], [["U+1F51A"], "🔚", "END arrow"], [["U+1F51B"], "🔛", "ON! arrow"], [["U+1F51C"], "🔜", "SOON arrow"], [["U+1F51D"], "🔝", "TOP arrow"]]], ["religion", [[["U+1F6D0"], "🛐", "place of worship"], [["U+269B"], "⚛", "atom symbol"], [["U+1F549"], "🕉", "om"], [["U+2721"], "✡", "star of David"], [["U+2638"], "☸", "wheel of dharma"], [["U+262F"], "☯", "yin yang"], [["U+271D"], "✝", "latin cross"], [["U+2626"], "☦", "orthodox cross"], [["U+262A"], "☪", "star and crescent"], [["U+262E"], "☮", "peace symbol"], [["U+1F54E"], "🕎", "menorah"], [["U+1F52F"], "🔯", "dotted six-pointed star"]]], ["zodiac", [[["U+2648"], "♈", "Aries"], [["U+2649"], "♉", "Taurus"], [["U+264A"], "♊", "Gemini"], [["U+264B"], "♋", "Cancer"], [["U+264C"], "♌", "Leo"], [["U+264D"], "♍", "Virgo"], [["U+264E"], "♎", "Libra"], [["U+264F"], "♏", "Scorpio"], [["U+2650"], "♐", "Sagittarius"], [["U+2651"], "♑", "Capricorn"], [["U+2652"], "♒", "Aquarius"], [["U+2653"], "♓", "Pisces"], [["U+26CE"], "⛎", "Ophiuchus"]]], ["av-symbol", [[["U+1F500"], "🔀", "shuffle tracks button"], [["U+1F501"], "🔁", "repeat button"], [["U+1F502"], "🔂", "repeat single button"], [["U+25B6"], "▶", "play button"], [["U+23E9"], "⏩", "fast-forward button"], [["U+23ED"], "⏭", "next track button"], [["U+23EF"], "⏯", "play or pause button"], [["U+25C0"], "◀", "reverse button"], [["U+23EA"], "⏪", "fast reverse button"], [["U+23EE"], "⏮", "last track button"], [["U+1F53C"], "🔼", "upwards button"], [["U+23EB"], "⏫", "fast up button"], [["U+1F53D"], "🔽", "downwards button"], [["U+23EC"], "⏬", "fast down button"], [["U+23F8"], "⏸", "pause button"], [["U+23F9"], "⏹", "stop button"], [["U+23FA"], "⏺", "record button"], [["U+23CF"], "⏏", "eject button"], [["U+1F3A6"], "🎦", "cinema"], [["U+1F505"], "🔅", "dim button"], [["U+1F506"], "🔆", "bright button"], [["U+1F4F6"], "📶", "antenna bars"], [["U+1F4F3"], "📳", "vibration mode"], [["U+1F4F4"], "📴", "mobile phone off"]]], ["gender", [[["U+2640"], "♀", "female sign"], [["U+2642"], "♂", "male sign"], [["U+26A7"], "⚧", "⊛ transgender symbol"]]], ["math", [[["U+2716"], "✖", "multiply"], [["U+2795"], "➕", "plus"], [["U+2796"], "➖", "minus"], [["U+2797"], "➗", "divide"], [["U+267E"], "♾", "infinity"]]], ["punctuation", [[["U+203C"], "‼", "double exclamation mark"], [["U+2049"], "⁉", "exclamation question mark"], [["U+2753"], "❓", "question mark"], [["U+2754"], "❔", "white question mark"], [["U+2755"], "❕", "white exclamation mark"], [["U+2757"], "❗", "exclamation mark"], [["U+3030"], "〰", "wavy dash"]]], ["currency", [[["U+1F4B1"], "💱", "currency exchange"], [["U+1F4B2"], "💲", "heavy dollar sign"]]], ["other-symbol", [[["U+2695"], "⚕", "medical symbol"], [["U+267B"], "♻", "recycling symbol"], [["U+269C"], "⚜", "fleur-de-lis"], [["U+1F531"], "🔱", "trident emblem"], [["U+1F4DB"], "📛", "name badge"], [["U+1F530"], "🔰", "Japanese symbol for beginner"], [["U+2B55"], "⭕", "hollow red circle"], [["U+2705"], "✅", "check mark button"], [["U+2611"], "☑", "check box with check"], [["U+2714"], "✔", "check mark"], [["U+274C"], "❌", "cross mark"], [["U+274E"], "❎", "cross mark button"], [["U+27B0"], "➰", "curly loop"], [["U+27BF"], "➿", "double curly loop"], [["U+303D"], "〽", "part alternation mark"], [["U+2733"], "✳", "eight-spoked asterisk"], [["U+2734"], "✴", "eight-pointed star"], [["U+2747"], "❇", "sparkle"], [["U+00A9"], "©", "copyright"], [["U+00AE"], "®", "registered"], [["U+2122"], "™", "trade mark"]]], ["keycap", [[["U+0023", "U+FE0F", "U+20E3"], "#️⃣", "keycap: #"], [["U+002A", "U+FE0F", "U+20E3"], "*️⃣", "keycap: *"], [["U+0030", "U+FE0F", "U+20E3"], "0️⃣", "keycap: 0"], [["U+0031", "U+FE0F", "U+20E3"], "1️⃣", "keycap: 1"], [["U+0032", "U+FE0F", "U+20E3"], "2️⃣", "keycap: 2"], [["U+0033", "U+FE0F", "U+20E3"], "3️⃣", "keycap: 3"], [["U+0034", "U+FE0F", "U+20E3"], "4️⃣", "keycap: 4"], [["U+0035", "U+FE0F", "U+20E3"], "5️⃣", "keycap: 5"], [["U+0036", "U+FE0F", "U+20E3"], "6️⃣", "keycap: 6"], [["U+0037", "U+FE0F", "U+20E3"], "7️⃣", "keycap: 7"], [["U+0038", "U+FE0F", "U+20E3"], "8️⃣", "keycap: 8"], [["U+0039", "U+FE0F", "U+20E3"], "9️⃣", "keycap: 9"], [["U+1F51F"], "🔟", "keycap: 10"]]], ["alphanum", [[["U+1F520"], "🔠", "input latin uppercase"], [["U+1F521"], "🔡", "input latin lowercase"], [["U+1F522"], "🔢", "input numbers"], [["U+1F523"], "🔣", "input symbols"], [["U+1F524"], "🔤", "input latin letters"], [["U+1F170"], "🅰", "A button (blood type)"], [["U+1F18E"], "🆎", "AB button (blood type)"], [["U+1F171"], "🅱", "B button (blood type)"], [["U+1F191"], "🆑", "CL button"], [["U+1F192"], "🆒", "COOL button"], [["U+1F193"], "🆓", "FREE button"], [["U+2139"], "ℹ", "information"], [["U+1F194"], "🆔", "ID button"], [["U+24C2"], "Ⓜ", "circled M"], [["U+1F195"], "🆕", "NEW button"], [["U+1F196"], "🆖", "NG button"], [["U+1F17E"], "🅾", "O button (blood type)"], [["U+1F197"], "🆗", "OK button"], [["U+1F17F"], "🅿", "P button"], [["U+1F198"], "🆘", "SOS button"], [["U+1F199"], "🆙", "UP! button"], [["U+1F19A"], "🆚", "VS button"], [["U+1F201"], "🈁", "Japanese “here” button"], [["U+1F202"], "🈂", "Japanese “service charge” button"], [["U+1F237"], "🈷", "Japanese “monthly amount” button"], [["U+1F236"], "🈶", "Japanese “not free of charge” button"], [["U+1F22F"], "🈯", "Japanese “reserved” button"], [["U+1F250"], "🉐", "Japanese “bargain” button"], [["U+1F239"], "🈹", "Japanese “discount” button"], [["U+1F21A"], "🈚", "Japanese “free of charge” button"], [["U+1F232"], "🈲", "Japanese “prohibited” button"], [["U+1F251"], "🉑", "Japanese “acceptable” button"], [["U+1F238"], "🈸", "Japanese “application” button"], [["U+1F234"], "🈴", "Japanese “passing grade” button"], [["U+1F233"], "🈳", "Japanese “vacancy” button"], [["U+3297"], "㊗", "Japanese “congratulations” button"], [["U+3299"], "㊙", "Japanese “secret” button"], [["U+1F23A"], "🈺", "Japanese “open for business” button"], [["U+1F235"], "🈵", "Japanese “no vacancy” button"]]], ["geometric", [[["U+1F534"], "🔴", "red circle"], [["U+1F7E0"], "🟠", "orange circle"], [["U+1F7E1"], "🟡", "yellow circle"], [["U+1F7E2"], "🟢", "green circle"], [["U+1F535"], "🔵", "blue circle"], [["U+1F7E3"], "🟣", "purple circle"], [["U+1F7E4"], "🟤", "brown circle"], [["U+26AB"], "⚫", "black circle"], [["U+26AA"], "⚪", "white circle"], [["U+1F7E5"], "🟥", "red square"], [["U+1F7E7"], "🟧", "orange square"], [["U+1F7E8"], "🟨", "yellow square"], [["U+1F7E9"], "🟩", "green square"], [["U+1F7E6"], "🟦", "blue square"], [["U+1F7EA"], "🟪", "purple square"], [["U+1F7EB"], "🟫", "brown square"], [["U+2B1B"], "⬛", "black large square"], [["U+2B1C"], "⬜", "white large square"], [["U+25FC"], "◼", "black medium square"], [["U+25FB"], "◻", "white medium square"], [["U+25FE"], "◾", "black medium-small square"], [["U+25FD"], "◽", "white medium-small square"], [["U+25AA"], "▪", "black small square"], [["U+25AB"], "▫", "white small square"], [["U+1F536"], "🔶", "large orange diamond"], [["U+1F537"], "🔷", "large blue diamond"], [["U+1F538"], "🔸", "small orange diamond"], [["U+1F539"], "🔹", "small blue diamond"], [["U+1F53A"], "🔺", "red triangle pointed up"], [["U+1F53B"], "🔻", "red triangle pointed down"], [["U+1F4A0"], "💠", "diamond with a dot"], [["U+1F518"], "🔘", "radio button"], [["U+1F533"], "🔳", "white square button"], [["U+1F532"], "🔲", "black square button"]]]]], ["Flags", [["flag", [[["U+1F3C1"], "🏁", "chequered flag"], [["U+1F6A9"], "🚩", "triangular flag"], [["U+1F38C"], "🎌", "crossed flags"], [["U+1F3F4"], "🏴", "black flag"], [["U+1F3F3"], "🏳", "white flag"], [["U+1F3F3", "U+FE0F", "U+200D", "U+1F308"], "🏳️‍🌈", "rainbow flag"], [["U+1F3F3", "U+FE0F", "U+200D", "U+26A7", "U+FE0F"], "🏳️‍⚧️", "⊛ transgender flag"], [["U+1F3F4", "U+200D", "U+2620", "U+FE0F"], "🏴‍☠️", "pirate flag"]]], ["country-flag", [[["U+1F1E6", "U+1F1E8"], "🇦🇨", "flag: Ascension Island"], [["U+1F1E6", "U+1F1E9"], "🇦🇩", "flag: Andorra"], [["U+1F1E6", "U+1F1EA"], "🇦🇪", "flag: United Arab Emirates"], [["U+1F1E6", "U+1F1EB"], "🇦🇫", "flag: Afghanistan"], [["U+1F1E6", "U+1F1EC"], "🇦🇬", "flag: Antigua & Barbuda"], [["U+1F1E6", "U+1F1EE"], "🇦🇮", "flag: Anguilla"], [["U+1F1E6", "U+1F1F1"], "🇦🇱", "flag: Albania"], [["U+1F1E6", "U+1F1F2"], "🇦🇲", "flag: Armenia"], [["U+1F1E6", "U+1F1F4"], "🇦🇴", "flag: Angola"], [["U+1F1E6", "U+1F1F6"], "🇦🇶", "flag: Antarctica"], [["U+1F1E6", "U+1F1F7"], "🇦🇷", "flag: Argentina"], [["U+1F1E6", "U+1F1F8"], "🇦🇸", "flag: American Samoa"], [["U+1F1E6", "U+1F1F9"], "🇦🇹", "flag: Austria"], [["U+1F1E6", "U+1F1FA"], "🇦🇺", "flag: Australia"], [["U+1F1E6", "U+1F1FC"], "🇦🇼", "flag: Aruba"], [["U+1F1E6", "U+1F1FD"], "🇦🇽", "flag: Åland Islands"], [["U+1F1E6", "U+1F1FF"], "🇦🇿", "flag: Azerbaijan"], [["U+1F1E7", "U+1F1E6"], "🇧🇦", "flag: Bosnia & Herzegovina"], [["U+1F1E7", "U+1F1E7"], "🇧🇧", "flag: Barbados"], [["U+1F1E7", "U+1F1E9"], "🇧🇩", "flag: Bangladesh"], [["U+1F1E7", "U+1F1EA"], "🇧🇪", "flag: Belgium"], [["U+1F1E7", "U+1F1EB"], "🇧🇫", "flag: Burkina Faso"], [["U+1F1E7", "U+1F1EC"], "🇧🇬", "flag: Bulgaria"], [["U+1F1E7", "U+1F1ED"], "🇧🇭", "flag: Bahrain"], [["U+1F1E7", "U+1F1EE"], "🇧🇮", "flag: Burundi"], [["U+1F1E7", "U+1F1EF"], "🇧🇯", "flag: Benin"], [["U+1F1E7", "U+1F1F1"], "🇧🇱", "flag: St. Barthélemy"], [["U+1F1E7", "U+1F1F2"], "🇧🇲", "flag: Bermuda"], [["U+1F1E7", "U+1F1F3"], "🇧🇳", "flag: Brunei"], [["U+1F1E7", "U+1F1F4"], "🇧🇴", "flag: Bolivia"], [["U+1F1E7", "U+1F1F6"], "🇧🇶", "flag: Caribbean Netherlands"], [["U+1F1E7", "U+1F1F7"], "🇧🇷", "flag: Brazil"], [["U+1F1E7", "U+1F1F8"], "🇧🇸", "flag: Bahamas"], [["U+1F1E7", "U+1F1F9"], "🇧🇹", "flag: Bhutan"], [["U+1F1E7", "U+1F1FB"], "🇧🇻", "flag: Bouvet Island"], [["U+1F1E7", "U+1F1FC"], "🇧🇼", "flag: Botswana"], [["U+1F1E7", "U+1F1FE"], "🇧🇾", "flag: Belarus"], [["U+1F1E7", "U+1F1FF"], "🇧🇿", "flag: Belize"], [["U+1F1E8", "U+1F1E6"], "🇨🇦", "flag: Canada"], [["U+1F1E8", "U+1F1E8"], "🇨🇨", "flag: Cocos (Keeling) Islands"], [["U+1F1E8", "U+1F1E9"], "🇨🇩", "flag: Congo - Kinshasa"], [["U+1F1E8", "U+1F1EB"], "🇨🇫", "flag: Central African Republic"], [["U+1F1E8", "U+1F1EC"], "🇨🇬", "flag: Congo - Brazzaville"], [["U+1F1E8", "U+1F1ED"], "🇨🇭", "flag: Switzerland"], [["U+1F1E8", "U+1F1EE"], "🇨🇮", "flag: Côte d’Ivoire"], [["U+1F1E8", "U+1F1F0"], "🇨🇰", "flag: Cook Islands"], [["U+1F1E8", "U+1F1F1"], "🇨🇱", "flag: Chile"], [["U+1F1E8", "U+1F1F2"], "🇨🇲", "flag: Cameroon"], [["U+1F1E8", "U+1F1F3"], "🇨🇳", "flag: China"], [["U+1F1E8", "U+1F1F4"], "🇨🇴", "flag: Colombia"], [["U+1F1E8", "U+1F1F5"], "🇨🇵", "flag: Clipperton Island"], [["U+1F1E8", "U+1F1F7"], "🇨🇷", "flag: Costa Rica"], [["U+1F1E8", "U+1F1FA"], "🇨🇺", "flag: Cuba"], [["U+1F1E8", "U+1F1FB"], "🇨🇻", "flag: Cape Verde"], [["U+1F1E8", "U+1F1FC"], "🇨🇼", "flag: Curaçao"], [["U+1F1E8", "U+1F1FD"], "🇨🇽", "flag: Christmas Island"], [["U+1F1E8", "U+1F1FE"], "🇨🇾", "flag: Cyprus"], [["U+1F1E8", "U+1F1FF"], "🇨🇿", "flag: Czechia"], [["U+1F1E9", "U+1F1EA"], "🇩🇪", "flag: Germany"], [["U+1F1E9", "U+1F1EC"], "🇩🇬", "flag: Diego Garcia"], [["U+1F1E9", "U+1F1EF"], "🇩🇯", "flag: Djibouti"], [["U+1F1E9", "U+1F1F0"], "🇩🇰", "flag: Denmark"], [["U+1F1E9", "U+1F1F2"], "🇩🇲", "flag: Dominica"], [["U+1F1E9", "U+1F1F4"], "🇩🇴", "flag: Dominican Republic"], [["U+1F1E9", "U+1F1FF"], "🇩🇿", "flag: Algeria"], [["U+1F1EA", "U+1F1E6"], "🇪🇦", "flag: Ceuta & Melilla"], [["U+1F1EA", "U+1F1E8"], "🇪🇨", "flag: Ecuador"], [["U+1F1EA", "U+1F1EA"], "🇪🇪", "flag: Estonia"], [["U+1F1EA", "U+1F1EC"], "🇪🇬", "flag: Egypt"], [["U+1F1EA", "U+1F1ED"], "🇪🇭", "flag: Western Sahara"], [["U+1F1EA", "U+1F1F7"], "🇪🇷", "flag: Eritrea"], [["U+1F1EA", "U+1F1F8"], "🇪🇸", "flag: Spain"], [["U+1F1EA", "U+1F1F9"], "🇪🇹", "flag: Ethiopia"], [["U+1F1EA", "U+1F1FA"], "🇪🇺", "flag: European Union"], [["U+1F1EB", "U+1F1EE"], "🇫🇮", "flag: Finland"], [["U+1F1EB", "U+1F1EF"], "🇫🇯", "flag: Fiji"], [["U+1F1EB", "U+1F1F0"], "🇫🇰", "flag: Falkland Islands"], [["U+1F1EB", "U+1F1F2"], "🇫🇲", "flag: Micronesia"], [["U+1F1EB", "U+1F1F4"], "🇫🇴", "flag: Faroe Islands"], [["U+1F1EB", "U+1F1F7"], "🇫🇷", "flag: France"], [["U+1F1EC", "U+1F1E6"], "🇬🇦", "flag: Gabon"], [["U+1F1EC", "U+1F1E7"], "🇬🇧", "flag: United Kingdom"], [["U+1F1EC", "U+1F1E9"], "🇬🇩", "flag: Grenada"], [["U+1F1EC", "U+1F1EA"], "🇬🇪", "flag: Georgia"], [["U+1F1EC", "U+1F1EB"], "🇬🇫", "flag: French Guiana"], [["U+1F1EC", "U+1F1EC"], "🇬🇬", "flag: Guernsey"], [["U+1F1EC", "U+1F1ED"], "🇬🇭", "flag: Ghana"], [["U+1F1EC", "U+1F1EE"], "🇬🇮", "flag: Gibraltar"], [["U+1F1EC", "U+1F1F1"], "🇬🇱", "flag: Greenland"], [["U+1F1EC", "U+1F1F2"], "🇬🇲", "flag: Gambia"], [["U+1F1EC", "U+1F1F3"], "🇬🇳", "flag: Guinea"], [["U+1F1EC", "U+1F1F5"], "🇬🇵", "flag: Guadeloupe"], [["U+1F1EC", "U+1F1F6"], "🇬🇶", "flag: Equatorial Guinea"], [["U+1F1EC", "U+1F1F7"], "🇬🇷", "flag: Greece"], [["U+1F1EC", "U+1F1F8"], "🇬🇸", "flag: South Georgia & South Sandwich Islands"], [["U+1F1EC", "U+1F1F9"], "🇬🇹", "flag: Guatemala"], [["U+1F1EC", "U+1F1FA"], "🇬🇺", "flag: Guam"], [["U+1F1EC", "U+1F1FC"], "🇬🇼", "flag: Guinea-Bissau"], [["U+1F1EC", "U+1F1FE"], "🇬🇾", "flag: Guyana"], [["U+1F1ED", "U+1F1F0"], "🇭🇰", "flag: Hong Kong SAR China"], [["U+1F1ED", "U+1F1F2"], "🇭🇲", "flag: Heard & McDonald Islands"], [["U+1F1ED", "U+1F1F3"], "🇭🇳", "flag: Honduras"], [["U+1F1ED", "U+1F1F7"], "🇭🇷", "flag: Croatia"], [["U+1F1ED", "U+1F1F9"], "🇭🇹", "flag: Haiti"], [["U+1F1ED", "U+1F1FA"], "🇭🇺", "flag: Hungary"], [["U+1F1EE", "U+1F1E8"], "🇮🇨", "flag: Canary Islands"], [["U+1F1EE", "U+1F1E9"], "🇮🇩", "flag: Indonesia"], [["U+1F1EE", "U+1F1EA"], "🇮🇪", "flag: Ireland"], [["U+1F1EE", "U+1F1F1"], "🇮🇱", "flag: Israel"], [["U+1F1EE", "U+1F1F2"], "🇮🇲", "flag: Isle of Man"], [["U+1F1EE", "U+1F1F3"], "🇮🇳", "flag: India"], [["U+1F1EE", "U+1F1F4"], "🇮🇴", "flag: British Indian Ocean Territory"], [["U+1F1EE", "U+1F1F6"], "🇮🇶", "flag: Iraq"], [["U+1F1EE", "U+1F1F7"], "🇮🇷", "flag: Iran"], [["U+1F1EE", "U+1F1F8"], "🇮🇸", "flag: Iceland"], [["U+1F1EE", "U+1F1F9"], "🇮🇹", "flag: Italy"], [["U+1F1EF", "U+1F1EA"], "🇯🇪", "flag: Jersey"], [["U+1F1EF", "U+1F1F2"], "🇯🇲", "flag: Jamaica"], [["U+1F1EF", "U+1F1F4"], "🇯🇴", "flag: Jordan"], [["U+1F1EF", "U+1F1F5"], "🇯🇵", "flag: Japan"], [["U+1F1F0", "U+1F1EA"], "🇰🇪", "flag: Kenya"], [["U+1F1F0", "U+1F1EC"], "🇰🇬", "flag: Kyrgyzstan"], [["U+1F1F0", "U+1F1ED"], "🇰🇭", "flag: Cambodia"], [["U+1F1F0", "U+1F1EE"], "🇰🇮", "flag: Kiribati"], [["U+1F1F0", "U+1F1F2"], "🇰🇲", "flag: Comoros"], [["U+1F1F0", "U+1F1F3"], "🇰🇳", "flag: St. Kitts & Nevis"], [["U+1F1F0", "U+1F1F5"], "🇰🇵", "flag: North Korea"], [["U+1F1F0", "U+1F1F7"], "🇰🇷", "flag: South Korea"], [["U+1F1F0", "U+1F1FC"], "🇰🇼", "flag: Kuwait"], [["U+1F1F0", "U+1F1FE"], "🇰🇾", "flag: Cayman Islands"], [["U+1F1F0", "U+1F1FF"], "🇰🇿", "flag: Kazakhstan"], [["U+1F1F1", "U+1F1E6"], "🇱🇦", "flag: Laos"], [["U+1F1F1", "U+1F1E7"], "🇱🇧", "flag: Lebanon"], [["U+1F1F1", "U+1F1E8"], "🇱🇨", "flag: St. Lucia"], [["U+1F1F1", "U+1F1EE"], "🇱🇮", "flag: Liechtenstein"], [["U+1F1F1", "U+1F1F0"], "🇱🇰", "flag: Sri Lanka"], [["U+1F1F1", "U+1F1F7"], "🇱🇷", "flag: Liberia"], [["U+1F1F1", "U+1F1F8"], "🇱🇸", "flag: Lesotho"], [["U+1F1F1", "U+1F1F9"], "🇱🇹", "flag: Lithuania"], [["U+1F1F1", "U+1F1FA"], "🇱🇺", "flag: Luxembourg"], [["U+1F1F1", "U+1F1FB"], "🇱🇻", "flag: Latvia"], [["U+1F1F1", "U+1F1FE"], "🇱🇾", "flag: Libya"], [["U+1F1F2", "U+1F1E6"], "🇲🇦", "flag: Morocco"], [["U+1F1F2", "U+1F1E8"], "🇲🇨", "flag: Monaco"], [["U+1F1F2", "U+1F1E9"], "🇲🇩", "flag: Moldova"], [["U+1F1F2", "U+1F1EA"], "🇲🇪", "flag: Montenegro"], [["U+1F1F2", "U+1F1EB"], "🇲🇫", "flag: St. Martin"], [["U+1F1F2", "U+1F1EC"], "🇲🇬", "flag: Madagascar"], [["U+1F1F2", "U+1F1ED"], "🇲🇭", "flag: Marshall Islands"], [["U+1F1F2", "U+1F1F0"], "🇲🇰", "flag: North Macedonia"], [["U+1F1F2", "U+1F1F1"], "🇲🇱", "flag: Mali"], [["U+1F1F2", "U+1F1F2"], "🇲🇲", "flag: Myanmar (Burma)"], [["U+1F1F2", "U+1F1F3"], "🇲🇳", "flag: Mongolia"], [["U+1F1F2", "U+1F1F4"], "🇲🇴", "flag: Macao SAR China"], [["U+1F1F2", "U+1F1F5"], "🇲🇵", "flag: Northern Mariana Islands"], [["U+1F1F2", "U+1F1F6"], "🇲🇶", "flag: Martinique"], [["U+1F1F2", "U+1F1F7"], "🇲🇷", "flag: Mauritania"], [["U+1F1F2", "U+1F1F8"], "🇲🇸", "flag: Montserrat"], [["U+1F1F2", "U+1F1F9"], "🇲🇹", "flag: Malta"], [["U+1F1F2", "U+1F1FA"], "🇲🇺", "flag: Mauritius"], [["U+1F1F2", "U+1F1FB"], "🇲🇻", "flag: Maldives"], [["U+1F1F2", "U+1F1FC"], "🇲🇼", "flag: Malawi"], [["U+1F1F2", "U+1F1FD"], "🇲🇽", "flag: Mexico"], [["U+1F1F2", "U+1F1FE"], "🇲🇾", "flag: Malaysia"], [["U+1F1F2", "U+1F1FF"], "🇲🇿", "flag: Mozambique"], [["U+1F1F3", "U+1F1E6"], "🇳🇦", "flag: Namibia"], [["U+1F1F3", "U+1F1E8"], "🇳🇨", "flag: New Caledonia"], [["U+1F1F3", "U+1F1EA"], "🇳🇪", "flag: Niger"], [["U+1F1F3", "U+1F1EB"], "🇳🇫", "flag: Norfolk Island"], [["U+1F1F3", "U+1F1EC"], "🇳🇬", "flag: Nigeria"], [["U+1F1F3", "U+1F1EE"], "🇳🇮", "flag: Nicaragua"], [["U+1F1F3", "U+1F1F1"], "🇳🇱", "flag: Netherlands"], [["U+1F1F3", "U+1F1F4"], "🇳🇴", "flag: Norway"], [["U+1F1F3", "U+1F1F5"], "🇳🇵", "flag: Nepal"], [["U+1F1F3", "U+1F1F7"], "🇳🇷", "flag: Nauru"], [["U+1F1F3", "U+1F1FA"], "🇳🇺", "flag: Niue"], [["U+1F1F3", "U+1F1FF"], "🇳🇿", "flag: New Zealand"], [["U+1F1F4", "U+1F1F2"], "🇴🇲", "flag: Oman"], [["U+1F1F5", "U+1F1E6"], "🇵🇦", "flag: Panama"], [["U+1F1F5", "U+1F1EA"], "🇵🇪", "flag: Peru"], [["U+1F1F5", "U+1F1EB"], "🇵🇫", "flag: French Polynesia"], [["U+1F1F5", "U+1F1EC"], "🇵🇬", "flag: Papua New Guinea"], [["U+1F1F5", "U+1F1ED"], "🇵🇭", "flag: Philippines"], [["U+1F1F5", "U+1F1F0"], "🇵🇰", "flag: Pakistan"], [["U+1F1F5", "U+1F1F1"], "🇵🇱", "flag: Poland"], [["U+1F1F5", "U+1F1F2"], "🇵🇲", "flag: St. Pierre & Miquelon"], [["U+1F1F5", "U+1F1F3"], "🇵🇳", "flag: Pitcairn Islands"], [["U+1F1F5", "U+1F1F7"], "🇵🇷", "flag: Puerto Rico"], [["U+1F1F5", "U+1F1F8"], "🇵🇸", "flag: Palestinian Territories"], [["U+1F1F5", "U+1F1F9"], "🇵🇹", "flag: Portugal"], [["U+1F1F5", "U+1F1FC"], "🇵🇼", "flag: Palau"], [["U+1F1F5", "U+1F1FE"], "🇵🇾", "flag: Paraguay"], [["U+1F1F6", "U+1F1E6"], "🇶🇦", "flag: Qatar"], [["U+1F1F7", "U+1F1EA"], "🇷🇪", "flag: Réunion"], [["U+1F1F7", "U+1F1F4"], "🇷🇴", "flag: Romania"], [["U+1F1F7", "U+1F1F8"], "🇷🇸", "flag: Serbia"], [["U+1F1F7", "U+1F1FA"], "🇷🇺", "flag: Russia"], [["U+1F1F7", "U+1F1FC"], "🇷🇼", "flag: Rwanda"], [["U+1F1F8", "U+1F1E6"], "🇸🇦", "flag: Saudi Arabia"], [["U+1F1F8", "U+1F1E7"], "🇸🇧", "flag: Solomon Islands"], [["U+1F1F8", "U+1F1E8"], "🇸🇨", "flag: Seychelles"], [["U+1F1F8", "U+1F1E9"], "🇸🇩", "flag: Sudan"], [["U+1F1F8", "U+1F1EA"], "🇸🇪", "flag: Sweden"], [["U+1F1F8", "U+1F1EC"], "🇸🇬", "flag: Singapore"], [["U+1F1F8", "U+1F1ED"], "🇸🇭", "flag: St. Helena"], [["U+1F1F8", "U+1F1EE"], "🇸🇮", "flag: Slovenia"], [["U+1F1F8", "U+1F1EF"], "🇸🇯", "flag: Svalbard & Jan Mayen"], [["U+1F1F8", "U+1F1F0"], "🇸🇰", "flag: Slovakia"], [["U+1F1F8", "U+1F1F1"], "🇸🇱", "flag: Sierra Leone"], [["U+1F1F8", "U+1F1F2"], "🇸🇲", "flag: San Marino"], [["U+1F1F8", "U+1F1F3"], "🇸🇳", "flag: Senegal"], [["U+1F1F8", "U+1F1F4"], "🇸🇴", "flag: Somalia"], [["U+1F1F8", "U+1F1F7"], "🇸🇷", "flag: Suriname"], [["U+1F1F8", "U+1F1F8"], "🇸🇸", "flag: South Sudan"], [["U+1F1F8", "U+1F1F9"], "🇸🇹", "flag: São Tomé & Príncipe"], [["U+1F1F8", "U+1F1FB"], "🇸🇻", "flag: El Salvador"], [["U+1F1F8", "U+1F1FD"], "🇸🇽", "flag: Sint Maarten"], [["U+1F1F8", "U+1F1FE"], "🇸🇾", "flag: Syria"], [["U+1F1F8", "U+1F1FF"], "🇸🇿", "flag: Eswatini"], [["U+1F1F9", "U+1F1E6"], "🇹🇦", "flag: Tristan da Cunha"], [["U+1F1F9", "U+1F1E8"], "🇹🇨", "flag: Turks & Caicos Islands"], [["U+1F1F9", "U+1F1E9"], "🇹🇩", "flag: Chad"], [["U+1F1F9", "U+1F1EB"], "🇹🇫", "flag: French Southern Territories"], [["U+1F1F9", "U+1F1EC"], "🇹🇬", "flag: Togo"], [["U+1F1F9", "U+1F1ED"], "🇹🇭", "flag: Thailand"], [["U+1F1F9", "U+1F1EF"], "🇹🇯", "flag: Tajikistan"], [["U+1F1F9", "U+1F1F0"], "🇹🇰", "flag: Tokelau"], [["U+1F1F9", "U+1F1F1"], "🇹🇱", "flag: Timor-Leste"], [["U+1F1F9", "U+1F1F2"], "🇹🇲", "flag: Turkmenistan"], [["U+1F1F9", "U+1F1F3"], "🇹🇳", "flag: Tunisia"], [["U+1F1F9", "U+1F1F4"], "🇹🇴", "flag: Tonga"], [["U+1F1F9", "U+1F1F7"], "🇹🇷", "flag: Turkey"], [["U+1F1F9", "U+1F1F9"], "🇹🇹", "flag: Trinidad & Tobago"], [["U+1F1F9", "U+1F1FB"], "🇹🇻", "flag: Tuvalu"], [["U+1F1F9", "U+1F1FC"], "🇹🇼", "flag: Taiwan"], [["U+1F1F9", "U+1F1FF"], "🇹🇿", "flag: Tanzania"], [["U+1F1FA", "U+1F1E6"], "🇺🇦", "flag: Ukraine"], [["U+1F1FA", "U+1F1EC"], "🇺🇬", "flag: Uganda"], [["U+1F1FA", "U+1F1F2"], "🇺🇲", "flag: U.S. Outlying Islands"], [["U+1F1FA", "U+1F1F3"], "🇺🇳", "flag: United Nations"], [["U+1F1FA", "U+1F1F8"], "🇺🇸", "flag: United States"], [["U+1F1FA", "U+1F1FE"], "🇺🇾", "flag: Uruguay"], [["U+1F1FA", "U+1F1FF"], "🇺🇿", "flag: Uzbekistan"], [["U+1F1FB", "U+1F1E6"], "🇻🇦", "flag: Vatican City"], [["U+1F1FB", "U+1F1E8"], "🇻🇨", "flag: St. Vincent & Grenadines"], [["U+1F1FB", "U+1F1EA"], "🇻🇪", "flag: Venezuela"], [["U+1F1FB", "U+1F1EC"], "🇻🇬", "flag: British Virgin Islands"], [["U+1F1FB", "U+1F1EE"], "🇻🇮", "flag: U.S. Virgin Islands"], [["U+1F1FB", "U+1F1F3"], "🇻🇳", "flag: Vietnam"], [["U+1F1FB", "U+1F1FA"], "🇻🇺", "flag: Vanuatu"], [["U+1F1FC", "U+1F1EB"], "🇼🇫", "flag: Wallis & Futuna"], [["U+1F1FC", "U+1F1F8"], "🇼🇸", "flag: Samoa"], [["U+1F1FD", "U+1F1F0"], "🇽🇰", "flag: Kosovo"], [["U+1F1FE", "U+1F1EA"], "🇾🇪", "flag: Yemen"], [["U+1F1FE", "U+1F1F9"], "🇾🇹", "flag: Mayotte"], [["U+1F1FF", "U+1F1E6"], "🇿🇦", "flag: South Africa"], [["U+1F1FF", "U+1F1F2"], "🇿🇲", "flag: Zambia"], [["U+1F1FF", "U+1F1FC"], "🇿🇼", "flag: Zimbabwe"]]], ["subdivision-flag", [[["U+1F3F4", "U+E0067", "U+E0062", "U+E0065", "U+E006E", "U+E0067", "U+E007F"], "🏴󠁧󠁢󠁥󠁮󠁧󠁿", "flag: England"], [["U+1F3F4", "U+E0067", "U+E0062", "U+E0073", "U+E0063", "U+E0074", "U+E007F"], "🏴󠁧󠁢󠁳󠁣󠁴󠁿", "flag: Scotland"], [["U+1F3F4", "U+E0067", "U+E0062", "U+E0077", "U+E006C", "U+E0073", "U+E007F"], "🏴󠁧󠁢󠁷󠁬󠁳󠁿", "flag: Wales"]]]]]];
/* harmony default export */ var js_EmojiChars = (EmojiChars); 
// CONCATENATED MODULE: ./node_modules/absol-acomp/AComp.js












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,
    EmojiChars: js_EmojiChars,
    EmojiAnims: js_EmojiAnims,
    install: dom_install
};

window.runDebugTask = DebugTask["a" /* default */].start.bind(DebugTask["a" /* default */]);

/* harmony default export */ var absol_acomp_AComp = (AComp);
// CONCATENATED MODULE: ./node_modules/absol-mobile/js/dom/Core.js



var Core = new Dom["b" /* default */]();
Core.install(absol_acomp_AComp.core);

/* harmony default export */ var dom_Core = (Core);
// CONCATENATED MODULE: ./node_modules/absol-mobile/js/dom/MLeftNavigator.js


var MLeftNavigator_ = dom_Core._;
var MLeftNavigator_$ = dom_Core.$;

function MLeftNavigator() {
    this.on('dragstart', this.eventHandler.modalDragStart)
        .on('drag', this.eventHandler.modalDrag)
        .on('dragend', this.eventHandler.modalDragEnd);
    this.$content = MLeftNavigator_$('.am-navigator-content', this);
    this.$modal = MLeftNavigator_$('.am-navigator-modal', this);
    this._contentWidth = 0;

    this._speedTimeout = -1;
    this._dragSpeed = 0;
    this._preDragTime = 0;
    this._state = -1;
    this._preventDrag = false;
}

MLeftNavigator.tag = 'MLeftNavigator'.toLowerCase();
MLeftNavigator.render = function () {
    return MLeftNavigator_({
        tag: 'hanger',
        class: 'am-navigator',
        child: [
            '.am-navigator-modal',
            '.am-navigator-content'
        ],
        props: {
            hangOn: 9
        }
    });
};


['addChild', 'addChildBefore', 'addChildAfter', 'clearChild', 'findChildBefore', 'findChildAfter', 'removeChild'].forEach(function (key) {
    MLeftNavigator.prototype[key] = function () {
        return this.$content[key].apply(this.$content, arguments);
    };
});

MLeftNavigator.prototype.getChildNodes = function () {
    return this.$modal.childNodes;
};

MLeftNavigator.prototype.open = function (v0) {
    if (this._state == 1) return;
    v0 = v0 || 1000;
    v0 = Math.max(400, Math.min(4000, v0));
    var ctBound = this.$content.getBoundingClientRect();
    var dx = - ctBound.left;
    var dt = Math.sqrt(2 * dx / v0) / 2;
    this.$content.addStyle('transition', 'right ease-out ' + dt + 's');
    this.$modal.addStyle('transition', 'opacity ease-out ' + dt + 's');
    this.$content.addStyle('right', 'calc(100% - ' + ctBound.width + 'px)');
    this.$modal.addStyle('opacity', '0.5');

    this.addClass('am-open');
    var thisnm = this;
    this._state = -1;
    thisnm.$modal.on('click', thisnm.eventHandler.clickModal);
    setTimeout(function () {
        thisnm._state = 1;
        thisnm.$content.removeStyle('transition');
        thisnm.$modal.removeStyle('transition');
    }, dt * 1000 + 1);
};

MLeftNavigator.prototype.close = function (v0) {
    if (this._state == -1) return;
    this.$modal.off('click', this.eventHandler.clickModal);
    v0 = v0 || 0;
    v0 = v0 || 1000;
    v0 = Math.max(400, Math.min(4000, v0));

    var ctBound = this.$content.getBoundingClientRect();
    var dx = ctBound.right;
    var dt = Math.sqrt(2 * dx / v0) / 2;
    this.$content.addStyle('transition', 'right ease-out ' + dt + 's');
    this.$modal.addStyle('transition', 'opacity ease-out ' + dt + 's');
    this.$content.addStyle('right', '100%');
    setTimeout(this.$modal.addStyle.bind(this.$modal, 'opacity', '0.001'), 4);
    // this.$modal.addStyle('opacity', '0.001');

    var thisnm = this;
    this._state = 0;

    setTimeout(function () {
        thisnm._state = -1;
        thisnm.$content.removeStyle('transition');
        thisnm.$modal.removeStyle('transition');
        thisnm.removeClass('am-open');
    }, dt * 1000 + 1);
};



/** 
 * @type {MLeftNavigator}
 */
MLeftNavigator.eventHandler = {};

MLeftNavigator.eventHandler.modalDragStart = function (event) {
    this.$modal.off('click', this.eventHandler.clickModal);
    this._contentWidth = this.$content.getBoundingClientRect().width;
    this._prevState = this._state;
    this._preDragTime = new Date().getTime();
    this._preMoveDistance = 0;
    this._dragSpeed = 0;
    this._preX = event.clientX;
    var moveVec = event.currentPoint.sub(event.startingPoint);

    if (Math.abs(moveVec.x) > Math.abs(moveVec.y)) {
        this.addClass('am-dragging');
        event.preventDefault();
        this._preventDrag = false;
    }
    else {
        this._preventDrag = true;
    }

};

MLeftNavigator.eventHandler.modalDrag = function (event) {
    if (this._preventDrag) return;
    var thisnm = this;
    var now = new Date().getTime();
    if (now - this._preDragTime > 10) {
        var dt = now - this._preDragTime;
        this._dragSpeed = (event.clientX - this._preX) * 1000 / dt;
        this._preDragTime = now;
        this._preX = event.clientX;
    }

    if (this._speedTimeout > 0) {
        this._speedTimeout = -1;
    }

    this._speedTimeout = setTimeout(function () {
        thisnm._dragSpeed = 0;
    }, 200);

    var moveVec = event.currentPoint.sub(event.startingPoint);
    var dx;
    if (this._state != 0) {
        event.preventDefault();
        if (this._state == -1) {
            dx = Math.max(0, Math.min(moveVec.x, this._contentWidth));

        }
        else if (this._state == 1) {
            dx = Math.max(0, Math.min(this._contentWidth + moveVec.x, this._contentWidth));
        }
        this.$content.addStyle({
            right: 'calc(100% - ' + (dx) + 'px)'
        });
        this.$modal.addStyle('opacity', (dx / this._contentWidth / 2) + '');
    }

    // this.$modal.addStyle('opacity', dx / this._contentWidth / 2 +'')
};


MLeftNavigator.eventHandler.clickModal = function (event) {
    if (event.target == this.$modal)
        this.close();
};

/**
 * throwing_speed 400px/s
 * 
 */
MLeftNavigator.eventHandler.modalDragEnd = function () {
    if (this._preventDrag) {
        this._preventDrag = false;
    }
    else {
        this.removeClass('am-dragging');
        this._state = 0;//animating state
        var ctBound = this.$content.getBoundingClientRect();
        if (this._dragSpeed > -200 || (ctBound.right > ctBound.width / 2 && this._dragSpeed >= 0)) {
            this.open(this._dragSpeed);
        }
        else if (this._dragSpeed < -200 || (ctBound.right < ctBound.width / 2 && this._dragSpeed <= 0)) {
            this.close(-this._dragSpeed);
        }
        else {
            if (this._prevState == 1) this.open();
            else if (this._prevState == -1) this.close();
        }
    }
};


dom_Core.install(MLeftNavigator);

/* harmony default export */ var dom_MLeftNavigator = (MLeftNavigator);
// EXTERNAL MODULE: ./node_modules/absol-mobile/css/mnavigatormenu.css
var mnavigatormenu = __webpack_require__(253);

// CONCATENATED MODULE: ./node_modules/absol-mobile/js/dom/MNavigatorMenu.js


var MNavigatorMenu_ = dom_Core._;
var MNavigatorMenu_$ = dom_Core.$;

function MNavigatorMenu() {
    this.$header = MNavigatorMenu_$('.am-navigator-menu-body', this);
    this.$body = MNavigatorMenu_$('.am-navigator-menu-body', this);
    var data = [
        {
            items: [
                {
                    text: 'Trang chủ',
                    icon: 'span.mdi.mdi-home'
                }
            ]
        },
        {
            gname: 'Danh mục',
            items: [
                { text: 'Kiểu dữ liệu', icon: 'span.mdi.mdi-alpha-t-box-outline' },
                { text: 'Bảng', icon: 'span.mdi.mdi-file-table-outline' },
                { text: 'Trạng thái', icon: 'span.mdi.mdi-check' },
                { text: 'Nhóm đối tượng', icon: 'span.mdi.mdi-google-circles-communities' },
                { text: 'Đối tượng', icon: 'span.mdi.mdi-cube-outline' },
                { text: 'Chat', icon: 'span.mdi.mdi-chat-outline' },
                { text: 'Quốc gia', icon: 'span.mdi.mdi-earth' },
                { text: 'Công ty', icon: 'span.mdi.mdi-warehouse' },
                { text: 'Liên hệ', icon: 'span.mdi.mdi-contact-mail' },
                { text: 'Loại', icon: 'span.mdi.mdi-grain' },
            ]
        },
        {
            gname: 'Báo cáo',
            items: [
                { text: 'Báo cáo của tôi', icon: 'span.mdi.mdi-note-text' },
                { text: 'Báo cáo công khai', icon: 'span.mdi.mdi-note-text-outline' },
            ]
        },
        {
            gname: 'Hệ thống',
            items: [
                { text: 'Người dùng', icon: 'span.mdi.mdi-account-outline' },
                { text: 'Hồ sơ cá nhân', icon: 'span.mdi.mdi-file-account' },
                { text: 'Đăng xuất', icon: 'span.mdi.mdi-logout' },
            ]
        }
    ];

    var thismn = this;
    data.forEach(function (gr) {
        thismn.$body.addChild(thismn._makeGroup(gr.gname, gr.items));
    });
}

MNavigatorMenu.tag = 'MNavigatorMenu'.toLowerCase();
MNavigatorMenu.render = function () {
    return MNavigatorMenu_({
        tag: 'mleftnavigator',
        class: 'am-navigator-menu',
        child: [
            {
                class: 'am-navigator-menu-header',
                child: [
                    {
                        class: 'am-navigator-menu-avatar-ctn',
                        child: '.am-navigator-menu-avatar'
                    },
                    {
                        class: 'am-navigator-menu-full-name',
                        child: { text: 'Phạm Quốc Du Thiên' }
                    },
                    {
                        class: 'am-navigator-menu-email',
                        child: { text: 'blueskythien2010@live.com' }
                    }
                ]
            },
            {
                class: 'am-navigator-menu-body',
                child: [
                ]

            }
        ]
    }, true);
};
/**
 *
                    {
                        class: 'am-navigator-menu-group',
                        child: [

                            {
                                class: 'am-navigator-menu-item',
                                child: [
                                    {
                                        class: 'am-navigator-menu-item-icon-ctn',
                                        child: 'span.mdi.mdi-home'
                                    },
                                    {
                                        tag: 'span',
                                        class: 'am-navigator-menu-item-text',
                                        child: { text: 'Trang chủ' }
                                    }
                                ]

                            }
                        ]
                    },
                    {
                        class: 'am-navigator-menu-group',
                        child: [
                            {
                                class: 'am-navigator-menu-group-name',
                                child: { text: 'Danh mục' }
                            },
                            {
                                class: 'am-navigator-menu-item',
                                child: [
                                    {
                                        class: 'am-navigator-menu-item-icon-ctn',
                                        child: 'span.mdi.mdi-alpha-t-box-outline'
                                    },
                                    {
                                        tag: 'span',
                                        class: 'am-navigator-menu-item-text',
                                        child: { text: 'Kiểu dữ liệu' }
                                    }
                                ]

                            }
                        ]
                    }
 */

MNavigatorMenu.prototype._makeItem = function (icon, text) {
    return MNavigatorMenu_({
        class: 'am-navigator-menu-item',
        child: [
            {
                class: 'am-navigator-menu-item-icon-ctn',
                child: icon ? icon : []
            },
            {
                tag: 'span',
                class: 'am-navigator-menu-item-text',
                child: { text: text }
            }
        ]
    });
};

MNavigatorMenu.prototype._makeGroup = function (groupName, items) {
    var aobj = {
        class: 'am-navigator-menu-group',
        child: []
    };//absol object
    if (groupName) {
        aobj.child.push({
            class: 'am-navigator-menu-group-name',
            child: { text: groupName + '' }
        })
    };
    var thismn = this;
    aobj.child = aobj.child.concat(items.map(function (item) {
        return thismn._makeItem(item.icon, item.text);
    }));

    return MNavigatorMenu_(aobj);
};

MNavigatorMenu.property = {};


/**
 * @type {MNavigatorMenu}
 */
MNavigatorMenu.property.headerBackgroundSrc = {
    set: function () {

    },
    get: function () {

    }
};

/**
 * @type {MNavigatorMenu}
 */
MNavigatorMenu.property.avatarSrc = {
    set: function () {

    },
    get: function () {

    }
}


dom_Core.install(MNavigatorMenu);

/* harmony default export */ var dom_MNavigatorMenu = (MNavigatorMenu);
// EXTERNAL MODULE: ./node_modules/absol-mobile/css/mbottomtabbar.css
var mbottomtabbar = __webpack_require__(255);

// CONCATENATED MODULE: ./node_modules/absol-mobile/js/dom/MBottomTabbar.js



var MBottomTabbar_ = dom_Core._;
var MBottomTabbar_$ = dom_Core.$;

function MBottomTabbar() {
    this._items = [];
    this.$row = MBottomTabbar_$('.am-bottom-tabbar-content-row', this);
    this.$itemDict = {};
    this.$line = MBottomTabbar_$('.am-bottom-tabbar-line', this);
    this.$attachhook = MBottomTabbar_('attachhook').addTo(this);
    this.$attachhook.requestUpdateSize = this.updateSize.bind(this);
    this.$attachhook.on('error', function () {
        Dom["b" /* default */].addToResizeSystem(this);
    });
    this.$activeItem = null;
}


MBottomTabbar.tag = 'MBottomTabbar'.toLowerCase();
MBottomTabbar.render = function () {
    return MBottomTabbar_({
        class: 'am-bottom-tabbar',
        extendEvent: 'change',
        child: [
            '.am-bottom-tabbar-line',
            {
                class: 'am-bottom-tabbar-content',
                child: '.am-bottom-tabbar-content-row'
            }]
    });
};

MBottomTabbar.prototype.updateSize = function () {
    this.updateLinePosition();
};

MBottomTabbar.prototype.notifyChange = function () {
    this.emit('change', { target: this, value: this._value }, this);
};


MBottomTabbar.prototype.updateLinePosition = function () {
    if (this.$activeItem) {
        var bound = this.getBoundingClientRect();
        var iBound = this.$activeItem.getBoundingClientRect();
        this.$line.addStyle({
            width: iBound.width + 'px',
            left: iBound.left - bound.left + 'px'
        });
    }
    else {
        this.$line.addStyle('width', '0');
    }

};

MBottomTabbar.prototype._makeItem = function (data) {
    var thisbt = this;
    var itemElt = MBottomTabbar_({
        class: 'am-bottom-tabbar-item',
        child: [
            data.icon,
            '.am-bottom-tabbar-item-counter'
        ]
    });
    var counterElt = MBottomTabbar_$('.am-bottom-tabbar-item-counter', itemElt);
    var counter = data.counter;
    if (!data.__bindCounter__) {
        Object.defineProperties(data, {
            __dataBinding__: {
                value: true,
                writable: false
            },
            counter: {
                set: function (value) {
                    if (value >= 0) {
                        if (value > 9) {
                            counterElt.innerHTML = '9+';
                        }
                        else if (value > 0) {
                            counterElt.innerHTML = value;
                        }
                        else {
                            counterElt.innerHTML = '';
                        }
                    }
                    else {
                        if (value)
                            counterElt.innerHTML = value + "";
                        else
                            counterElt.innerHTML = '';
                    }
                    this._counter = value;
                },
                get: function () {
                    return this._counter;
                }
            }
        });
    }
    data.counter = counter;

    itemElt.on('click', function () {
        if (thisbt._value !== data.value) {
            thisbt.value = data.value;
            thisbt.notifyChange();
        }
    });

    return itemElt;
};

MBottomTabbar.property = {};

/**
 * @type {MBottomTabbar}
 */
MBottomTabbar.property.items = {
    set: function (items) {
        items = items || [];
        this._items = items;
        this.$row.clearChild();
        this.$itemDict = {};
        this.$activeItem = null;
        for (var i = 0; i < items.length; ++i) {
            this.$itemDict[items[i].value] = this._makeItem(items[i]).addTo(this.$row);
        }
        if (items && items.length > 0) {
            if (this.$itemDict[this._value]) {
                this.value = this._value;
            }
            else {
                this.value = items[0].value;
            }
        }
    },
    get: function () {
        return this._items;
    }
};

/**
 * @type {MBottomTabbar}
 */
MBottomTabbar.property.value = {
    set: function (value) {
        this._value = value;

        if (this.$activeItem) {
            this.$activeItem.removeClass('am-active');
        }
        this.$activeItem = this.$itemDict[value];
        if (this.$activeItem) {
            this.$activeItem.addClass('am-active');
        }
        this.updateLinePosition();
    },
    get: function () {
        return this._value;
    }
}


dom_Core.install(MBottomTabbar);

/* harmony default export */ var dom_MBottomTabbar = (MBottomTabbar);
// EXTERNAL MODULE: ./node_modules/absol-mobile/css/mtinyprofileblock.css
var mtinyprofileblock = __webpack_require__(257);

// CONCATENATED MODULE: ./node_modules/absol-mobile/js/dom/MTinyProfileBlock.js


var MTinyProfileBlock_ = dom_Core._;
var MTinyProfileBlock_$ = dom_Core.$;

function MTinyProfileBlock() {
    this._avatarSrc = '';
    this.$name = MTinyProfileBlock_$('.am-tiny-profile-block-name', this);
    this.$desc = MTinyProfileBlock_$('.am-tiny-profile-block-desc', this);
    this.$avatar = MTinyProfileBlock_$('.am-tiny-profile-block-avatar', this);
}

MTinyProfileBlock.tag = 'MTinyProfileBlock'.toLowerCase();
MTinyProfileBlock.render = function () {
    return MTinyProfileBlock_({
        class: 'am-tiny-profile-block',
        extendEvent: 'change',
        child: [
            {
                class: 'am-tiny-profile-block-avatar'
            },
            {
                class: 'am-tiny-profile-block-text-ctn',
                child: [
                    {
                        class: 'am-tiny-profile-block-name',
                        child: { text: 'Pham Quoc Du Thien' }
                    },
                    {
                        class: 'am-tiny-profile-block-desc',
                        child: { text: 'View your profile' }
                    }
                ]
            }

        ]
    });
};

MTinyProfileBlock.property = {};

/**
 * @type {MTinyProfileBlock}
 */
MTinyProfileBlock.property.desc = {
    set: function (value) {
        this.$desc.firstChild.data = value + '';
    },
    get: function () {
        return this.$desc.firstChild.data;
    }
};

/**
 * @type {MTinyProfileBlock}
 */
MTinyProfileBlock.property.name = {
    set: function (value) {
        this.$name.firstChild.data = value + '';
    },
    get: function () {
        return this.$name.firstChild.data;
    }
};


/**
 * @type {MTinyProfileBlock}
 */
MTinyProfileBlock.property.avatarSrc = {
    set: function (value) {
        value = value + '';
        this._avatarSrc = value;
        this.$avatar.addStyle('background-image', 'url(' + value + ')')
    },
    get: function () {
        return this._avatarSrc;
    }
};



dom_Core.install(MTinyProfileBlock);

/* harmony default export */ var dom_MTinyProfileBlock = (MTinyProfileBlock);
// EXTERNAL MODULE: ./node_modules/absol-mobile/css/mmatmenu.css
var mmatmenu = __webpack_require__(39);

// EXTERNAL MODULE: ./node_modules/absol-mobile/css/mmdirect.css
var mmdirect = __webpack_require__(260);

// CONCATENATED MODULE: ./node_modules/absol-mobile/js/dom/MMdiRect.js


var MMdiRect_ = dom_Core._;
var MMdiRect_$ = dom_Core.$;


function MMdiRect() {
    this.$icon = MMdiRect_$('.am-mdi-rect-icon', this);
    this._iconName = undefined;
}

MMdiRect.tag = 'MMdiRect'.toLowerCase();
MMdiRect.render = function () {
    return MMdiRect_({
        class: 'am-mdi-rect',
        child: 'span.mdi.am-mdi-rect-icon'
    });
};


MMdiRect.property = {};

/**
 * @type {MMdiRect}
 */
MMdiRect.property.iconName = {
    set: function (value) {
        value = value || null;
        if (this._iconName)
            this.$icon.removeClass('mdi-' + this._iconName);
        this._iconName = value;
        if (this._iconName)
            this.$icon.addClass('mdi-' + this._iconName);
    },
    get: function () {
        return this._iconName;
    }
};


MMdiRect.attribute = {};

MMdiRect.attribute.iconName = {
    set: function (value) {
        this.iconName = value;
    },
    get: function () {
        return this.iconName;
    },
    remove: function () {
        this.iconName = undefined;
    }
};

dom_Core.install(MMdiRect);

/* harmony default export */ var dom_MMdiRect = (MMdiRect);
// CONCATENATED MODULE: ./node_modules/absol-mobile/js/dom/MMatMenuButton.js



var MMatMenuButton_ = dom_Core._;
var MMatMenuButton_$ = dom_Core.$;


function MMatMenuButton() {
    this.$toggleIcon = MMatMenuButton_$('.am-mat-menu-button-toggle-icon-ctn span.mdi.mdi-chevron-right', this);
    this.$icon = null;
    this.$iconCtn = MMatMenuButton_$('.am-mat-menu-button-icon-ctn', this);
    this.$text = MMatMenuButton_$('.am-mat-menu-button-text', this);
    this.icon = {
        tag: 'mmdirect',
        props: { iconName: "home" }
    };
    this._status = 'none';
    this._level = 0;
    this.$level = MMatMenuButton_$('.am-mat-menu-button-level', this);
}

MMatMenuButton.tag = 'MMatMenuButton'.toLowerCase();
MMatMenuButton.render = function () {
    return MMatMenuButton_({
        tag: 'button',
        class: 'am-mat-menu-button',
        child: [
            {
                class: 'am-mat-menu-button-level',
            },
            {
                class: 'am-mat-menu-button-icon-ctn',
            },
            {
                tag: 'span',
                class: 'am-mat-menu-button-text',
                child: { text: 'Trang chủ' }
            },
            {
                class: 'am-mat-menu-button-toggle-icon-ctn',
                child: 'span.mdi.mdi-chevron-right'
            }
        ]
    });
};


MMatMenuButton.property = {};

/**
 * @type {MMatMenuButton}
*/
MMatMenuButton.property.level = {
    set: function (value) {
        value = Math.max(0, value || 0);
        this.$level.innerHTML = '&nbsp;'.repeat(value * 4);
    },
    get: function () {
        return this._level;
    }
}

/**
 * @type {MMatMenuButton}
*/
MMatMenuButton.property.status = {
    set: function (value) {
        this.removeClass('am-status-open')
            .removeClass('am-status-close');
        if (value == 'open') {
            this.$toggleIcon.addClass('mdi-rotate-90');
            this.addClass('am-status-open');
        }
        else if (value == 'close') {
            this.$toggleIcon.removeClass('mdi-rotate-90');
            this.addClass('am-status-close');
        }
        else {
            value = 'none';
        }
        this._status = value;
    },
    get: function () {
        return this._status;
    }
};

/**
 * @type {MMatMenuButton}
*/
MMatMenuButton.property.icon = {
    set: function (value) {
        value = value || null;
        if (this.$icon) {
            this.$icon.remove();
        }
        if (value) {
            this.$icon = MMatMenuButton_(value).addTo(this.$iconCtn);
        }
    },
    get: function () {
        return this._icon;
    }
};

/**
 * @type {MMatMenuButton}
*/
MMatMenuButton.property.text = {
    set: function (value) {
        this.$text.firstChild.data = value;
    },
    get: function () {
        return this.$text.firstChild.data;
    }
};


dom_Core.install(MMatMenuButton);

/* harmony default export */ var dom_MMatMenuButton = (MMatMenuButton);
// CONCATENATED MODULE: ./node_modules/absol-mobile/js/dom/MMatMenuItem.js



var MMatMenuItem_ = dom_Core._;
var MMatMenuItem_$ = dom_Core.$;

function MMatMenuItem() {
    this.$node = MMatMenuItem_$('mmatmenubutton', this).on('click', this.eventHandler.clickNode);
    OOP["a" /* default */].drillProperty(this, this.$node, ['icon', 'text']);
    /**
     * @type {import('./MMatMenu').default}
     */
    this.$matmenu = MMatMenuItem_$('mmatmenu', this)
        .on('press', this.eventHandler.itemPress);
    this.$dropdown = MMatMenuItem_$('.am-mat-menu-dropdown', this);
}

MMatMenuItem.tag = 'MMatMenuItem'.toLowerCase();
MMatMenuItem.render = function () {
    return MMatMenuItem_({
        extendEvent: ['press'],
        class: 'am-mat-menu-item',
        child: [
            {
                tag: 'mmatmenubutton'
            },
            {
                class: 'am-mat-menu-dropdown',
                child: {
                    tag: 'mmatmenu'
                }
            }
        ]
    });
};

MMatMenuItem.prototype.getNode = function () {
    return this.$node;
};


MMatMenuItem.prototype.openChild = function () {
    this.$node.status = 'open';
    this.addClass('am-status-open');
    var menuBound = this.$matmenu.getBoundingClientRect();
    this.$dropdown.addStyle('max-height', menuBound.height + 2 + 'px');

};

MMatMenuItem.prototype.closeChild = function () {
    this.$node.status = 'close';
    this.removeClass('am-status-open');
    this.$dropdown.removeStyle('max-height');

};


MMatMenuItem.prototype.toggleChild = function () {

    if (this.$node.status == 'open') {
        this.closeChild();
    }
    else if (this.$node.status == 'close') {
        this.openChild();
    }
};

MMatMenuItem.prototype.notifyPress = function (args) {
    this.emit('press', Object.assign({ target: this, type: 'press', item: this, menuItem: this }, args || {}), this);
};


MMatMenuItem.property = {};


MMatMenuItem.property.items = {
    set: function (items) {
        items = items || [];
        if (items.length > 0) this.$node.status = 'close';
        else this.$node.status = 'none';
        this.$matmenu.items = items;
        this.level = this.level;// update
    },
    get: function () {
        return this.$matmenu.items;
    }
};

MMatMenuItem.property.level = {
    set: function (value) {
        this.$node.level = value;
        value = this.$node.level;
        for (var i = 0; i < this.$matmenu.childNodes.length; ++i) {
            this.$matmenu.childNodes[i].level = value + 1;
        }
    },
    get: function () {
        return this.$node.level
    }
};


/**
 * @type {MMatMenuItem}
 */
MMatMenuItem.eventHandler = {};

MMatMenuItem.eventHandler.clickNode = function (event) {
    if (this.$node.status == 'none') {
        //todo
        this.notifyPress();
    }
    else {
        this.toggleChild();
    }
};

MMatMenuItem.eventHandler.itemPress = function (event) {
    this.notifyPress(event);
};

dom_Core.install(MMatMenuItem);

/* harmony default export */ var dom_MMatMenuItem = (MMatMenuItem);
// CONCATENATED MODULE: ./node_modules/absol-mobile/js/dom/MMatMenu.js





var MMatMenu_ = dom_Core._;
var MMatMenu_$ = dom_Core.$;

function MMatMenu() {

}

MMatMenu.tag = 'MMatMenu'.toLowerCase();
MMatMenu.render = function () {
    return MMatMenu_({
        extendEvent: ['press'],
        class: 'am-mat-menu'
    });
};


MMatMenu.prototype.notifyPress = function (args) {
    this.emit('press', Object.assign({ target: this, type: 'press' }, args || {}), this);
};


MMatMenu.property = {};

MMatMenu.property.items = {
    set: function (items) {
        items = items || [];
        this.clearChild();
        var item;
        var itemElt;
        for (var i = 0; i < items.length; ++i) {
            item = items[i];
            itemElt = MMatMenu_({
                tag: 'mmatmenuitem',
                props: Object.assign({}, item),
                on: {
                    press: this.eventHandler.itemPress
                }
            });
            this.addChild(itemElt);
        }
    },
    get: function () {
        return Array.map.call(this.childNodes, function (elt) {
            return {
                text: elt.text,
                items: elt.items,
                icon: elt.icon
            }
        })
    }
};

/***
 * @type {MMatMenuItem}
 */
MMatMenu.eventHandler = {};


MMatMenu.eventHandler.itemPress = function (event) {
    this.notifyPress(event);
};

dom_Core.install(MMatMenu);

/* harmony default export */ var dom_MMatMenu = (MMatMenu);
// EXTERNAL MODULE: ./node_modules/absol-mobile/css/mheaderbar.css
var mheaderbar = __webpack_require__(262);

// CONCATENATED MODULE: ./node_modules/absol-mobile/js/dom/MHeaderBar.js



var MHeaderBar_ = dom_Core._;
var MHeaderBar_$ = dom_Core.$;


function MHeaderBar() {
    this._title = null;
    this._titleDesc = null;
    this._actionIcon = null;
    this._commands = [];

    this._quickmenuHolder = null;
    this._quickmenu = null;
    this.$right = MHeaderBar_$('.am-header-bar-right', this);
    this.$leftBtn = null;
    this.$titleCtn = null;
    this.$title = null;
    this.$titleDesc = null;
    this.$commands = [];
}

MHeaderBar.tag = 'MHeaderBar'.toLowerCase();
MHeaderBar.render = function () {
    return MHeaderBar_({
        extendEvent: ['action', 'command'],
        class: 'am-header-bar',
        child: [
            {
                class: 'am-header-bar-right'
            }
        ]
    });
};


MHeaderBar.prototype.notifyAction = function () {
    this.emit('action', { type: 'action', target: this }, this);
};


MHeaderBar.prototype.notifyCommand = function (commandItem) {
    this.emit('command', { type: 'command', target: this, commandName: commandItem.name, commandItem }, this);
};


MHeaderBar.prototype.showTitle = function (flag) {
    if (!this.$titleCtn && flag) {
        this.$titleCtn = MHeaderBar_({
            class: 'am-header-bar-title-ctn',
            child: [
                {
                    class: 'am-header-bar-title',
                    child: { text: 'Phạm Hùng Quốc' }
                },
                {
                    class: 'am-header-bar-title-desc'
                }
            ]
        });

        this.$title = MHeaderBar_$('.am-header-bar-title', this.$titleCtn);
        this.$titleDesc = MHeaderBar_$('.am-header-bar-title-desc', this.$titleCtn);
    }
    if (flag) {
        this.insertBefore(this.$titleCtn, this.$right);
    }
    else {
        if (this.$titleCtn) this.$titleCtn.remove();
    }
};

MHeaderBar.prototype.showActionBtn = function (flag) {
    if (!this.$leftBtn && flag) {
        this.$leftBtn = MHeaderBar_({
            tag: 'button',
            class: 'am-header-bar-left-btn',
            child: 'span.mdi.mdi-chevron-left',
            on: {
                click: this.notifyAction.bind(this)
            }
        });
    }
    if (flag) {
        this.insertBefore(this.$leftBtn, this.firstChild);
    }
    else {
        if (this.$leftBtn) this.$leftBtn.remove();
    }
};


MHeaderBar.prototype.showQuickMenu = function (flag) {
    if (!this.$quickmenuBtn && flag) {
        this.$quickmenuBtn = MHeaderBar_({
            tag: 'button',
            class: ['am-header-bar-action', 'am-header-bar-quickmenu-btn'],
            child: {
                class: 'am-header-bar-quickmenu-btn-circle',
                child: 'span.mdi.mdi-dots-horizontal'
            },
        });
    }

    if (flag) {
        this.$right.addChild(this.$quickmenuBtn);
    }
    else {
        if (this.$quickmenuBtn) this.$quickmenuBtn.remove();
    }

};



MHeaderBar.prototype._makeCommandBtn = function (item) {
    return MHeaderBar_({
        tag: 'button',
        class: 'am-header-bar-command',
        child: item.icon || [],
        on: {
            click: this.notifyCommand.bind(this, item)
        }
    });
};

MHeaderBar.property = {};

/**
 * @type {MHeaderBar}
 */
MHeaderBar.property.quickmenu = {
    set: function (value) {
        if (this._quickmenuHolder) {
            this._quickmenuHolder.remove();
            this._quickmenu = null;
        }
        if (value) {
            this.showQuickMenu(true);
            var button = this.$quickmenuBtn;
            var onClose = value.onClose;
            var onOpen = value.onOpen;
            value.onOpen = function () {
                button.addClass('am-status-active');
                onOpen && onOpen.apply(this, arguments);
            };
            value.onClose = function () {
                button.removeClass('am-status-active');
                onClose && onClose.apply(this, arguments);
            };
            if (!value.getAnchor) {
                value.getAnchor = function () {
                    return [2];
                }
            }
            this._quickmenuHolder = js_QuickMenu.toggleWhenClick(this.$quickmenuBtn, value);
        }
        else {
            this.showQuickMenu(false);
            value = null;
        }
        this._quickmenu = value;
    },
    get: function () {
        return this._quickmenu;
    }
};


/**
 * @type {MHeaderBar}
 */
MHeaderBar.property.title = {
    set: function (value) {
        if (value) {
            value = value + '';
            this.showTitle(true);
            this.$title.firstChild.data = value;
        }
        else {
            this.showTitle(false);
            value = null;
        }
        this._title = value;
    },
    get: function () {
        return this._title;
    }
};

/**
 * @type {MHeaderBar}
 */
MHeaderBar.property.titleDesc = {
    set: function (value) {
        if (value) {
            value = value + '';
            this.showTitle(true);
            this.$titleDesc.clearChild().addChild(MHeaderBar_({ text: value }));
        }
        else {
            this.showTitle(false);
            if (this.$titleDesc) this.$titleDesc.clearChild();
            value = null;
        }
        this._titleDesc = value;
    },
    get: function () {
        return this._titleDesc;
    }
};

/**
 * @type {MHeaderBar}
 */
MHeaderBar.property.actionIcon = {
    set: function (value) {
        if (value) {
            this.showActionBtn(true);
            this.$leftBtn.clearChild()
                .addChild(MHeaderBar_(value));
        }
        else {
            this.showActionBtn(false);
            value = null;
        }
        this._actionIcon = value;
    },
    get: function () {
        return this._actionIcon;
    }
};



/**
 * @type {MHeaderBar}
 */
MHeaderBar.property.commands = {
    set: function (value) {
        this.$commands.forEach(function (e) {
            e.selftRemove();
        });
        this.$commands = [];
        var commandBtn;
        if (value) {
            var firstChild = this.$right.firstChild;
            if (firstChild) {
                for (var i = 0; i < value.length; ++i) {
                    commandBtn = this._makeCommandBtn(value[i]);
                    this.$right.addChildBefore(commandBtn, firstChild)
                }
            }
            else {
                for (var i = 0; i < value.length; ++i) {
                    commandBtn = this._makeCommandBtn(value[i]);
                    this.$right.addChild(commandBtn);
                }
            }
        }
        else {
            this._commands = [];
        }
        this._commands = value;
    },
    get: function () {
        return this._commands;
    }
};


dom_Core.install(MHeaderBar);

/* harmony default export */ var dom_MHeaderBar = (MHeaderBar);
// EXTERNAL MODULE: ./node_modules/absol-mobile/css/mconversation.css
var mconversation = __webpack_require__(264);

// CONCATENATED MODULE: ./node_modules/absol-mobile/js/dom/MConversation.js




var MConversation_ = dom_Core._;
var MConversation_$ = dom_Core.$;

function MConversation() {
    this._name = '';
    this._shortContent = '';
    this._time = '';
    this._avatarSrc = null;
    this.$name = MConversation_$('.am-conversation-name', this);
    this.$shortContent = MConversation_$('.am-conversation-short-content', this);
    this.$time = MConversation_$('span.am-conversation-time', this);
    this.$counter = MConversation_$('.am-conversation-counter', this);
    this.$avatar = MConversation_$('.am-conversation-avatar', this);
    OOP["a" /* default */].drillProperty(this, this.$counter, 'counter', 'innerHTML');
    OOP["a" /* default */].drillProperty(this, this.$avatar, 'avatarSrc', 'src');
    OOP["a" /* default */].drillProperty(this, this.$avatar, 'onlineStatus', 'status');
}

MConversation.tag = 'MConversation'.toLowerCase();
MConversation.render = function () {
    return MConversation_({
        class: 'am-conversation',
        child: [
            {
                class: 'am-conversation-avatar-ctn',
                child: 'mcircleavatar.am-conversation-avatar'
            },
            {
                class: 'am-conversation-body',
                child: [
                    '.am-conversation-name',
                    '.am-conversation-short-content',
                ]

            },
            {
                class: 'am-conversation-time-ctn',
                child: 'span.am-conversation-time'
            },
            {
                class: 'am-conversation-counter'
            },
            '.am-conversation-bottom-line'
        ]
    });
};


MConversation.property = {};

/**
 * @type {MConversation}
 */
MConversation.property.name = {
    set: function (value) {
        value = value || '';
        this.$name.clearChild();
        if (value) {
            this.$name.addChild(MConversation_({ text: value }))
        }
        this._name = value;
    },
    get: function () {
        return this._name;
    }
};


/**
 * @type {MConversation}
 */
MConversation.property.time = {
    set: function (value) {
        value = value || '';
        this.$time.clearChild().addChild(MConversation_({ text: value }))
        this._time = value;
    },
    get: function () {
        return this._time;
    }
};

/**
 * @type {MConversation}
 */
MConversation.property.shortContent = {
    set: function (value) {
        if (typeof value == 'object') {
            this.$shortContent.clearChild().addChild(MConversation_(value));
        }
        else {
            this.$shortContent.innerHTML = value + '';
        }
        this._shortContent = value;
    },
    get: function () {
        return this._shortContent;
    }
};

/**
 * @type {MConversation}
 */
MConversation.property.unread = {
    set: function (value) {
        if (value) {
            this.addClass('am-status-unread');
        }
        else {
            this.removeClass('am-status-unread');

        }
    },
    get: function () {
        return this.containsClass('am-status-unread')
    }
};


dom_Core.install(MConversation);


/* harmony default export */ var dom_MConversation = (MConversation);
// EXTERNAL MODULE: ./node_modules/absol-mobile/css/mmessageinput.css
var mmessageinput = __webpack_require__(266);

// EXTERNAL MODULE: ./node_modules/absol-mobile/css/mmessagetool.css
var mmessagetool = __webpack_require__(268);

// CONCATENATED MODULE: ./node_modules/absol-mobile/js/dom/MMessageTool.js







var MMessageTool_ = dom_Core._;
var MMessageTool_$ = dom_Core.$;

var supportContactPicker = ('contacts' in navigator && 'ContactsManager' in window) && false;//disable until done


/***
 * @extends AElement
 * @constructor
 */
function MMessageTool() {
    this.$contactPicker = MMessageTool_$('.am-message-tool-contact-picker', this);
    if (!supportContactPicker) {
        this.$contactPicker.remove();
        // this.$contactPicker.addStyle('display', 'none');
    }

    this.$image = MMessageTool_$('.am-message-tool-image', this)
        .on('click', this.openImages.bind(this));
    this.$video = MMessageTool_$('.am-message-tool-video', this)
        .on('click', this.openVideos.bind(this));
    this.$file = MMessageTool_$('.am-message-tool-file', this)
        .on('click', this.openFiles.bind(this));

    this.$closeBtn = MMessageTool_$('.am-message-tool-header-close-btn', this)
        .on('click', this.notifyClose.bind(this));
}

MMessageTool.tag = 'MMessageTool'.toLowerCase();


function makePlugin(data) {
    return {
        class: ['am-message-tool-plugin'].concat(data.class ? [data.class] : []),
        child: [
            {
                class: 'am-message-tool-plugin-icon-ctn',
                child: data.icon
            },
            {
                class: 'am-message-tool-plugin-content',
                child: [
                    {
                        class: 'am-message-tool-plugin-name',
                        child: { text: data.name }
                    }, {
                        class: 'am-message-tool-plugin-desc',
                        child: { text: data.desc }
                    }
                ]

            }
        ]
    }
}

MMessageTool.render = function () {
    return MMessageTool_({
        class: 'am-message-tool',
        extendEvent: ['pressclose', 'resolve'],
        child: [
            {
                class: 'am-message-tool-box',
                child: [
                    {
                        class: 'am-message-tool-header',
                        child: [
                            {
                                class: 'am-message-tool-header-close-btn-ctn',
                                child: {
                                    tag: 'button',
                                    class: 'am-message-tool-header-close-btn',
                                    child: 'span.mdi.mdi-close'
                                }
                            }, {
                                class: 'am-message-tool-title',
                                child: { text: this.prototype.titleText }
                            }
                        ]

                    },
                    {
                        class: 'am-message-tool-body',
                        child: [
                            makePlugin({
                                class: 'am-message-tool-image',
                                name: "Ảnh",
                                desc: "Chia sẻ ảnh",
                                icon: 'span.mdi.mdi-file-image-outline'
                            }),
                            makePlugin({
                                class: 'am-message-tool-video',
                                name: "Video",
                                desc: "Chia sẻ video",
                                icon: 'span.mdi.mdi-file-video-outline'
                            }),
                            makePlugin({
                                class: 'am-message-tool-file',
                                name: "Tệp", desc: "Chia sẻ tệp",
                                icon: 'span.mdi.mdi-file-outline'
                            }),
                            makePlugin({
                                class: 'am-message-tool-contact-picker',
                                name: "Liên hệ",
                                desc: "Chia sẻ liên hệ từ danh bạ",
                                icon: 'span.mdi.mdi-account-box-outline'
                            })
                        ]
                    }
                ]
            },
        ]
    });
};

MMessageTool.prototype.titleText = "Nội dung và công cụ";



MMessageTool.prototype.openImages = function () {
    var thisMT = this;
    return openFileDialog({ multiple: true, accept: "image/*" }).then(function (files) {
        console.log(files)
        if (files && files.length > 0) {
            thisMT.notifyResolve({ type: 'image', files: files });
        }
        else {
            thisMT.notifyClose();
        }
    });
};


MMessageTool.prototype.openVideos = function () {
    var thisMT = this;
    openFileDialog({ multiple: true, accept: "video/*" }).then(function (files) {
        console.log('resolve', files);
        if (files && files.length > 0) {
            thisMT.notifyResolve({ type: 'video', files: files });
        }
        else {
            thisMT.notifyClose();
        }
    });
};


MMessageTool.prototype.openFiles = function () {
    var thisMT = this;
    return openFileDialog({ multiple: true }).then(function (files) {
        if (files && files.length > 0) {
            thisMT.notifyResolve({ type: 'file', files: files });
        }
        else {
            thisMT.notifyClose();

        }
    });
};

MMessageTool.prototype.notifyClose = function () {
    this.emit('pressclose', { type: 'pressclose', target: this }, this);
};

MMessageTool.prototype.notifyResolve = function (value) {
    this.emit('resolve', { type: 'resolve', target: this , value: value}, this);
};


dom_Core.install(MMessageTool);


MMessageTool.$share = MMessageTool_('mmessagetool');
MMessageTool.resolveCB = null;
MMessageTool.rejectCB = null;
MMessageTool.currentSession = null;
MMessageTool._closeTimeout = -1;

MMessageTool.open = function () {
    if (MMessageTool._closeTimeout >= 0) {
        clearTimeout(MMessageTool._closeTimeout);
        MMessageTool._closeTimeout = -1;
    }
    if (typeof MMessageTool.resolveCB == "function") {
        MMessageTool.rejectCB();
        MMessageTool.resolveCB = null;
        MMessageTool.rejectCB = null;
    }

    // MMessageTool.$share
    MMessageTool.$share.addStyle('visibility', 'hidden')
    MMessageTool.$share.addClass('am-hiding');
    setTimeout(function () {
        MMessageTool.$share.removeStyle('visibility')

        MMessageTool.$share.removeClass('am-hiding');
    }, 1)
    MMessageTool.$share.addTo(document.body);
    var ss = randomIdent(20);
    return new Promise(function (rs, rj) {
        MMessageTool.currentSession = ss;
        MMessageTool.resolveCB = rs;
        MMessageTool.rejectCB = rj;

        function finish() {
            MMessageTool.$share.off('pressclose', pressClose);
            MMessageTool.$share.off('resolve', resolve);

            if (MMessageTool.currentSession !== ss) return;
            MMessageTool.resolveCB = null;
            MMessageTool.resolveCB = null;
            MMessageTool.rejectCB = null;
            MMessageTool.$share.addClass('am-hiding');
            MMessageTool._closeTimeout = setTimeout(function () {
                MMessageTool.$share.remove();
            }, 250);
            if (arguments.length === 0) {
                rj();
            }
            else {
                rs(arguments[0]);
            }
        }

        function pressClose() {
            finish();
        }

        function resolve(event){
            finish(event.value)
        }

        MMessageTool.$share.on('pressclose', pressClose);
        MMessageTool.$share.on('resolve', resolve);


    });

};

/* harmony default export */ var dom_MMessageTool = (MMessageTool);


// CONCATENATED MODULE: ./node_modules/absol-mobile/js/dom/MMessageInput.js







var MMessageInput_ = dom_Core._;
var MMessageInput_$ = dom_Core.$;

/***
 * @extends MessageInput
 * @constructor
 */
function MMessageInput() {
    this.autoSend = true;
    this.$left = MMessageInput_('.am-message-input-left').addTo(this);
    this.$moreBtn = MMessageInput_({
        tag: 'button',
        class: ['as-message-input-plugin-btn', 'am-message-input-plugin-more'],
        child: 'span.mdi.mdi-plus'
    }).addTo(this.$left)
        .on('click', this.eventHandler.clickMore);

    this.$cameraBtn = MMessageInput_({
        tag: 'button',
        class: ['as-message-input-plugin-btn', 'am-message-input-plugin-camera'],
        child: 'span.mdi.mdi-camera-outline'
    }).on('click', this.eventHandler.clickCameraBtn);
    this.$right = MMessageInput_$('.as-message-input-right', this);
    this.$right.addChildBefore(this.$cameraBtn, this.$fileBtn);

}

MMessageInput.tag = 'mmessageinput';
MMessageInput.render = function (data) {
    return MMessageInput_('messageinput.am-message-input', true);
};

/***
 *
 * @type {{}|MMessageInput}
 */
MMessageInput.eventHandler = {};

MMessageInput.eventHandler.clickCameraBtn = function (event) {
    var thisMi = this;
    openFileDialog('camera').then(function (files) {
        if (files.length > 0) {
            var imageFiles = [];
            var otherFiles = [];
            var file;
            for (var i = 0; i < files.length; ++i) {
                file = files[i];
                if (!!file.type && file.type.match && file.type.match(/^image\//)) {
                    imageFiles.push(file);
                }
                else {
                    otherFiles.push(file);
                }
            }
            if (imageFiles.length > 0) {
                thisMi.addImageFiles(imageFiles);
                thisMi.images = imageFiles;
            }
            if (otherFiles.length > 0) {
                thisMi.addFiles(otherFiles);
            }
            thisMi.notifyChange();
        }
    });
};


MMessageInput.eventHandler.clickMore = function () {
    var thisMi = this;
    dom_MMessageTool.open().then(function (result) {
        if (result.type ==='file' || result.type =='image'){
            console.log(result.files)
            thisMi.handleAddingFileByType(result.files);
        }
    }, function () {
    })
};

dom_Core.install(MMessageInput);
/* harmony default export */ var dom_MMessageInput = (MMessageInput);
// EXTERNAL MODULE: ./node_modules/absol-mobile/css/mselectlistitem.css
var mselectlistitem = __webpack_require__(270);

// CONCATENATED MODULE: ./node_modules/absol-mobile/js/dom/MSelectListItem.js





var MSelectListItem_ = dom_Core._;
var MSelectListItem_$ = dom_Core.$;


function MSelectListItem() {
    this.$textCtn = MSelectListItem_$('.am-selectlist-item-text-ctn', this);
    this.$text = MSelectListItem_$('span.am-selectlist-item-text', this);
    this.$textValue = this.$text.childNodes[0];
    this.$descCtn = MSelectListItem_$('.am-selectlist-item-desc-ctn', this);
    this.$desc = MSelectListItem_$('span.am-selectlist-item-desc', this.$descCtn);
    this.$descValue = this.$desc.childNodes[0];
    this._extendClasses = [];
    this._extendStyle = {};
    this._data = "";
    this._level = 0;
    return this;
}

MSelectListItem.tag = 'MSelectListItem'.toLowerCase();
MSelectListItem.render = function () {
    return MSelectListItem_({
        class: 'am-selectlist-item',
        child: [
            {
                class: 'am-selectlist-item-text-ctn',
                child: {
                    tag: 'span',
                    class: 'am-selectlist-item-text',
                    child: { text: '' }
                }
            },
            {
                class: 'am-selectlist-item-desc-ctn',
                child: {
                    tag: 'span',
                    class: 'am-selectlist-item-desc',
                    child: { text: '' }
                }
            }
        ]
    });
}

MSelectListItem.property = Object.assign({}, js_SelectListItem.property);


MSelectListItem.property.extendClasses = js_SelectListItem.property.extendClasses;
MSelectListItem.property.extendStyle = js_SelectListItem.property.extendStyle;



MSelectListItem.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;
    }
};


dom_Core.install(MSelectListItem);

/* harmony default export */ var dom_MSelectListItem = (MSelectListItem);
// EXTERNAL MODULE: ./node_modules/absol-mobile/css/mselectlist.css
var mselectlist = __webpack_require__(272);

// CONCATENATED MODULE: ./node_modules/absol-mobile/js/dom/MSelectList.js





var MSelectList_ = dom_Core._;
var MSelectList_$ = dom_Core.$;


function MSelectList_measureListSize(items) {
    var descWidth = measureMaxDescriptionWidth(items);
    var textWidth = measureMaxTextWidth(items);
    var width = descWidth + 20 + textWidth + 12 + 15;//padding, margin
    return {
        width: width,
        descWidth: descWidth,
        textWidth: textWidth
    };
}

var MSelectList_itemPool = [];

function onClickItem(event) {
    var thisSL = this.$parent;
    if (thisSL) {
        thisSL.value = this.value;
        thisSL.emit('pressitem', {
            type: 'pressitem',
            target: thisSL,
            itemElt: this,
            value: this.value,
            data: this.data
        });
    }
}

/**
 * @returns {MSelectListItem}
 */
function MSelectList_makeItem() {
    return MSelectList_({
        tag: 'mselectlistitem',
        on: {
            click: onClickItem
        }
    });
}

function MSelectList_requireItem($parent) {
    var item;
    if (MSelectList_itemPool.length > 0) {
        item = MSelectList_itemPool.pop();
    }
    else {
        item = MSelectList_makeItem();
    }
    item.$parent = $parent;
    return item;
}

function MSelectList_releaseItem(item) {
    item.$parent = null;
    item.attr('class', 'am-selectlist-item');
    MSelectList_itemPool.push(item);
}


/*global absol*/
/***
 * @extends Element
 * @constructor
 */
function MSelectList() {
    var res = this;
    this.defineEvent(['pressitem', 'cancelasync', 'valuevisibilityasync', 'finishasync', 'sizechangeasync']);
    this.$attachhook = MSelectList_('attachhook').addTo(this);
    this.sync = new Promise(function (rs) {
        res.$attachhook.once('error', rs);
    });
    this.$items = [];
    this.$itemByValue = {};//quick find element
    this.$selectedItem = undefined;

    this._itemSession = 0;
    this._finished = true;
    this._resourceReady = true;
};

MSelectList.tag = "MSelectList".toLowerCase();

MSelectList.render = function () {
    return MSelectList_('.am-selectlist');
};

//todo: update this feature to SelectList
/***
 *
 * @param value
 * @return {MSelectListItem|null}
 */
MSelectList.prototype.getItemElementByValue = function (value) {
    return this.$itemByValue[value + ''] || null;
};

MSelectList.prototype._updateSelectedItem = function () {
    var newSelectedItemElt = this.$itemByValue[this._selectValue + ''];
    if (newSelectedItemElt != this.$selectedItem) {
        if (this.$selectedItem) {
            this.$selectedItem.removeClass('selected');
        }
        if (newSelectedItemElt) {
            newSelectedItemElt.addClass('selected');
            this.$selectedItem = newSelectedItemElt;
        }
    }
};


MSelectList.prototype._requireItems = function (itemCout) {
    var item;
    while (this.$items.length < itemCout) {
        item = MSelectList_requireItem(this);
        this.$items.push(item);
        this.addChild(item);
    }

    while (this.$items.length > itemCout) {
        item = this.$items.pop();
        item.remove();
        MSelectList_releaseItem(item);
    }
};

MSelectList.prototype._assignItems = function (from, to) {
    var foundSelected = false;
    var itemElt;
    var item;
    for (var i = from; i < to; ++i) {
        itemElt = this.$items[i];
        item = this._items[i];
        itemElt.data = item;
        itemElt.__index__ = i;
        if (this.$itemByValue[item.value + '']) {
            console.warn('Value  ' + this.$items[i].value + ' is duplicated!');
        }
        else {
            this.$itemByValue[item.value + ''] = itemElt;
            if (this._selectValue == item.value) {
                itemElt.addClass('selected');
                this.$selectedItem = itemElt;
                foundSelected = true;
            }
            else {
                itemElt.removeClass('selected');
            }
        }
    }
    return foundSelected;
};


MSelectList.prototype.setItemsAsync = function (items) {
    //start process
    this._finished = false;
    var session = Math.floor(Math.random() * 1000000);
    this._itemSession = session;
    this._items = items || [];
    this.$itemByValue = {};
    this.measuredSize = MSelectList_measureListSize(items);
    var thisSL = this;
    var i = 0;
    var limit = 20;

    function tick() {
        if (thisSL._itemSession != session) {
            thisSL.emit('cancelasync', { session: session, type: 'cancelasync' }, this);
            return;
        }
        if (i >= items.length) {
            thisSL._updateSelectedItem();
            thisSL._finished = false;
            thisSL.emit('finishasync', { session: session, type: 'finishasync' }, this);
            return;
        }

        var n = Math.min(items.length - i, limit);
        var itemCout = i + n;
        thisSL._requireItems(itemCout);
        i = itemCout;

        var foundSelected = thisSL._assignItems(itemCout - n, itemCout);
        if (foundSelected) {
            thisSL.emit('valuevisibilityasync', {
                session: session,
                type: 'valuevisibilityasync',
                itemElt: thisSL.$items[i]
            }, thisSL);
        }

        thisSL.emit('sizechangeasync', { session: session, type: 'sizechangeasync' }, this);
        setTimeout(tick, 2);
    }

    setTimeout(tick, 2);

    return Object.assign({ session: session }, this.measuredSize);
};


MSelectList.prototype.setItems = function (items) {
    this._finished = false;
    var session = Math.floor(Math.random() * 1000000);
    this._itemSession = session;
    this._items = items || [];
    this.$itemByValue = {};
    this.measuredSize = MSelectList_measureListSize(items);

    var itemCount = items.length;
    this._requireItems(itemCount);
    this._assignItems(0, itemCount);

    this._finished = true;
    return Object.assign({
        session: this._itemSession
    }, this.measuredSize);
};


MSelectList.property = Object.assign({}, js_SelectList.property);

MSelectList.prototype.init = js_SelectList.prototype.init;

MSelectList.eventHandler = {};

dom_Core.install(MSelectList);


/* harmony default export */ var dom_MSelectList = (MSelectList);
// EXTERNAL MODULE: ./node_modules/absol-mobile/css/mselectmenu.css
var mselectmenu = __webpack_require__(274);

// EXTERNAL MODULE: ./node_modules/absol-mobile/css/mlistmodal.css
var mlistmodal = __webpack_require__(276);

// CONCATENATED MODULE: ./node_modules/absol-mobile/js/dom/MListModal.js









var MListModal_ = dom_Core._;
var MListModal_$ = dom_Core.$;
var MListModal_$$ = dom_Core.$$;

var MListModal_VALUE_HIDDEN = -1;
var MListModal_VALUE_NORMAL = 1;


/***
 * @extends AElement
 * @constructor
 */
function MListModal() {
    this._initDomHook();
    this._initControl();
    this._initScroller();
    this._initProperty();
}


MListModal.tag = "MListModal".toLowerCase();
MListModal.render = function () {
    return MListModal_({
        extendEvent: ['pressitem', 'pressclose', 'pressout'],
        class: 'am-list-modal',
        child: [
            {
                class: ['am-list-popup-box'],
                child: [
                    {
                        class: 'am-list-popup-header',
                        child: [
                            {
                                tag: 'button',
                                class: 'am-list-popup-close-btn',
                                child: 'span.mdi.mdi-close'
                            },
                            {
                                tag: 'searchtextinput'
                            }
                        ]
                    },
                    {
                        class: 'am-list-popup-list-scroller',
                        child: {
                            class: 'am-list-popup-content',
                            child: Array(MListModal.prototype.preLoadN).fill('.am-list-popup-list-page.am-selectlist')
                        }
                    }
                ]
            }
        ]
    });
};

MListModal.prototype.toLoadNextY = 200;

MListModal.prototype.preLoadN = 5;

MListModal.prototype._initDomHook = function () {
    this.estimateSize = { width: 0 };
    this.$attachhook = MListModal_('attachhook').addTo(this);

    this.$attachhook._isAttached = false;
    this.$attachhook.requestUpdateSize = this.updateSize.bind(this);
    this.$attachhook.on('attached', function () {
        Dom["b" /* default */].addToResizeSystem(this);
        this.requestUpdateSize();
        this._isAttached = true;
    });
    this.$domSignal = MListModal_('attachhook').addTo(this);
    this.domSignal = new HTML5_DomSignal(this.$domSignal);
    this.domSignal.on('viewListAt', this.viewListAt.bind(this));
    this.domSignal.on('viewListAtFirstSelected', this.viewListAtFirstSelected.bind(this));
};

MListModal.prototype._initControl = function () {
    this._currentOffset = 0;
    this._startItemIdx = 0;

    this.$closeBtn = MListModal_$('.am-list-popup-close-btn', this)
        .on('click', this.notifyPressClose.bind(this));

    this.on('click', this.eventHandler.click);

    this.$box = MListModal_$('.am-list-popup-box', this);


    this.$searchInput = MListModal_$('searchtextinput', this)
        .on('stoptyping', this.eventHandler.searchModify);
};

MListModal.prototype._initScroller = function () {
    this._estimateHeight = 0;
    this._pageOffsets = Array(this.preLoadN + 1).fill(0);
    this._pageYs = Array(this.preLoadN + 1).fill(0);
    this.$listScroller = MListModal_$('.am-list-popup-list-scroller', this)
        .on('scroll', this.eventHandler.scroll);
    this.$content = MListModal_$('.am-list-popup-content', this);
    this.$listPages = MListModal_$$('.am-list-popup-list-page', this);
};

MListModal.prototype._initProperty = function () {
    this._items = [];
    this._values = [];
    this._valueDict = {};
    this._preDisplayItems = [];
    this._displayItems = [];
    this._searchCache = {};
    this._displayValue = MListModal_VALUE_NORMAL;
    this.displayValue = MListModal_VALUE_NORMAL;
    this.items = [];
};

MListModal.prototype.updateSize = function () {
    var bound = this.getBoundingClientRect();
    var boxBound = this.$box.getBoundingClientRect();
    var listScrollerBound = this.$listScroller.getBoundingClientRect();
    this.$listScroller.addStyle('max-height', 'calc(' + (bound.height - listScrollerBound.top + boxBound.top) + 'px - var(--modal-margin-bottom) - var(--modal-margin-top))');
};


MListModal.prototype._requireItem = function (pageElt, n) {
    var itemElt;
    while (pageElt.childNodes.length > n) {
        itemElt = pageElt.lastChild;
        itemElt.selfRemove();
        MSelectList_releaseItem(itemElt);
    }
    while (pageElt.childNodes.length < n) {
        itemElt = MSelectList_requireItem(this);
        pageElt.addChild(itemElt);
    }
};


MListModal.prototype._listToDisplay = function (items) {
    return items;
};

/***
 *
 * @param {Array<{value:String|Number}>} items
 * @return {Array<{value:String|Number}>}
 */
MListModal.prototype._filterValue = function (items) {
    if (this._displayValue === MListModal_VALUE_NORMAL) return items;
    var dict = this._valueDict;
    return items.filter(function (item) {
        return !dict[item.value + ''];
    });
};

MListModal.prototype._assignItems = function (pageElt, offset) {
    var n = Math.min(this._displayItems.length - offset, pageElt.childNodes.length);
    var itemElt, value;
    for (var i = 0; i < n; ++i) {
        itemElt = pageElt.childNodes[i];
        itemElt.data = this._displayItems[offset + i];
        value = itemElt.value + '';
    }
};

MListModal.prototype._alignPage = function () {
    var pageElt;
    var pageBound;
    for (var i = 0; i < this.$listPages.length; ++i) {
        pageElt = this.$listPages[i];
        pageBound = pageElt.getBoundingClientRect();
        if (i > 0) this.$listPages[i].addStyle('top', this._pageYs[i] + 'px');
        this._pageYs[i + 1] = this._pageYs[i] + pageBound.height;
    }
    this.$content.addStyle('height', this._pageYs[this.preLoadN] + 'px');
};

MListModal.prototype._updateSelectedItem = function () {
    var valueDict = this._valueDict;
    this.$listPages.forEach(function (pageElt) {
        Array.prototype.forEach.call(pageElt.childNodes, function (itemElt) {
            var value = itemElt.value + '';
            if (valueDict[value]) {
                itemElt.addClass('selected');
            }
            else {
                itemElt.removeClass('selected');
            }
        });
    });
    if (this._displayValue === MListModal_VALUE_HIDDEN)
        this._alignPage();
};


MListModal.prototype.viewListAt = function (offset) {
    if (!this.isDescendantOf(document.body)) {
        this.domSignal.emit('viewListAt', offset);
        return;
    }
    var fontSize = this.$listScroller.getFontSize() || 14;
    offset = Math.max(0, Math.min(offset, this._displayItems.length - 1));
    var screenSize = Dom["b" /* default */].getScreenSize();
    var maxItem = Math.ceil(screenSize.height / (fontSize * 2.25));
    var contentBound = this.$content.getBoundingClientRect();

    this._pageOffsets[0] = Math.max(offset - maxItem, 0);
    for (var i = 1; i <= this.preLoadN; ++i) {
        this._pageOffsets[i] = Math.min(this._pageOffsets[i - 1] + maxItem, this._displayItems.length);
    }

    var sIdx, nItem, pageBound;
    var pageElt;
    for (var pageIndex = 0; pageIndex < this.preLoadN; ++pageIndex) {
        sIdx = this._pageOffsets[pageIndex];
        nItem = this._pageOffsets[pageIndex + 1] - sIdx;
        pageElt = this.$listPages[pageIndex];

        if (pageIndex === 0) {
            this._pageYs[pageIndex] = sIdx / this._displayItems.length * contentBound.height;
        }

        pageElt.addStyle('top', this._pageYs[pageIndex] + 'px');
        this._requireItem(pageElt, nItem);
        this._assignItems(pageElt, sIdx);
        pageBound = pageElt.getBoundingClientRect();
        this._pageYs[pageIndex + 1] = this._pageYs[pageIndex] + pageBound.height;
    }
    if (this._pageOffsets[this.preLoadN] === this._displayItems.length) {
        this.$content.addStyle('height', this._pageYs[this.preLoadN] + 'px');

    }
    else {
        this.$content.addStyle('height', this._estimateHeight + 'px');
    }
    this._updateSelectedItem();
};


MListModal.prototype.viewListAtFirstSelected = function () {
    if (!this.isDescendantOf(document.body)) {
        this.domSignal.emit('viewListAtFirstSelected');
        return;
    }
    if (this._displayValue == MListModal_VALUE_HIDDEN) {
        return false;
    }
    else if (this._values.length > 0) {
        var value = this._values[0];
        var itemHolders = this._itemHolderByValue[value + ''];
        if (itemHolders) {
            this.domSignal.once('scrollIntoSelected', function () {
                var holder = itemHolders[0];
                this.viewListAt(holder.idx);
                var itemElt = MListModal_$('.selected', this.$listScroller);
                if (itemElt) {
                    var scrollBound = this.$listScroller.getBoundingClientRect();
                    var itemBound = itemElt.getBoundingClientRect();
                    this.$listScroller.scrollTop += itemBound.top - scrollBound.top;
                }
            }.bind(this));
            this.domSignal.emit('scrollIntoSelected');
            return true;
        }
        else return false;
    }
    else
        return false;
};


MListModal.prototype.searchItemByText = function (text) {
    text = text.trim();
    if (text.length == 0) return this._items;
    if (this._searchCache[text]) return this._searchCache[text];
    this._searchCache[text] = searchListByText(text, this._items);
    return this._searchCache[text];
};

MListModal.prototype.resetSearchState = function () {
    this.$searchInput.value = '';
    this._preDisplayItems = this._listToDisplay(this._items);
    this._displayItems = this._filterValue(this._preDisplayItems);
    this._updateItemIndex();
    this.domSignal.emit('viewListAt', 0);
    this.$listScroller.scrollTop = 0;
};

MListModal.prototype.notifyPressOut = function () {
    this.emit('pressout', { target: this, type: 'pressout' }, this);
};

MListModal.prototype.notifyPressClose = function () {
    this.emit('pressclose', { target: this, type: 'pressclose' }, this);
};

MListModal.prototype._findFirstPageIdx = function () {
    for (var i = 0; i < this.preLoadN; ++i) {
        if (this._pageOffsets[i + 1] - this._pageOffsets[i] > 0) {
            return i;
        }
    }
    return -1;
};

MListModal.prototype._findLastPageIdx = function () {
    for (var i = this.preLoadN - 1; i >= 0; --i) {
        if (this._pageOffsets[i + 1] - this._pageOffsets[i] > 0) {
            return i;
        }
    }
    return -1;
};

MListModal.prototype._updateItemIndex = function (){
    this._itemHolderByValue = this._displayItems.reduce(function (ac, cr, idx) {
        var value = typeof cr === "string" ? cr : cr.value + '';
        ac[value] = ac[value] || [];
        ac[value].push({
            idx: idx,
            item: cr
        });
        return ac;
    }, {});
};


MListModal.property = {};

/***
 *
 * @type {MListModal}
 */
MListModal.property.items = {
    get: function () {
        return this._items;
    },
    set: function (items) {
        var items = items || [];
        this._items = items;
        this._preDisplayItems = this._listToDisplay(this._items);
        this._displayItems = this._filterValue(this._preDisplayItems);
        this._updateItemIndex();
        this._searchCache = {};
        var estimateSize = MSelectList_measureListSize(this._preDisplayItems);
        if (estimateSize.descWidth > 0) {
            this.$listScroller.addStyle('--desc-width', 100 * (estimateSize.descWidth + 15) / (estimateSize.width) + '%');
        }
        else {
            this.$listScroller.removeStyle('--desc-width');
        }
        var estimateHeight = this._displayItems.length * 30 * Math.ceil(estimateSize.width * 1.2 / Math.min(Dom["b" /* default */].getScreenSize().width - 80, 500));
        this._estimateHeight = estimateHeight;
        this.$content.addStyle('height', estimateHeight + 'px');
        this.estimateSize = estimateSize;
        prepareSearchForList(items);
        this.domSignal.emit('viewListAt', 0);
    }
};

MListModal.property.values = {
    set: function (values) {
        values = values || [];
        this._values = values;
        this._valueDict = values.reduce(function (ac, cr) {
            ac[cr + ''] = true;
            return ac;
        }, {});

        this._displayItems = this._filterValue(this._preDisplayItems);
        this._updateItemIndex();
        //todo
        if (this._pageOffsets[this.preLoadN] > this._pageOffsets[0]) this._updateSelectedItem();
    },
    get: function () {
        return this._values;
    }
};

MListModal.property.displayValue = {
    set: function (value) {
        this._displayValue = value;
        this._displayItems = this._filterValue(this._preDisplayItems);
        this._updateItemIndex();
        if (value === MListModal_VALUE_HIDDEN) {
            this.addClass('am-value-hidden');
        }
        else {
            this.removeClass('am-value-hidden');
        }
    },
    get: function () {
        return this._displayValue;
    }
}

MListModal.property.enableSearch = {
    set: function (value) {
        if (value) this.$box.addClass('am-enable-search');
    },
    get: function () {
        return this.$box.removeClass('am-enable-search');
    }
};


/***
 *
 * @type {MListModal}
 */
MListModal.eventHandler = {};

/***
 *
 * @param {MouseEvent} event
 */
MListModal.eventHandler.click = function (event) {
    if (event.target === this)
        this.notifyPressOut();
};

MListModal.eventHandler.searchModify = function () {
    var text = this.$searchInput.value;
    var searchedItems = this.searchItemByText(text);
    this._preDisplayItems = this._listToDisplay(searchedItems);
    this._displayItems = this._filterValue(this._preDisplayItems);
    this._updateItemIndex();
    this.viewListAt(0);
    this.$listScroller.scrollTop = 0;
};


MListModal.eventHandler.scroll = function () {
    var scrollerBound = this.$listScroller.getBoundingClientRect();
    var topIdx = this._findFirstPageIdx();
    var fontSize = this.$listScroller.getFontSize() || 14;
    var screenSize = Dom["b" /* default */].getScreenSize();
    var maxItem = Math.ceil(screenSize.height / (fontSize * 2.25));
    var pageBound;
    var topBound = this.$listPages[topIdx].getBoundingClientRect();
    ;
    if (this._pageOffsets[topIdx] > 0) {
        if (topBound.top + this.toLoadNextY > scrollerBound.top) {
            this._pageOffsets.unshift(this._pageOffsets.pop());
            this._pageYs.unshift(this._pageYs.pop());
            this.$listPages.unshift(this.$listPages.pop());
            this._pageOffsets[topIdx] = Math.max(0, this._pageOffsets[topIdx + 1] - maxItem);

            this._requireItem(this.$listPages[topIdx], this._pageOffsets[topIdx + 1] - this._pageOffsets[topIdx]);
            this._assignItems(this.$listPages[topIdx], this._pageOffsets[topIdx]);
            pageBound = this.$listPages[topIdx].getBoundingClientRect();
            this._pageYs[topIdx] = this._pageYs[topIdx + 1] - pageBound.height;
            this.$listPages[topIdx].addStyle('top', this._pageYs[topIdx] + 'px');
            this._updateSelectedItem();
            if (this._pageOffsets[topIdx] === 0) {
                this.$listPages[0].addStyle('top', '0');
                this._pageYs[0] = 0;
                this._alignPage();
                this.$listScroller.scrollTop = 0;
            }

        }
    }
    else {
        if (topBound.top > scrollerBound.top) {
            this.$listScrolle.scrollTop += topBound.top - scrollerBound.top;
        }
    }

    var botIdx = this._findLastPageIdx();
    var botBound;
    botBound = this.$listPages[botIdx].getBoundingClientRect();
    if (this._pageOffsets[botIdx + 1] < this._displayItems.length) {
        if (botBound.bottom - this.toLoadNextY < scrollerBound.bottom) {
            this._pageOffsets.push(this._pageOffsets.shift());
            this._pageYs.push(this._pageYs.shift());
            this.$listPages.push(this.$listPages.shift());
            this._pageOffsets[botIdx + 1] = Math.min(this._displayItems.length, this._pageOffsets[botIdx] + maxItem);
            this.$listPages[botIdx].addStyle('top', this._pageYs[botIdx] + 'px');
            this._requireItem(this.$listPages[botIdx], this._pageOffsets[botIdx + 1] - this._pageOffsets[botIdx]);
            this._assignItems(this.$listPages[botIdx], this._pageOffsets[botIdx]);
            pageBound = this.$listPages[botIdx].getBoundingClientRect();
            this._pageYs[botIdx + 1] = this._pageYs[botIdx] + pageBound.height;
            this._updateSelectedItem();
            if (this._pageOffsets[botIdx + 1] < this._displayItems.length) {
                this.$content.addStyle('height', this._estimateHeight + 'px');
            }
            else {
                this.$content.addStyle('height', this._pageYs[botIdx + 1] + 'px');
            }
        }
    }
};

dom_Core.install(MListModal);
/* harmony default export */ var dom_MListModal = (MListModal);

// CONCATENATED MODULE: ./node_modules/absol-mobile/js/dom/MSelectMenu.js





var MSelectMenu_ = dom_Core._;
var MSelectMenu_$ = dom_Core.$;


function MSelectMenu() {
    this._isFocus = false;
    this._itemsByValue = {};
    this.$holderItem = MSelectMenu_$('.am-selectmenu-holder-item', this);

    /***
     * @type {MListModal}
     */
    this.$selectlist = MSelectMenu_('mlistmodal');

    this.$selectlist.on('pressitem', this.eventHandler.pressItem, true)
        .on('pressout', this.eventHandler.pressOut)
        .on('pressclose', this.eventHandler.pressOut);
    this.on('click', this.eventHandler.click, true);

    this.$attachhook = MSelectMenu_$('attachhook', this).on('error', this.eventHandler.attached);
}

MSelectMenu.tag = 'mselectmenu';
MSelectMenu.render = function () {
    return MSelectMenu_({
        class: ['absol-selectmenu', 'am-selectmenu'],
        extendEvent: ['change', 'minwidthchange'],
        attr: {
            tabindex: '1'
        },
        child: [
            '.am-selectmenu-holder-item',
            {
                tag: 'button',
                class: 'absol-selectmenu-btn',
                child: ['dropdown-ico']
            },
            'attachhook',
        ]
    });
};


MSelectMenu.prototype.updateItem = function () {
    this.$holderItem.clearChild();
    if (this._itemsByValue[this.value]) {
        var elt = MSelectMenu_({
            tag: 'mselectlistitem',
            props: {
                data: this._itemsByValue[this.value]
            }
        }).addTo(this.$holderItem);
        // elt.$descCtn.addStyle('width', this.$selectlist._descWidth + 'px');
    }
};

MSelectMenu.prototype.notifyChange = function (data) {
    this.emit('change', Object.assign({}, data, { type: 'chage', target: this }), this);
};

MSelectMenu.prototype._dictByValue = js_SelectMenu.prototype._dictByValue;

MSelectMenu.prototype.getRecommendWith = function () {
    return this.$selectlist.estimateSize.width + 36;
};

MSelectMenu.prototype.init = js_SelectMenu.prototype.init;

MSelectMenu.property = {};


MSelectMenu.property.items = {
    set: function (value) {
        this._itemIdxByValue = null;
        /**
         * verity data
         */
        if (value) {
            value.forEach(function (it) {
                if (it && it.text) {
                    it.text = it.text + '';
                }
            });
        }

        this._items = value;
        this._itemsByValue = this._dictByValue(value);

        if (!this._itemsByValue[this.value] && value.length > 0) {
            this.value = value[0].value;
        }
        else
            this.updateItem();
        this.$selectlist.items = value
    },
    get: function () {
        return this._items || [];
    }
};

MSelectMenu.property.value = {
    set: function (value) {
        this._value = value;

        this.$selectlist.values = [value];
        this.updateItem();
    },
    get: function () {
        return this._value;
    }
};


MSelectMenu.property.enableSearch = {
    set: function (value) {
        this.$selectlist.enableSearch = !!value;
    },
    get: function () {
        return this.$selectlist.enableSearch;
    }
};


MSelectMenu.property.isFocus = {
    set: function (value) {
        var thisSM = this;
        value = !!value;
        if (value === this._isFocus) return;
        this._isFocus = value;
        if (value) {
            this.$selectlist.afterAttached().then(function () {
                thisSM.$selectlist.viewListAtFirstSelected();
            });
            thisSM.$selectlist.viewListAt(0);
            this.$selectlist.addTo(document.body);
        }
        else {
            this.$selectlist.selfRemove();
            setTimeout(function () {
                thisSM.$selectlist.resetSearchState();
            }, 100);
        }
    },
    get: function () {
        return this._isFocus;
    }
};

MSelectMenu.property.selectedIndex = js_SelectMenu.property.selectedIndex;

MSelectMenu.property.disabled = js_SelectMenu.property.disabled;
MSelectMenu.property.hidden = js_SelectMenu.property.hidden;

/**
 * @type {MSelectMenu}
 */
MSelectMenu.eventHandler = {};

MSelectMenu.eventHandler.attached = function () {
    if (this.style.width === 'auto') {
        this.addStyle('width', this.getRecommendWith() / 14 + 'em');
    }
};

MSelectMenu.eventHandler.click = function (event) {
    this.isFocus = !this.isFocus;
};


MSelectMenu.eventHandler.pressOut = function (event) {
    this.isFocus = false;
};


MSelectMenu.eventHandler.pressItem = function (event) {
    var newValue = event.value;
    if (newValue !== this._value) {
        var lastValue = this._value;
        this._value = newValue;
        this.$selectlist.values = [newValue];
        this.updateItem();
        var changeEvent = Object.assign({}, event, { lastValue: lastValue });
        setTimeout(function () {
            this.notifyChange(changeEvent);
        }.bind(this), 1);
    }
    setTimeout(function () {
        this.isFocus = false;
    }.bind(this), 100);
};


dom_Core.install(MSelectMenu);

/* harmony default export */ var dom_MSelectMenu = (MSelectMenu);
// EXTERNAL MODULE: ./node_modules/absol-mobile/css/mselecttreemenu.css
var mselecttreemenu = __webpack_require__(278);

// CONCATENATED MODULE: ./node_modules/absol-mobile/js/dom/MTreeModal.js






/***
 * @extends MListModal
 * @constructor
 */
function MTreeModal() {
    dom_MListModal.call(this);
}


MTreeModal.tag = 'MTreeModal'.toLowerCase();

MTreeModal.render = function () {
    return dom_MListModal.render().addClass('am-tree-modal');
};


Object.assign(MTreeModal.prototype, dom_MListModal.prototype);

MTreeModal.prototype._listToDisplay = function (items) {
    return treeListToList(items);
};

MTreeModal.prototype.searchItemByText = function (text) {
    text = text.trim();
    if (text.length == 0) return this._items;
    if (this._searchCache[text]) return this._searchCache[text];
    this._searchCache[text] = searchTreeListByText(text, this._items);
    return this._searchCache[text];
};

MTreeModal.property = Object.assign({}, dom_MListModal.property);


MTreeModal.eventHandler = Object.assign({}, dom_MListModal.eventHandler);

dom_Core.install(MTreeModal);

/* harmony default export */ var dom_MTreeModal = (MTreeModal);
// CONCATENATED MODULE: ./node_modules/absol-mobile/js/dom/MSelectTreeMenu.js





var MSelectTreeMenu_ = dom_Core._;
var MSelectTreeMenu_$ = dom_Core.$;

function MSelectTreeMenu() {
    this._isFocus = false;
    this._itemsByValue = {};
    this.$holderItem = MSelectTreeMenu_$('.am-selectmenu-holder-item', this);

    /***
     * @type {MTreeModal}
     */
    this.$selectlist = MSelectTreeMenu_('mtreemodal');

    this.$selectlist.on('pressitem', this.eventHandler.pressItem, true)
        .on('pressout', this.eventHandler.pressOut)
        .on('pressclose', this.eventHandler.pressOut);
    this.on('click', this.eventHandler.click, true);
    this.$attachhook = MSelectTreeMenu_$('attachhook', this).on('error', this.eventHandler.attached);
}

MSelectTreeMenu.tag = 'MSelectTreeMenu'.toLowerCase();

MSelectTreeMenu.render = function () {
    return  dom_MSelectMenu.render().addClass('am-select-tree-menu');
};

Object.assign(MSelectTreeMenu.prototype, dom_MSelectMenu.prototype);
MSelectTreeMenu.property = Object.assign({}, dom_MSelectMenu.property);
MSelectTreeMenu.eventHandler = Object.assign({}, dom_MSelectMenu.eventHandler);

MSelectTreeMenu.prototype._dictByValue = function(items){
    return items.reduce(function visitor(ac, cr) {
        if (cr.items && cr.items.reduce){
            cr.items.reduce(visitor, ac);
        }
        var value = cr.value+'';
        ac[value] = cr;
        return ac;
    }, {})
};

dom_Core.install(MSelectTreeMenu);

/* harmony default export */ var dom_MSelectTreeMenu = (MSelectTreeMenu);
// EXTERNAL MODULE: ./node_modules/absol-mobile/css/mselectbox.css
var mselectbox = __webpack_require__(280);

// CONCATENATED MODULE: ./node_modules/absol-mobile/js/dom/MSelectBox.js





/*global absol*/
var MSelectBox_ = dom_Core._;
var MSelectBox_$ = dom_Core.$;


var boxItemPool = [];

function closeBoxItem(event) {
    var thisSB = this.$parent;
    if (!thisSB) return;
    var itemValue = this.value

    var index = thisSB.values.indexOf(itemValue);
    if (index >= 0) {
        thisSB.values = thisSB.values.slice(0, index).concat(thisSB.values.slice(index + 1));
        thisSB.emit('remove', {
            type: 'remove',
            values: thisSB.values,
            target: thisSB,
            itemElt: this,
            value: this.value,
            itemData: this.data
        }, thisSB);
        thisSB.emit('change', { type: 'change', values: thisSB.values, target: thisSB }, thisSB);
    }
}

/**
 * @returns {MSelectListItem}
 */
function MSelectBox_makeItem() {
    return MSelectBox_({
        tag: 'selectboxitem',
        on: {
            close: closeBoxItem
        }
    });
}

function requireBoxItem($parent) {
    var item;
    if (boxItemPool.length > 0) {
        item = boxItemPool.pop();
    }
    else {
        item = MSelectBox_makeItem();
    }
    item.$parent = $parent;
    return item;
}

function releaseBoxItem(item) {
    item.$parent = null;
    boxItemPool.push(item);
}

/***
 * @extends Element
 * @constructor
 */
function MSelectBox() {
    this._isFocus = false;
    this._values = [];
    this._orderly = false;

    this._itemsByValue = {};

    this.$boxItems = [];

    this.$selectlist = MSelectBox_('mlistmodal');
    this.$selectlist.displayValue = MListModal_VALUE_HIDDEN;

    this.$selectlist.on('pressitem', this.eventHandler.pressItem, true)
        .on('pressout', this.eventHandler.pressOut)
        .on('pressclose', this.eventHandler.pressOut);
    this.on('click', this.eventHandler.click);
    this.$attachhook = MSelectBox_$('attachhook', this).on('error', this.eventHandler.attached);

    this.orderly = false;
    this.items = [];
    this.values = [];
}

MSelectBox.tag = 'MSelectBox'.toLowerCase();
MSelectBox.render = function () {
    return MSelectBox_({
        tag: 'bscroller',
        class: ['absol-selectbox', 'absol-bscroller', 'am-select-box'],
        extendEvent: ['change', 'add', 'remove', 'minwidthchange'],
        attr: {
            tabindex: '1'
        },
        child: 'attachhook'
    }, true);
};


MSelectBox.prototype.getRecommendWith = function () {
    return this.$selectlist.estimateSize.textWidth + 60;
};

MSelectBox.prototype._dictByValue = dom_MSelectMenu.prototype._dictByValue;


MSelectBox.property = {};
MSelectBox.property.disabled = dom_MSelectMenu.property.disabled;
MSelectBox.property.hidden = dom_MSelectMenu.property.hidden;
MSelectBox.property.enableSearch = dom_MSelectMenu.property.enableSearch;


MSelectBox.prototype.init = function (props) {
    props = props || [];
    Object.keys(props).forEach(function (key) {
        if (props[key] === undefined) delete props[key];
    });
    this.super(props);
};


MSelectBox.prototype._requireBoxItems = function () {
    var n = this._values.length;
    var boxItemElt;
    while (this.$boxItems.length < n) {
        boxItemElt = requireBoxItem(this);
        this.$boxItems.push(boxItemElt);
        this.addChild(boxItemElt);
    }
    while (this.$boxItems.length > n) {
        boxItemElt = this.$boxItems.pop();
        boxItemElt.selfRemove();
        releaseBoxItem(boxItemElt);
    }
};

MSelectBox.prototype._sortValuesIfNeed = function () {
    if (this._orderly) {
        var thisMB = this;
        this.values.sort(function (a, b) {
            var aItem = thisMB._itemsByValue[a];
            var bItem = thisMB._itemsByValue[b];
            if (!aItem) return 1;
            if (!bItem) return -1;
            return aItem.__index__ - bItem.__index__;
        });
    }
};


MSelectBox.prototype._assignBoxItems = function () {
    var n = this._values.length;
    var item;
    var value;
    for (var i = 0; i < n; ++i) {
        value = this._values[i];
        item = this._itemsByValue[value];
        this.$boxItems[i].data = item || { text: 'error' };
    }
};


MSelectBox.prototype._updateValues = function () {
    this._requireBoxItems();
    this._assignBoxItems();
};


MSelectBox.prototype.querySelectedItems = function () {
    return Array.prototype.map.call(this.$holderItem.childNodes, function (e) {
        return e.data;
    });
};


MSelectBox.property.isFocus = dom_MSelectMenu.property.isFocus;


/***
 *
 * @type {MSelectBox}
 */
MSelectBox.property.items = {
    set: function (items) {
        items = items || [];
        items.forEach(function (item, i) {
            item.__index__ = i;
        })
        this._items = items;
        this._itemsByValue = this._dictByValue(items);
        this.$selectlist.items = items;
        this._sortValuesIfNeed();
        this._updateValues();
    },
    get: function () {
        return this._items;
    }
};

MSelectBox.property.values = {
    set: function (values) {
        values = values || [];
        values = (values instanceof Array) ? values : [values];
        this._values = values;
        this.$selectlist.values = values;
        this._sortValuesIfNeed();
        this._updateValues();
    },
    get: function () {
        return this._values || [];
    }
};

MSelectBox.property.orderly = {
    set: function (value) {
        this._orderly = !!value;
        this._sortValuesIfNeed();
        this._updateValues();
    },
    get: function () {
        return !!this._orderly;
    }

}

/***
 *
 * @type {MSelectBox}
 */
MSelectBox.eventHandler = {};

MSelectBox.eventHandler.pressOut = dom_MSelectMenu.eventHandler.pressOut;
MSelectBox.eventHandler.attached = dom_MSelectMenu.eventHandler.attached;


MSelectBox.eventHandler.click = function (event) {
    if (event.target == this) {
        this.isFocus = !this.isFocus;
    }
};


MSelectBox.eventHandler.pressItem = function (event) {
    this.values.push(event.value);
    this._sortValuesIfNeed();
    this._updateValues();
    this.$selectlist.values = this.values;
    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);
    this.isFocus = false;
};

dom_Core.install('MSelectBox'.toLowerCase(), MSelectBox);

/* harmony default export */ var dom_MSelectBox = (MSelectBox);
// EXTERNAL MODULE: ./node_modules/absol-mobile/css/mblinkmodal.css
var mblinkmodal = __webpack_require__(282);

// CONCATENATED MODULE: ./node_modules/absol-mobile/js/dom/MBlinkModal.js




var MBlinkModal_ = dom_Core._;
var MBlinkModal_$ = dom_Core.$;

/***
 * extends {Element}
 * @constructor
 */
function MBlinkModal() {
    this.$attachhook = MBlinkModal_('attachhook');
    this.$attachhook.requestUpdateSize = this.updateSize.bind(this);
    this.$attachhook.addTo(this)
        .on('error', function () {
            Dom["b" /* default */].addToResizeSystem(this);
            this.requestUpdateSize();
        });
    this._show = false;
    this.show = false;
}


MBlinkModal.tag = 'MBlinkModal'.toLowerCase();
MBlinkModal.render = function () {
    return MBlinkModal_({
        class: 'am-blink-modal'
    });
};

MBlinkModal.prototype.clearChild = function () {
    var child = Array.prototype.slice(this.childNodes);
};

MBlinkModal.prototype.updateSize = function () {
    this.removeClass('am-animation');
    var bound = this.getBoundingClientRect();
    this.addStyle('--hide-top', -(bound.height + 2) + 'px');
    this.addClass('am-animation');
}

MBlinkModal.property = {};

MBlinkModal.property.show = {
    set: function (value) {
        this._show = !!value;
        if (this._show) {
            this.addClass('am-show');
        }
        else {
            this.removeClass('am-show');
        }
    },
    get: function () {
        return this._show;
    }
};


MBlinkModal.newInstance = function (instanceData) {
    instanceData = instanceData || {};
    instanceData.duration = instanceData.duration || 2000;
    var modal = MBlinkModal_(Object.assign({
        tag: 'mblinkmodal',
    }, instanceData || {}));

    var state = 0;//not attach

    function waitToRemove() {
        setTimeout(function () {
            if (state !== 3) return;
            state = 4;
            modal.selfRemove();
        }, 300);
    }

    function waitToShow() {
        setTimeout(function () {
            if (state !== 1) return;
            state = 2;
            modal.show = true;
            waitToClose(instanceData.duration);
        }, 1);
    }

    function waitToClose(mil) {
        if (state === 2) {
            setTimeout(function () {
                if (state !== 2) return;
                state = 3;
                modal.show = false;
                waitToRemove();
            }, mil);
        }
    }

    modal.addTo(document.body);
    modal.$attachhook.on('error', function () {
        state = 1;//attached
        waitToShow();
    });

    return {
        modal: modal,
        close: waitToClose.bind(null, 100)
    };
};

dom_Core.install(MBlinkModal);


/* harmony default export */ var dom_MBlinkModal = (MBlinkModal);
// EXTERNAL MODULE: ./node_modules/absol-mobile/css/mhsnapscroller.css
var mhsnapscroller = __webpack_require__(284);

// CONCATENATED MODULE: ./node_modules/absol-mobile/js/dom/MHSnapScroller.js




var MHSnapScroller_ = dom_Core._;
var MHSnapScroller_$ = dom_Core.$;


/***
 *  @extends AElement
 * @constructor
 */
function MHSnapScroller() {
    this.addClass('am-h-snap-scroller');
    //still fail on iOS, disable all
    // this.on('touchstart', this.eventHandler.touchstart);
    // this.on('touchend', this.eventHandler.touchend);
    // this.on('scroll', this.eventHandler.scroll);
    this._scroll = {
        speed: 0,
        lastEventTime: 0,
        homeGoing: false,
        release: true,
        homeX: 0,
        x: 0,
        scrollEnded: true
    };
}

MHSnapScroller.tag = 'MHSnapScroller'.toLowerCase();


MHSnapScroller.render = function () {
    return MHSnapScroller_({});
};

MHSnapScroller.prototype._findHomeX = function () {
    var bound = this.getBoundingClientRect();
    var centerX = (bound.left + bound.right) / 2;
    var eBounds = Array.prototype.map.call(this.childNodes, function (elt) {
        return elt.getBoundingClientRect();
    }).filter(function (bound) {
        return bound.width > 0;
    });
    var scrollLeft = this.scrollLeft;
    var nearestX = Infinity;
    var nextX = Infinity;
    var childCenterX;
    for (var i = 0; i < eBounds.length; ++i) {
        childCenterX = (eBounds[i].left + eBounds[i].right) / 2;
        if (Math.abs(childCenterX - centerX) < Math.abs(nearestX - centerX)) {
            nearestX = childCenterX;
        }

        if ((childCenterX - centerX >= 0) == (this._scroll.speed >= 0)) {
            if (Math.abs(childCenterX - centerX) < Math.abs(nextX - centerX)) {
                nextX = childCenterX;
            }
        }
    }

    if (((nearestX - centerX >= 0) != (this._scroll.speed >= 0)) && (nextX != Infinity)) {
        nearestX = nextX;
    }

    return Math.max(0, Math.min(this.scrollWidth - this.clientWidth, scrollLeft + (nearestX - centerX)));

};


MHSnapScroller.prototype.startHomeGoing = function () {
    if (this._scroll.homeGoing || !this._scroll.release || !this._scroll.scrollEnded) return;
    var homeX = this._findHomeX();
    this._scroll.homeX = homeX;
    this._scroll.homeGoing = true;
    if (this._scroll.speed < 50 && this._scroll.speed >= 0) {
        this._scroll.speed = 50;
    }
    else if (this._scroll.speed > -50 && this._scroll.speed < 0) {
        this._scroll.speed = -50;
    }

    this.eventHandler.homeGoingTick();

};

MHSnapScroller.prototype.stopHomeGoing = function () {
    if (!this._scroll.homeGoing) return;
    this._scroll.homeGoing = false;
};


/***
 *
 * @type {{}|MHSnapScroller}
 */
MHSnapScroller.eventHandler = {};

MHSnapScroller.eventHandler.homeGoingTick = function (toFinish) {
    if (!this._scroll.homeGoing) return;
    if (toFinish === true) {
        this.stopHomeGoing();
        return;
    }
    var last = this._scroll.lastEventTime;
    var now = new Date().getTime();
    var dt = (now - last) / 1000;
    var dx = dt * this._scroll.speed;
    var limitDx = this._scroll.homeX - this._scroll.x;
    var needContinue = false;
    if (Math.abs(dx) >= Math.abs(limitDx) || dx * limitDx <= 0) {
        this._scroll.x = this._scroll.homeX;
    }
    else {
        this._scroll.x += dx;
        needContinue = true;
    }

    this.scrollLeft = this._scroll.x;
    if (needContinue)
        requestAnimationFrame(this.eventHandler.homeGoingTick);
    else
        requestAnimationFrame(this.eventHandler.homeGoingTick.bind(this, true));
}

MHSnapScroller.eventHandler.stopScroll = function () {
    this._scroll.scrollEnded = true;
    this.startHomeGoing();
};

/***
 *
 * @param {TouchEvent} event
 */
MHSnapScroller.eventHandler.touchstart = function (event) {
    this.stopHomeGoing();
    this._scroll.release = false;
};

/***
 *
 * @param {TouchEvent} event
 */
MHSnapScroller.eventHandler.touchend = function (event) {
    if (event.touches.length === 0) {
        this._scroll.release = true;
        this.startHomeGoing();
    }
};

MHSnapScroller.eventHandler.scroll = function () {
    if (this._scroll.homeGoing) return;
    var last = this._scroll.lastEventTime;
    this._scroll.scrollEnded = false;
    var now = new Date().getTime();
    if (now - last > 100) {
        this._scroll.speed = 0;
        this._scroll.lastEventTime = now;
        this._scroll.x = this.scrollLeft;
    }
    else if (now > last) {
        this._scroll.speed = (this.scrollLeft - this._scroll.x) * 1000 / (now - last);
        this._scroll.lastEventTime = now;
        this._scroll.x = this.scrollLeft;
    }
    if (this._scroll.stopTimeout > 0) {
        clearTimeout(this._scroll.stopTimeout);
    }
    this._scroll.stopTimeout = setTimeout(this.eventHandler.stopScroll, 30);
};

/* harmony default export */ var dom_MHSnapScroller = (MHSnapScroller);
// CONCATENATED MODULE: ./node_modules/absol-mobile/js/dom/install.js




















function install_install(core) {
    core.install([
        dom_MMessageInput, dom_MNavigatorMenu, dom_MBottomTabbar,
        dom_MLeftNavigator, dom_MTinyProfileBlock, dom_MMatMenuButton,
        dom_MMatMenuItem, dom_MMatMenu, dom_MHeaderBar,
        dom_MConversation,
        dom_MSelectListItem,
        dom_MSelectList,
        dom_MSelectMenu, dom_MSelectTreeMenu,
        dom_MSelectBox,
        dom_MBlinkModal,
        dom_MListModal,
        dom_MTreeModal,
        dom_MHSnapScroller
    ]);
}
// CONCATENATED MODULE: ./app/dom/Core.js



var Core_Core = new Dom["b" /* default */]({});
dom_install(Core_Core);
install_install(Core_Core);
var Core_ = Core_Core._;
var Core_$ = Core_Core.$;
/* harmony default export */ var app_dom_Core = (Core_Core);
// EXTERNAL MODULE: ./style/loginfrag.css
var loginfrag = __webpack_require__(286);

// EXTERNAL MODULE: ./node_modules/socket.io-client/build/index.js
var build = __webpack_require__(89);
var build_default = /*#__PURE__*/__webpack_require__.n(build);

// EXTERNAL MODULE: ./node_modules/mediasoup-client/lib/index.js
var lib = __webpack_require__(90);

// CONCATENATED MODULE: ./app/GDVClient.js




/***
 * @extends EventEmitter
 * @param config
 * @constructor
 */

function GDVClient(config) {
  EventEmitter["b" /* default */].call(this);
  this.config = config;
  this.socket = new build_default.a('https://' + this.config.host + ':' + this.config.port, {
    path: '/server',
    transports: ['websocket']
  });
  this.device = new lib["Device"]();

  this._setupSocket();
}

OOP["a" /* default */].mixClass(GDVClient, EventEmitter["b" /* default */]);
GDVClient.prototype.eventList = ['other_offline', 'other_online', 'outcome_resolve', 'income'];

GDVClient.prototype._setupSocket = function () {
  for (var i = 0; i < this.eventList.length; ++i) {
    this.socket.on(this.eventList[i], this._repeatEvent.bind(this, this.eventList[i]));
  }
};

GDVClient.prototype._loadDevice = function () {
  var thisC = this;
  return new Promise(function (resolve) {
    thisC.request('getRouterRtpCapabilities').then(function (result) {
      thisC.device.load({
        routerRtpCapabilities: result
      }).then(resolve);
    });
  });
};

GDVClient.prototype._repeatEvent = function () {
  this.emit.apply(this, arguments);
};

GDVClient.prototype.request = function (type, data) {
  var socket = this.socket;
  return new Promise(function (resolve) {
    socket.emit(type, data, resolve);
  });
};

GDVClient.prototype.send = function (type, data) {
  this.socket.emit(type, data);
};
/***
 *
 * @param {string} type
 * @param {function(data: object):void} callback
 */


GDVClient.prototype.onReceive = function (type, callback) {
  this.socket.on(type, callback);
};
/***
 *
 * @param {string} type
 * @param {function(data: object):void} callback
 */


GDVClient.prototype.offReceive = function (type, callback) {
  this.socket.off(type, callback);
};
/***
 *
 * @param {string} type
 * @param {function(data: object):void} callback
 */


GDVClient.prototype.onceReceive = function (type, callback) {
  this.socket.once(type, callback);
};

GDVClient.prototype.login = function (userData) {
  var thisC = this;
  return this.request('login', userData).then(function (result) {
    if (result.error) {
      console.error(result.error);
    } else {
      thisC.id = result.id;
      thisC.name = result.name;
      thisC.token = result.token;
      return thisC._loadDevice().then(function () {
        return result;
      });
    }

    return result;
  });
};

GDVClient.prototype.getContactList = function () {
  return this.request('getContactList');
};

/* harmony default export */ var app_GDVClient = (GDVClient);
// CONCATENATED MODULE: ./app/fragment/LoginFrg.js








/***
 * @augments Fragment
 * @augments EventEmitter
 * @constructor
 */

function LoginFrg() {
  EventEmitter["b" /* default */].call(this);
  AppPattern_Fragment.call(this);
  /***
   * @type {GDVClient|null}
   */

  this.connector = null;
  this.userInfo = null;
  this.returns = null;
}

OOP["a" /* default */].mixClass(LoginFrg, AppPattern_Fragment, EventEmitter["b" /* default */]);

LoginFrg.prototype.createView = function () {
  this.$view = Core_({
    class: ['gdv-fragment', 'gdv-login-frag'],
    child: {
      class: 'gdv-login-frag-content',
      child: [{
        tag: 'h3',
        child: {
          text: "Nickname"
        }
      }, {
        tag: 'input',
        class: 'gdv-login-frag-user-name',
        attr: {
          type: 'text'
        },
        props: {
          value: localStorage.getItem('gdv_user_name') || ''
        },
        on: {
          change: function change() {
            localStorage.setItem('gdv_user_name', this.value);
          }
        }
      }, {
        tag: 'h3',
        child: {
          text: "Password"
        }
      }, {
        tag: 'input',
        class: 'gdv-login-frag-password',
        attr: {
          type: 'password'
        },
        on: {
          change: function change() {
            localStorage.setItem('gdv_passwd', this.value);
          }
        }
      }, {
        class: 'gdv-login-frag-button-ctn',
        child: {
          tag: js_FlexiconButton.tag,
          class: 'gdv-login-frag-button',
          props: {
            text: 'LOGIN',
            icon: 'span.mdi.mdi-login-variant',
            disabled: true
          }
        }
      }]
    }
  });
  this.$userName = Core_$('input.gdv-login-frag-user-name', this.$view).on('keyup', this.ev_keyup.bind(this));
  this.$password = Core_$('input.gdv-login-frag-password', this.$view).on('keyup', this.ev_keyup.bind(this));
  this.$button = Core_$('.gdv-login-frag-button', this.$view).on('click', this.submit.bind(this));
};

LoginFrg.prototype.onStart = function () {
  this.connector = this.getContext("CONNECTOR");
  setTimeout(function () {
    var passwd = localStorage.getItem('gdv_passwd');
    if (passwd) this.$password.value = passwd;
    this.submit();
  }.bind(this), 100);
};

LoginFrg.prototype.ev_keyup = function () {
  var userName = this.$userName.value;
  userName = userName.trim();
  var password = this.$password.value;
  password = password.trim();

  if (userName.length > 0 && password.length > 0) {
    this.$button.disabled = false;
  } else {
    this.$button.disabled = true;
  }
};

LoginFrg.prototype.submit = function () {
  var userName = this.$userName.value;
  userName = userName.trim();
  var password = this.$password.value;
  password = password.trim();

  if (userName.length > 0 && password.length > 0) {
    if (userName.length === 0 || password.length === 0) return;
    this.connector.login({
      userName: userName,
      password: password
    }).then(function (result) {
      if (result.error) {
        Snackbar.show("ERROR: " + result.error);
      } else {
        this.userInfo = result;
        this.returns = "LOGIN_COMPLETE";
        this.stop();
      }
    }.bind(this));
  }
};

LoginFrg.prototype.afterLoginComplete = function () {
  if (this.userInfo) {
    return Promise.resolve(this.userInfo);
  } else {
    var thisF = this;
    return new Promise(function (resolve) {
      thisF.once('login_complete', function () {
        resolve(thisF.userInfo);
      });
    });
  }
};

/* harmony default export */ var fragment_LoginFrg = (LoginFrg);
// EXTERNAL MODULE: ./style/app.css
var style_app = __webpack_require__(322);

// EXTERNAL MODULE: ./style/mainfrag.css
var mainfrag = __webpack_require__(324);

// EXTERNAL MODULE: ./style/contactitem.css
var contactitem = __webpack_require__(326);

// CONCATENATED MODULE: ./app/dom/ContactItem.js


/***
 * @extends AElement
 * @constructor
 */

function ContactItem() {
  this.$name = Core_$('.gdv-contact-item-name', this);
  this.$status = Core_$('.gdv-contact-item-status', this);
  this._name = '';
  this.name = 'Noname';
  this.$voiceBtn = Core_$('.gdv-contact-item-voice-btn', this).on('click', this.emit.bind(this, 'pressvoice', {
    type: 'pressvoice',
    target: this
  }, this));
  this.$videoBtn = Core_$('.gdv-contact-item-video-btn', this).on('click', this.emit.bind(this, 'pressvideo', {
    type: 'pressvideo',
    target: this
  }, this));
}

ContactItem.tag = 'ContactItem'.toLowerCase();

ContactItem.render = function () {
  return Core_({
    extendEvent: ['pressvoice', 'pressvideo'],
    class: 'gdv-contact-item',
    child: [{
      class: 'gdv-contact-item-name',
      child: {
        text: "NoName"
      }
    }, {
      class: 'gdv-contact-item-status',
      child: {
        text: "offline"
      }
    }, {
      tag: 'button',
      class: 'gdv-contact-item-voice-btn',
      child: 'span.mdi.mdi-phone-message-outline'
    }, {
      tag: 'button',
      class: 'gdv-contact-item-video-btn',
      child: 'span.mdi.mdi-message-video'
    }]
  });
};

ContactItem.property = {};
ContactItem.property.name = {
  set: function set(value) {
    value = (value || '') + '';
    this.$name.firstChild.data = value;
  },
  get: function get() {
    return this.$name.firstChild.data;
  }
};
ContactItem.property.online = {
  set: function set(value) {
    if (value) {
      this.addClass('gdv-online');
      this.$status.firstChild.data = 'online';
    } else {
      this.$status.firstChild.data = 'offline';
      this.removeClass('gdv-online');
    }
  },
  get: function get() {
    return this.containsClass('gdv-online');
  }
};
app_dom_Core.install(ContactItem);
/* harmony default export */ var dom_ContactItem = (ContactItem);
// EXTERNAL MODULE: ./style/incomefrg.css
var incomefrg = __webpack_require__(74);

// CONCATENATED MODULE: ./app/fragment/OutgoingFrg.js






/**
 * @typedef {{from: string, conversationId: string, incomeType:("voice"|"video")}} Income
 */

/***
 *
 * @augments Income
 * @augments Fragment
 * @constructor
 * @param {Income} props
 */

function OutgoingFrg(props) {
  AppPattern_Fragment.call(this);
  this.to = null;
  this.outgoingType = 'voice';
  /***
   *
   * @type {GPhone|null}
   */

  this.phone = null;
  Object.assign(this, props);
}

OOP["a" /* default */].mixClass(OutgoingFrg, AppPattern_Fragment);

OutgoingFrg.prototype.createView = function () {
  this.$view = Core_({
    class: ['gdv-fragment', 'gdv-outgoing-frag'],
    child: [{
      class: 'gdv-income-frag-info',
      child: [{
        class: 'gdv-income-frag-name',
        child: {
          text: this.to
        }
      }, {
        class: 'gdv-income-frag-type',
        child: {
          text: 'outgoing voice chat'
        }
      }, {
        class: 'gdv-income-frag-status',
        child: {
          text: 'DIAL'
        }
      }]
    }, {
      class: 'gdv-outgoing-frag-button-ctn',
      child: [{
        tag: 'button',
        class: ['gdv-income-frag-action-btn', 'gdv-outgoing-frag-cancel-btn'],
        child: 'span.mdi.mdi-phone-hangup'
      }]
    }]
  });
  this.$cancelBtn = Core_$('.gdv-outgoing-frag-cancel-btn', this.$view).on('click', this.cancel.bind(this));
  this.$status = Core_$('.gdv-income-frag-status', this.$view);
};

OutgoingFrg.prototype.onStart = function () {
  this.phone = this.getContext("PHONE");
  this.phone.dial(this.to, 20000, function (data) {
    if (data.state === 'WAITING') {
      this.$status.firstChild.data = "WAITING";
    } else if (data.state === "ACCEPT") {
      this.returns = {
        answer: "ACCEPT"
      };
      this.stop();
    } else
      /*if (data.state === "NOT_RESPONSE" || data.state === "BUSY" || data.state === 'NOT_ANSWER')*/
      {
        this.$status.firstChild.data = data.state;
        this.returns = {
          state: data.state
        };
        this.$cancelBtn.disabled = true;
        setTimeout(this.stop.bind(this), 3000);
      }
  }.bind(this));
};

OutgoingFrg.prototype.onStop = function () {// this.connector.offReceive('outgoing_response', this.ev_receiveOutgoingResponse);
  // clearInterval(this._statusAnim);
};

OutgoingFrg.prototype.cancel = function () {
  this.$cancelBtn.disabled = true;
  this.$status.firstChild.data = "CANCELED";
  setTimeout(this.stop.bind(this), 500);
};

/* harmony default export */ var fragment_OutgoingFrg = (OutgoingFrg);
// CONCATENATED MODULE: ./app/fragment/IncomeFrg.js





/**
 * @typedef {{from: string, conversationId: string, incomeType:("voice"|"video")}} Income
 */

/***
 *
 * @augments Income
 * @augments Fragment
 * @constructor
 * @param {Income} props
 */

function IncomeFrg(props) {
  AppPattern_Fragment.call(this);
  this.from = null;
  this.conversationId = null;
  this.incomeType = 'voice';
  /***
   *
   * @type {GDVClient|null}
   */

  this.connector = null;
  Object.assign(this, props);
  this.ev_incomeCancel = this.ev_incomeCancel.bind(this);
}

OOP["a" /* default */].mixClass(IncomeFrg, AppPattern_Fragment);

IncomeFrg.prototype.createView = function () {
  this.$view = Core_({
    class: ['gdv-fragment', 'gdv-income-frag'],
    child: [{
      class: 'gdv-income-frag-info',
      child: [{
        class: 'gdv-income-frag-name',
        child: {
          text: this.from
        }
      }, {
        class: 'gdv-income-frag-type',
        child: {
          text: 'income voice chat'
        }
      }, {
        class: 'gdv-income-frag-status',
        child: {
          text: 'CALLING'
        }
      }]
    }, {
      class: 'gdv-income-frag-button-ctn',
      child: [{
        tag: 'button',
        class: ['gdv-income-frag-action-btn', 'gdv-income-frag-hangup-btn'],
        child: 'span.mdi.mdi-phone-hangup'
      }, {
        tag: 'button',
        class: ['gdv-income-frag-action-btn', 'gdv-income-frag-answer-btn'],
        child: 'span.mdi.mdi-phone'
      }]
    }]
  });
  this.$hangupBtn = Core_$('.gdv-income-frag-hangup-btn', this.$view).on('click', this.hangup.bind(this));
  this.$answerBtn = Core_$('.gdv-income-frag-answer-btn', this.$view).on('click', this.answer.bind(this));
  this.$status = Core_$('.gdv-income-frag-status', this.$view);
};

IncomeFrg.prototype.onStart = function () {
  this.phone = this.getContext("PHONE");
};

IncomeFrg.prototype.onStop = function () {};

IncomeFrg.prototype.answer = function () {
  this.phone.pickup();
  this.returns = {
    answer: "ACCEPT",
    conversationId: this.conversationId,
    type: this.incomeType
  };
  this.stop();
};

IncomeFrg.prototype.hangup = function () {
  this.phone.hangup();
  this.returns = {
    answer: "DENY",
    conversationId: this.conversationId
  };
  this.stop();
};

IncomeFrg.prototype.ev_incomeCancel = function (incomeData) {
  if (incomeData.conversationId === this.conversationId) {
    this.$status.firstChild.data = "CANCELED";
    this.$answerBtn.disabled = true;
    this.$hangupBtn.disabled = true;
    this.returns = {
      answer: "CANCELED",
      conversationId: this.conversationId
    };
    setTimeout(this.stop.bind(this), 2000);
  }
};

/* harmony default export */ var fragment_IncomeFrg = (IncomeFrg);
// CONCATENATED MODULE: ./app/fragment/ConversationFrg.js



/***
 * @extends Fragment
 * @constructor
 */

function ConversationFrg(props) {
  AppPattern_Fragment.call(this);
  this.name = 'NoName';
  this.conversationId = null;
  this.dir = "INCOME";
  /***
   * @type {GDVClient|null}
   */

  Object.assign(this, props);
  /***
   *
   * @type {GPhone|null}
   */

  this.phone = null;
  this.ev_hangup = this.ev_hangup.bind(this);
}

OOP["a" /* default */].mixClass(ConversationFrg, AppPattern_Fragment);

ConversationFrg.prototype.createView = function () {
  this.$view = Core_({
    class: ['gdv-fragment', 'gdv-outgoing-frag'],
    child: [{
      class: 'gdv-income-frag-info',
      child: [{
        class: 'gdv-income-frag-name',
        child: {
          text: this.name
        }
      }, {
        class: 'gdv-income-frag-type',
        child: {
          text: this.dir.toLowerCase() + '  voice chat'
        }
      }, {
        class: 'gdv-income-frag-status',
        child: {
          text: 'CONNECTING'
        }
      }]
    }, {
      class: 'gdv-outgoing-frag-button-ctn',
      child: [{
        tag: 'button',
        class: ['gdv-income-frag-action-btn', 'gdv-outgoing-frag-cancel-btn'],
        child: 'span.mdi.mdi-phone-hangup'
      }]
    }, {
      tag: 'audio',
      class: 'gdv-conversation-frag-audio'
    }]
  });
  this.$cancelBtn = Core_$('.gdv-outgoing-frag-cancel-btn', this.$view).on('click', this.cancel.bind(this));
  this.$status = Core_$('.gdv-income-frag-status', this.$view);
  this.$audio = Core_$('.gdv-conversation-frag-audio', this.$view);
};

ConversationFrg.prototype.onStart = function () {
  this.phone = this.getContext("PHONE");
  this.phone.on('hangup', this.ev_hangup);
  this._remoteErrorTimeout = setTimeout(function () {
    this.pause();
    this.$status.firstChild.data = "CANCELED";
    setTimeout(this.stop.bind(this), 3000);
  }.bind(this), 6000);
  this.remoteAudioSync = this.phone.conversation.getRemoteStreams().then(function (streams) {
    if (this.state !== 'RUNNING') return;
    this.$audio.srcObject = streams[0];
    this.$audio.play();
    this.$status.firstChild.data = "TRANSMIT";
    clearTimeout(this._remoteErrorTimeout);
  }.bind(this));
};

ConversationFrg.prototype.ev_hangup = function () {
  this.$audio.pause();
  this.$cancelBtn.disabled = true;
  this.$status.firstChild.data = "HANGUP";
  setTimeout(this.stop.bind(this), 1000);
};

ConversationFrg.prototype.cancel = function () {
  this.$audio.pause();
  this.phone.hangup();
  this.$cancelBtn.disabled = true;
  this.$status.firstChild.data = "HANGUP";
  setTimeout(this.stop.bind(this), 1000);
};

ConversationFrg.prototype.onStop = function () {
  this.phone.off('hangup', this.ev_hangup);
};

/* harmony default export */ var fragment_ConversationFrg = (ConversationFrg);
// CONCATENATED MODULE: ./app/fragment/MainFrg.js











/***
 * @augments EventEmitter
 * @augments Fragment
 * @constructor
 */

function MainFrg() {
  EventEmitter["b" /* default */].call(this);
  AppPattern_Fragment.call(this);
  /***
   *
   * @type {GPhone|null}
   */

  this.phone = null;
  this.$itemByName = {};
  this.ev_income = this.ev_income.bind(this);
  this.ev_whoOnline = this.ev_whoOnline.bind(this);
}

OOP["a" /* default */].mixClass(MainFrg, EventEmitter["b" /* default */], AppPattern_Fragment);

MainFrg.prototype.createView = function () {
  this.$view = Core_({
    class: ['gdv-fragment', 'gdv-main-frag'],
    child: [{
      tag: dom_MHeaderBar.tag,
      props: {
        title: "Contact"
      }
    }, '.gdv-main-frag-contact-list']
  });
  this.$header = Core_$(dom_MHeaderBar.tag, this.$view);
  this.$contactList = Core_$('.gdv-main-frag-contact-list', this.$view);
};

MainFrg.prototype.onStart = function () {
  this.phone = this.getContext("PHONE");
  this.$header.title = this.phone.number + "'s contacts";
};

MainFrg.prototype.onResume = function () {
  this._loadOnlineList();

  setTimeout(this._loadOnlineList.bind(this), 1000);
  this.phone.pkgRecv.on('who_online', this.ev_whoOnline);
  this.phone.on('income', this.ev_income);
};

MainFrg.prototype.onStop = function () {// this.connector.offReceive('income', this.ev_income);
};

MainFrg.prototype.onPause = function () {
  this.phone.pkgRecv.off('who_online', this.ev_whoOnline);
  this.phone.off('income', this.ev_income);
};

MainFrg.prototype._loadOnlineList = function () {
  var thisF = this;
  this.phone.getOnlineList().then(function (result) {
    var phoneNumbers = Object.keys(result);
    thisF.$contactList.clearChild();
    thisF.$itemByName = phoneNumbers.reduce(function (ac, item) {
      var itemElt = thisF._makeContactItem(item);

      thisF.$contactList.addChild(itemElt);
      ac[item] = itemElt;
      return ac;
    }, {});
  });
};

MainFrg.prototype._makeContactItem = function (phoneNumber) {
  return Core_({
    tag: dom_ContactItem.tag,
    props: {
      name: phoneNumber,
      online: true
    },
    on: {
      pressvoice: this.callTo.bind(this, phoneNumber, 'voice'),
      pressvideo: this.callTo.bind(this, phoneNumber, 'video')
    }
  });
};

MainFrg.prototype.ev_whoOnline = function (data, pack) {
  if (pack.sourcePhone === this.phone.number) return;
  if (!pack.sourcePhone) return;
  var itemElt = this.$itemByName[pack.sourcePhone];

  if (!itemElt) {
    itemElt = this._makeContactItem(pack.sourcePhone);
    this.$itemByName[pack.sourcePhone] = itemElt;
    this.$contactList.addChild(itemElt);
  }

  itemElt.online = true;
};

MainFrg.prototype.ev_otherOffline = function (userInfo) {
  var itemElt = this.$itemByName[userInfo.name];
  if (itemElt) itemElt.online = false;
};

MainFrg.prototype.ev_income = function (incomeData) {
  var app = this.getContext("APP");
  console.log(incomeData);
  app.startFrag(fragment_IncomeFrg, {
    incomeType: incomeData.type,
    from: incomeData.from,
    conversationId: incomeData.id
  }, true).then(function (returns) {
    if (returns && returns.answer === 'ACCEPT') {
      app.startFrag(fragment_ConversationFrg);
    }
  });
};

MainFrg.prototype.callTo = function (phoneNumber, type) {
  var app = this.getContext("APP");
  app.startFrag(fragment_OutgoingFrg, {
    outgoingType: type,
    to: phoneNumber
  }, true).then(function (returns) {
    if (returns && returns.answer === 'ACCEPT') {
      app.startFrag(fragment_ConversationFrg);
    }
  });
};

/* harmony default export */ var fragment_MainFrg = (MainFrg);
// CONCATENATED MODULE: ./node_modules/webrtc-adapter/src/js/utils.js
/*
 *  Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
 *
 *  Use of this source code is governed by a BSD-style license
 *  that can be found in the LICENSE file in the root of the source
 *  tree.
 */
 /* eslint-env node */


let logDisabled_ = true;
let deprecationWarnings_ = true;

/**
 * Extract browser version out of the provided user agent string.
 *
 * @param {!string} uastring userAgent string.
 * @param {!string} expr Regular expression used as match criteria.
 * @param {!number} pos position in the version string to be returned.
 * @return {!number} browser version.
 */
function extractVersion(uastring, expr, pos) {
  const match = uastring.match(expr);
  return match && match.length >= pos && parseInt(match[pos], 10);
}

// Wraps the peerconnection event eventNameToWrap in a function
// which returns the modified event object (or false to prevent
// the event).
function wrapPeerConnectionEvent(window, eventNameToWrap, wrapper) {
  if (!window.RTCPeerConnection) {
    return;
  }
  const proto = window.RTCPeerConnection.prototype;
  const nativeAddEventListener = proto.addEventListener;
  proto.addEventListener = function(nativeEventName, cb) {
    if (nativeEventName !== eventNameToWrap) {
      return nativeAddEventListener.apply(this, arguments);
    }
    const wrappedCallback = (e) => {
      const modifiedEvent = wrapper(e);
      if (modifiedEvent) {
        if (cb.handleEvent) {
          cb.handleEvent(modifiedEvent);
        } else {
          cb(modifiedEvent);
        }
      }
    };
    this._eventMap = this._eventMap || {};
    if (!this._eventMap[eventNameToWrap]) {
      this._eventMap[eventNameToWrap] = new Map();
    }
    this._eventMap[eventNameToWrap].set(cb, wrappedCallback);
    return nativeAddEventListener.apply(this, [nativeEventName,
      wrappedCallback]);
  };

  const nativeRemoveEventListener = proto.removeEventListener;
  proto.removeEventListener = function(nativeEventName, cb) {
    if (nativeEventName !== eventNameToWrap || !this._eventMap
        || !this._eventMap[eventNameToWrap]) {
      return nativeRemoveEventListener.apply(this, arguments);
    }
    if (!this._eventMap[eventNameToWrap].has(cb)) {
      return nativeRemoveEventListener.apply(this, arguments);
    }
    const unwrappedCb = this._eventMap[eventNameToWrap].get(cb);
    this._eventMap[eventNameToWrap].delete(cb);
    if (this._eventMap[eventNameToWrap].size === 0) {
      delete this._eventMap[eventNameToWrap];
    }
    if (Object.keys(this._eventMap).length === 0) {
      delete this._eventMap;
    }
    return nativeRemoveEventListener.apply(this, [nativeEventName,
      unwrappedCb]);
  };

  Object.defineProperty(proto, 'on' + eventNameToWrap, {
    get() {
      return this['_on' + eventNameToWrap];
    },
    set(cb) {
      if (this['_on' + eventNameToWrap]) {
        this.removeEventListener(eventNameToWrap,
            this['_on' + eventNameToWrap]);
        delete this['_on' + eventNameToWrap];
      }
      if (cb) {
        this.addEventListener(eventNameToWrap,
            this['_on' + eventNameToWrap] = cb);
      }
    },
    enumerable: true,
    configurable: true
  });
}

function disableLog(bool) {
  if (typeof bool !== 'boolean') {
    return new Error('Argument type: ' + typeof bool +
        '. Please use a boolean.');
  }
  logDisabled_ = bool;
  return (bool) ? 'adapter.js logging disabled' :
      'adapter.js logging enabled';
}

/**
 * Disable or enable deprecation warnings
 * @param {!boolean} bool set to true to disable warnings.
 */
function disableWarnings(bool) {
  if (typeof bool !== 'boolean') {
    return new Error('Argument type: ' + typeof bool +
        '. Please use a boolean.');
  }
  deprecationWarnings_ = !bool;
  return 'adapter.js deprecation warnings ' + (bool ? 'disabled' : 'enabled');
}

function log() {
  if (typeof window === 'object') {
    if (logDisabled_) {
      return;
    }
    if (typeof console !== 'undefined' && typeof console.log === 'function') {
      console.log.apply(console, arguments);
    }
  }
}

/**
 * Shows a deprecation warning suggesting the modern and spec-compatible API.
 */
function deprecated(oldMethod, newMethod) {
  if (!deprecationWarnings_) {
    return;
  }
  console.warn(oldMethod + ' is deprecated, please use ' + newMethod +
      ' instead.');
}

/**
 * Browser detector.
 *
 * @return {object} result containing browser and version
 *     properties.
 */
function detectBrowser(window) {
  // Returned result object.
  const result = {browser: null, version: null};

  // Fail early if it's not a browser
  if (typeof window === 'undefined' || !window.navigator) {
    result.browser = 'Not a browser.';
    return result;
  }

  const {navigator} = window;

  if (navigator.mozGetUserMedia) { // Firefox.
    result.browser = 'firefox';
    result.version = extractVersion(navigator.userAgent,
        /Firefox\/(\d+)\./, 1);
  } else if (navigator.webkitGetUserMedia ||
      (window.isSecureContext === false && window.webkitRTCPeerConnection &&
       !window.RTCIceGatherer)) {
    // Chrome, Chromium, Webview, Opera.
    // Version matches Chrome/WebRTC version.
    // Chrome 74 removed webkitGetUserMedia on http as well so we need the
    // more complicated fallback to webkitRTCPeerConnection.
    result.browser = 'chrome';
    result.version = extractVersion(navigator.userAgent,
        /Chrom(e|ium)\/(\d+)\./, 2);
  } else if (navigator.mediaDevices &&
      navigator.userAgent.match(/Edge\/(\d+).(\d+)$/)) { // Edge.
    result.browser = 'edge';
    result.version = extractVersion(navigator.userAgent,
        /Edge\/(\d+).(\d+)$/, 2);
  } else if (window.RTCPeerConnection &&
      navigator.userAgent.match(/AppleWebKit\/(\d+)\./)) { // Safari.
    result.browser = 'safari';
    result.version = extractVersion(navigator.userAgent,
        /AppleWebKit\/(\d+)\./, 1);
    result.supportsUnifiedPlan = window.RTCRtpTransceiver &&
        'currentDirection' in window.RTCRtpTransceiver.prototype;
  } else { // Default fallthrough: not supported.
    result.browser = 'Not a supported browser.';
    return result;
  }

  return result;
}

/**
 * Checks if something is an object.
 *
 * @param {*} val The something you want to check.
 * @return true if val is an object, false otherwise.
 */
function isObject(val) {
  return Object.prototype.toString.call(val) === '[object Object]';
}

/**
 * Remove all empty objects and undefined values
 * from a nested object -- an enhanced and vanilla version
 * of Lodash's `compact`.
 */
function compactObject(data) {
  if (!isObject(data)) {
    return data;
  }

  return Object.keys(data).reduce(function(accumulator, key) {
    const isObj = isObject(data[key]);
    const value = isObj ? compactObject(data[key]) : data[key];
    const isEmptyObject = isObj && !Object.keys(value).length;
    if (value === undefined || isEmptyObject) {
      return accumulator;
    }
    return Object.assign(accumulator, {[key]: value});
  }, {});
}

/* iterates the stats graph recursively. */
function walkStats(stats, base, resultSet) {
  if (!base || resultSet.has(base.id)) {
    return;
  }
  resultSet.set(base.id, base);
  Object.keys(base).forEach(name => {
    if (name.endsWith('Id')) {
      walkStats(stats, stats.get(base[name]), resultSet);
    } else if (name.endsWith('Ids')) {
      base[name].forEach(id => {
        walkStats(stats, stats.get(id), resultSet);
      });
    }
  });
}

/* filter getStats for a sender/receiver track. */
function filterStats(result, track, outbound) {
  const streamStatsType = outbound ? 'outbound-rtp' : 'inbound-rtp';
  const filteredResult = new Map();
  if (track === null) {
    return filteredResult;
  }
  const trackStats = [];
  result.forEach(value => {
    if (value.type === 'track' &&
        value.trackIdentifier === track.id) {
      trackStats.push(value);
    }
  });
  trackStats.forEach(trackStat => {
    result.forEach(stats => {
      if (stats.type === streamStatsType && stats.trackId === trackStat.id) {
        walkStats(result, stats, filteredResult);
      }
    });
  });
  return filteredResult;
}


// CONCATENATED MODULE: ./node_modules/webrtc-adapter/src/js/chrome/getusermedia.js
/*
 *  Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
 *
 *  Use of this source code is governed by a BSD-style license
 *  that can be found in the LICENSE file in the root of the source
 *  tree.
 */
/* eslint-env node */


const getusermedia_logging = log;

function shimGetUserMedia(window) {
  const navigator = window && window.navigator;

  if (!navigator.mediaDevices) {
    return;
  }

  const browserDetails = detectBrowser(window);

  const constraintsToChrome_ = function(c) {
    if (typeof c !== 'object' || c.mandatory || c.optional) {
      return c;
    }
    const cc = {};
    Object.keys(c).forEach(key => {
      if (key === 'require' || key === 'advanced' || key === 'mediaSource') {
        return;
      }
      const r = (typeof c[key] === 'object') ? c[key] : {ideal: c[key]};
      if (r.exact !== undefined && typeof r.exact === 'number') {
        r.min = r.max = r.exact;
      }
      const oldname_ = function(prefix, name) {
        if (prefix) {
          return prefix + name.charAt(0).toUpperCase() + name.slice(1);
        }
        return (name === 'deviceId') ? 'sourceId' : name;
      };
      if (r.ideal !== undefined) {
        cc.optional = cc.optional || [];
        let oc = {};
        if (typeof r.ideal === 'number') {
          oc[oldname_('min', key)] = r.ideal;
          cc.optional.push(oc);
          oc = {};
          oc[oldname_('max', key)] = r.ideal;
          cc.optional.push(oc);
        } else {
          oc[oldname_('', key)] = r.ideal;
          cc.optional.push(oc);
        }
      }
      if (r.exact !== undefined && typeof r.exact !== 'number') {
        cc.mandatory = cc.mandatory || {};
        cc.mandatory[oldname_('', key)] = r.exact;
      } else {
        ['min', 'max'].forEach(mix => {
          if (r[mix] !== undefined) {
            cc.mandatory = cc.mandatory || {};
            cc.mandatory[oldname_(mix, key)] = r[mix];
          }
        });
      }
    });
    if (c.advanced) {
      cc.optional = (cc.optional || []).concat(c.advanced);
    }
    return cc;
  };

  const shimConstraints_ = function(constraints, func) {
    if (browserDetails.version >= 61) {
      return func(constraints);
    }
    constraints = JSON.parse(JSON.stringify(constraints));
    if (constraints && typeof constraints.audio === 'object') {
      const remap = function(obj, a, b) {
        if (a in obj && !(b in obj)) {
          obj[b] = obj[a];
          delete obj[a];
        }
      };
      constraints = JSON.parse(JSON.stringify(constraints));
      remap(constraints.audio, 'autoGainControl', 'googAutoGainControl');
      remap(constraints.audio, 'noiseSuppression', 'googNoiseSuppression');
      constraints.audio = constraintsToChrome_(constraints.audio);
    }
    if (constraints && typeof constraints.video === 'object') {
      // Shim facingMode for mobile & surface pro.
      let face = constraints.video.facingMode;
      face = face && ((typeof face === 'object') ? face : {ideal: face});
      const getSupportedFacingModeLies = browserDetails.version < 66;

      if ((face && (face.exact === 'user' || face.exact === 'environment' ||
                    face.ideal === 'user' || face.ideal === 'environment')) &&
          !(navigator.mediaDevices.getSupportedConstraints &&
            navigator.mediaDevices.getSupportedConstraints().facingMode &&
            !getSupportedFacingModeLies)) {
        delete constraints.video.facingMode;
        let matches;
        if (face.exact === 'environment' || face.ideal === 'environment') {
          matches = ['back', 'rear'];
        } else if (face.exact === 'user' || face.ideal === 'user') {
          matches = ['front'];
        }
        if (matches) {
          // Look for matches in label, or use last cam for back (typical).
          return navigator.mediaDevices.enumerateDevices()
          .then(devices => {
            devices = devices.filter(d => d.kind === 'videoinput');
            let dev = devices.find(d => matches.some(match =>
              d.label.toLowerCase().includes(match)));
            if (!dev && devices.length && matches.includes('back')) {
              dev = devices[devices.length - 1]; // more likely the back cam
            }
            if (dev) {
              constraints.video.deviceId = face.exact ? {exact: dev.deviceId} :
                                                        {ideal: dev.deviceId};
            }
            constraints.video = constraintsToChrome_(constraints.video);
            getusermedia_logging('chrome: ' + JSON.stringify(constraints));
            return func(constraints);
          });
        }
      }
      constraints.video = constraintsToChrome_(constraints.video);
    }
    getusermedia_logging('chrome: ' + JSON.stringify(constraints));
    return func(constraints);
  };

  const shimError_ = function(e) {
    if (browserDetails.version >= 64) {
      return e;
    }
    return {
      name: {
        PermissionDeniedError: 'NotAllowedError',
        PermissionDismissedError: 'NotAllowedError',
        InvalidStateError: 'NotAllowedError',
        DevicesNotFoundError: 'NotFoundError',
        ConstraintNotSatisfiedError: 'OverconstrainedError',
        TrackStartError: 'NotReadableError',
        MediaDeviceFailedDueToShutdown: 'NotAllowedError',
        MediaDeviceKillSwitchOn: 'NotAllowedError',
        TabCaptureError: 'AbortError',
        ScreenCaptureError: 'AbortError',
        DeviceCaptureError: 'AbortError'
      }[e.name] || e.name,
      message: e.message,
      constraint: e.constraint || e.constraintName,
      toString() {
        return this.name + (this.message && ': ') + this.message;
      }
    };
  };

  const getUserMedia_ = function(constraints, onSuccess, onError) {
    shimConstraints_(constraints, c => {
      navigator.webkitGetUserMedia(c, onSuccess, e => {
        if (onError) {
          onError(shimError_(e));
        }
      });
    });
  };
  navigator.getUserMedia = getUserMedia_.bind(navigator);

  // Even though Chrome 45 has navigator.mediaDevices and a getUserMedia
  // function which returns a Promise, it does not accept spec-style
  // constraints.
  if (navigator.mediaDevices.getUserMedia) {
    const origGetUserMedia = navigator.mediaDevices.getUserMedia.
        bind(navigator.mediaDevices);
    navigator.mediaDevices.getUserMedia = function(cs) {
      return shimConstraints_(cs, c => origGetUserMedia(c).then(stream => {
        if (c.audio && !stream.getAudioTracks().length ||
            c.video && !stream.getVideoTracks().length) {
          stream.getTracks().forEach(track => {
            track.stop();
          });
          throw new DOMException('', 'NotFoundError');
        }
        return stream;
      }, e => Promise.reject(shimError_(e))));
    };
  }
}

// CONCATENATED MODULE: ./node_modules/webrtc-adapter/src/js/chrome/getdisplaymedia.js
/*
 *  Copyright (c) 2018 The adapter.js project authors. All Rights Reserved.
 *
 *  Use of this source code is governed by a BSD-style license
 *  that can be found in the LICENSE file in the root of the source
 *  tree.
 */
/* eslint-env node */

function shimGetDisplayMedia(window, getSourceId) {
  if (window.navigator.mediaDevices &&
    'getDisplayMedia' in window.navigator.mediaDevices) {
    return;
  }
  if (!(window.navigator.mediaDevices)) {
    return;
  }
  // getSourceId is a function that returns a promise resolving with
  // the sourceId of the screen/window/tab to be shared.
  if (typeof getSourceId !== 'function') {
    console.error('shimGetDisplayMedia: getSourceId argument is not ' +
        'a function');
    return;
  }
  window.navigator.mediaDevices.getDisplayMedia =
    function getDisplayMedia(constraints) {
      return getSourceId(constraints)
        .then(sourceId => {
          const widthSpecified = constraints.video && constraints.video.width;
          const heightSpecified = constraints.video &&
            constraints.video.height;
          const frameRateSpecified = constraints.video &&
            constraints.video.frameRate;
          constraints.video = {
            mandatory: {
              chromeMediaSource: 'desktop',
              chromeMediaSourceId: sourceId,
              maxFrameRate: frameRateSpecified || 3
            }
          };
          if (widthSpecified) {
            constraints.video.mandatory.maxWidth = widthSpecified;
          }
          if (heightSpecified) {
            constraints.video.mandatory.maxHeight = heightSpecified;
          }
          return window.navigator.mediaDevices.getUserMedia(constraints);
        });
    };
}

// CONCATENATED MODULE: ./node_modules/webrtc-adapter/src/js/chrome/chrome_shim.js
/*
 *  Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
 *
 *  Use of this source code is governed by a BSD-style license
 *  that can be found in the LICENSE file in the root of the source
 *  tree.
 */
 /* eslint-env node */






function shimMediaStream(window) {
  window.MediaStream = window.MediaStream || window.webkitMediaStream;
}

function shimOnTrack(window) {
  if (typeof window === 'object' && window.RTCPeerConnection && !('ontrack' in
      window.RTCPeerConnection.prototype)) {
    Object.defineProperty(window.RTCPeerConnection.prototype, 'ontrack', {
      get() {
        return this._ontrack;
      },
      set(f) {
        if (this._ontrack) {
          this.removeEventListener('track', this._ontrack);
        }
        this.addEventListener('track', this._ontrack = f);
      },
      enumerable: true,
      configurable: true
    });
    const origSetRemoteDescription =
        window.RTCPeerConnection.prototype.setRemoteDescription;
    window.RTCPeerConnection.prototype.setRemoteDescription =
      function setRemoteDescription() {
        if (!this._ontrackpoly) {
          this._ontrackpoly = (e) => {
            // onaddstream does not fire when a track is added to an existing
            // stream. But stream.onaddtrack is implemented so we use that.
            e.stream.addEventListener('addtrack', te => {
              let receiver;
              if (window.RTCPeerConnection.prototype.getReceivers) {
                receiver = this.getReceivers()
                  .find(r => r.track && r.track.id === te.track.id);
              } else {
                receiver = {track: te.track};
              }

              const event = new Event('track');
              event.track = te.track;
              event.receiver = receiver;
              event.transceiver = {receiver};
              event.streams = [e.stream];
              this.dispatchEvent(event);
            });
            e.stream.getTracks().forEach(track => {
              let receiver;
              if (window.RTCPeerConnection.prototype.getReceivers) {
                receiver = this.getReceivers()
                  .find(r => r.track && r.track.id === track.id);
              } else {
                receiver = {track};
              }
              const event = new Event('track');
              event.track = track;
              event.receiver = receiver;
              event.transceiver = {receiver};
              event.streams = [e.stream];
              this.dispatchEvent(event);
            });
          };
          this.addEventListener('addstream', this._ontrackpoly);
        }
        return origSetRemoteDescription.apply(this, arguments);
      };
  } else {
    // even if RTCRtpTransceiver is in window, it is only used and
    // emitted in unified-plan. Unfortunately this means we need
    // to unconditionally wrap the event.
    wrapPeerConnectionEvent(window, 'track', e => {
      if (!e.transceiver) {
        Object.defineProperty(e, 'transceiver',
          {value: {receiver: e.receiver}});
      }
      return e;
    });
  }
}

function shimGetSendersWithDtmf(window) {
  // Overrides addTrack/removeTrack, depends on shimAddTrackRemoveTrack.
  if (typeof window === 'object' && window.RTCPeerConnection &&
      !('getSenders' in window.RTCPeerConnection.prototype) &&
      'createDTMFSender' in window.RTCPeerConnection.prototype) {
    const shimSenderWithDtmf = function(pc, track) {
      return {
        track,
        get dtmf() {
          if (this._dtmf === undefined) {
            if (track.kind === 'audio') {
              this._dtmf = pc.createDTMFSender(track);
            } else {
              this._dtmf = null;
            }
          }
          return this._dtmf;
        },
        _pc: pc
      };
    };

    // augment addTrack when getSenders is not available.
    if (!window.RTCPeerConnection.prototype.getSenders) {
      window.RTCPeerConnection.prototype.getSenders = function getSenders() {
        this._senders = this._senders || [];
        return this._senders.slice(); // return a copy of the internal state.
      };
      const origAddTrack = window.RTCPeerConnection.prototype.addTrack;
      window.RTCPeerConnection.prototype.addTrack =
        function addTrack(track, stream) {
          let sender = origAddTrack.apply(this, arguments);
          if (!sender) {
            sender = shimSenderWithDtmf(this, track);
            this._senders.push(sender);
          }
          return sender;
        };

      const origRemoveTrack = window.RTCPeerConnection.prototype.removeTrack;
      window.RTCPeerConnection.prototype.removeTrack =
        function removeTrack(sender) {
          origRemoveTrack.apply(this, arguments);
          const idx = this._senders.indexOf(sender);
          if (idx !== -1) {
            this._senders.splice(idx, 1);
          }
        };
    }
    const origAddStream = window.RTCPeerConnection.prototype.addStream;
    window.RTCPeerConnection.prototype.addStream = function addStream(stream) {
      this._senders = this._senders || [];
      origAddStream.apply(this, [stream]);
      stream.getTracks().forEach(track => {
        this._senders.push(shimSenderWithDtmf(this, track));
      });
    };

    const origRemoveStream = window.RTCPeerConnection.prototype.removeStream;
    window.RTCPeerConnection.prototype.removeStream =
      function removeStream(stream) {
        this._senders = this._senders || [];
        origRemoveStream.apply(this, [stream]);

        stream.getTracks().forEach(track => {
          const sender = this._senders.find(s => s.track === track);
          if (sender) { // remove sender
            this._senders.splice(this._senders.indexOf(sender), 1);
          }
        });
      };
  } else if (typeof window === 'object' && window.RTCPeerConnection &&
             'getSenders' in window.RTCPeerConnection.prototype &&
             'createDTMFSender' in window.RTCPeerConnection.prototype &&
             window.RTCRtpSender &&
             !('dtmf' in window.RTCRtpSender.prototype)) {
    const origGetSenders = window.RTCPeerConnection.prototype.getSenders;
    window.RTCPeerConnection.prototype.getSenders = function getSenders() {
      const senders = origGetSenders.apply(this, []);
      senders.forEach(sender => sender._pc = this);
      return senders;
    };

    Object.defineProperty(window.RTCRtpSender.prototype, 'dtmf', {
      get() {
        if (this._dtmf === undefined) {
          if (this.track.kind === 'audio') {
            this._dtmf = this._pc.createDTMFSender(this.track);
          } else {
            this._dtmf = null;
          }
        }
        return this._dtmf;
      }
    });
  }
}

function shimGetStats(window) {
  if (!window.RTCPeerConnection) {
    return;
  }

  const origGetStats = window.RTCPeerConnection.prototype.getStats;
  window.RTCPeerConnection.prototype.getStats = function getStats() {
    const [selector, onSucc, onErr] = arguments;

    // If selector is a function then we are in the old style stats so just
    // pass back the original getStats format to avoid breaking old users.
    if (arguments.length > 0 && typeof selector === 'function') {
      return origGetStats.apply(this, arguments);
    }

    // When spec-style getStats is supported, return those when called with
    // either no arguments or the selector argument is null.
    if (origGetStats.length === 0 && (arguments.length === 0 ||
        typeof selector !== 'function')) {
      return origGetStats.apply(this, []);
    }

    const fixChromeStats_ = function(response) {
      const standardReport = {};
      const reports = response.result();
      reports.forEach(report => {
        const standardStats = {
          id: report.id,
          timestamp: report.timestamp,
          type: {
            localcandidate: 'local-candidate',
            remotecandidate: 'remote-candidate'
          }[report.type] || report.type
        };
        report.names().forEach(name => {
          standardStats[name] = report.stat(name);
        });
        standardReport[standardStats.id] = standardStats;
      });

      return standardReport;
    };

    // shim getStats with maplike support
    const makeMapStats = function(stats) {
      return new Map(Object.keys(stats).map(key => [key, stats[key]]));
    };

    if (arguments.length >= 2) {
      const successCallbackWrapper_ = function(response) {
        onSucc(makeMapStats(fixChromeStats_(response)));
      };

      return origGetStats.apply(this, [successCallbackWrapper_,
        selector]);
    }

    // promise-support
    return new Promise((resolve, reject) => {
      origGetStats.apply(this, [
        function(response) {
          resolve(makeMapStats(fixChromeStats_(response)));
        }, reject]);
    }).then(onSucc, onErr);
  };
}

function shimSenderReceiverGetStats(window) {
  if (!(typeof window === 'object' && window.RTCPeerConnection &&
      window.RTCRtpSender && window.RTCRtpReceiver)) {
    return;
  }

  // shim sender stats.
  if (!('getStats' in window.RTCRtpSender.prototype)) {
    const origGetSenders = window.RTCPeerConnection.prototype.getSenders;
    if (origGetSenders) {
      window.RTCPeerConnection.prototype.getSenders = function getSenders() {
        const senders = origGetSenders.apply(this, []);
        senders.forEach(sender => sender._pc = this);
        return senders;
      };
    }

    const origAddTrack = window.RTCPeerConnection.prototype.addTrack;
    if (origAddTrack) {
      window.RTCPeerConnection.prototype.addTrack = function addTrack() {
        const sender = origAddTrack.apply(this, arguments);
        sender._pc = this;
        return sender;
      };
    }
    window.RTCRtpSender.prototype.getStats = function getStats() {
      const sender = this;
      return this._pc.getStats().then(result =>
        /* Note: this will include stats of all senders that
         *   send a track with the same id as sender.track as
         *   it is not possible to identify the RTCRtpSender.
         */
        filterStats(result, sender.track, true));
    };
  }

  // shim receiver stats.
  if (!('getStats' in window.RTCRtpReceiver.prototype)) {
    const origGetReceivers = window.RTCPeerConnection.prototype.getReceivers;
    if (origGetReceivers) {
      window.RTCPeerConnection.prototype.getReceivers =
        function getReceivers() {
          const receivers = origGetReceivers.apply(this, []);
          receivers.forEach(receiver => receiver._pc = this);
          return receivers;
        };
    }
    wrapPeerConnectionEvent(window, 'track', e => {
      e.receiver._pc = e.srcElement;
      return e;
    });
    window.RTCRtpReceiver.prototype.getStats = function getStats() {
      const receiver = this;
      return this._pc.getStats().then(result =>
        filterStats(result, receiver.track, false));
    };
  }

  if (!('getStats' in window.RTCRtpSender.prototype &&
      'getStats' in window.RTCRtpReceiver.prototype)) {
    return;
  }

  // shim RTCPeerConnection.getStats(track).
  const origGetStats = window.RTCPeerConnection.prototype.getStats;
  window.RTCPeerConnection.prototype.getStats = function getStats() {
    if (arguments.length > 0 &&
        arguments[0] instanceof window.MediaStreamTrack) {
      const track = arguments[0];
      let sender;
      let receiver;
      let err;
      this.getSenders().forEach(s => {
        if (s.track === track) {
          if (sender) {
            err = true;
          } else {
            sender = s;
          }
        }
      });
      this.getReceivers().forEach(r => {
        if (r.track === track) {
          if (receiver) {
            err = true;
          } else {
            receiver = r;
          }
        }
        return r.track === track;
      });
      if (err || (sender && receiver)) {
        return Promise.reject(new DOMException(
          'There are more than one sender or receiver for the track.',
          'InvalidAccessError'));
      } else if (sender) {
        return sender.getStats();
      } else if (receiver) {
        return receiver.getStats();
      }
      return Promise.reject(new DOMException(
        'There is no sender or receiver for the track.',
        'InvalidAccessError'));
    }
    return origGetStats.apply(this, arguments);
  };
}

function shimAddTrackRemoveTrackWithNative(window) {
  // shim addTrack/removeTrack with native variants in order to make
  // the interactions with legacy getLocalStreams behave as in other browsers.
  // Keeps a mapping stream.id => [stream, rtpsenders...]
  window.RTCPeerConnection.prototype.getLocalStreams =
    function getLocalStreams() {
      this._shimmedLocalStreams = this._shimmedLocalStreams || {};
      return Object.keys(this._shimmedLocalStreams)
        .map(streamId => this._shimmedLocalStreams[streamId][0]);
    };

  const origAddTrack = window.RTCPeerConnection.prototype.addTrack;
  window.RTCPeerConnection.prototype.addTrack =
    function addTrack(track, stream) {
      if (!stream) {
        return origAddTrack.apply(this, arguments);
      }
      this._shimmedLocalStreams = this._shimmedLocalStreams || {};

      const sender = origAddTrack.apply(this, arguments);
      if (!this._shimmedLocalStreams[stream.id]) {
        this._shimmedLocalStreams[stream.id] = [stream, sender];
      } else if (this._shimmedLocalStreams[stream.id].indexOf(sender) === -1) {
        this._shimmedLocalStreams[stream.id].push(sender);
      }
      return sender;
    };

  const origAddStream = window.RTCPeerConnection.prototype.addStream;
  window.RTCPeerConnection.prototype.addStream = function addStream(stream) {
    this._shimmedLocalStreams = this._shimmedLocalStreams || {};

    stream.getTracks().forEach(track => {
      const alreadyExists = this.getSenders().find(s => s.track === track);
      if (alreadyExists) {
        throw new DOMException('Track already exists.',
            'InvalidAccessError');
      }
    });
    const existingSenders = this.getSenders();
    origAddStream.apply(this, arguments);
    const newSenders = this.getSenders()
      .filter(newSender => existingSenders.indexOf(newSender) === -1);
    this._shimmedLocalStreams[stream.id] = [stream].concat(newSenders);
  };

  const origRemoveStream = window.RTCPeerConnection.prototype.removeStream;
  window.RTCPeerConnection.prototype.removeStream =
    function removeStream(stream) {
      this._shimmedLocalStreams = this._shimmedLocalStreams || {};
      delete this._shimmedLocalStreams[stream.id];
      return origRemoveStream.apply(this, arguments);
    };

  const origRemoveTrack = window.RTCPeerConnection.prototype.removeTrack;
  window.RTCPeerConnection.prototype.removeTrack =
    function removeTrack(sender) {
      this._shimmedLocalStreams = this._shimmedLocalStreams || {};
      if (sender) {
        Object.keys(this._shimmedLocalStreams).forEach(streamId => {
          const idx = this._shimmedLocalStreams[streamId].indexOf(sender);
          if (idx !== -1) {
            this._shimmedLocalStreams[streamId].splice(idx, 1);
          }
          if (this._shimmedLocalStreams[streamId].length === 1) {
            delete this._shimmedLocalStreams[streamId];
          }
        });
      }
      return origRemoveTrack.apply(this, arguments);
    };
}

function shimAddTrackRemoveTrack(window) {
  if (!window.RTCPeerConnection) {
    return;
  }
  const browserDetails = detectBrowser(window);
  // shim addTrack and removeTrack.
  if (window.RTCPeerConnection.prototype.addTrack &&
      browserDetails.version >= 65) {
    return shimAddTrackRemoveTrackWithNative(window);
  }

  // also shim pc.getLocalStreams when addTrack is shimmed
  // to return the original streams.
  const origGetLocalStreams = window.RTCPeerConnection.prototype
      .getLocalStreams;
  window.RTCPeerConnection.prototype.getLocalStreams =
    function getLocalStreams() {
      const nativeStreams = origGetLocalStreams.apply(this);
      this._reverseStreams = this._reverseStreams || {};
      return nativeStreams.map(stream => this._reverseStreams[stream.id]);
    };

  const origAddStream = window.RTCPeerConnection.prototype.addStream;
  window.RTCPeerConnection.prototype.addStream = function addStream(stream) {
    this._streams = this._streams || {};
    this._reverseStreams = this._reverseStreams || {};

    stream.getTracks().forEach(track => {
      const alreadyExists = this.getSenders().find(s => s.track === track);
      if (alreadyExists) {
        throw new DOMException('Track already exists.',
            'InvalidAccessError');
      }
    });
    // Add identity mapping for consistency with addTrack.
    // Unless this is being used with a stream from addTrack.
    if (!this._reverseStreams[stream.id]) {
      const newStream = new window.MediaStream(stream.getTracks());
      this._streams[stream.id] = newStream;
      this._reverseStreams[newStream.id] = stream;
      stream = newStream;
    }
    origAddStream.apply(this, [stream]);
  };

  const origRemoveStream = window.RTCPeerConnection.prototype.removeStream;
  window.RTCPeerConnection.prototype.removeStream =
    function removeStream(stream) {
      this._streams = this._streams || {};
      this._reverseStreams = this._reverseStreams || {};

      origRemoveStream.apply(this, [(this._streams[stream.id] || stream)]);
      delete this._reverseStreams[(this._streams[stream.id] ?
          this._streams[stream.id].id : stream.id)];
      delete this._streams[stream.id];
    };

  window.RTCPeerConnection.prototype.addTrack =
    function addTrack(track, stream) {
      if (this.signalingState === 'closed') {
        throw new DOMException(
          'The RTCPeerConnection\'s signalingState is \'closed\'.',
          'InvalidStateError');
      }
      const streams = [].slice.call(arguments, 1);
      if (streams.length !== 1 ||
          !streams[0].getTracks().find(t => t === track)) {
        // this is not fully correct but all we can manage without
        // [[associated MediaStreams]] internal slot.
        throw new DOMException(
          'The adapter.js addTrack polyfill only supports a single ' +
          ' stream which is associated with the specified track.',
          'NotSupportedError');
      }

      const alreadyExists = this.getSenders().find(s => s.track === track);
      if (alreadyExists) {
        throw new DOMException('Track already exists.',
            'InvalidAccessError');
      }

      this._streams = this._streams || {};
      this._reverseStreams = this._reverseStreams || {};
      const oldStream = this._streams[stream.id];
      if (oldStream) {
        // this is using odd Chrome behaviour, use with caution:
        // https://bugs.chromium.org/p/webrtc/issues/detail?id=7815
        // Note: we rely on the high-level addTrack/dtmf shim to
        // create the sender with a dtmf sender.
        oldStream.addTrack(track);

        // Trigger ONN async.
        Promise.resolve().then(() => {
          this.dispatchEvent(new Event('negotiationneeded'));
        });
      } else {
        const newStream = new window.MediaStream([track]);
        this._streams[stream.id] = newStream;
        this._reverseStreams[newStream.id] = stream;
        this.addStream(newStream);
      }
      return this.getSenders().find(s => s.track === track);
    };

  // replace the internal stream id with the external one and
  // vice versa.
  function replaceInternalStreamId(pc, description) {
    let sdp = description.sdp;
    Object.keys(pc._reverseStreams || []).forEach(internalId => {
      const externalStream = pc._reverseStreams[internalId];
      const internalStream = pc._streams[externalStream.id];
      sdp = sdp.replace(new RegExp(internalStream.id, 'g'),
          externalStream.id);
    });
    return new RTCSessionDescription({
      type: description.type,
      sdp
    });
  }
  function replaceExternalStreamId(pc, description) {
    let sdp = description.sdp;
    Object.keys(pc._reverseStreams || []).forEach(internalId => {
      const externalStream = pc._reverseStreams[internalId];
      const internalStream = pc._streams[externalStream.id];
      sdp = sdp.replace(new RegExp(externalStream.id, 'g'),
          internalStream.id);
    });
    return new RTCSessionDescription({
      type: description.type,
      sdp
    });
  }
  ['createOffer', 'createAnswer'].forEach(function(method) {
    const nativeMethod = window.RTCPeerConnection.prototype[method];
    const methodObj = {[method]() {
      const args = arguments;
      const isLegacyCall = arguments.length &&
          typeof arguments[0] === 'function';
      if (isLegacyCall) {
        return nativeMethod.apply(this, [
          (description) => {
            const desc = replaceInternalStreamId(this, description);
            args[0].apply(null, [desc]);
          },
          (err) => {
            if (args[1]) {
              args[1].apply(null, err);
            }
          }, arguments[2]
        ]);
      }
      return nativeMethod.apply(this, arguments)
      .then(description => replaceInternalStreamId(this, description));
    }};
    window.RTCPeerConnection.prototype[method] = methodObj[method];
  });

  const origSetLocalDescription =
      window.RTCPeerConnection.prototype.setLocalDescription;
  window.RTCPeerConnection.prototype.setLocalDescription =
    function setLocalDescription() {
      if (!arguments.length || !arguments[0].type) {
        return origSetLocalDescription.apply(this, arguments);
      }
      arguments[0] = replaceExternalStreamId(this, arguments[0]);
      return origSetLocalDescription.apply(this, arguments);
    };

  // TODO: mangle getStats: https://w3c.github.io/webrtc-stats/#dom-rtcmediastreamstats-streamidentifier

  const origLocalDescription = Object.getOwnPropertyDescriptor(
      window.RTCPeerConnection.prototype, 'localDescription');
  Object.defineProperty(window.RTCPeerConnection.prototype,
      'localDescription', {
        get() {
          const description = origLocalDescription.get.apply(this);
          if (description.type === '') {
            return description;
          }
          return replaceInternalStreamId(this, description);
        }
      });

  window.RTCPeerConnection.prototype.removeTrack =
    function removeTrack(sender) {
      if (this.signalingState === 'closed') {
        throw new DOMException(
          'The RTCPeerConnection\'s signalingState is \'closed\'.',
          'InvalidStateError');
      }
      // We can not yet check for sender instanceof RTCRtpSender
      // since we shim RTPSender. So we check if sender._pc is set.
      if (!sender._pc) {
        throw new DOMException('Argument 1 of RTCPeerConnection.removeTrack ' +
            'does not implement interface RTCRtpSender.', 'TypeError');
      }
      const isLocal = sender._pc === this;
      if (!isLocal) {
        throw new DOMException('Sender was not created by this connection.',
            'InvalidAccessError');
      }

      // Search for the native stream the senders track belongs to.
      this._streams = this._streams || {};
      let stream;
      Object.keys(this._streams).forEach(streamid => {
        const hasTrack = this._streams[streamid].getTracks()
          .find(track => sender.track === track);
        if (hasTrack) {
          stream = this._streams[streamid];
        }
      });

      if (stream) {
        if (stream.getTracks().length === 1) {
          // if this is the last track of the stream, remove the stream. This
          // takes care of any shimmed _senders.
          this.removeStream(this._reverseStreams[stream.id]);
        } else {
          // relying on the same odd chrome behaviour as above.
          stream.removeTrack(sender.track);
        }
        this.dispatchEvent(new Event('negotiationneeded'));
      }
    };
}

function shimPeerConnection(window) {
  const browserDetails = detectBrowser(window);

  if (!window.RTCPeerConnection && window.webkitRTCPeerConnection) {
    // very basic support for old versions.
    window.RTCPeerConnection = window.webkitRTCPeerConnection;
  }
  if (!window.RTCPeerConnection) {
    return;
  }

  const addIceCandidateNullSupported =
    window.RTCPeerConnection.prototype.addIceCandidate.length === 0;

  // shim implicit creation of RTCSessionDescription/RTCIceCandidate
  if (browserDetails.version < 53) {
    ['setLocalDescription', 'setRemoteDescription', 'addIceCandidate']
        .forEach(function(method) {
          const nativeMethod = window.RTCPeerConnection.prototype[method];
          const methodObj = {[method]() {
            arguments[0] = new ((method === 'addIceCandidate') ?
                window.RTCIceCandidate :
                window.RTCSessionDescription)(arguments[0]);
            return nativeMethod.apply(this, arguments);
          }};
          window.RTCPeerConnection.prototype[method] = methodObj[method];
        });
  }

  // support for addIceCandidate(null or undefined)
  const nativeAddIceCandidate =
      window.RTCPeerConnection.prototype.addIceCandidate;
  window.RTCPeerConnection.prototype.addIceCandidate =
    function addIceCandidate() {
      if (!addIceCandidateNullSupported && !arguments[0]) {
        if (arguments[1]) {
          arguments[1].apply(null);
        }
        return Promise.resolve();
      }
      // Firefox 68+ emits and processes {candidate: "", ...}, ignore
      // in older versions. Native support planned for Chrome M77.
      if (browserDetails.version < 78 &&
        arguments[0] && arguments[0].candidate === '') {
        return Promise.resolve();
      }
      return nativeAddIceCandidate.apply(this, arguments);
    };
}

// Attempt to fix ONN in plan-b mode.
function fixNegotiationNeeded(window) {
  const browserDetails = detectBrowser(window);
  wrapPeerConnectionEvent(window, 'negotiationneeded', e => {
    const pc = e.target;
    if (browserDetails.version < 72 || (pc.getConfiguration &&
        pc.getConfiguration().sdpSemantics === 'plan-b')) {
      if (pc.signalingState !== 'stable') {
        return;
      }
    }
    return e;
  });
}

// CONCATENATED MODULE: ./node_modules/webrtc-adapter/src/js/edge/filtericeservers.js
/*
 *  Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
 *
 *  Use of this source code is governed by a BSD-style license
 *  that can be found in the LICENSE file in the root of the source
 *  tree.
 */
/* eslint-env node */



// Edge does not like
// 1) stun: filtered after 14393 unless ?transport=udp is present
// 2) turn: that does not have all of turn:host:port?transport=udp
// 3) turn: with ipv6 addresses
// 4) turn: occurring muliple times
function filterIceServers(iceServers, edgeVersion) {
  let hasTurn = false;
  iceServers = JSON.parse(JSON.stringify(iceServers));
  return iceServers.filter(server => {
    if (server && (server.urls || server.url)) {
      let urls = server.urls || server.url;
      if (server.url && !server.urls) {
        deprecated('RTCIceServer.url', 'RTCIceServer.urls');
      }
      const isString = typeof urls === 'string';
      if (isString) {
        urls = [urls];
      }
      urls = urls.filter(url => {
        // filter STUN unconditionally.
        if (url.indexOf('stun:') === 0) {
          return false;
        }

        const validTurn = url.startsWith('turn') &&
            !url.startsWith('turn:[') &&
            url.includes('transport=udp');
        if (validTurn && !hasTurn) {
          hasTurn = true;
          return true;
        }
        return validTurn && !hasTurn;
      });

      delete server.url;
      server.urls = isString ? urls[0] : urls;
      return !!urls.length;
    }
  });
}

// EXTERNAL MODULE: ./node_modules/rtcpeerconnection-shim/rtcpeerconnection.js
var rtcpeerconnection = __webpack_require__(91);
var rtcpeerconnection_default = /*#__PURE__*/__webpack_require__.n(rtcpeerconnection);

// CONCATENATED MODULE: ./node_modules/webrtc-adapter/src/js/edge/getusermedia.js
/*
 *  Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
 *
 *  Use of this source code is governed by a BSD-style license
 *  that can be found in the LICENSE file in the root of the source
 *  tree.
 */
 /* eslint-env node */


function getusermedia_shimGetUserMedia(window) {
  const navigator = window && window.navigator;

  const shimError_ = function(e) {
    return {
      name: {PermissionDeniedError: 'NotAllowedError'}[e.name] || e.name,
      message: e.message,
      constraint: e.constraint,
      toString() {
        return this.name;
      }
    };
  };

  // getUserMedia error shim.
  const origGetUserMedia = navigator.mediaDevices.getUserMedia.
      bind(navigator.mediaDevices);
  navigator.mediaDevices.getUserMedia = function(c) {
    return origGetUserMedia(c).catch(e => Promise.reject(shimError_(e)));
  };
}

// CONCATENATED MODULE: ./node_modules/webrtc-adapter/src/js/edge/getdisplaymedia.js
/*
 *  Copyright (c) 2018 The adapter.js project authors. All Rights Reserved.
 *
 *  Use of this source code is governed by a BSD-style license
 *  that can be found in the LICENSE file in the root of the source
 *  tree.
 */
 /* eslint-env node */


function getdisplaymedia_shimGetDisplayMedia(window) {
  if (!('getDisplayMedia' in window.navigator)) {
    return;
  }
  if (!(window.navigator.mediaDevices)) {
    return;
  }
  if (window.navigator.mediaDevices &&
    'getDisplayMedia' in window.navigator.mediaDevices) {
    return;
  }
  window.navigator.mediaDevices.getDisplayMedia =
    window.navigator.getDisplayMedia.bind(window.navigator);
}

// CONCATENATED MODULE: ./node_modules/webrtc-adapter/src/js/edge/edge_shim.js
/*
 *  Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
 *
 *  Use of this source code is governed by a BSD-style license
 *  that can be found in the LICENSE file in the root of the source
 *  tree.
 */
/* eslint-env node */









function edge_shim_shimPeerConnection(window) {
  const browserDetails = detectBrowser(window);

  if (window.RTCIceGatherer) {
    if (!window.RTCIceCandidate) {
      window.RTCIceCandidate = function RTCIceCandidate(args) {
        return args;
      };
    }
    if (!window.RTCSessionDescription) {
      window.RTCSessionDescription = function RTCSessionDescription(args) {
        return args;
      };
    }
    // this adds an additional event listener to MediaStrackTrack that signals
    // when a tracks enabled property was changed. Workaround for a bug in
    // addStream, see below. No longer required in 15025+
    if (browserDetails.version < 15025) {
      const origMSTEnabled = Object.getOwnPropertyDescriptor(
          window.MediaStreamTrack.prototype, 'enabled');
      Object.defineProperty(window.MediaStreamTrack.prototype, 'enabled', {
        set(value) {
          origMSTEnabled.set.call(this, value);
          const ev = new Event('enabled');
          ev.enabled = value;
          this.dispatchEvent(ev);
        }
      });
    }
  }

  // ORTC defines the DTMF sender a bit different.
  // https://github.com/w3c/ortc/issues/714
  if (window.RTCRtpSender && !('dtmf' in window.RTCRtpSender.prototype)) {
    Object.defineProperty(window.RTCRtpSender.prototype, 'dtmf', {
      get() {
        if (this._dtmf === undefined) {
          if (this.track.kind === 'audio') {
            this._dtmf = new window.RTCDtmfSender(this);
          } else if (this.track.kind === 'video') {
            this._dtmf = null;
          }
        }
        return this._dtmf;
      }
    });
  }
  // Edge currently only implements the RTCDtmfSender, not the
  // RTCDTMFSender alias. See http://draft.ortc.org/#rtcdtmfsender2*
  if (window.RTCDtmfSender && !window.RTCDTMFSender) {
    window.RTCDTMFSender = window.RTCDtmfSender;
  }

  const RTCPeerConnectionShim = rtcpeerconnection_default()(window,
      browserDetails.version);
  window.RTCPeerConnection = function RTCPeerConnection(config) {
    if (config && config.iceServers) {
      config.iceServers = filterIceServers(config.iceServers,
        browserDetails.version);
      log('ICE servers after filtering:', config.iceServers);
    }
    return new RTCPeerConnectionShim(config);
  };
  window.RTCPeerConnection.prototype = RTCPeerConnectionShim.prototype;
}

function shimReplaceTrack(window) {
  // ORTC has replaceTrack -- https://github.com/w3c/ortc/issues/614
  if (window.RTCRtpSender &&
      !('replaceTrack' in window.RTCRtpSender.prototype)) {
    window.RTCRtpSender.prototype.replaceTrack =
        window.RTCRtpSender.prototype.setTrack;
  }
}

// CONCATENATED MODULE: ./node_modules/webrtc-adapter/src/js/firefox/getusermedia.js
/*
 *  Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
 *
 *  Use of this source code is governed by a BSD-style license
 *  that can be found in the LICENSE file in the root of the source
 *  tree.
 */
/* eslint-env node */




function firefox_getusermedia_shimGetUserMedia(window) {
  const browserDetails = detectBrowser(window);
  const navigator = window && window.navigator;
  const MediaStreamTrack = window && window.MediaStreamTrack;

  navigator.getUserMedia = function(constraints, onSuccess, onError) {
    // Replace Firefox 44+'s deprecation warning with unprefixed version.
    deprecated('navigator.getUserMedia',
        'navigator.mediaDevices.getUserMedia');
    navigator.mediaDevices.getUserMedia(constraints).then(onSuccess, onError);
  };

  if (!(browserDetails.version > 55 &&
      'autoGainControl' in navigator.mediaDevices.getSupportedConstraints())) {
    const remap = function(obj, a, b) {
      if (a in obj && !(b in obj)) {
        obj[b] = obj[a];
        delete obj[a];
      }
    };

    const nativeGetUserMedia = navigator.mediaDevices.getUserMedia.
        bind(navigator.mediaDevices);
    navigator.mediaDevices.getUserMedia = function(c) {
      if (typeof c === 'object' && typeof c.audio === 'object') {
        c = JSON.parse(JSON.stringify(c));
        remap(c.audio, 'autoGainControl', 'mozAutoGainControl');
        remap(c.audio, 'noiseSuppression', 'mozNoiseSuppression');
      }
      return nativeGetUserMedia(c);
    };

    if (MediaStreamTrack && MediaStreamTrack.prototype.getSettings) {
      const nativeGetSettings = MediaStreamTrack.prototype.getSettings;
      MediaStreamTrack.prototype.getSettings = function() {
        const obj = nativeGetSettings.apply(this, arguments);
        remap(obj, 'mozAutoGainControl', 'autoGainControl');
        remap(obj, 'mozNoiseSuppression', 'noiseSuppression');
        return obj;
      };
    }

    if (MediaStreamTrack && MediaStreamTrack.prototype.applyConstraints) {
      const nativeApplyConstraints =
        MediaStreamTrack.prototype.applyConstraints;
      MediaStreamTrack.prototype.applyConstraints = function(c) {
        if (this.kind === 'audio' && typeof c === 'object') {
          c = JSON.parse(JSON.stringify(c));
          remap(c, 'autoGainControl', 'mozAutoGainControl');
          remap(c, 'noiseSuppression', 'mozNoiseSuppression');
        }
        return nativeApplyConstraints.apply(this, [c]);
      };
    }
  }
}

// CONCATENATED MODULE: ./node_modules/webrtc-adapter/src/js/firefox/getdisplaymedia.js
/*
 *  Copyright (c) 2018 The adapter.js project authors. All Rights Reserved.
 *
 *  Use of this source code is governed by a BSD-style license
 *  that can be found in the LICENSE file in the root of the source
 *  tree.
 */
/* eslint-env node */


function firefox_getdisplaymedia_shimGetDisplayMedia(window, preferredMediaSource) {
  if (window.navigator.mediaDevices &&
    'getDisplayMedia' in window.navigator.mediaDevices) {
    return;
  }
  if (!(window.navigator.mediaDevices)) {
    return;
  }
  window.navigator.mediaDevices.getDisplayMedia =
    function getDisplayMedia(constraints) {
      if (!(constraints && constraints.video)) {
        const err = new DOMException('getDisplayMedia without video ' +
            'constraints is undefined');
        err.name = 'NotFoundError';
        // from https://heycam.github.io/webidl/#idl-DOMException-error-names
        err.code = 8;
        return Promise.reject(err);
      }
      if (constraints.video === true) {
        constraints.video = {mediaSource: preferredMediaSource};
      } else {
        constraints.video.mediaSource = preferredMediaSource;
      }
      return window.navigator.mediaDevices.getUserMedia(constraints);
    };
}

// CONCATENATED MODULE: ./node_modules/webrtc-adapter/src/js/firefox/firefox_shim.js
/*
 *  Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
 *
 *  Use of this source code is governed by a BSD-style license
 *  that can be found in the LICENSE file in the root of the source
 *  tree.
 */
/* eslint-env node */






function firefox_shim_shimOnTrack(window) {
  if (typeof window === 'object' && window.RTCTrackEvent &&
      ('receiver' in window.RTCTrackEvent.prototype) &&
      !('transceiver' in window.RTCTrackEvent.prototype)) {
    Object.defineProperty(window.RTCTrackEvent.prototype, 'transceiver', {
      get() {
        return {receiver: this.receiver};
      }
    });
  }
}

function firefox_shim_shimPeerConnection(window) {
  const browserDetails = detectBrowser(window);

  if (typeof window !== 'object' ||
      !(window.RTCPeerConnection || window.mozRTCPeerConnection)) {
    return; // probably media.peerconnection.enabled=false in about:config
  }
  if (!window.RTCPeerConnection && window.mozRTCPeerConnection) {
    // very basic support for old versions.
    window.RTCPeerConnection = window.mozRTCPeerConnection;
  }

  if (browserDetails.version < 53) {
    // shim away need for obsolete RTCIceCandidate/RTCSessionDescription.
    ['setLocalDescription', 'setRemoteDescription', 'addIceCandidate']
        .forEach(function(method) {
          const nativeMethod = window.RTCPeerConnection.prototype[method];
          const methodObj = {[method]() {
            arguments[0] = new ((method === 'addIceCandidate') ?
                window.RTCIceCandidate :
                window.RTCSessionDescription)(arguments[0]);
            return nativeMethod.apply(this, arguments);
          }};
          window.RTCPeerConnection.prototype[method] = methodObj[method];
        });
  }

  // support for addIceCandidate(null or undefined)
  // as well as ignoring {sdpMid, candidate: ""}
  if (browserDetails.version < 68) {
    const nativeAddIceCandidate =
        window.RTCPeerConnection.prototype.addIceCandidate;
    window.RTCPeerConnection.prototype.addIceCandidate =
    function addIceCandidate() {
      if (!arguments[0]) {
        if (arguments[1]) {
          arguments[1].apply(null);
        }
        return Promise.resolve();
      }
      // Firefox 68+ emits and processes {candidate: "", ...}, ignore
      // in older versions.
      if (arguments[0] && arguments[0].candidate === '') {
        return Promise.resolve();
      }
      return nativeAddIceCandidate.apply(this, arguments);
    };
  }

  const modernStatsTypes = {
    inboundrtp: 'inbound-rtp',
    outboundrtp: 'outbound-rtp',
    candidatepair: 'candidate-pair',
    localcandidate: 'local-candidate',
    remotecandidate: 'remote-candidate'
  };

  const nativeGetStats = window.RTCPeerConnection.prototype.getStats;
  window.RTCPeerConnection.prototype.getStats = function getStats() {
    const [selector, onSucc, onErr] = arguments;
    return nativeGetStats.apply(this, [selector || null])
      .then(stats => {
        if (browserDetails.version < 53 && !onSucc) {
          // Shim only promise getStats with spec-hyphens in type names
          // Leave callback version alone; misc old uses of forEach before Map
          try {
            stats.forEach(stat => {
              stat.type = modernStatsTypes[stat.type] || stat.type;
            });
          } catch (e) {
            if (e.name !== 'TypeError') {
              throw e;
            }
            // Avoid TypeError: "type" is read-only, in old versions. 34-43ish
            stats.forEach((stat, i) => {
              stats.set(i, Object.assign({}, stat, {
                type: modernStatsTypes[stat.type] || stat.type
              }));
            });
          }
        }
        return stats;
      })
      .then(onSucc, onErr);
  };
}

function shimSenderGetStats(window) {
  if (!(typeof window === 'object' && window.RTCPeerConnection &&
      window.RTCRtpSender)) {
    return;
  }
  if (window.RTCRtpSender && 'getStats' in window.RTCRtpSender.prototype) {
    return;
  }
  const origGetSenders = window.RTCPeerConnection.prototype.getSenders;
  if (origGetSenders) {
    window.RTCPeerConnection.prototype.getSenders = function getSenders() {
      const senders = origGetSenders.apply(this, []);
      senders.forEach(sender => sender._pc = this);
      return senders;
    };
  }

  const origAddTrack = window.RTCPeerConnection.prototype.addTrack;
  if (origAddTrack) {
    window.RTCPeerConnection.prototype.addTrack = function addTrack() {
      const sender = origAddTrack.apply(this, arguments);
      sender._pc = this;
      return sender;
    };
  }
  window.RTCRtpSender.prototype.getStats = function getStats() {
    return this.track ? this._pc.getStats(this.track) :
        Promise.resolve(new Map());
  };
}

function shimReceiverGetStats(window) {
  if (!(typeof window === 'object' && window.RTCPeerConnection &&
      window.RTCRtpSender)) {
    return;
  }
  if (window.RTCRtpSender && 'getStats' in window.RTCRtpReceiver.prototype) {
    return;
  }
  const origGetReceivers = window.RTCPeerConnection.prototype.getReceivers;
  if (origGetReceivers) {
    window.RTCPeerConnection.prototype.getReceivers = function getReceivers() {
      const receivers = origGetReceivers.apply(this, []);
      receivers.forEach(receiver => receiver._pc = this);
      return receivers;
    };
  }
  wrapPeerConnectionEvent(window, 'track', e => {
    e.receiver._pc = e.srcElement;
    return e;
  });
  window.RTCRtpReceiver.prototype.getStats = function getStats() {
    return this._pc.getStats(this.track);
  };
}

function shimRemoveStream(window) {
  if (!window.RTCPeerConnection ||
      'removeStream' in window.RTCPeerConnection.prototype) {
    return;
  }
  window.RTCPeerConnection.prototype.removeStream =
    function removeStream(stream) {
      deprecated('removeStream', 'removeTrack');
      this.getSenders().forEach(sender => {
        if (sender.track && stream.getTracks().includes(sender.track)) {
          this.removeTrack(sender);
        }
      });
    };
}

function shimRTCDataChannel(window) {
  // rename DataChannel to RTCDataChannel (native fix in FF60):
  // https://bugzilla.mozilla.org/show_bug.cgi?id=1173851
  if (window.DataChannel && !window.RTCDataChannel) {
    window.RTCDataChannel = window.DataChannel;
  }
}

function shimAddTransceiver(window) {
  // https://github.com/webrtcHacks/adapter/issues/998#issuecomment-516921647
  // Firefox ignores the init sendEncodings options passed to addTransceiver
  // https://bugzilla.mozilla.org/show_bug.cgi?id=1396918
  if (!(typeof window === 'object' && window.RTCPeerConnection)) {
    return;
  }
  const origAddTransceiver = window.RTCPeerConnection.prototype.addTransceiver;
  if (origAddTransceiver) {
    window.RTCPeerConnection.prototype.addTransceiver =
      function addTransceiver() {
        this.setParametersPromises = [];
        const initParameters = arguments[1];
        const shouldPerformCheck = initParameters &&
                                  'sendEncodings' in initParameters;
        if (shouldPerformCheck) {
          // If sendEncodings params are provided, validate grammar
          initParameters.sendEncodings.forEach((encodingParam) => {
            if ('rid' in encodingParam) {
              const ridRegex = /^[a-z0-9]{0,16}$/i;
              if (!ridRegex.test(encodingParam.rid)) {
                throw new TypeError('Invalid RID value provided.');
              }
            }
            if ('scaleResolutionDownBy' in encodingParam) {
              if (!(parseFloat(encodingParam.scaleResolutionDownBy) >= 1.0)) {
                throw new RangeError('scale_resolution_down_by must be >= 1.0');
              }
            }
            if ('maxFramerate' in encodingParam) {
              if (!(parseFloat(encodingParam.maxFramerate) >= 0)) {
                throw new RangeError('max_framerate must be >= 0.0');
              }
            }
          });
        }
        const transceiver = origAddTransceiver.apply(this, arguments);
        if (shouldPerformCheck) {
          // Check if the init options were applied. If not we do this in an
          // asynchronous way and save the promise reference in a global object.
          // This is an ugly hack, but at the same time is way more robust than
          // checking the sender parameters before and after the createOffer
          // Also note that after the createoffer we are not 100% sure that
          // the params were asynchronously applied so we might miss the
          // opportunity to recreate offer.
          const {sender} = transceiver;
          const params = sender.getParameters();
          if (!('encodings' in params) ||
              // Avoid being fooled by patched getParameters() below.
              (params.encodings.length === 1 &&
               Object.keys(params.encodings[0]).length === 0)) {
            params.encodings = initParameters.sendEncodings;
            sender.sendEncodings = initParameters.sendEncodings;
            this.setParametersPromises.push(sender.setParameters(params)
              .then(() => {
                delete sender.sendEncodings;
              }).catch(() => {
                delete sender.sendEncodings;
              })
            );
          }
        }
        return transceiver;
      };
  }
}

function shimGetParameters(window) {
  if (!(typeof window === 'object' && window.RTCRtpSender)) {
    return;
  }
  const origGetParameters = window.RTCRtpSender.prototype.getParameters;
  if (origGetParameters) {
    window.RTCRtpSender.prototype.getParameters =
      function getParameters() {
        const params = origGetParameters.apply(this, arguments);
        if (!('encodings' in params)) {
          params.encodings = [].concat(this.sendEncodings || [{}]);
        }
        return params;
      };
  }
}

function shimCreateOffer(window) {
  // https://github.com/webrtcHacks/adapter/issues/998#issuecomment-516921647
  // Firefox ignores the init sendEncodings options passed to addTransceiver
  // https://bugzilla.mozilla.org/show_bug.cgi?id=1396918
  if (!(typeof window === 'object' && window.RTCPeerConnection)) {
    return;
  }
  const origCreateOffer = window.RTCPeerConnection.prototype.createOffer;
  window.RTCPeerConnection.prototype.createOffer = function createOffer() {
    if (this.setParametersPromises && this.setParametersPromises.length) {
      return Promise.all(this.setParametersPromises)
      .then(() => {
        return origCreateOffer.apply(this, arguments);
      })
      .finally(() => {
        this.setParametersPromises = [];
      });
    }
    return origCreateOffer.apply(this, arguments);
  };
}

function shimCreateAnswer(window) {
  // https://github.com/webrtcHacks/adapter/issues/998#issuecomment-516921647
  // Firefox ignores the init sendEncodings options passed to addTransceiver
  // https://bugzilla.mozilla.org/show_bug.cgi?id=1396918
  if (!(typeof window === 'object' && window.RTCPeerConnection)) {
    return;
  }
  const origCreateAnswer = window.RTCPeerConnection.prototype.createAnswer;
  window.RTCPeerConnection.prototype.createAnswer = function createAnswer() {
    if (this.setParametersPromises && this.setParametersPromises.length) {
      return Promise.all(this.setParametersPromises)
      .then(() => {
        return origCreateAnswer.apply(this, arguments);
      })
      .finally(() => {
        this.setParametersPromises = [];
      });
    }
    return origCreateAnswer.apply(this, arguments);
  };
}

// CONCATENATED MODULE: ./node_modules/webrtc-adapter/src/js/safari/safari_shim.js
/*
 *  Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
 *
 *  Use of this source code is governed by a BSD-style license
 *  that can be found in the LICENSE file in the root of the source
 *  tree.
 */



function shimLocalStreamsAPI(window) {
  if (typeof window !== 'object' || !window.RTCPeerConnection) {
    return;
  }
  if (!('getLocalStreams' in window.RTCPeerConnection.prototype)) {
    window.RTCPeerConnection.prototype.getLocalStreams =
      function getLocalStreams() {
        if (!this._localStreams) {
          this._localStreams = [];
        }
        return this._localStreams;
      };
  }
  if (!('addStream' in window.RTCPeerConnection.prototype)) {
    const _addTrack = window.RTCPeerConnection.prototype.addTrack;
    window.RTCPeerConnection.prototype.addStream = function addStream(stream) {
      if (!this._localStreams) {
        this._localStreams = [];
      }
      if (!this._localStreams.includes(stream)) {
        this._localStreams.push(stream);
      }
      // Try to emulate Chrome's behaviour of adding in audio-video order.
      // Safari orders by track id.
      stream.getAudioTracks().forEach(track => _addTrack.call(this, track,
        stream));
      stream.getVideoTracks().forEach(track => _addTrack.call(this, track,
        stream));
    };

    window.RTCPeerConnection.prototype.addTrack =
      function addTrack(track, ...streams) {
        if (streams) {
          streams.forEach((stream) => {
            if (!this._localStreams) {
              this._localStreams = [stream];
            } else if (!this._localStreams.includes(stream)) {
              this._localStreams.push(stream);
            }
          });
        }
        return _addTrack.apply(this, arguments);
      };
  }
  if (!('removeStream' in window.RTCPeerConnection.prototype)) {
    window.RTCPeerConnection.prototype.removeStream =
      function removeStream(stream) {
        if (!this._localStreams) {
          this._localStreams = [];
        }
        const index = this._localStreams.indexOf(stream);
        if (index === -1) {
          return;
        }
        this._localStreams.splice(index, 1);
        const tracks = stream.getTracks();
        this.getSenders().forEach(sender => {
          if (tracks.includes(sender.track)) {
            this.removeTrack(sender);
          }
        });
      };
  }
}

function shimRemoteStreamsAPI(window) {
  if (typeof window !== 'object' || !window.RTCPeerConnection) {
    return;
  }
  if (!('getRemoteStreams' in window.RTCPeerConnection.prototype)) {
    window.RTCPeerConnection.prototype.getRemoteStreams =
      function getRemoteStreams() {
        return this._remoteStreams ? this._remoteStreams : [];
      };
  }
  if (!('onaddstream' in window.RTCPeerConnection.prototype)) {
    Object.defineProperty(window.RTCPeerConnection.prototype, 'onaddstream', {
      get() {
        return this._onaddstream;
      },
      set(f) {
        if (this._onaddstream) {
          this.removeEventListener('addstream', this._onaddstream);
          this.removeEventListener('track', this._onaddstreampoly);
        }
        this.addEventListener('addstream', this._onaddstream = f);
        this.addEventListener('track', this._onaddstreampoly = (e) => {
          e.streams.forEach(stream => {
            if (!this._remoteStreams) {
              this._remoteStreams = [];
            }
            if (this._remoteStreams.includes(stream)) {
              return;
            }
            this._remoteStreams.push(stream);
            const event = new Event('addstream');
            event.stream = stream;
            this.dispatchEvent(event);
          });
        });
      }
    });
    const origSetRemoteDescription =
      window.RTCPeerConnection.prototype.setRemoteDescription;
    window.RTCPeerConnection.prototype.setRemoteDescription =
      function setRemoteDescription() {
        const pc = this;
        if (!this._onaddstreampoly) {
          this.addEventListener('track', this._onaddstreampoly = function(e) {
            e.streams.forEach(stream => {
              if (!pc._remoteStreams) {
                pc._remoteStreams = [];
              }
              if (pc._remoteStreams.indexOf(stream) >= 0) {
                return;
              }
              pc._remoteStreams.push(stream);
              const event = new Event('addstream');
              event.stream = stream;
              pc.dispatchEvent(event);
            });
          });
        }
        return origSetRemoteDescription.apply(pc, arguments);
      };
  }
}

function shimCallbacksAPI(window) {
  if (typeof window !== 'object' || !window.RTCPeerConnection) {
    return;
  }
  const prototype = window.RTCPeerConnection.prototype;
  const origCreateOffer = prototype.createOffer;
  const origCreateAnswer = prototype.createAnswer;
  const setLocalDescription = prototype.setLocalDescription;
  const setRemoteDescription = prototype.setRemoteDescription;
  const addIceCandidate = prototype.addIceCandidate;

  prototype.createOffer =
    function createOffer(successCallback, failureCallback) {
      const options = (arguments.length >= 2) ? arguments[2] : arguments[0];
      const promise = origCreateOffer.apply(this, [options]);
      if (!failureCallback) {
        return promise;
      }
      promise.then(successCallback, failureCallback);
      return Promise.resolve();
    };

  prototype.createAnswer =
    function createAnswer(successCallback, failureCallback) {
      const options = (arguments.length >= 2) ? arguments[2] : arguments[0];
      const promise = origCreateAnswer.apply(this, [options]);
      if (!failureCallback) {
        return promise;
      }
      promise.then(successCallback, failureCallback);
      return Promise.resolve();
    };

  let withCallback = function(description, successCallback, failureCallback) {
    const promise = setLocalDescription.apply(this, [description]);
    if (!failureCallback) {
      return promise;
    }
    promise.then(successCallback, failureCallback);
    return Promise.resolve();
  };
  prototype.setLocalDescription = withCallback;

  withCallback = function(description, successCallback, failureCallback) {
    const promise = setRemoteDescription.apply(this, [description]);
    if (!failureCallback) {
      return promise;
    }
    promise.then(successCallback, failureCallback);
    return Promise.resolve();
  };
  prototype.setRemoteDescription = withCallback;

  withCallback = function(candidate, successCallback, failureCallback) {
    const promise = addIceCandidate.apply(this, [candidate]);
    if (!failureCallback) {
      return promise;
    }
    promise.then(successCallback, failureCallback);
    return Promise.resolve();
  };
  prototype.addIceCandidate = withCallback;
}

function safari_shim_shimGetUserMedia(window) {
  const navigator = window && window.navigator;

  if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) {
    // shim not needed in Safari 12.1
    const mediaDevices = navigator.mediaDevices;
    const _getUserMedia = mediaDevices.getUserMedia.bind(mediaDevices);
    navigator.mediaDevices.getUserMedia = (constraints) => {
      return _getUserMedia(shimConstraints(constraints));
    };
  }

  if (!navigator.getUserMedia && navigator.mediaDevices &&
    navigator.mediaDevices.getUserMedia) {
    navigator.getUserMedia = function getUserMedia(constraints, cb, errcb) {
      navigator.mediaDevices.getUserMedia(constraints)
      .then(cb, errcb);
    }.bind(navigator);
  }
}

function shimConstraints(constraints) {
  if (constraints && constraints.video !== undefined) {
    return Object.assign({},
      constraints,
      {video: compactObject(constraints.video)}
    );
  }

  return constraints;
}

function shimRTCIceServerUrls(window) {
  if (!window.RTCPeerConnection) {
    return;
  }
  // migrate from non-spec RTCIceServer.url to RTCIceServer.urls
  const OrigPeerConnection = window.RTCPeerConnection;
  window.RTCPeerConnection =
    function RTCPeerConnection(pcConfig, pcConstraints) {
      if (pcConfig && pcConfig.iceServers) {
        const newIceServers = [];
        for (let i = 0; i < pcConfig.iceServers.length; i++) {
          let server = pcConfig.iceServers[i];
          if (!server.hasOwnProperty('urls') &&
              server.hasOwnProperty('url')) {
            deprecated('RTCIceServer.url', 'RTCIceServer.urls');
            server = JSON.parse(JSON.stringify(server));
            server.urls = server.url;
            delete server.url;
            newIceServers.push(server);
          } else {
            newIceServers.push(pcConfig.iceServers[i]);
          }
        }
        pcConfig.iceServers = newIceServers;
      }
      return new OrigPeerConnection(pcConfig, pcConstraints);
    };
  window.RTCPeerConnection.prototype = OrigPeerConnection.prototype;
  // wrap static methods. Currently just generateCertificate.
  if ('generateCertificate' in OrigPeerConnection) {
    Object.defineProperty(window.RTCPeerConnection, 'generateCertificate', {
      get() {
        return OrigPeerConnection.generateCertificate;
      }
    });
  }
}

function shimTrackEventTransceiver(window) {
  // Add event.transceiver member over deprecated event.receiver
  if (typeof window === 'object' && window.RTCTrackEvent &&
      'receiver' in window.RTCTrackEvent.prototype &&
      !('transceiver' in window.RTCTrackEvent.prototype)) {
    Object.defineProperty(window.RTCTrackEvent.prototype, 'transceiver', {
      get() {
        return {receiver: this.receiver};
      }
    });
  }
}

function shimCreateOfferLegacy(window) {
  const origCreateOffer = window.RTCPeerConnection.prototype.createOffer;
  window.RTCPeerConnection.prototype.createOffer =
    function createOffer(offerOptions) {
      if (offerOptions) {
        if (typeof offerOptions.offerToReceiveAudio !== 'undefined') {
          // support bit values
          offerOptions.offerToReceiveAudio =
            !!offerOptions.offerToReceiveAudio;
        }
        const audioTransceiver = this.getTransceivers().find(transceiver =>
          transceiver.receiver.track.kind === 'audio');
        if (offerOptions.offerToReceiveAudio === false && audioTransceiver) {
          if (audioTransceiver.direction === 'sendrecv') {
            if (audioTransceiver.setDirection) {
              audioTransceiver.setDirection('sendonly');
            } else {
              audioTransceiver.direction = 'sendonly';
            }
          } else if (audioTransceiver.direction === 'recvonly') {
            if (audioTransceiver.setDirection) {
              audioTransceiver.setDirection('inactive');
            } else {
              audioTransceiver.direction = 'inactive';
            }
          }
        } else if (offerOptions.offerToReceiveAudio === true &&
            !audioTransceiver) {
          this.addTransceiver('audio');
        }

        if (typeof offerOptions.offerToReceiveVideo !== 'undefined') {
          // support bit values
          offerOptions.offerToReceiveVideo =
            !!offerOptions.offerToReceiveVideo;
        }
        const videoTransceiver = this.getTransceivers().find(transceiver =>
          transceiver.receiver.track.kind === 'video');
        if (offerOptions.offerToReceiveVideo === false && videoTransceiver) {
          if (videoTransceiver.direction === 'sendrecv') {
            if (videoTransceiver.setDirection) {
              videoTransceiver.setDirection('sendonly');
            } else {
              videoTransceiver.direction = 'sendonly';
            }
          } else if (videoTransceiver.direction === 'recvonly') {
            if (videoTransceiver.setDirection) {
              videoTransceiver.setDirection('inactive');
            } else {
              videoTransceiver.direction = 'inactive';
            }
          }
        } else if (offerOptions.offerToReceiveVideo === true &&
            !videoTransceiver) {
          this.addTransceiver('video');
        }
      }
      return origCreateOffer.apply(this, arguments);
    };
}

function shimAudioContext(window) {
  if (typeof window !== 'object' || window.AudioContext) {
    return;
  }
  window.AudioContext = window.webkitAudioContext;
}

// EXTERNAL MODULE: ./node_modules/sdp/sdp.js
var sdp = __webpack_require__(28);
var sdp_default = /*#__PURE__*/__webpack_require__.n(sdp);

// CONCATENATED MODULE: ./node_modules/webrtc-adapter/src/js/common_shim.js
/*
 *  Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
 *
 *  Use of this source code is governed by a BSD-style license
 *  that can be found in the LICENSE file in the root of the source
 *  tree.
 */
/* eslint-env node */





function shimRTCIceCandidate(window) {
  // foundation is arbitrarily chosen as an indicator for full support for
  // https://w3c.github.io/webrtc-pc/#rtcicecandidate-interface
  if (!window.RTCIceCandidate || (window.RTCIceCandidate && 'foundation' in
      window.RTCIceCandidate.prototype)) {
    return;
  }

  const NativeRTCIceCandidate = window.RTCIceCandidate;
  window.RTCIceCandidate = function RTCIceCandidate(args) {
    // Remove the a= which shouldn't be part of the candidate string.
    if (typeof args === 'object' && args.candidate &&
        args.candidate.indexOf('a=') === 0) {
      args = JSON.parse(JSON.stringify(args));
      args.candidate = args.candidate.substr(2);
    }

    if (args.candidate && args.candidate.length) {
      // Augment the native candidate with the parsed fields.
      const nativeCandidate = new NativeRTCIceCandidate(args);
      const parsedCandidate = sdp_default.a.parseCandidate(args.candidate);
      const augmentedCandidate = Object.assign(nativeCandidate,
          parsedCandidate);

      // Add a serializer that does not serialize the extra attributes.
      augmentedCandidate.toJSON = function toJSON() {
        return {
          candidate: augmentedCandidate.candidate,
          sdpMid: augmentedCandidate.sdpMid,
          sdpMLineIndex: augmentedCandidate.sdpMLineIndex,
          usernameFragment: augmentedCandidate.usernameFragment,
        };
      };
      return augmentedCandidate;
    }
    return new NativeRTCIceCandidate(args);
  };
  window.RTCIceCandidate.prototype = NativeRTCIceCandidate.prototype;

  // Hook up the augmented candidate in onicecandidate and
  // addEventListener('icecandidate', ...)
  wrapPeerConnectionEvent(window, 'icecandidate', e => {
    if (e.candidate) {
      Object.defineProperty(e, 'candidate', {
        value: new window.RTCIceCandidate(e.candidate),
        writable: 'false'
      });
    }
    return e;
  });
}

function shimMaxMessageSize(window) {
  if (!window.RTCPeerConnection) {
    return;
  }
  const browserDetails = detectBrowser(window);

  if (!('sctp' in window.RTCPeerConnection.prototype)) {
    Object.defineProperty(window.RTCPeerConnection.prototype, 'sctp', {
      get() {
        return typeof this._sctp === 'undefined' ? null : this._sctp;
      }
    });
  }

  const sctpInDescription = function(description) {
    if (!description || !description.sdp) {
      return false;
    }
    const sections = sdp_default.a.splitSections(description.sdp);
    sections.shift();
    return sections.some(mediaSection => {
      const mLine = sdp_default.a.parseMLine(mediaSection);
      return mLine && mLine.kind === 'application'
          && mLine.protocol.indexOf('SCTP') !== -1;
    });
  };

  const getRemoteFirefoxVersion = function(description) {
    // TODO: Is there a better solution for detecting Firefox?
    const match = description.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);
    if (match === null || match.length < 2) {
      return -1;
    }
    const version = parseInt(match[1], 10);
    // Test for NaN (yes, this is ugly)
    return version !== version ? -1 : version;
  };

  const getCanSendMaxMessageSize = function(remoteIsFirefox) {
    // Every implementation we know can send at least 64 KiB.
    // Note: Although Chrome is technically able to send up to 256 KiB, the
    //       data does not reach the other peer reliably.
    //       See: https://bugs.chromium.org/p/webrtc/issues/detail?id=8419
    let canSendMaxMessageSize = 65536;
    if (browserDetails.browser === 'firefox') {
      if (browserDetails.version < 57) {
        if (remoteIsFirefox === -1) {
          // FF < 57 will send in 16 KiB chunks using the deprecated PPID
          // fragmentation.
          canSendMaxMessageSize = 16384;
        } else {
          // However, other FF (and RAWRTC) can reassemble PPID-fragmented
          // messages. Thus, supporting ~2 GiB when sending.
          canSendMaxMessageSize = 2147483637;
        }
      } else if (browserDetails.version < 60) {
        // Currently, all FF >= 57 will reset the remote maximum message size
        // to the default value when a data channel is created at a later
        // stage. :(
        // See: https://bugzilla.mozilla.org/show_bug.cgi?id=1426831
        canSendMaxMessageSize =
          browserDetails.version === 57 ? 65535 : 65536;
      } else {
        // FF >= 60 supports sending ~2 GiB
        canSendMaxMessageSize = 2147483637;
      }
    }
    return canSendMaxMessageSize;
  };

  const getMaxMessageSize = function(description, remoteIsFirefox) {
    // Note: 65536 bytes is the default value from the SDP spec. Also,
    //       every implementation we know supports receiving 65536 bytes.
    let maxMessageSize = 65536;

    // FF 57 has a slightly incorrect default remote max message size, so
    // we need to adjust it here to avoid a failure when sending.
    // See: https://bugzilla.mozilla.org/show_bug.cgi?id=1425697
    if (browserDetails.browser === 'firefox'
         && browserDetails.version === 57) {
      maxMessageSize = 65535;
    }

    const match = sdp_default.a.matchPrefix(description.sdp,
      'a=max-message-size:');
    if (match.length > 0) {
      maxMessageSize = parseInt(match[0].substr(19), 10);
    } else if (browserDetails.browser === 'firefox' &&
                remoteIsFirefox !== -1) {
      // If the maximum message size is not present in the remote SDP and
      // both local and remote are Firefox, the remote peer can receive
      // ~2 GiB.
      maxMessageSize = 2147483637;
    }
    return maxMessageSize;
  };

  const origSetRemoteDescription =
      window.RTCPeerConnection.prototype.setRemoteDescription;
  window.RTCPeerConnection.prototype.setRemoteDescription =
    function setRemoteDescription() {
      this._sctp = null;
      // Chrome decided to not expose .sctp in plan-b mode.
      // As usual, adapter.js has to do an 'ugly worakaround'
      // to cover up the mess.
      if (browserDetails.browser === 'chrome' && browserDetails.version >= 76) {
        const {sdpSemantics} = this.getConfiguration();
        if (sdpSemantics === 'plan-b') {
          Object.defineProperty(this, 'sctp', {
            get() {
              return typeof this._sctp === 'undefined' ? null : this._sctp;
            },
            enumerable: true,
            configurable: true,
          });
        }
      }

      if (sctpInDescription(arguments[0])) {
        // Check if the remote is FF.
        const isFirefox = getRemoteFirefoxVersion(arguments[0]);

        // Get the maximum message size the local peer is capable of sending
        const canSendMMS = getCanSendMaxMessageSize(isFirefox);

        // Get the maximum message size of the remote peer.
        const remoteMMS = getMaxMessageSize(arguments[0], isFirefox);

        // Determine final maximum message size
        let maxMessageSize;
        if (canSendMMS === 0 && remoteMMS === 0) {
          maxMessageSize = Number.POSITIVE_INFINITY;
        } else if (canSendMMS === 0 || remoteMMS === 0) {
          maxMessageSize = Math.max(canSendMMS, remoteMMS);
        } else {
          maxMessageSize = Math.min(canSendMMS, remoteMMS);
        }

        // Create a dummy RTCSctpTransport object and the 'maxMessageSize'
        // attribute.
        const sctp = {};
        Object.defineProperty(sctp, 'maxMessageSize', {
          get() {
            return maxMessageSize;
          }
        });
        this._sctp = sctp;
      }

      return origSetRemoteDescription.apply(this, arguments);
    };
}

function shimSendThrowTypeError(window) {
  if (!(window.RTCPeerConnection &&
      'createDataChannel' in window.RTCPeerConnection.prototype)) {
    return;
  }

  // Note: Although Firefox >= 57 has a native implementation, the maximum
  //       message size can be reset for all data channels at a later stage.
  //       See: https://bugzilla.mozilla.org/show_bug.cgi?id=1426831

  function wrapDcSend(dc, pc) {
    const origDataChannelSend = dc.send;
    dc.send = function send() {
      const data = arguments[0];
      const length = data.length || data.size || data.byteLength;
      if (dc.readyState === 'open' &&
          pc.sctp && length > pc.sctp.maxMessageSize) {
        throw new TypeError('Message too large (can send a maximum of ' +
          pc.sctp.maxMessageSize + ' bytes)');
      }
      return origDataChannelSend.apply(dc, arguments);
    };
  }
  const origCreateDataChannel =
    window.RTCPeerConnection.prototype.createDataChannel;
  window.RTCPeerConnection.prototype.createDataChannel =
    function createDataChannel() {
      const dataChannel = origCreateDataChannel.apply(this, arguments);
      wrapDcSend(dataChannel, this);
      return dataChannel;
    };
  wrapPeerConnectionEvent(window, 'datachannel', e => {
    wrapDcSend(e.channel, e.target);
    return e;
  });
}


/* shims RTCConnectionState by pretending it is the same as iceConnectionState.
 * See https://bugs.chromium.org/p/webrtc/issues/detail?id=6145#c12
 * for why this is a valid hack in Chrome. In Firefox it is slightly incorrect
 * since DTLS failures would be hidden. See
 * https://bugzilla.mozilla.org/show_bug.cgi?id=1265827
 * for the Firefox tracking bug.
 */
function shimConnectionState(window) {
  if (!window.RTCPeerConnection ||
      'connectionState' in window.RTCPeerConnection.prototype) {
    return;
  }
  const proto = window.RTCPeerConnection.prototype;
  Object.defineProperty(proto, 'connectionState', {
    get() {
      return {
        completed: 'connected',
        checking: 'connecting'
      }[this.iceConnectionState] || this.iceConnectionState;
    },
    enumerable: true,
    configurable: true
  });
  Object.defineProperty(proto, 'onconnectionstatechange', {
    get() {
      return this._onconnectionstatechange || null;
    },
    set(cb) {
      if (this._onconnectionstatechange) {
        this.removeEventListener('connectionstatechange',
            this._onconnectionstatechange);
        delete this._onconnectionstatechange;
      }
      if (cb) {
        this.addEventListener('connectionstatechange',
            this._onconnectionstatechange = cb);
      }
    },
    enumerable: true,
    configurable: true
  });

  ['setLocalDescription', 'setRemoteDescription'].forEach((method) => {
    const origMethod = proto[method];
    proto[method] = function() {
      if (!this._connectionstatechangepoly) {
        this._connectionstatechangepoly = e => {
          const pc = e.target;
          if (pc._lastConnectionState !== pc.connectionState) {
            pc._lastConnectionState = pc.connectionState;
            const newEvent = new Event('connectionstatechange', e);
            pc.dispatchEvent(newEvent);
          }
          return e;
        };
        this.addEventListener('iceconnectionstatechange',
          this._connectionstatechangepoly);
      }
      return origMethod.apply(this, arguments);
    };
  });
}

function removeAllowExtmapMixed(window) {
  /* remove a=extmap-allow-mixed for webrtc.org < M71 */
  if (!window.RTCPeerConnection) {
    return;
  }
  const browserDetails = detectBrowser(window);
  if (browserDetails.browser === 'chrome' && browserDetails.version >= 71) {
    return;
  }
  if (browserDetails.browser === 'safari' && browserDetails.version >= 605) {
    return;
  }
  const nativeSRD = window.RTCPeerConnection.prototype.setRemoteDescription;
  window.RTCPeerConnection.prototype.setRemoteDescription =
  function setRemoteDescription(desc) {
    if (desc && desc.sdp && desc.sdp.indexOf('\na=extmap-allow-mixed') !== -1) {
      desc.sdp = desc.sdp.split('\n').filter((line) => {
        return line.trim() !== 'a=extmap-allow-mixed';
      }).join('\n');
    }
    return nativeSRD.apply(this, arguments);
  };
}

// CONCATENATED MODULE: ./node_modules/webrtc-adapter/src/js/adapter_factory.js
/*
 *  Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
 *
 *  Use of this source code is governed by a BSD-style license
 *  that can be found in the LICENSE file in the root of the source
 *  tree.
 */


  // Browser shims.






// Shimming starts here.
function adapterFactory({window} = {}, options = {
  shimChrome: true,
  shimFirefox: true,
  shimEdge: true,
  shimSafari: true,
}) {
  // Utils.
  const logging = log;
  const browserDetails = detectBrowser(window);

  const adapter = {
    browserDetails,
    commonShim: common_shim_namespaceObject,
    extractVersion: extractVersion,
    disableLog: disableLog,
    disableWarnings: disableWarnings
  };

  // Shim browser if found.
  switch (browserDetails.browser) {
    case 'chrome':
      if (!chrome_shim_namespaceObject || !shimPeerConnection ||
          !options.shimChrome) {
        logging('Chrome shim is not included in this adapter release.');
        return adapter;
      }
      if (browserDetails.version === null) {
        logging('Chrome shim can not determine version, not shimming.');
        return adapter;
      }
      logging('adapter.js shimming chrome.');
      // Export to the adapter global object visible in the browser.
      adapter.browserShim = chrome_shim_namespaceObject;

      shimGetUserMedia(window);
      shimMediaStream(window);
      shimPeerConnection(window);
      shimOnTrack(window);
      shimAddTrackRemoveTrack(window);
      shimGetSendersWithDtmf(window);
      shimGetStats(window);
      shimSenderReceiverGetStats(window);
      fixNegotiationNeeded(window);

      shimRTCIceCandidate(window);
      shimConnectionState(window);
      shimMaxMessageSize(window);
      shimSendThrowTypeError(window);
      removeAllowExtmapMixed(window);
      break;
    case 'firefox':
      if (!firefox_shim_namespaceObject || !firefox_shim_shimPeerConnection ||
          !options.shimFirefox) {
        logging('Firefox shim is not included in this adapter release.');
        return adapter;
      }
      logging('adapter.js shimming firefox.');
      // Export to the adapter global object visible in the browser.
      adapter.browserShim = firefox_shim_namespaceObject;

      firefox_getusermedia_shimGetUserMedia(window);
      firefox_shim_shimPeerConnection(window);
      firefox_shim_shimOnTrack(window);
      shimRemoveStream(window);
      shimSenderGetStats(window);
      shimReceiverGetStats(window);
      shimRTCDataChannel(window);
      shimAddTransceiver(window);
      shimGetParameters(window);
      shimCreateOffer(window);
      shimCreateAnswer(window);

      shimRTCIceCandidate(window);
      shimConnectionState(window);
      shimMaxMessageSize(window);
      shimSendThrowTypeError(window);
      break;
    case 'edge':
      if (!edge_shim_namespaceObject || !edge_shim_shimPeerConnection || !options.shimEdge) {
        logging('MS edge shim is not included in this adapter release.');
        return adapter;
      }
      logging('adapter.js shimming edge.');
      // Export to the adapter global object visible in the browser.
      adapter.browserShim = edge_shim_namespaceObject;

      getusermedia_shimGetUserMedia(window);
      getdisplaymedia_shimGetDisplayMedia(window);
      edge_shim_shimPeerConnection(window);
      shimReplaceTrack(window);

      // the edge shim implements the full RTCIceCandidate object.

      shimMaxMessageSize(window);
      shimSendThrowTypeError(window);
      break;
    case 'safari':
      if (!safari_shim_namespaceObject || !options.shimSafari) {
        logging('Safari shim is not included in this adapter release.');
        return adapter;
      }
      logging('adapter.js shimming safari.');
      // Export to the adapter global object visible in the browser.
      adapter.browserShim = safari_shim_namespaceObject;

      shimRTCIceServerUrls(window);
      shimCreateOfferLegacy(window);
      shimCallbacksAPI(window);
      shimLocalStreamsAPI(window);
      shimRemoteStreamsAPI(window);
      shimTrackEventTransceiver(window);
      safari_shim_shimGetUserMedia(window);
      shimAudioContext(window);

      shimRTCIceCandidate(window);
      shimMaxMessageSize(window);
      shimSendThrowTypeError(window);
      removeAllowExtmapMixed(window);
      break;
    default:
      logging('Unsupported browser!');
      break;
  }

  return adapter;
}

// CONCATENATED MODULE: ./node_modules/webrtc-adapter/src/js/adapter_core.js
/*
 *  Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
 *
 *  Use of this source code is governed by a BSD-style license
 *  that can be found in the LICENSE file in the root of the source
 *  tree.
 */
/* eslint-env node */





const adapter_core_adapter =
  adapterFactory({window: typeof window === 'undefined' ? undefined : window});
/* harmony default export */ var adapter_core = (adapter_core_adapter);

// CONCATENATED MODULE: ./util.js
function _typeof(obj) { "@babel/helpers - typeof"; 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 util_isObject(obj) {
  if (_typeof(obj) == "object") {
    for (var key in obj) {
      if (obj.hasOwnProperty(key)) {
        return true; // search for first object prop
      }
    }
  }

  return false;
}
function mergeObject(target, add) {
  for (var key in add) {
    if (add.hasOwnProperty(key)) {
      if (target[key] && util_isObject(target[key]) && util_isObject(add[key])) {
        mergeObject(target[key], add[key]);
      } else {
        target[key] = add[key];
      }
    }
  }

  return target;
}
// EXTERNAL MODULE: ./node_modules/mqtt/lib/connect/index.js
var connect = __webpack_require__(92);

// CONCATENATED MODULE: ./app/GConversation.js



navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia;
/***
 * @typedef {{number: string, clientId: string}} GEndPoint
 */

/***
 * @extends EventEmitter
 * @param {GPhone} phone
 * @param {GEndPoint} other
 * @param {string=} id
 * @param {("outgoing"|"income")=} type
 *
 */

function GConversation(phone, other, id, type) {
  EventEmitter["b" /* default */].call(this);
  this.type = type || "outgoing";
  this.phone = phone;
  /***
   *
   * @type {GEndPoint}
   */

  this.me = {
    number: phone.number,
    clientId: phone.clientId
  };
  this.id = id || randomIdent(32);
  this.other = other; //video=>remote description => ice

  this.localStream = null;
  this.localStreamSync = new Promise(function (resolve) {
    this._localStreamResolveCb = resolve;
  }.bind(this));
  this.remoteStreams = null;
  this.remoteStreamSync = new Promise(function (resolve) {
    this._remoteResolveCb = resolve;
  }.bind(this));
  this.remoteDescSync = new Promise(function (resolve) {
    this._remoteDescResolveCb = resolve;
  }.bind(this)); // IceCandidate
}

OOP["a" /* default */].mixClass(GConversation, EventEmitter["b" /* default */]);

GConversation.prototype.startP2P = function () {
  this.pc = new RTCPeerConnection(this.phone.config.rtc); //ontrack not work with webrtc-adapter

  this.pc.addEventListener('track', this.ev_ontrack.bind(this));
  this.pc.addEventListener('icecandidate', this.ev_onicecandidate.bind(this));
};

GConversation.prototype.startVideo = function () {};

GConversation.prototype.startAudio = function () {
  var thisC = this;
  return navigator.mediaDevices.getUserMedia({
    audio: this.phone.config.media.audio
  }).then(function (stream) {
    thisC.localStream = stream;
    stream.getTracks().forEach(function (track) {
      thisC.pc.addTrack(track, stream);
    });

    thisC._localStreamResolveCb(stream);

    thisC._localStreamResolveCb = null;
  });
};

GConversation.prototype._setupAntiNoise = function () {};

GConversation.prototype.getLocalStream = function () {
  return this.localStreamSync;
};

GConversation.prototype.getRemoteStreams = function () {
  return this.remoteStreamSync;
};

GConversation.prototype.close = function () {
  this.pc.close();
  if (this.remoteStreams) this.remoteStreams.forEach(function (stream) {
    stream.getTracks().forEach(function (track) {
      track.stop();
    });
  });
  if (this.localStream) this.localStream.getTracks().forEach(function (track) {
    track.stop();
  });
};

GConversation.prototype.setRemoteDescription = function (offer) {
  var thisC = this;
  var pc = this.pc; //don't set remoteDescription before audio

  return this.localStreamSync.then(function () {
    return pc.setRemoteDescription(new RTCSessionDescription(offer)).then(function () {
      thisC._remoteDescResolveCb(offer);

      thisC._remoteDescResolveCb = null;
    });
  });
};

GConversation.prototype.getRemoteDescription = function () {
  return this.remoteDescSync;
};
/***
 *
 * @return {Promise<RTCSessionDescriptionInit>}
 */


GConversation.prototype.offer = function () {
  var thisC = this;
  return this.localStreamSync.then(function () {
    return thisC.pc.createOffer();
  }).then(function (offer) {
    return thisC.pc.setLocalDescription(offer).then(function () {
      return offer;
    });
  });
};
/***
 * @returns {Promise<RTCSessionDescriptionInit>}
 */


GConversation.prototype.answer = function () {
  var pc = this.pc;
  return this.remoteDescSync.then(function () {
    if (pc.remoteDescription.type !== "offer") return null;
    return pc.createAnswer().then(function (answer) {
      return pc.setLocalDescription(answer).then(function () {
        return answer;
      });
    });
  });
};

GConversation.prototype.addIceCandidate = function (candidate) {
  var pc = this.pc;
  this.remoteDescSync.then(function () {
    return pc.addIceCandidate(new RTCIceCandidate(candidate));
  });
};

GConversation.prototype.ev_ontrack = function (event) {
  var streams = Array.prototype.slice.call(event.streams);
  this.emit('remote_stream', {
    type: 'remote_stream',
    streams: streams,
    target: this
  }, this);
  this.remoteStreams = streams;

  if (this._remoteResolveCb) {
    this._remoteResolveCb(streams);

    this._remoteResolveCb = null;
  }
};

GConversation.prototype.ev_onicecandidate = function (event) {
  if (event.candidate) this.emit('icecandidate', {
    type: 'icecandidate',
    candidate: event.candidate,
    target: this
  });
};

/* harmony default export */ var app_GConversation = (GConversation);
// CONCATENATED MODULE: ./app/GPhone.js







var defaultConfig = {
  media: {
    audio: {
      echoCancellationType: 'system',
      echoCancellation: true,
      noiseSuppression: true,
      // sampleRate:24000,
      // sampleSize:16,
      // channelCount:2,
      volume: 0.5
    },
    video: {
      facingMode: 'user'
    }
  },
  mqtt: {
    ws: 'wss:mqtt.absol.cf:9884',
    appChannel: 'gadevoir'
  },
  rtc: {
    offerToReceiveAudio: true,
    offerToReceiveVideo: true,
    iceServers: [{
      "urls": "stun:absol.cf:3478"
      // "urls": "stun:stun2.l.google.com:19302"
    }]
  }
};
navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia;

function GPhone(config) {
  this.state = "NOT_READY";
  EventEmitter["b" /* default */].call(this);
  this.config = mergeObject(defaultConfig, config || {});
  this.number = this.config.number || localStorage.getItem('gphone_id') || this._randomPhoneNumber();
  this.clientId = this.config.clientId || this.number + '-' + randomIdent(24);
  localStorage.setItem('gphone_id', this.number);
  this.classChannel = this.config.mqtt.appChannel + '/gphone';
  this.phoneChannel = this.classChannel + '/' + this.number;
  this.clientChannel = this.classChannel + '/' + this.clientId;
  /***
   *
   * @type {null|GConversation}
   */

  this.conversation = null;
  this.mqttClient = connect["connect"](this.config.mqtt.ws);
  this.pkgRecv = new EventEmitter["b" /* default */]();

  this._setupMQTT();

  this.sync = new Promise(function (resolve) {
    this.mqttClient.on("connect", resolve);
  }.bind(this));
}

OOP["a" /* default */].mixClass(GPhone, EventEmitter["b" /* default */]);

GPhone.isSupported = function () {
  return !!window.RTCPeerConnection && !!(navigator.mediaDevices && navigator.mediaDevices.getUserMedia) && !!RTCPeerConnection.prototype.createDataChannel;
};

GPhone.prototype._randomPhoneNumber = function () {
  return '0908' + Array(6).fill(0).map(function () {
    return Math.floor(Math.random() * 10);
  }).join('');
};

GPhone.prototype._setupMQTT = function () {
  this.mqttClient.on('connect', this.mqtt_onConnect.bind(this));
  this.mqttClient.on('error', this.mqtt_onError.bind(this));
  this.mqttClient.on('message', this.mqtt_onMessage.bind(this));
  this.mqttClient.subscribe([this.classChannel, this.phoneChannel, this.clientChannel]);
  this.pkgRecv.on('dial', this.recv_dial.bind(this));
  this.pkgRecv.on('who_online', this.recv_whoOnline.bind(this));
  this.pkgRecv.on('icecandidate', this.recv_icecandidate.bind(this));
  this.pkgRecv.on('answer', this.recv_answer.bind(this));
  this.pkgRecv.on('hangup', this.recv_hangup.bind(this));
};

GPhone.prototype.mqtt_onMessage = function (channel, payload) {
  try {
    var json = JSON.parse(payload + '');
    this.pkgRecv.emit(json.type, json.data, json);
  } catch (error) {
    console.error(error);
  }
};

GPhone.prototype.mqtt_onConnect = function () {
  if (this.state === "NOT_READY") {
    this.state = "READY";
    this.emit('ready', {
      type: 'ready',
      target: this
    }, this);
  }
};

GPhone.prototype.mqtt_onError = function (err) {// this.state = "NOT_READY";
};

GPhone.prototype.sendToPhone = function (number, type, data, cb) {
  var json = JSON.stringify({
    type: type,
    data: data,
    sourceClient: this.clientId,
    sourcePhone: this.number,
    from: this.number,
    destType: 'phone',
    dest: number
  });
  this.mqttClient.publish(this.classChannel + '/' + number, json, cb);
};

GPhone.prototype.sendToClient = function (client, type, data, cb) {
  var json = JSON.stringify({
    type: type,
    data: data,
    sourceClient: this.clientId,
    sourcePhone: this.number,
    from: this.clientId,
    destType: 'client',
    dest: client
  });
  this.mqttClient.publish(this.classChannel + '/' + client, json, cb);
};

GPhone.prototype.sendToClass = function (type, data, cb) {
  var json = JSON.stringify({
    type: type,
    data: data,
    sourceClient: this.clientId,
    sourcePhone: this.number,
    from: this.number,
    destType: 'class'
  });
  this.mqttClient.publish(this.classChannel, json, cb);
};
/***
 *
 * @param {string} phoneNumber
 * @param {number} timeout
 * @param {function} onStateChangeCb
 */


GPhone.prototype.dial = function (phoneNumber, timeout, onStateChangeCb) {
  if (this.state !== 'READY') {
    return false; // throw  new Error("GPhone is not ready");
  }

  this.state = "OUTGOING_DIAL";
  var responseIdx = -1;
  var answerCount = 0;
  var thisPhone = this;
  var conversation = new app_GConversation(this, {
    clientId: "undefined",
    number: phoneNumber
  });
  conversation.on('icecandidate', this.ev_icecandidate.bind(this, conversation));
  var id = conversation.id;
  this.conversation = conversation;
  var answerVal = 'NOT_RESPONSE';

  function onDialResponse(res, pkg) {
    if (id !== res.id) return;

    if (responseIdx >= 0) {
      clearTimeout(responseIdx);
    }

    switch (res.answer) {
      case "ACCEPT":
        answerVal = "ACCEPT";
        finish();
        thisPhone.state = "OUTGOING_TRANSMIT";
        conversation.other.clientId = pkg.sourceClient;
        conversation.startP2P();
        conversation.startAudio();
        conversation.setRemoteDescription(res.offer);
        conversation.answer().then(function (answer) {
          thisPhone.sendToPhone(conversation.other.number, 'answer', {
            id: conversation.id,
            answer: answer,
            targetClient: pkg.sourceClient
          });
        });
        onStateChangeCb({
          state: "ACCEPT"
        });
        break;

      case "BUSY":
        if (answerVal === 'NOT_RESPONSE') {
          answerVal = 'BUSY';
          responseIdx = setTimeout(finish, 4000);
        }

        break;

      case "DENY":
        answerVal = "DENY";
        onStateChangeCb({
          state: "DENY"
        });
        finish();
        break;

      case "WAITING":
        if (answerVal !== "WAITING") {
          answerVal = "WAITING";
          onStateChangeCb({
            state: "WAITING"
          });
        }

        responseIdx = setTimeout(finish, timeout);
        break;
    }
  }

  function finish() {
    responseIdx = -1;
    thisPhone.off('dial_response', onDialResponse);

    switch (answerVal) {
      case "NOT_RESPONSE":
        onStateChangeCb({
          state: "NOT_RESPONSE"
        });
        break;

      case "BUSY":
        onStateChangeCb({
          state: "BUSY"
        });
        break;

      case "WAITING":
        onStateChangeCb({
          state: "NOT_ANSWER"
        });
        break;
    }

    if (answerVal !== 'ACCEPT') {
      thisPhone.state = "READY";
      thisPhone.conversation = null;
    }
  }

  responseIdx = setTimeout(finish, 2000);
  this.sendToPhone(phoneNumber, 'dial', {
    id: id
  });
  this.pkgRecv.on('dial_response', onDialResponse);
  return true;
};

GPhone.prototype.recv_dial = function (data, pkg) {
  var clientId = pkg.sourceClient;

  if (this.state === 'READY') {
    this.sendToPhone(clientId, 'dial_response', {
      answer: "WAITING",
      id: data.id
    });
    this.state = "INCOME_DIAL";
    var conversation = new app_GConversation(this, {
      clientId: pkg.sourceClient,
      number: pkg.sourcePhone
    }, data.id, 'income');
    conversation.on('icecandidate', this.ev_icecandidate.bind(this, conversation));
    this.conversation = conversation;
    this.emit('income', {
      from: pkg.sourcePhone,
      clientId: clientId,
      conversationId: conversation.id
    });
  } else {
    this.sendToClient(clientId, 'dial_response', {
      answer: "BUSY"
    });
  }
};

GPhone.prototype.hangup = function () {
  var conversation = this.conversation;

  if (conversation) {
    switch (this.conversation.type) {
      case "income":
        if (conversation.pc) {
          this.sendToPhone(this.conversation.other.clientId, 'hangup', {
            id: conversation.id
          });
          conversation.close();
        } else {
          this.sendToClient(this.conversation.other.clientId, 'dial_response', {
            id: conversation.id,
            answer: "DENY"
          });
        }

        break;

      case "outgoing":
        if (conversation.pc) {
          this.sendToPhone(this.conversation.other.clientId, 'hangup', {
            id: conversation.id
          });
          conversation.close();
        } else {
          this.sendToClient(this.conversation.other.clientId, 'dial_cancel', {
            id: conversation.id,
            answer: "DENY"
          });
        }

        break;
    } //do something before remove


    this.conversation = null;
  }

  this.state = "READY";
};

GPhone.prototype.pickup = function () {
  var conversation = this.conversation;
  if (!conversation) return;
  var thisPhone = this;

  if (!conversation.pc) {
    this.state = "INCOME_TRANSMIT";
    conversation.startP2P();
    conversation.startAudio();
    conversation.offer().then(function (offer) {
      return thisPhone.sendToClient(conversation.other.clientId, 'dial_response', {
        answer: "ACCEPT",
        id: conversation.id,
        offer: offer
      });
    }); //todo: handle dial cancel after start P2P
  }
};

GPhone.prototype.getOnlineList = function () {
  var thisPhone = this;
  this.sendToClass('who_online', {});
  return new Promise(function (resolve) {
    var onlineList = {};
    var timeout;

    function onFinish() {
      thisPhone.mqttRecv.off('who_online_response', onResponse);
      resolve(onlineList);
    }

    function onResponse(data, pack) {
      var from = pack.sourcePhone;
      if (from === thisPhone.number) return;
      onlineList[from] = true;
      clearTimeout(timeout);
      timeout = setTimeout(onFinish, 500);
    }

    timeout = setTimeout(onFinish, 1500);
    thisPhone.mqttRecv.on('who_online_response', onResponse);
  });
};

GPhone.prototype.recv_whoOnline = function (data, pack) {
  this.sendToClient(pack.sourceClient, 'who_online_response', {});
};

GPhone.prototype.ev_icecandidate = function (conversation, event) {
  if (conversation !== this.conversation) return;

  if (conversation) {
    this.sendToPhone(conversation.other.clientId, 'icecandidate', {
      id: conversation.id,
      candidate: event.candidate
    });
  }
};

GPhone.prototype.recv_icecandidate = function (data) {
  var conversation = this.conversation;
  if (!conversation || conversation.id !== data.id) return;
  conversation.addIceCandidate(data.candidate);
};

GPhone.prototype.recv_answer = function (data, pkg) {
  var conversation = this.conversation;
  if (!conversation || conversation.id !== data.id) return;

  if (this.clientId === data.targetClient) {
    conversation.setRemoteDescription(data.answer);
  } else {
    //todo: cancel current conversation
    conversation.close();
    this.emit('cancel_income', {
      type: 'cancel_income',
      target: this
    });
    console.info("Pickup by other client, cancel!");
    this.state = "READY";
  }
};

GPhone.prototype.recv_hangup = function (data, pack) {
  var conversation = this.conversation;
  if (!conversation || conversation.id !== data.id) return;

  if (conversation.pc) {
    conversation.close();
    this.emit('hangup', {
      from: pack.sourcePhone,
      conversationId: data.id
    }, this);
  } else {
    this.emit('cancel_income', {
      type: 'cancel_income',
      target: this
    });
  }

  this.emit('hangup', {
    from: pack.sourcePhone,
    conversationId: data.id
  }, this);
  this.state = "READY";
};

GPhone.prototype.copyRTCIceCandidate = function (obj) {
  return ['address', 'candidate', "component", "foundation", "port", "priority", "protocol", "relatedAddress", "relatedPort", "sdpMLineIndex", "sdpMid", "tcpType", "usernameFragment"].reduce(function (ac, key) {
    ac[key] = obj[key];
    return ac;
  }, {});
};

/* harmony default export */ var app_GPhone = (GPhone);
// CONCATENATED MODULE: ./app/fragment/GadevoirApp.js








/***
 * @extends Fragment
 * @constructor
 */

function GadevoirApp(config) {
  AppPattern_Fragment.call(this);
  this.config = config;
  this.phone = new app_GPhone();
  this._fragHolders = [];
  this.setContext("PHONE", this.phone);
  this.setContext("APP", this);
  this.sync = Promise.resolve();
}

OOP["a" /* default */].mixClass(GadevoirApp, AppPattern_Fragment);

GadevoirApp.prototype.createView = function () {
  this.$view = Core_({
    class: 'gdv-app'
  });
};

GadevoirApp.prototype.onStart = function () {
  this.phone.sync.then(this.startFrag.bind(this, fragment_MainFrg, {}, false));
};
/***
 *
 * @param {Function} clazz
 * @param props
 * @param {boolean} [overlay = false]
 * @return {Promise<*>}
 */


GadevoirApp.prototype.startFrag = function (clazz, props, overlay) {
  var sameClazzHolder = this._fragHolders.find(function (holder) {
    return holder.frag.constructor === clazz;
  });

  if (sameClazzHolder) {
    sameClazzHolder.frag.stop();
  }

  var app = this;
  app.sync = app.sync.then(function () {
    app._pauseCurrentFragment();

    var holder = {};
    holder.frag = new clazz(props);
    holder.$ctn = Core_('.gdv-app-frag-ctn').addChild(holder.frag.getView());

    if (overlay) {
      holder.$ctn.addClass('gdv-overlay').addStyle('left', '-100%').addStyle('opacity', '0').addStyle('transition', 'left 0.5s, opacity 0.5s');
      setTimeout(function () {
        holder.$ctn.addStyle('left', '0').addStyle('opacity', '1');
        setTimeout(function () {
          holder.$ctn.removeStyle('transition');
        }, 500);
      }, 1);
    } else {
      app.$view.clearChild();
    }

    app.$view.addChild(holder.$ctn);
    var res = new Promise(function (resolve) {
      var onStop = holder.frag.onStop;

      holder.frag.onStop = function () {
        onStop && onStop.apply(this, arguments);
        app.sync = new Promise(function (resolve1) {
          setTimeout(function () {
            var cHolder;

            if (app._fragHolders.indexOf(holder) >= 0) {
              while (app._fragHolders.length > 0) {
                cHolder = app._fragHolders.pop();
                cHolder.frag.destroy();
                cHolder.$ctn.remove();
                if (cHolder === holder) break;
              }
            }

            resolve(holder.frag.returns);
            resolve1();

            app._resumeCurrentFragment();
          }, 1);
        });
      };
    });

    app._fragHolders.push(holder);

    holder.frag.attach(app);
    holder.frag.start();
    return {
      result: res
    };
  });
  return app.sync.then(function (ref) {
    return ref.result;
  });
};

GadevoirApp.prototype._pauseCurrentFragment = function () {
  var holder = this._fragHolders[this._fragHolders.length - 1];
  if (holder && holder.frag.state === "RUNNING") holder.frag.pause();
};

GadevoirApp.prototype._resumeCurrentFragment = function () {
  var holder = this._fragHolders[this._fragHolders.length - 1];

  if (holder) {
    if (!holder.frag.getView().isDescendantOf(this.$view)) {
      this.$view.addChild(holder.frag.getView());
    }

    holder.frag.resume();
  }
};

/* harmony default export */ var fragment_GadevoirApp = (GadevoirApp);
// EXTERNAL MODULE: ./config.js
var config_0 = __webpack_require__(93);
var config_default = /*#__PURE__*/__webpack_require__.n(config_0);

// CONCATENATED MODULE: ./app/index.js


var APP = new fragment_GadevoirApp(config_default.a);
APP.getView().addTo(document.body);
APP.start();

/***/ })
/******/ ]);

VaKeR 2022