diff --git a/.gitignore b/.gitignore index 410739f5..d2406cc4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ docs/dist +dist .DS_Store node_modules *.grunt diff --git a/.travis.yml b/.travis.yml index 3723f17a..4ed941c1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,4 +2,5 @@ language: node_js node_js: - "12" script: - - npm run ci + - npm run build + - npm run test diff --git a/dist/f2.js b/dist/f2.js deleted file mode 100644 index 4fd7fb9c..00000000 --- a/dist/f2.js +++ /dev/null @@ -1,6695 +0,0 @@ -/*! - * - * F2 v2.0.0-alpha 7/14/21 - * Copyright (c) 2014 Markit On Demand, Inc. http://www.openf2.org - * - * "F2" is licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at: - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed - * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR - * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific - * language governing permissions and limitations under the License. - * - * Please note that F2 ("Software") may contain third party material that Markit - * On Demand Inc. has a license to use and include within the Software (the - * "Third Party Material"). A list of the software comprising the Third Party Material - * and the terms and conditions under which such Third Party Material is distributed - * are reproduced in the ThirdPartyMaterial.md file available at: - * - * https://github.com/OpenF2/F2/blob/master/ThirdPartyMaterial.md - * - * The inclusion of the Third Party Material in the Software does not grant, provide - * nor result in you having acquiring any rights whatsoever, other than as stipulated - * in the terms and conditions related to the specific Third Party Material, if any. - */ -(function webpackUniversalModuleDefinition(root, factory) { - if(typeof exports === 'object' && typeof module === 'object') - module.exports = factory(); - else if(typeof define === 'function' && define.amd) - define([], factory); - else if(typeof exports === 'object') - exports["F2"] = factory(); - else - root["F2"] = factory(); -})(self, function() { -return /******/ (() => { // webpackBootstrap -/******/ var __webpack_modules__ = ({ - -/***/ 137: -/***/ ((module) => { - - -/** - * Expose `parse`. - */ - -module.exports = parse; - -/** - * Tests for browser support. - */ - -var innerHTMLBug = false; -var bugTestDiv; -if (typeof document !== 'undefined') { - bugTestDiv = document.createElement('div'); - // Setup - bugTestDiv.innerHTML = '
a'; - // Make sure that link elements get serialized correctly by innerHTML - // This requires a wrapper element in IE - innerHTMLBug = !bugTestDiv.getElementsByTagName('link').length; - bugTestDiv = undefined; -} - -/** - * Wrap map from jquery. - */ - -var map = { - legend: [1, '
', '
'], - tr: [2, '', '
'], - col: [2, '', '
'], - // for script/link/style tags to work in IE6-8, you have to wrap - // in a div with a non-whitespace character in front, ha! - _default: innerHTMLBug ? [1, 'X
', '
'] : [0, '', ''] -}; - -map.td = -map.th = [3, '', '
']; - -map.option = -map.optgroup = [1, '']; - -map.thead = -map.tbody = -map.colgroup = -map.caption = -map.tfoot = [1, '', '
']; - -map.polyline = -map.ellipse = -map.polygon = -map.circle = -map.text = -map.line = -map.path = -map.rect = -map.g = [1, '','']; - -/** - * Parse `html` and return a DOM Node instance, which could be a TextNode, - * HTML DOM Node of some kind (
for example), or a DocumentFragment - * instance, depending on the contents of the `html` string. - * - * @param {String} html - HTML string to "domify" - * @param {Document} doc - The `document` instance to create the Node for - * @return {DOMNode} the TextNode, DOM Node, or DocumentFragment instance - * @api private - */ - -function parse(html, doc) { - if ('string' != typeof html) throw new TypeError('String expected'); - - // default to the global `document` object - if (!doc) doc = document; - - // tag name - var m = /<([\w:]+)/.exec(html); - if (!m) return doc.createTextNode(html); - - html = html.replace(/^\s+|\s+$/g, ''); // Remove leading/trailing whitespace - - var tag = m[1]; - - // body support - if (tag == 'body') { - var el = doc.createElement('html'); - el.innerHTML = html; - return el.removeChild(el.lastChild); - } - - // wrap map - var wrap = Object.prototype.hasOwnProperty.call(map, tag) ? map[tag] : map._default; - var depth = wrap[0]; - var prefix = wrap[1]; - var suffix = wrap[2]; - var el = doc.createElement('div'); - el.innerHTML = prefix + html + suffix; - while (depth--) el = el.lastChild; - - // one element - if (el.firstChild == el.lastChild) { - return el.removeChild(el.firstChild); - } - - // several elements - var fragment = doc.createDocumentFragment(); - while (el.firstChild) { - fragment.appendChild(el.removeChild(el.firstChild)); - } - - return fragment; -} - - -/***/ }), - -/***/ 387: -/***/ ((module, exports, __webpack_require__) => { - -var __WEBPACK_AMD_DEFINE_RESULT__;/*! - * EventEmitter2 - * https://github.com/hij1nx/EventEmitter2 - * - * Copyright (c) 2013 hij1nx - * Licensed under the MIT license. - */ -;!function(undefined) { - var hasOwnProperty= Object.hasOwnProperty; - var isArray = Array.isArray ? Array.isArray : function _isArray(obj) { - return Object.prototype.toString.call(obj) === "[object Array]"; - }; - var defaultMaxListeners = 10; - var nextTickSupported= typeof process=='object' && typeof process.nextTick=='function'; - var symbolsSupported= typeof Symbol==='function'; - var reflectSupported= typeof Reflect === 'object'; - var setImmediateSupported= typeof setImmediate === 'function'; - var _setImmediate= setImmediateSupported ? setImmediate : setTimeout; - var ownKeys= symbolsSupported? (reflectSupported && typeof Reflect.ownKeys==='function'? Reflect.ownKeys : function(obj){ - var arr= Object.getOwnPropertyNames(obj); - arr.push.apply(arr, Object.getOwnPropertySymbols(obj)); - return arr; - }) : Object.keys; - - function init() { - this._events = {}; - if (this._conf) { - configure.call(this, this._conf); - } - } - - function configure(conf) { - if (conf) { - this._conf = conf; - - conf.delimiter && (this.delimiter = conf.delimiter); - - if(conf.maxListeners!==undefined){ - this._maxListeners= conf.maxListeners; - } - - conf.wildcard && (this.wildcard = conf.wildcard); - conf.newListener && (this._newListener = conf.newListener); - conf.removeListener && (this._removeListener = conf.removeListener); - conf.verboseMemoryLeak && (this.verboseMemoryLeak = conf.verboseMemoryLeak); - conf.ignoreErrors && (this.ignoreErrors = conf.ignoreErrors); - - if (this.wildcard) { - this.listenerTree = {}; - } - } - } - - function logPossibleMemoryLeak(count, eventName) { - var errorMsg = '(node) warning: possible EventEmitter memory ' + - 'leak detected. ' + count + ' listeners added. ' + - 'Use emitter.setMaxListeners() to increase limit.'; - - if(this.verboseMemoryLeak){ - errorMsg += ' Event name: ' + eventName + '.'; - } - - if(typeof process !== 'undefined' && process.emitWarning){ - var e = new Error(errorMsg); - e.name = 'MaxListenersExceededWarning'; - e.emitter = this; - e.count = count; - process.emitWarning(e); - } else { - console.error(errorMsg); - - if (console.trace){ - console.trace(); - } - } - } - - var toArray = function (a, b, c) { - var n = arguments.length; - switch (n) { - case 0: - return []; - case 1: - return [a]; - case 2: - return [a, b]; - case 3: - return [a, b, c]; - default: - var arr = new Array(n); - while (n--) { - arr[n] = arguments[n]; - } - return arr; - } - }; - - function toObject(keys, values) { - var obj = {}; - var key; - var len = keys.length; - var valuesCount = values ? value.length : 0; - for (var i = 0; i < len; i++) { - key = keys[i]; - obj[key] = i < valuesCount ? values[i] : undefined; - } - return obj; - } - - function TargetObserver(emitter, target, options) { - this._emitter = emitter; - this._target = target; - this._listeners = {}; - this._listenersCount = 0; - - var on, off; - - if (options.on || options.off) { - on = options.on; - off = options.off; - } - - if (target.addEventListener) { - on = target.addEventListener; - off = target.removeEventListener; - } else if (target.addListener) { - on = target.addListener; - off = target.removeListener; - } else if (target.on) { - on = target.on; - off = target.off; - } - - if (!on && !off) { - throw Error('target does not implement any known event API'); - } - - if (typeof on !== 'function') { - throw TypeError('on method must be a function'); - } - - if (typeof off !== 'function') { - throw TypeError('off method must be a function'); - } - - this._on = on; - this._off = off; - - var _observers= emitter._observers; - if(_observers){ - _observers.push(this); - }else{ - emitter._observers= [this]; - } - } - - Object.assign(TargetObserver.prototype, { - subscribe: function(event, localEvent, reducer){ - var observer= this; - var target= this._target; - var emitter= this._emitter; - var listeners= this._listeners; - var handler= function(){ - var args= toArray.apply(null, arguments); - var eventObj= { - data: args, - name: localEvent, - original: event - }; - if(reducer){ - var result= reducer.call(target, eventObj); - if(result!==false){ - emitter.emit.apply(emitter, [eventObj.name].concat(args)) - } - return; - } - emitter.emit.apply(emitter, [localEvent].concat(args)); - }; - - - if(listeners[event]){ - throw Error('Event \'' + event + '\' is already listening'); - } - - this._listenersCount++; - - if(emitter._newListener && emitter._removeListener && !observer._onNewListener){ - - this._onNewListener = function (_event) { - if (_event === localEvent && listeners[event] === null) { - listeners[event] = handler; - observer._on.call(target, event, handler); - } - }; - - emitter.on('newListener', this._onNewListener); - - this._onRemoveListener= function(_event){ - if(_event === localEvent && !emitter.hasListeners(_event) && listeners[event]){ - listeners[event]= null; - observer._off.call(target, event, handler); - } - }; - - listeners[event]= null; - - emitter.on('removeListener', this._onRemoveListener); - }else{ - listeners[event]= handler; - observer._on.call(target, event, handler); - } - }, - - unsubscribe: function(event){ - var observer= this; - var listeners= this._listeners; - var emitter= this._emitter; - var handler; - var events; - var off= this._off; - var target= this._target; - var i; - - if(event && typeof event!=='string'){ - throw TypeError('event must be a string'); - } - - function clearRefs(){ - if(observer._onNewListener){ - emitter.off('newListener', observer._onNewListener); - emitter.off('removeListener', observer._onRemoveListener); - observer._onNewListener= null; - observer._onRemoveListener= null; - } - var index= findTargetIndex.call(emitter, observer); - emitter._observers.splice(index, 1); - } - - if(event){ - handler= listeners[event]; - if(!handler) return; - off.call(target, event, handler); - delete listeners[event]; - if(!--this._listenersCount){ - clearRefs(); - } - }else{ - events= ownKeys(listeners); - i= events.length; - while(i-->0){ - event= events[i]; - off.call(target, event, listeners[event]); - } - this._listeners= {}; - this._listenersCount= 0; - clearRefs(); - } - } - }); - - function resolveOptions(options, schema, reducers, allowUnknown) { - var computedOptions = Object.assign({}, schema); - - if (!options) return computedOptions; - - if (typeof options !== 'object') { - throw TypeError('options must be an object') - } - - var keys = Object.keys(options); - var length = keys.length; - var option, value; - var reducer; - - function reject(reason) { - throw Error('Invalid "' + option + '" option value' + (reason ? '. Reason: ' + reason : '')) - } - - for (var i = 0; i < length; i++) { - option = keys[i]; - if (!allowUnknown && !hasOwnProperty.call(schema, option)) { - throw Error('Unknown "' + option + '" option'); - } - value = options[option]; - if (value !== undefined) { - reducer = reducers[option]; - computedOptions[option] = reducer ? reducer(value, reject) : value; - } - } - return computedOptions; - } - - function constructorReducer(value, reject) { - if (typeof value !== 'function' || !value.hasOwnProperty('prototype')) { - reject('value must be a constructor'); - } - return value; - } - - function makeTypeReducer(types) { - var message= 'value must be type of ' + types.join('|'); - var len= types.length; - var firstType= types[0]; - var secondType= types[1]; - - if (len === 1) { - return function (v, reject) { - if (typeof v === firstType) { - return v; - } - reject(message); - } - } - - if (len === 2) { - return function (v, reject) { - var kind= typeof v; - if (kind === firstType || kind === secondType) return v; - reject(message); - } - } - - return function (v, reject) { - var kind = typeof v; - var i = len; - while (i-- > 0) { - if (kind === types[i]) return v; - } - reject(message); - } - } - - var functionReducer= makeTypeReducer(['function']); - - var objectFunctionReducer= makeTypeReducer(['object', 'function']); - - function makeCancelablePromise(Promise, executor, options) { - var isCancelable; - var callbacks; - var timer= 0; - var subscriptionClosed; - - var promise = new Promise(function (resolve, reject, onCancel) { - options= resolveOptions(options, { - timeout: 0, - overload: false - }, { - timeout: function(value, reject){ - value*= 1; - if (typeof value !== 'number' || value < 0 || !Number.isFinite(value)) { - reject('timeout must be a positive number'); - } - return value; - } - }); - - isCancelable = !options.overload && typeof Promise.prototype.cancel === 'function' && typeof onCancel === 'function'; - - function cleanup() { - if (callbacks) { - callbacks = null; - } - if (timer) { - clearTimeout(timer); - timer = 0; - } - } - - var _resolve= function(value){ - cleanup(); - resolve(value); - }; - - var _reject= function(err){ - cleanup(); - reject(err); - }; - - if (isCancelable) { - executor(_resolve, _reject, onCancel); - } else { - callbacks = [function(reason){ - _reject(reason || Error('canceled')); - }]; - executor(_resolve, _reject, function (cb) { - if (subscriptionClosed) { - throw Error('Unable to subscribe on cancel event asynchronously') - } - if (typeof cb !== 'function') { - throw TypeError('onCancel callback must be a function'); - } - callbacks.push(cb); - }); - subscriptionClosed= true; - } - - if (options.timeout > 0) { - timer= setTimeout(function(){ - var reason= Error('timeout'); - reason.code = 'ETIMEDOUT' - timer= 0; - promise.cancel(reason); - reject(reason); - }, options.timeout); - } - }); - - if (!isCancelable) { - promise.cancel = function (reason) { - if (!callbacks) { - return; - } - var length = callbacks.length; - for (var i = 1; i < length; i++) { - callbacks[i](reason); - } - // internal callback to reject the promise - callbacks[0](reason); - callbacks = null; - }; - } - - return promise; - } - - function findTargetIndex(observer) { - var observers = this._observers; - if(!observers){ - return -1; - } - var len = observers.length; - for (var i = 0; i < len; i++) { - if (observers[i]._target === observer) return i; - } - return -1; - } - - // Attention, function return type now is array, always ! - // It has zero elements if no any matches found and one or more - // elements (leafs) if there are matches - // - function searchListenerTree(handlers, type, tree, i, typeLength) { - if (!tree) { - return null; - } - - if (i === 0) { - var kind = typeof type; - if (kind === 'string') { - var ns, n, l = 0, j = 0, delimiter = this.delimiter, dl = delimiter.length; - if ((n = type.indexOf(delimiter)) !== -1) { - ns = new Array(5); - do { - ns[l++] = type.slice(j, n); - j = n + dl; - } while ((n = type.indexOf(delimiter, j)) !== -1); - - ns[l++] = type.slice(j); - type = ns; - typeLength = l; - } else { - type = [type]; - typeLength = 1; - } - } else if (kind === 'object') { - typeLength = type.length; - } else { - type = [type]; - typeLength = 1; - } - } - - var listeners= null, branch, xTree, xxTree, isolatedBranch, endReached, currentType = type[i], - nextType = type[i + 1], branches, _listeners; - - if (i === typeLength && tree._listeners) { - // - // If at the end of the event(s) list and the tree has listeners - // invoke those listeners. - // - if (typeof tree._listeners === 'function') { - handlers && handlers.push(tree._listeners); - return [tree]; - } else { - handlers && handlers.push.apply(handlers, tree._listeners); - return [tree]; - } - } - - if (currentType === '*') { - // - // If the event emitted is '*' at this part - // or there is a concrete match at this patch - // - branches= ownKeys(tree); - n= branches.length; - while(n-->0){ - branch= branches[n]; - if (branch !== '_listeners') { - _listeners = searchListenerTree(handlers, type, tree[branch], i + 1, typeLength); - if(_listeners){ - if(listeners){ - listeners.push.apply(listeners, _listeners); - }else{ - listeners = _listeners; - } - } - } - } - return listeners; - } else if (currentType === '**') { - endReached = (i + 1 === typeLength || (i + 2 === typeLength && nextType === '*')); - if (endReached && tree._listeners) { - // The next element has a _listeners, add it to the handlers. - listeners = searchListenerTree(handlers, type, tree, typeLength, typeLength); - } - - branches= ownKeys(tree); - n= branches.length; - while(n-->0){ - branch= branches[n]; - if (branch !== '_listeners') { - if (branch === '*' || branch === '**') { - if (tree[branch]._listeners && !endReached) { - _listeners = searchListenerTree(handlers, type, tree[branch], typeLength, typeLength); - if(_listeners){ - if(listeners){ - listeners.push.apply(listeners, _listeners); - }else{ - listeners = _listeners; - } - } - } - _listeners = searchListenerTree(handlers, type, tree[branch], i, typeLength); - } else if (branch === nextType) { - _listeners = searchListenerTree(handlers, type, tree[branch], i + 2, typeLength); - } else { - // No match on this one, shift into the tree but not in the type array. - _listeners = searchListenerTree(handlers, type, tree[branch], i, typeLength); - } - if(_listeners){ - if(listeners){ - listeners.push.apply(listeners, _listeners); - }else{ - listeners = _listeners; - } - } - } - } - return listeners; - }else if (tree[currentType]) { - listeners= searchListenerTree(handlers, type, tree[currentType], i + 1, typeLength); - } - - xTree = tree['*']; - if (xTree) { - // - // If the listener tree will allow any match for this part, - // then recursively explore all branches of the tree - // - searchListenerTree(handlers, type, xTree, i + 1, typeLength); - } - - xxTree = tree['**']; - if (xxTree) { - if (i < typeLength) { - if (xxTree._listeners) { - // If we have a listener on a '**', it will catch all, so add its handler. - searchListenerTree(handlers, type, xxTree, typeLength, typeLength); - } - - // Build arrays of matching next branches and others. - branches= ownKeys(xxTree); - n= branches.length; - while(n-->0){ - branch= branches[n]; - if (branch !== '_listeners') { - if (branch === nextType) { - // We know the next element will match, so jump twice. - searchListenerTree(handlers, type, xxTree[branch], i + 2, typeLength); - } else if (branch === currentType) { - // Current node matches, move into the tree. - searchListenerTree(handlers, type, xxTree[branch], i + 1, typeLength); - } else { - isolatedBranch = {}; - isolatedBranch[branch] = xxTree[branch]; - searchListenerTree(handlers, type, {'**': isolatedBranch}, i + 1, typeLength); - } - } - } - } else if (xxTree._listeners) { - // We have reached the end and still on a '**' - searchListenerTree(handlers, type, xxTree, typeLength, typeLength); - } else if (xxTree['*'] && xxTree['*']._listeners) { - searchListenerTree(handlers, type, xxTree['*'], typeLength, typeLength); - } - } - - return listeners; - } - - function growListenerTree(type, listener, prepend) { - var len = 0, j = 0, i, delimiter = this.delimiter, dl= delimiter.length, ns; - - if(typeof type==='string') { - if ((i = type.indexOf(delimiter)) !== -1) { - ns = new Array(5); - do { - ns[len++] = type.slice(j, i); - j = i + dl; - } while ((i = type.indexOf(delimiter, j)) !== -1); - - ns[len++] = type.slice(j); - }else{ - ns= [type]; - len= 1; - } - }else{ - ns= type; - len= type.length; - } - - // - // Looks for two consecutive '**', if so, don't add the event at all. - // - if (len > 1) { - for (i = 0; i + 1 < len; i++) { - if (ns[i] === '**' && ns[i + 1] === '**') { - return; - } - } - } - - - - var tree = this.listenerTree, name; - - for (i = 0; i < len; i++) { - name = ns[i]; - - tree = tree[name] || (tree[name] = {}); - - if (i === len - 1) { - if (!tree._listeners) { - tree._listeners = listener; - } else { - if (typeof tree._listeners === 'function') { - tree._listeners = [tree._listeners]; - } - - if (prepend) { - tree._listeners.unshift(listener); - } else { - tree._listeners.push(listener); - } - - if ( - !tree._listeners.warned && - this._maxListeners > 0 && - tree._listeners.length > this._maxListeners - ) { - tree._listeners.warned = true; - logPossibleMemoryLeak.call(this, tree._listeners.length, name); - } - } - return true; - } - } - - return true; - } - - function collectTreeEvents(tree, events, root, asArray){ - var branches= ownKeys(tree); - var i= branches.length; - var branch, branchName, path; - var hasListeners= tree['_listeners']; - var isArrayPath; - - while(i-->0){ - branchName= branches[i]; - - branch= tree[branchName]; - - if(branchName==='_listeners'){ - path= root; - }else { - path = root ? root.concat(branchName) : [branchName]; - } - - isArrayPath= asArray || typeof branchName==='symbol'; - - hasListeners && events.push(isArrayPath? path : path.join(this.delimiter)); - - if(typeof branch==='object'){ - collectTreeEvents.call(this, branch, events, path, isArrayPath); - } - } - - return events; - } - - function recursivelyGarbageCollect(root) { - var keys = ownKeys(root); - var i= keys.length; - var obj, key, flag; - while(i-->0){ - key = keys[i]; - obj = root[key]; - - if(obj){ - flag= true; - if(key !== '_listeners' && !recursivelyGarbageCollect(obj)){ - delete root[key]; - } - } - } - - return flag; - } - - function Listener(emitter, event, listener){ - this.emitter= emitter; - this.event= event; - this.listener= listener; - } - - Listener.prototype.off= function(){ - this.emitter.off(this.event, this.listener); - return this; - }; - - function setupListener(event, listener, options){ - if (options === true) { - promisify = true; - } else if (options === false) { - async = true; - } else { - if (!options || typeof options !== 'object') { - throw TypeError('options should be an object or true'); - } - var async = options.async; - var promisify = options.promisify; - var nextTick = options.nextTick; - var objectify = options.objectify; - } - - if (async || nextTick || promisify) { - var _listener = listener; - var _origin = listener._origin || listener; - - if (nextTick && !nextTickSupported) { - throw Error('process.nextTick is not supported'); - } - - if (promisify === undefined) { - promisify = listener.constructor.name === 'AsyncFunction'; - } - - listener = function () { - var args = arguments; - var context = this; - var event = this.event; - - return promisify ? (nextTick ? Promise.resolve() : new Promise(function (resolve) { - _setImmediate(resolve); - }).then(function () { - context.event = event; - return _listener.apply(context, args) - })) : (nextTick ? process.nextTick : _setImmediate)(function () { - context.event = event; - _listener.apply(context, args) - }); - }; - - listener._async = true; - listener._origin = _origin; - } - - return [listener, objectify? new Listener(this, event, listener): this]; - } - - function EventEmitter(conf) { - this._events = {}; - this._newListener = false; - this._removeListener = false; - this.verboseMemoryLeak = false; - configure.call(this, conf); - } - - EventEmitter.EventEmitter2 = EventEmitter; // backwards compatibility for exporting EventEmitter property - - EventEmitter.prototype.listenTo= function(target, events, options){ - if(typeof target!=='object'){ - throw TypeError('target musts be an object'); - } - - var emitter= this; - - options = resolveOptions(options, { - on: undefined, - off: undefined, - reducers: undefined - }, { - on: functionReducer, - off: functionReducer, - reducers: objectFunctionReducer - }); - - function listen(events){ - if(typeof events!=='object'){ - throw TypeError('events must be an object'); - } - - var reducers= options.reducers; - var index= findTargetIndex.call(emitter, target); - var observer; - - if(index===-1){ - observer= new TargetObserver(emitter, target, options); - }else{ - observer= emitter._observers[index]; - } - - var keys= ownKeys(events); - var len= keys.length; - var event; - var isSingleReducer= typeof reducers==='function'; - - for(var i=0; i 0) { - observer = observers[i]; - if (!target || observer._target === target) { - observer.unsubscribe(event); - matched= true; - } - } - - return matched; - }; - - // 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. - // - // Obviously not all Emitters should be limited to 10. This function allows - // that to be increased. Set to zero for unlimited. - - EventEmitter.prototype.delimiter = '.'; - - EventEmitter.prototype.setMaxListeners = function(n) { - if (n !== undefined) { - this._maxListeners = n; - if (!this._conf) this._conf = {}; - this._conf.maxListeners = n; - } - }; - - EventEmitter.prototype.getMaxListeners = function() { - return this._maxListeners; - }; - - EventEmitter.prototype.event = ''; - - EventEmitter.prototype.once = function(event, fn, options) { - return this._once(event, fn, false, options); - }; - - EventEmitter.prototype.prependOnceListener = function(event, fn, options) { - return this._once(event, fn, true, options); - }; - - EventEmitter.prototype._once = function(event, fn, prepend, options) { - return this._many(event, 1, fn, prepend, options); - }; - - EventEmitter.prototype.many = function(event, ttl, fn, options) { - return this._many(event, ttl, fn, false, options); - }; - - EventEmitter.prototype.prependMany = function(event, ttl, fn, options) { - return this._many(event, ttl, fn, true, options); - }; - - EventEmitter.prototype._many = function(event, ttl, fn, prepend, options) { - var self = this; - - if (typeof fn !== 'function') { - throw new Error('many only accepts instances of Function'); - } - - function listener() { - if (--ttl === 0) { - self.off(event, listener); - } - return fn.apply(this, arguments); - } - - listener._origin = fn; - - return this._on(event, listener, prepend, options); - }; - - EventEmitter.prototype.emit = function() { - if (!this._events && !this._all) { - return false; - } - - this._events || init.call(this); - - var type = arguments[0], ns, wildcard= this.wildcard; - var args,l,i,j, containsSymbol; - - if (type === 'newListener' && !this._newListener) { - if (!this._events.newListener) { - return false; - } - } - - if (wildcard) { - ns= type; - if(type!=='newListener' && type!=='removeListener'){ - if (typeof type === 'object') { - l = type.length; - if (symbolsSupported) { - for (i = 0; i < l; i++) { - if (typeof type[i] === 'symbol') { - containsSymbol = true; - break; - } - } - } - if (!containsSymbol) { - type = type.join(this.delimiter); - } - } - } - } - - var al = arguments.length; - var handler; - - if (this._all && this._all.length) { - handler = this._all.slice(); - - for (i = 0, l = handler.length; i < l; i++) { - this.event = type; - switch (al) { - case 1: - handler[i].call(this, type); - break; - case 2: - handler[i].call(this, type, arguments[1]); - break; - case 3: - handler[i].call(this, type, arguments[1], arguments[2]); - break; - default: - handler[i].apply(this, arguments); - } - } - } - - if (wildcard) { - handler = []; - searchListenerTree.call(this, handler, ns, this.listenerTree, 0, l); - } else { - handler = this._events[type]; - if (typeof handler === 'function') { - this.event = type; - switch (al) { - case 1: - handler.call(this); - break; - case 2: - handler.call(this, arguments[1]); - break; - case 3: - handler.call(this, arguments[1], arguments[2]); - break; - default: - args = new Array(al - 1); - for (j = 1; j < al; j++) args[j - 1] = arguments[j]; - handler.apply(this, args); - } - return true; - } else if (handler) { - // need to make copy of handlers because list can change in the middle - // of emit call - handler = handler.slice(); - } - } - - if (handler && handler.length) { - if (al > 3) { - args = new Array(al - 1); - for (j = 1; j < al; j++) args[j - 1] = arguments[j]; - } - for (i = 0, l = handler.length; i < l; i++) { - this.event = type; - switch (al) { - case 1: - handler[i].call(this); - break; - case 2: - handler[i].call(this, arguments[1]); - break; - case 3: - handler[i].call(this, arguments[1], arguments[2]); - break; - default: - handler[i].apply(this, args); - } - } - return true; - } else if (!this.ignoreErrors && !this._all && type === 'error') { - if (arguments[1] instanceof Error) { - throw arguments[1]; // Unhandled 'error' event - } else { - throw new Error("Uncaught, unspecified 'error' event."); - } - } - - return !!this._all; - }; - - EventEmitter.prototype.emitAsync = function() { - if (!this._events && !this._all) { - return false; - } - - this._events || init.call(this); - - var type = arguments[0], wildcard= this.wildcard, ns, containsSymbol; - var args,l,i,j; - - if (type === 'newListener' && !this._newListener) { - if (!this._events.newListener) { return Promise.resolve([false]); } - } - - if (wildcard) { - ns= type; - if(type!=='newListener' && type!=='removeListener'){ - if (typeof type === 'object') { - l = type.length; - if (symbolsSupported) { - for (i = 0; i < l; i++) { - if (typeof type[i] === 'symbol') { - containsSymbol = true; - break; - } - } - } - if (!containsSymbol) { - type = type.join(this.delimiter); - } - } - } - } - - var promises= []; - - var al = arguments.length; - var handler; - - if (this._all) { - for (i = 0, l = this._all.length; i < l; i++) { - this.event = type; - switch (al) { - case 1: - promises.push(this._all[i].call(this, type)); - break; - case 2: - promises.push(this._all[i].call(this, type, arguments[1])); - break; - case 3: - promises.push(this._all[i].call(this, type, arguments[1], arguments[2])); - break; - default: - promises.push(this._all[i].apply(this, arguments)); - } - } - } - - if (wildcard) { - handler = []; - searchListenerTree.call(this, handler, ns, this.listenerTree, 0); - } else { - handler = this._events[type]; - } - - if (typeof handler === 'function') { - this.event = type; - switch (al) { - case 1: - promises.push(handler.call(this)); - break; - case 2: - promises.push(handler.call(this, arguments[1])); - break; - case 3: - promises.push(handler.call(this, arguments[1], arguments[2])); - break; - default: - args = new Array(al - 1); - for (j = 1; j < al; j++) args[j - 1] = arguments[j]; - promises.push(handler.apply(this, args)); - } - } else if (handler && handler.length) { - handler = handler.slice(); - if (al > 3) { - args = new Array(al - 1); - for (j = 1; j < al; j++) args[j - 1] = arguments[j]; - } - for (i = 0, l = handler.length; i < l; i++) { - this.event = type; - switch (al) { - case 1: - promises.push(handler[i].call(this)); - break; - case 2: - promises.push(handler[i].call(this, arguments[1])); - break; - case 3: - promises.push(handler[i].call(this, arguments[1], arguments[2])); - break; - default: - promises.push(handler[i].apply(this, args)); - } - } - } else if (!this.ignoreErrors && !this._all && type === 'error') { - if (arguments[1] instanceof Error) { - return Promise.reject(arguments[1]); // Unhandled 'error' event - } else { - return Promise.reject("Uncaught, unspecified 'error' event."); - } - } - - return Promise.all(promises); - }; - - EventEmitter.prototype.on = function(type, listener, options) { - return this._on(type, listener, false, options); - }; - - EventEmitter.prototype.prependListener = function(type, listener, options) { - return this._on(type, listener, true, options); - }; - - EventEmitter.prototype.onAny = function(fn) { - return this._onAny(fn, false); - }; - - EventEmitter.prototype.prependAny = function(fn) { - return this._onAny(fn, true); - }; - - EventEmitter.prototype.addListener = EventEmitter.prototype.on; - - EventEmitter.prototype._onAny = function(fn, prepend){ - if (typeof fn !== 'function') { - throw new Error('onAny only accepts instances of Function'); - } - - if (!this._all) { - this._all = []; - } - - // Add the function to the event listener collection. - if(prepend){ - this._all.unshift(fn); - }else{ - this._all.push(fn); - } - - return this; - }; - - EventEmitter.prototype._on = function(type, listener, prepend, options) { - if (typeof type === 'function') { - this._onAny(type, listener); - return this; - } - - if (typeof listener !== 'function') { - throw new Error('on only accepts instances of Function'); - } - this._events || init.call(this); - - var returnValue= this, temp; - - if (options !== undefined) { - temp = setupListener.call(this, type, listener, options); - listener = temp[0]; - returnValue = temp[1]; - } - - // To avoid recursion in the case that type == "newListeners"! Before - // adding it to the listeners, first emit "newListeners". - if (this._newListener) { - this.emit('newListener', type, listener); - } - - if (this.wildcard) { - growListenerTree.call(this, type, listener, prepend); - return returnValue; - } - - if (!this._events[type]) { - // Optimize the case of one listener. Don't need the extra array object. - this._events[type] = listener; - } else { - if (typeof this._events[type] === 'function') { - // Change to array. - this._events[type] = [this._events[type]]; - } - - // If we've already got an array, just add - if(prepend){ - this._events[type].unshift(listener); - }else{ - this._events[type].push(listener); - } - - // Check for listener leak - if ( - !this._events[type].warned && - this._maxListeners > 0 && - this._events[type].length > this._maxListeners - ) { - this._events[type].warned = true; - logPossibleMemoryLeak.call(this, this._events[type].length, type); - } - } - - return returnValue; - }; - - EventEmitter.prototype.off = function(type, listener) { - if (typeof listener !== 'function') { - throw new Error('removeListener only takes instances of Function'); - } - - var handlers,leafs=[]; - - if(this.wildcard) { - var ns = typeof type === 'string' ? type.split(this.delimiter) : type.slice(); - leafs = searchListenerTree.call(this, null, ns, this.listenerTree, 0); - if(!leafs) return this; - } else { - // does not use listeners(), so no side effect of creating _events[type] - if (!this._events[type]) return this; - handlers = this._events[type]; - leafs.push({_listeners:handlers}); - } - - for (var iLeaf=0; iLeaf 0) { - fns = this._all; - for(i = 0, l = fns.length; i < l; i++) { - if(fn === fns[i]) { - fns.splice(i, 1); - if (this._removeListener) - this.emit("removeListenerAny", fn); - return this; - } - } - } else { - fns = this._all; - if (this._removeListener) { - for(i = 0, l = fns.length; i < l; i++) - this.emit("removeListenerAny", fns[i]); - } - this._all = []; - } - return this; - }; - - EventEmitter.prototype.removeListener = EventEmitter.prototype.off; - - EventEmitter.prototype.removeAllListeners = function (type) { - if (type === undefined) { - !this._events || init.call(this); - return this; - } - - if (this.wildcard) { - var leafs = searchListenerTree.call(this, null, type, this.listenerTree, 0), leaf, i; - if (!leafs) return this; - for (i = 0; i < leafs.length; i++) { - leaf = leafs[i]; - leaf._listeners = null; - } - this.listenerTree && recursivelyGarbageCollect(this.listenerTree); - } else if (this._events) { - this._events[type] = null; - } - return this; - }; - - EventEmitter.prototype.listeners = function (type) { - var _events = this._events; - var keys, listeners, allListeners; - var i; - var listenerTree; - - if (type === undefined) { - if (this.wildcard) { - throw Error('event name required for wildcard emitter'); - } - - if (!_events) { - return []; - } - - keys = ownKeys(_events); - i = keys.length; - allListeners = []; - while (i-- > 0) { - listeners = _events[keys[i]]; - if (typeof listeners === 'function') { - allListeners.push(listeners); - } else { - allListeners.push.apply(allListeners, listeners); - } - } - return allListeners; - } else { - if (this.wildcard) { - listenerTree= this.listenerTree; - if(!listenerTree) return []; - var handlers = []; - var ns = typeof type === 'string' ? type.split(this.delimiter) : type.slice(); - searchListenerTree.call(this, handlers, ns, listenerTree, 0); - return handlers; - } - - if (!_events) { - return []; - } - - listeners = _events[type]; - - if (!listeners) { - return []; - } - return typeof listeners === 'function' ? [listeners] : listeners; - } - }; - - EventEmitter.prototype.eventNames = function(nsAsArray){ - var _events= this._events; - return this.wildcard? collectTreeEvents.call(this, this.listenerTree, [], null, nsAsArray) : (_events? ownKeys(_events) : []); - }; - - EventEmitter.prototype.listenerCount = function(type) { - return this.listeners(type).length; - }; - - EventEmitter.prototype.hasListeners = function (type) { - if (this.wildcard) { - var handlers = []; - var ns = typeof type === 'string' ? type.split(this.delimiter) : type.slice(); - searchListenerTree.call(this, handlers, ns, this.listenerTree, 0); - return handlers.length > 0; - } - - var _events = this._events; - var _all = this._all; - - return !!(_all && _all.length || _events && (type === undefined ? ownKeys(_events).length : _events[type])); - }; - - EventEmitter.prototype.listenersAny = function() { - - if(this._all) { - return this._all; - } - else { - return []; - } - - }; - - EventEmitter.prototype.waitFor = function (event, options) { - var self = this; - var type = typeof options; - if (type === 'number') { - options = {timeout: options}; - } else if (type === 'function') { - options = {filter: options}; - } - - options= resolveOptions(options, { - timeout: 0, - filter: undefined, - handleError: false, - Promise: Promise, - overload: false - }, { - filter: functionReducer, - Promise: constructorReducer - }); - - return makeCancelablePromise(options.Promise, function (resolve, reject, onCancel) { - function listener() { - var filter= options.filter; - if (filter && !filter.apply(self, arguments)) { - return; - } - self.off(event, listener); - if (options.handleError) { - var err = arguments[0]; - err ? reject(err) : resolve(toArray.apply(null, arguments).slice(1)); - } else { - resolve(toArray.apply(null, arguments)); - } - } - - onCancel(function(){ - self.off(event, listener); - }); - - self._on(event, listener, false); - }, { - timeout: options.timeout, - overload: options.overload - }) - }; - - function once(emitter, name, options) { - options= resolveOptions(options, { - Promise: Promise, - timeout: 0, - overload: false - }, { - Promise: constructorReducer - }); - - var _Promise= options.Promise; - - return makeCancelablePromise(_Promise, function(resolve, reject, onCancel){ - var handler; - if (typeof emitter.addEventListener === 'function') { - handler= function () { - resolve(toArray.apply(null, arguments)); - }; - - onCancel(function(){ - emitter.removeEventListener(name, handler); - }); - - emitter.addEventListener( - name, - handler, - {once: true} - ); - return; - } - - var eventListener = function(){ - errorListener && emitter.removeListener('error', errorListener); - resolve(toArray.apply(null, arguments)); - }; - - var errorListener; - - if (name !== 'error') { - errorListener = function (err){ - emitter.removeListener(name, eventListener); - reject(err); - }; - - emitter.once('error', errorListener); - } - - onCancel(function(){ - errorListener && emitter.removeListener('error', errorListener); - emitter.removeListener(name, eventListener); - }); - - emitter.once(name, eventListener); - }, { - timeout: options.timeout, - overload: options.overload - }); - } - - var prototype= EventEmitter.prototype; - - Object.defineProperties(EventEmitter, { - defaultMaxListeners: { - get: function () { - return prototype._maxListeners; - }, - set: function (n) { - if (typeof n !== 'number' || n < 0 || Number.isNaN(n)) { - throw TypeError('n must be a non-negative number') - } - prototype._maxListeners = n; - }, - enumerable: true - }, - once: { - value: once, - writable: true, - configurable: true - } - }); - - Object.defineProperties(prototype, { - _maxListeners: { - value: defaultMaxListeners, - writable: true, - configurable: true - }, - _observers: {value: null, writable: true, configurable: true} - }); - - if (true) { - // AMD. Register as an anonymous module. - !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() { - return EventEmitter; - }).call(exports, __webpack_require__, exports, module), - __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); - } else { var _global; } -}(); - - -/***/ }), - -/***/ 144: -/***/ (function(module, exports) { - -var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) { - if (true) { - !(__WEBPACK_AMD_DEFINE_ARRAY__ = [exports, module], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), - __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? - (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), - __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); - } else { var mod; } -})(this, function (exports, module) { - 'use strict'; - - var defaultOptions = { - timeout: 5000, - jsonpCallback: 'callback', - jsonpCallbackFunction: null - }; - - function generateCallbackFunction() { - return 'jsonp_' + Date.now() + '_' + Math.ceil(Math.random() * 100000); - } - - function clearFunction(functionName) { - // IE8 throws an exception when you try to delete a property on window - // http://stackoverflow.com/a/1824228/751089 - try { - delete window[functionName]; - } catch (e) { - window[functionName] = undefined; - } - } - - function removeScript(scriptId) { - var script = document.getElementById(scriptId); - if (script) { - document.getElementsByTagName('head')[0].removeChild(script); - } - } - - function fetchJsonp(_url) { - var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; - - // to avoid param reassign - var url = _url; - var timeout = options.timeout || defaultOptions.timeout; - var jsonpCallback = options.jsonpCallback || defaultOptions.jsonpCallback; - - var timeoutId = undefined; - - return new Promise(function (resolve, reject) { - var callbackFunction = options.jsonpCallbackFunction || generateCallbackFunction(); - var scriptId = jsonpCallback + '_' + callbackFunction; - - window[callbackFunction] = function (response) { - resolve({ - ok: true, - // keep consistent with fetch API - json: function json() { - return Promise.resolve(response); - } - }); - - if (timeoutId) clearTimeout(timeoutId); - - removeScript(scriptId); - - clearFunction(callbackFunction); - }; - - // Check if the user set their own params, and if not add a ? to start a list of params - url += url.indexOf('?') === -1 ? '?' : '&'; - - var jsonpScript = document.createElement('script'); - jsonpScript.setAttribute('src', '' + url + jsonpCallback + '=' + callbackFunction); - if (options.charset) { - jsonpScript.setAttribute('charset', options.charset); - } - jsonpScript.id = scriptId; - document.getElementsByTagName('head')[0].appendChild(jsonpScript); - - timeoutId = setTimeout(function () { - reject(new Error('JSONP request to ' + _url + ' timed out')); - - clearFunction(callbackFunction); - removeScript(scriptId); - window[callbackFunction] = function () { - clearFunction(callbackFunction); - }; - }, timeout); - - // Caught if got 404/500 - jsonpScript.onerror = function () { - reject(new Error('JSONP request to ' + _url + ' failed')); - - clearFunction(callbackFunction); - removeScript(scriptId); - if (timeoutId) clearTimeout(timeoutId); - }; - }); - } - - // export as global function - /* - let local; - if (typeof global !== 'undefined') { - local = global; - } else if (typeof self !== 'undefined') { - local = self; - } else { - try { - local = Function('return this')(); - } catch (e) { - throw new Error('polyfill failed because global object is unavailable in this environment'); - } - } - local.fetchJsonp = fetchJsonp; - */ - - module.exports = fetchJsonp; -}); - -/***/ }), - -/***/ 525: -/***/ ((module, exports, __webpack_require__) => { - -/* module decorator */ module = __webpack_require__.nmd(module); -/** - * lodash (Custom Build) - * Build: `lodash modularize exports="npm" -o ./` - * Copyright jQuery Foundation and other contributors - * Released under MIT license - * Based on Underscore.js 1.8.3 - * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - */ - -/** Used as the size to enable large array optimizations. */ -var LARGE_ARRAY_SIZE = 200; - -/** Used to stand-in for `undefined` hash values. */ -var HASH_UNDEFINED = '__lodash_hash_undefined__'; - -/** Used as references for various `Number` constants. */ -var MAX_SAFE_INTEGER = 9007199254740991; - -/** `Object#toString` result references. */ -var argsTag = '[object Arguments]', - arrayTag = '[object Array]', - boolTag = '[object Boolean]', - dateTag = '[object Date]', - errorTag = '[object Error]', - funcTag = '[object Function]', - genTag = '[object GeneratorFunction]', - mapTag = '[object Map]', - numberTag = '[object Number]', - objectTag = '[object Object]', - promiseTag = '[object Promise]', - regexpTag = '[object RegExp]', - setTag = '[object Set]', - stringTag = '[object String]', - symbolTag = '[object Symbol]', - weakMapTag = '[object WeakMap]'; - -var arrayBufferTag = '[object ArrayBuffer]', - dataViewTag = '[object DataView]', - float32Tag = '[object Float32Array]', - float64Tag = '[object Float64Array]', - int8Tag = '[object Int8Array]', - int16Tag = '[object Int16Array]', - int32Tag = '[object Int32Array]', - uint8Tag = '[object Uint8Array]', - uint8ClampedTag = '[object Uint8ClampedArray]', - uint16Tag = '[object Uint16Array]', - uint32Tag = '[object Uint32Array]'; - -/** - * Used to match `RegExp` - * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns). - */ -var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; - -/** Used to match `RegExp` flags from their coerced string values. */ -var reFlags = /\w*$/; - -/** Used to detect host constructors (Safari). */ -var reIsHostCtor = /^\[object .+?Constructor\]$/; - -/** Used to detect unsigned integer values. */ -var reIsUint = /^(?:0|[1-9]\d*)$/; - -/** Used to identify `toStringTag` values supported by `_.clone`. */ -var cloneableTags = {}; -cloneableTags[argsTag] = cloneableTags[arrayTag] = -cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] = -cloneableTags[boolTag] = cloneableTags[dateTag] = -cloneableTags[float32Tag] = cloneableTags[float64Tag] = -cloneableTags[int8Tag] = cloneableTags[int16Tag] = -cloneableTags[int32Tag] = cloneableTags[mapTag] = -cloneableTags[numberTag] = cloneableTags[objectTag] = -cloneableTags[regexpTag] = cloneableTags[setTag] = -cloneableTags[stringTag] = cloneableTags[symbolTag] = -cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = -cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true; -cloneableTags[errorTag] = cloneableTags[funcTag] = -cloneableTags[weakMapTag] = false; - -/** Detect free variable `global` from Node.js. */ -var freeGlobal = typeof __webpack_require__.g == 'object' && __webpack_require__.g && __webpack_require__.g.Object === Object && __webpack_require__.g; - -/** Detect free variable `self`. */ -var freeSelf = typeof self == 'object' && self && self.Object === Object && self; - -/** Used as a reference to the global object. */ -var root = freeGlobal || freeSelf || Function('return this')(); - -/** Detect free variable `exports`. */ -var freeExports = true && exports && !exports.nodeType && exports; - -/** Detect free variable `module`. */ -var freeModule = freeExports && "object" == 'object' && module && !module.nodeType && module; - -/** Detect the popular CommonJS extension `module.exports`. */ -var moduleExports = freeModule && freeModule.exports === freeExports; - -/** - * Adds the key-value `pair` to `map`. - * - * @private - * @param {Object} map The map to modify. - * @param {Array} pair The key-value pair to add. - * @returns {Object} Returns `map`. - */ -function addMapEntry(map, pair) { - // Don't return `map.set` because it's not chainable in IE 11. - map.set(pair[0], pair[1]); - return map; -} - -/** - * Adds `value` to `set`. - * - * @private - * @param {Object} set The set to modify. - * @param {*} value The value to add. - * @returns {Object} Returns `set`. - */ -function addSetEntry(set, value) { - // Don't return `set.add` because it's not chainable in IE 11. - set.add(value); - return set; -} - -/** - * A specialized version of `_.forEach` for arrays without support for - * iteratee shorthands. - * - * @private - * @param {Array} [array] The array to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Array} Returns `array`. - */ -function arrayEach(array, iteratee) { - var index = -1, - length = array ? array.length : 0; - - while (++index < length) { - if (iteratee(array[index], index, array) === false) { - break; - } - } - return array; -} - -/** - * Appends the elements of `values` to `array`. - * - * @private - * @param {Array} array The array to modify. - * @param {Array} values The values to append. - * @returns {Array} Returns `array`. - */ -function arrayPush(array, values) { - var index = -1, - length = values.length, - offset = array.length; - - while (++index < length) { - array[offset + index] = values[index]; - } - return array; -} - -/** - * A specialized version of `_.reduce` for arrays without support for - * iteratee shorthands. - * - * @private - * @param {Array} [array] The array to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @param {*} [accumulator] The initial value. - * @param {boolean} [initAccum] Specify using the first element of `array` as - * the initial value. - * @returns {*} Returns the accumulated value. - */ -function arrayReduce(array, iteratee, accumulator, initAccum) { - var index = -1, - length = array ? array.length : 0; - - if (initAccum && length) { - accumulator = array[++index]; - } - while (++index < length) { - accumulator = iteratee(accumulator, array[index], index, array); - } - return accumulator; -} - -/** - * The base implementation of `_.times` without support for iteratee shorthands - * or max array length checks. - * - * @private - * @param {number} n The number of times to invoke `iteratee`. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Array} Returns the array of results. - */ -function baseTimes(n, iteratee) { - var index = -1, - result = Array(n); - - while (++index < n) { - result[index] = iteratee(index); - } - return result; -} - -/** - * Gets the value at `key` of `object`. - * - * @private - * @param {Object} [object] The object to query. - * @param {string} key The key of the property to get. - * @returns {*} Returns the property value. - */ -function getValue(object, key) { - return object == null ? undefined : object[key]; -} - -/** - * Checks if `value` is a host object in IE < 9. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a host object, else `false`. - */ -function isHostObject(value) { - // Many host objects are `Object` objects that can coerce to strings - // despite having improperly defined `toString` methods. - var result = false; - if (value != null && typeof value.toString != 'function') { - try { - result = !!(value + ''); - } catch (e) {} - } - return result; -} - -/** - * Converts `map` to its key-value pairs. - * - * @private - * @param {Object} map The map to convert. - * @returns {Array} Returns the key-value pairs. - */ -function mapToArray(map) { - var index = -1, - result = Array(map.size); - - map.forEach(function(value, key) { - result[++index] = [key, value]; - }); - return result; -} - -/** - * Creates a unary function that invokes `func` with its argument transformed. - * - * @private - * @param {Function} func The function to wrap. - * @param {Function} transform The argument transform. - * @returns {Function} Returns the new function. - */ -function overArg(func, transform) { - return function(arg) { - return func(transform(arg)); - }; -} - -/** - * Converts `set` to an array of its values. - * - * @private - * @param {Object} set The set to convert. - * @returns {Array} Returns the values. - */ -function setToArray(set) { - var index = -1, - result = Array(set.size); - - set.forEach(function(value) { - result[++index] = value; - }); - return result; -} - -/** Used for built-in method references. */ -var arrayProto = Array.prototype, - funcProto = Function.prototype, - objectProto = Object.prototype; - -/** Used to detect overreaching core-js shims. */ -var coreJsData = root['__core-js_shared__']; - -/** Used to detect methods masquerading as native. */ -var maskSrcKey = (function() { - var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || ''); - return uid ? ('Symbol(src)_1.' + uid) : ''; -}()); - -/** Used to resolve the decompiled source of functions. */ -var funcToString = funcProto.toString; - -/** Used to check objects for own properties. */ -var hasOwnProperty = objectProto.hasOwnProperty; - -/** - * Used to resolve the - * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) - * of values. - */ -var objectToString = objectProto.toString; - -/** Used to detect if a method is native. */ -var reIsNative = RegExp('^' + - funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') - .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' -); - -/** Built-in value references. */ -var Buffer = moduleExports ? root.Buffer : undefined, - Symbol = root.Symbol, - Uint8Array = root.Uint8Array, - getPrototype = overArg(Object.getPrototypeOf, Object), - objectCreate = Object.create, - propertyIsEnumerable = objectProto.propertyIsEnumerable, - splice = arrayProto.splice; - -/* Built-in method references for those with the same name as other `lodash` methods. */ -var nativeGetSymbols = Object.getOwnPropertySymbols, - nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined, - nativeKeys = overArg(Object.keys, Object); - -/* Built-in method references that are verified to be native. */ -var DataView = getNative(root, 'DataView'), - Map = getNative(root, 'Map'), - Promise = getNative(root, 'Promise'), - Set = getNative(root, 'Set'), - WeakMap = getNative(root, 'WeakMap'), - nativeCreate = getNative(Object, 'create'); - -/** Used to detect maps, sets, and weakmaps. */ -var dataViewCtorString = toSource(DataView), - mapCtorString = toSource(Map), - promiseCtorString = toSource(Promise), - setCtorString = toSource(Set), - weakMapCtorString = toSource(WeakMap); - -/** Used to convert symbols to primitives and strings. */ -var symbolProto = Symbol ? Symbol.prototype : undefined, - symbolValueOf = symbolProto ? symbolProto.valueOf : undefined; - -/** - * Creates a hash object. - * - * @private - * @constructor - * @param {Array} [entries] The key-value pairs to cache. - */ -function Hash(entries) { - var index = -1, - length = entries ? entries.length : 0; - - this.clear(); - while (++index < length) { - var entry = entries[index]; - this.set(entry[0], entry[1]); - } -} - -/** - * Removes all key-value entries from the hash. - * - * @private - * @name clear - * @memberOf Hash - */ -function hashClear() { - this.__data__ = nativeCreate ? nativeCreate(null) : {}; -} - -/** - * Removes `key` and its value from the hash. - * - * @private - * @name delete - * @memberOf Hash - * @param {Object} hash The hash to modify. - * @param {string} key The key of the value to remove. - * @returns {boolean} Returns `true` if the entry was removed, else `false`. - */ -function hashDelete(key) { - return this.has(key) && delete this.__data__[key]; -} - -/** - * Gets the hash value for `key`. - * - * @private - * @name get - * @memberOf Hash - * @param {string} key The key of the value to get. - * @returns {*} Returns the entry value. - */ -function hashGet(key) { - var data = this.__data__; - if (nativeCreate) { - var result = data[key]; - return result === HASH_UNDEFINED ? undefined : result; - } - return hasOwnProperty.call(data, key) ? data[key] : undefined; -} - -/** - * Checks if a hash value for `key` exists. - * - * @private - * @name has - * @memberOf Hash - * @param {string} key The key of the entry to check. - * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. - */ -function hashHas(key) { - var data = this.__data__; - return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key); -} - -/** - * Sets the hash `key` to `value`. - * - * @private - * @name set - * @memberOf Hash - * @param {string} key The key of the value to set. - * @param {*} value The value to set. - * @returns {Object} Returns the hash instance. - */ -function hashSet(key, value) { - var data = this.__data__; - data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value; - return this; -} - -// Add methods to `Hash`. -Hash.prototype.clear = hashClear; -Hash.prototype['delete'] = hashDelete; -Hash.prototype.get = hashGet; -Hash.prototype.has = hashHas; -Hash.prototype.set = hashSet; - -/** - * Creates an list cache object. - * - * @private - * @constructor - * @param {Array} [entries] The key-value pairs to cache. - */ -function ListCache(entries) { - var index = -1, - length = entries ? entries.length : 0; - - this.clear(); - while (++index < length) { - var entry = entries[index]; - this.set(entry[0], entry[1]); - } -} - -/** - * Removes all key-value entries from the list cache. - * - * @private - * @name clear - * @memberOf ListCache - */ -function listCacheClear() { - this.__data__ = []; -} - -/** - * Removes `key` and its value from the list cache. - * - * @private - * @name delete - * @memberOf ListCache - * @param {string} key The key of the value to remove. - * @returns {boolean} Returns `true` if the entry was removed, else `false`. - */ -function listCacheDelete(key) { - var data = this.__data__, - index = assocIndexOf(data, key); - - if (index < 0) { - return false; - } - var lastIndex = data.length - 1; - if (index == lastIndex) { - data.pop(); - } else { - splice.call(data, index, 1); - } - return true; -} - -/** - * Gets the list cache value for `key`. - * - * @private - * @name get - * @memberOf ListCache - * @param {string} key The key of the value to get. - * @returns {*} Returns the entry value. - */ -function listCacheGet(key) { - var data = this.__data__, - index = assocIndexOf(data, key); - - return index < 0 ? undefined : data[index][1]; -} - -/** - * Checks if a list cache value for `key` exists. - * - * @private - * @name has - * @memberOf ListCache - * @param {string} key The key of the entry to check. - * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. - */ -function listCacheHas(key) { - return assocIndexOf(this.__data__, key) > -1; -} - -/** - * Sets the list cache `key` to `value`. - * - * @private - * @name set - * @memberOf ListCache - * @param {string} key The key of the value to set. - * @param {*} value The value to set. - * @returns {Object} Returns the list cache instance. - */ -function listCacheSet(key, value) { - var data = this.__data__, - index = assocIndexOf(data, key); - - if (index < 0) { - data.push([key, value]); - } else { - data[index][1] = value; - } - return this; -} - -// Add methods to `ListCache`. -ListCache.prototype.clear = listCacheClear; -ListCache.prototype['delete'] = listCacheDelete; -ListCache.prototype.get = listCacheGet; -ListCache.prototype.has = listCacheHas; -ListCache.prototype.set = listCacheSet; - -/** - * Creates a map cache object to store key-value pairs. - * - * @private - * @constructor - * @param {Array} [entries] The key-value pairs to cache. - */ -function MapCache(entries) { - var index = -1, - length = entries ? entries.length : 0; - - this.clear(); - while (++index < length) { - var entry = entries[index]; - this.set(entry[0], entry[1]); - } -} - -/** - * Removes all key-value entries from the map. - * - * @private - * @name clear - * @memberOf MapCache - */ -function mapCacheClear() { - this.__data__ = { - 'hash': new Hash, - 'map': new (Map || ListCache), - 'string': new Hash - }; -} - -/** - * Removes `key` and its value from the map. - * - * @private - * @name delete - * @memberOf MapCache - * @param {string} key The key of the value to remove. - * @returns {boolean} Returns `true` if the entry was removed, else `false`. - */ -function mapCacheDelete(key) { - return getMapData(this, key)['delete'](key); -} - -/** - * Gets the map value for `key`. - * - * @private - * @name get - * @memberOf MapCache - * @param {string} key The key of the value to get. - * @returns {*} Returns the entry value. - */ -function mapCacheGet(key) { - return getMapData(this, key).get(key); -} - -/** - * Checks if a map value for `key` exists. - * - * @private - * @name has - * @memberOf MapCache - * @param {string} key The key of the entry to check. - * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. - */ -function mapCacheHas(key) { - return getMapData(this, key).has(key); -} - -/** - * Sets the map `key` to `value`. - * - * @private - * @name set - * @memberOf MapCache - * @param {string} key The key of the value to set. - * @param {*} value The value to set. - * @returns {Object} Returns the map cache instance. - */ -function mapCacheSet(key, value) { - getMapData(this, key).set(key, value); - return this; -} - -// Add methods to `MapCache`. -MapCache.prototype.clear = mapCacheClear; -MapCache.prototype['delete'] = mapCacheDelete; -MapCache.prototype.get = mapCacheGet; -MapCache.prototype.has = mapCacheHas; -MapCache.prototype.set = mapCacheSet; - -/** - * Creates a stack cache object to store key-value pairs. - * - * @private - * @constructor - * @param {Array} [entries] The key-value pairs to cache. - */ -function Stack(entries) { - this.__data__ = new ListCache(entries); -} - -/** - * Removes all key-value entries from the stack. - * - * @private - * @name clear - * @memberOf Stack - */ -function stackClear() { - this.__data__ = new ListCache; -} - -/** - * Removes `key` and its value from the stack. - * - * @private - * @name delete - * @memberOf Stack - * @param {string} key The key of the value to remove. - * @returns {boolean} Returns `true` if the entry was removed, else `false`. - */ -function stackDelete(key) { - return this.__data__['delete'](key); -} - -/** - * Gets the stack value for `key`. - * - * @private - * @name get - * @memberOf Stack - * @param {string} key The key of the value to get. - * @returns {*} Returns the entry value. - */ -function stackGet(key) { - return this.__data__.get(key); -} - -/** - * Checks if a stack value for `key` exists. - * - * @private - * @name has - * @memberOf Stack - * @param {string} key The key of the entry to check. - * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. - */ -function stackHas(key) { - return this.__data__.has(key); -} - -/** - * Sets the stack `key` to `value`. - * - * @private - * @name set - * @memberOf Stack - * @param {string} key The key of the value to set. - * @param {*} value The value to set. - * @returns {Object} Returns the stack cache instance. - */ -function stackSet(key, value) { - var cache = this.__data__; - if (cache instanceof ListCache) { - var pairs = cache.__data__; - if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) { - pairs.push([key, value]); - return this; - } - cache = this.__data__ = new MapCache(pairs); - } - cache.set(key, value); - return this; -} - -// Add methods to `Stack`. -Stack.prototype.clear = stackClear; -Stack.prototype['delete'] = stackDelete; -Stack.prototype.get = stackGet; -Stack.prototype.has = stackHas; -Stack.prototype.set = stackSet; - -/** - * Creates an array of the enumerable property names of the array-like `value`. - * - * @private - * @param {*} value The value to query. - * @param {boolean} inherited Specify returning inherited property names. - * @returns {Array} Returns the array of property names. - */ -function arrayLikeKeys(value, inherited) { - // Safari 8.1 makes `arguments.callee` enumerable in strict mode. - // Safari 9 makes `arguments.length` enumerable in strict mode. - var result = (isArray(value) || isArguments(value)) - ? baseTimes(value.length, String) - : []; - - var length = result.length, - skipIndexes = !!length; - - for (var key in value) { - if ((inherited || hasOwnProperty.call(value, key)) && - !(skipIndexes && (key == 'length' || isIndex(key, length)))) { - result.push(key); - } - } - return result; -} - -/** - * Assigns `value` to `key` of `object` if the existing value is not equivalent - * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) - * for equality comparisons. - * - * @private - * @param {Object} object The object to modify. - * @param {string} key The key of the property to assign. - * @param {*} value The value to assign. - */ -function assignValue(object, key, value) { - var objValue = object[key]; - if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) || - (value === undefined && !(key in object))) { - object[key] = value; - } -} - -/** - * Gets the index at which the `key` is found in `array` of key-value pairs. - * - * @private - * @param {Array} array The array to inspect. - * @param {*} key The key to search for. - * @returns {number} Returns the index of the matched value, else `-1`. - */ -function assocIndexOf(array, key) { - var length = array.length; - while (length--) { - if (eq(array[length][0], key)) { - return length; - } - } - return -1; -} - -/** - * The base implementation of `_.assign` without support for multiple sources - * or `customizer` functions. - * - * @private - * @param {Object} object The destination object. - * @param {Object} source The source object. - * @returns {Object} Returns `object`. - */ -function baseAssign(object, source) { - return object && copyObject(source, keys(source), object); -} - -/** - * The base implementation of `_.clone` and `_.cloneDeep` which tracks - * traversed objects. - * - * @private - * @param {*} value The value to clone. - * @param {boolean} [isDeep] Specify a deep clone. - * @param {boolean} [isFull] Specify a clone including symbols. - * @param {Function} [customizer] The function to customize cloning. - * @param {string} [key] The key of `value`. - * @param {Object} [object] The parent object of `value`. - * @param {Object} [stack] Tracks traversed objects and their clone counterparts. - * @returns {*} Returns the cloned value. - */ -function baseClone(value, isDeep, isFull, customizer, key, object, stack) { - var result; - if (customizer) { - result = object ? customizer(value, key, object, stack) : customizer(value); - } - if (result !== undefined) { - return result; - } - if (!isObject(value)) { - return value; - } - var isArr = isArray(value); - if (isArr) { - result = initCloneArray(value); - if (!isDeep) { - return copyArray(value, result); - } - } else { - var tag = getTag(value), - isFunc = tag == funcTag || tag == genTag; - - if (isBuffer(value)) { - return cloneBuffer(value, isDeep); - } - if (tag == objectTag || tag == argsTag || (isFunc && !object)) { - if (isHostObject(value)) { - return object ? value : {}; - } - result = initCloneObject(isFunc ? {} : value); - if (!isDeep) { - return copySymbols(value, baseAssign(result, value)); - } - } else { - if (!cloneableTags[tag]) { - return object ? value : {}; - } - result = initCloneByTag(value, tag, baseClone, isDeep); - } - } - // Check for circular references and return its corresponding clone. - stack || (stack = new Stack); - var stacked = stack.get(value); - if (stacked) { - return stacked; - } - stack.set(value, result); - - if (!isArr) { - var props = isFull ? getAllKeys(value) : keys(value); - } - arrayEach(props || value, function(subValue, key) { - if (props) { - key = subValue; - subValue = value[key]; - } - // Recursively populate clone (susceptible to call stack limits). - assignValue(result, key, baseClone(subValue, isDeep, isFull, customizer, key, value, stack)); - }); - return result; -} - -/** - * The base implementation of `_.create` without support for assigning - * properties to the created object. - * - * @private - * @param {Object} prototype The object to inherit from. - * @returns {Object} Returns the new object. - */ -function baseCreate(proto) { - return isObject(proto) ? objectCreate(proto) : {}; -} - -/** - * The base implementation of `getAllKeys` and `getAllKeysIn` which uses - * `keysFunc` and `symbolsFunc` to get the enumerable property names and - * symbols of `object`. - * - * @private - * @param {Object} object The object to query. - * @param {Function} keysFunc The function to get the keys of `object`. - * @param {Function} symbolsFunc The function to get the symbols of `object`. - * @returns {Array} Returns the array of property names and symbols. - */ -function baseGetAllKeys(object, keysFunc, symbolsFunc) { - var result = keysFunc(object); - return isArray(object) ? result : arrayPush(result, symbolsFunc(object)); -} - -/** - * The base implementation of `getTag`. - * - * @private - * @param {*} value The value to query. - * @returns {string} Returns the `toStringTag`. - */ -function baseGetTag(value) { - return objectToString.call(value); -} - -/** - * The base implementation of `_.isNative` without bad shim checks. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a native function, - * else `false`. - */ -function baseIsNative(value) { - if (!isObject(value) || isMasked(value)) { - return false; - } - var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor; - return pattern.test(toSource(value)); -} - -/** - * The base implementation of `_.keys` which doesn't treat sparse arrays as dense. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names. - */ -function baseKeys(object) { - if (!isPrototype(object)) { - return nativeKeys(object); - } - var result = []; - for (var key in Object(object)) { - if (hasOwnProperty.call(object, key) && key != 'constructor') { - result.push(key); - } - } - return result; -} - -/** - * Creates a clone of `buffer`. - * - * @private - * @param {Buffer} buffer The buffer to clone. - * @param {boolean} [isDeep] Specify a deep clone. - * @returns {Buffer} Returns the cloned buffer. - */ -function cloneBuffer(buffer, isDeep) { - if (isDeep) { - return buffer.slice(); - } - var result = new buffer.constructor(buffer.length); - buffer.copy(result); - return result; -} - -/** - * Creates a clone of `arrayBuffer`. - * - * @private - * @param {ArrayBuffer} arrayBuffer The array buffer to clone. - * @returns {ArrayBuffer} Returns the cloned array buffer. - */ -function cloneArrayBuffer(arrayBuffer) { - var result = new arrayBuffer.constructor(arrayBuffer.byteLength); - new Uint8Array(result).set(new Uint8Array(arrayBuffer)); - return result; -} - -/** - * Creates a clone of `dataView`. - * - * @private - * @param {Object} dataView The data view to clone. - * @param {boolean} [isDeep] Specify a deep clone. - * @returns {Object} Returns the cloned data view. - */ -function cloneDataView(dataView, isDeep) { - var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer; - return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength); -} - -/** - * Creates a clone of `map`. - * - * @private - * @param {Object} map The map to clone. - * @param {Function} cloneFunc The function to clone values. - * @param {boolean} [isDeep] Specify a deep clone. - * @returns {Object} Returns the cloned map. - */ -function cloneMap(map, isDeep, cloneFunc) { - var array = isDeep ? cloneFunc(mapToArray(map), true) : mapToArray(map); - return arrayReduce(array, addMapEntry, new map.constructor); -} - -/** - * Creates a clone of `regexp`. - * - * @private - * @param {Object} regexp The regexp to clone. - * @returns {Object} Returns the cloned regexp. - */ -function cloneRegExp(regexp) { - var result = new regexp.constructor(regexp.source, reFlags.exec(regexp)); - result.lastIndex = regexp.lastIndex; - return result; -} - -/** - * Creates a clone of `set`. - * - * @private - * @param {Object} set The set to clone. - * @param {Function} cloneFunc The function to clone values. - * @param {boolean} [isDeep] Specify a deep clone. - * @returns {Object} Returns the cloned set. - */ -function cloneSet(set, isDeep, cloneFunc) { - var array = isDeep ? cloneFunc(setToArray(set), true) : setToArray(set); - return arrayReduce(array, addSetEntry, new set.constructor); -} - -/** - * Creates a clone of the `symbol` object. - * - * @private - * @param {Object} symbol The symbol object to clone. - * @returns {Object} Returns the cloned symbol object. - */ -function cloneSymbol(symbol) { - return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {}; -} - -/** - * Creates a clone of `typedArray`. - * - * @private - * @param {Object} typedArray The typed array to clone. - * @param {boolean} [isDeep] Specify a deep clone. - * @returns {Object} Returns the cloned typed array. - */ -function cloneTypedArray(typedArray, isDeep) { - var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer; - return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length); -} - -/** - * Copies the values of `source` to `array`. - * - * @private - * @param {Array} source The array to copy values from. - * @param {Array} [array=[]] The array to copy values to. - * @returns {Array} Returns `array`. - */ -function copyArray(source, array) { - var index = -1, - length = source.length; - - array || (array = Array(length)); - while (++index < length) { - array[index] = source[index]; - } - return array; -} - -/** - * Copies properties of `source` to `object`. - * - * @private - * @param {Object} source The object to copy properties from. - * @param {Array} props The property identifiers to copy. - * @param {Object} [object={}] The object to copy properties to. - * @param {Function} [customizer] The function to customize copied values. - * @returns {Object} Returns `object`. - */ -function copyObject(source, props, object, customizer) { - object || (object = {}); - - var index = -1, - length = props.length; - - while (++index < length) { - var key = props[index]; - - var newValue = customizer - ? customizer(object[key], source[key], key, object, source) - : undefined; - - assignValue(object, key, newValue === undefined ? source[key] : newValue); - } - return object; -} - -/** - * Copies own symbol properties of `source` to `object`. - * - * @private - * @param {Object} source The object to copy symbols from. - * @param {Object} [object={}] The object to copy symbols to. - * @returns {Object} Returns `object`. - */ -function copySymbols(source, object) { - return copyObject(source, getSymbols(source), object); -} - -/** - * Creates an array of own enumerable property names and symbols of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names and symbols. - */ -function getAllKeys(object) { - return baseGetAllKeys(object, keys, getSymbols); -} - -/** - * Gets the data for `map`. - * - * @private - * @param {Object} map The map to query. - * @param {string} key The reference key. - * @returns {*} Returns the map data. - */ -function getMapData(map, key) { - var data = map.__data__; - return isKeyable(key) - ? data[typeof key == 'string' ? 'string' : 'hash'] - : data.map; -} - -/** - * Gets the native function at `key` of `object`. - * - * @private - * @param {Object} object The object to query. - * @param {string} key The key of the method to get. - * @returns {*} Returns the function if it's native, else `undefined`. - */ -function getNative(object, key) { - var value = getValue(object, key); - return baseIsNative(value) ? value : undefined; -} - -/** - * Creates an array of the own enumerable symbol properties of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the array of symbols. - */ -var getSymbols = nativeGetSymbols ? overArg(nativeGetSymbols, Object) : stubArray; - -/** - * Gets the `toStringTag` of `value`. - * - * @private - * @param {*} value The value to query. - * @returns {string} Returns the `toStringTag`. - */ -var getTag = baseGetTag; - -// Fallback for data views, maps, sets, and weak maps in IE 11, -// for data views in Edge < 14, and promises in Node.js. -if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) || - (Map && getTag(new Map) != mapTag) || - (Promise && getTag(Promise.resolve()) != promiseTag) || - (Set && getTag(new Set) != setTag) || - (WeakMap && getTag(new WeakMap) != weakMapTag)) { - getTag = function(value) { - var result = objectToString.call(value), - Ctor = result == objectTag ? value.constructor : undefined, - ctorString = Ctor ? toSource(Ctor) : undefined; - - if (ctorString) { - switch (ctorString) { - case dataViewCtorString: return dataViewTag; - case mapCtorString: return mapTag; - case promiseCtorString: return promiseTag; - case setCtorString: return setTag; - case weakMapCtorString: return weakMapTag; - } - } - return result; - }; -} - -/** - * Initializes an array clone. - * - * @private - * @param {Array} array The array to clone. - * @returns {Array} Returns the initialized clone. - */ -function initCloneArray(array) { - var length = array.length, - result = array.constructor(length); - - // Add properties assigned by `RegExp#exec`. - if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) { - result.index = array.index; - result.input = array.input; - } - return result; -} - -/** - * Initializes an object clone. - * - * @private - * @param {Object} object The object to clone. - * @returns {Object} Returns the initialized clone. - */ -function initCloneObject(object) { - return (typeof object.constructor == 'function' && !isPrototype(object)) - ? baseCreate(getPrototype(object)) - : {}; -} - -/** - * Initializes an object clone based on its `toStringTag`. - * - * **Note:** This function only supports cloning values with tags of - * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`. - * - * @private - * @param {Object} object The object to clone. - * @param {string} tag The `toStringTag` of the object to clone. - * @param {Function} cloneFunc The function to clone values. - * @param {boolean} [isDeep] Specify a deep clone. - * @returns {Object} Returns the initialized clone. - */ -function initCloneByTag(object, tag, cloneFunc, isDeep) { - var Ctor = object.constructor; - switch (tag) { - case arrayBufferTag: - return cloneArrayBuffer(object); - - case boolTag: - case dateTag: - return new Ctor(+object); - - case dataViewTag: - return cloneDataView(object, isDeep); - - case float32Tag: case float64Tag: - case int8Tag: case int16Tag: case int32Tag: - case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag: - return cloneTypedArray(object, isDeep); - - case mapTag: - return cloneMap(object, isDeep, cloneFunc); - - case numberTag: - case stringTag: - return new Ctor(object); - - case regexpTag: - return cloneRegExp(object); - - case setTag: - return cloneSet(object, isDeep, cloneFunc); - - case symbolTag: - return cloneSymbol(object); - } -} - -/** - * Checks if `value` is a valid array-like index. - * - * @private - * @param {*} value The value to check. - * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. - * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. - */ -function isIndex(value, length) { - length = length == null ? MAX_SAFE_INTEGER : length; - return !!length && - (typeof value == 'number' || reIsUint.test(value)) && - (value > -1 && value % 1 == 0 && value < length); -} - -/** - * Checks if `value` is suitable for use as unique object key. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is suitable, else `false`. - */ -function isKeyable(value) { - var type = typeof value; - return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean') - ? (value !== '__proto__') - : (value === null); -} - -/** - * Checks if `func` has its source masked. - * - * @private - * @param {Function} func The function to check. - * @returns {boolean} Returns `true` if `func` is masked, else `false`. - */ -function isMasked(func) { - return !!maskSrcKey && (maskSrcKey in func); -} - -/** - * Checks if `value` is likely a prototype object. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a prototype, else `false`. - */ -function isPrototype(value) { - var Ctor = value && value.constructor, - proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto; - - return value === proto; -} - -/** - * Converts `func` to its source code. - * - * @private - * @param {Function} func The function to process. - * @returns {string} Returns the source code. - */ -function toSource(func) { - if (func != null) { - try { - return funcToString.call(func); - } catch (e) {} - try { - return (func + ''); - } catch (e) {} - } - return ''; -} - -/** - * This method is like `_.clone` except that it recursively clones `value`. - * - * @static - * @memberOf _ - * @since 1.0.0 - * @category Lang - * @param {*} value The value to recursively clone. - * @returns {*} Returns the deep cloned value. - * @see _.clone - * @example - * - * var objects = [{ 'a': 1 }, { 'b': 2 }]; - * - * var deep = _.cloneDeep(objects); - * console.log(deep[0] === objects[0]); - * // => false - */ -function cloneDeep(value) { - return baseClone(value, true, true); -} - -/** - * Performs a - * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) - * comparison between two values to determine if they are equivalent. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @returns {boolean} Returns `true` if the values are equivalent, else `false`. - * @example - * - * var object = { 'a': 1 }; - * var other = { 'a': 1 }; - * - * _.eq(object, object); - * // => true - * - * _.eq(object, other); - * // => false - * - * _.eq('a', 'a'); - * // => true - * - * _.eq('a', Object('a')); - * // => false - * - * _.eq(NaN, NaN); - * // => true - */ -function eq(value, other) { - return value === other || (value !== value && other !== other); -} - -/** - * Checks if `value` is likely an `arguments` object. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an `arguments` object, - * else `false`. - * @example - * - * _.isArguments(function() { return arguments; }()); - * // => true - * - * _.isArguments([1, 2, 3]); - * // => false - */ -function isArguments(value) { - // Safari 8.1 makes `arguments.callee` enumerable in strict mode. - return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') && - (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag); -} - -/** - * Checks if `value` is classified as an `Array` object. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an array, else `false`. - * @example - * - * _.isArray([1, 2, 3]); - * // => true - * - * _.isArray(document.body.children); - * // => false - * - * _.isArray('abc'); - * // => false - * - * _.isArray(_.noop); - * // => false - */ -var isArray = Array.isArray; - -/** - * Checks if `value` is array-like. A value is considered array-like if it's - * not a function and has a `value.length` that's an integer greater than or - * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is array-like, else `false`. - * @example - * - * _.isArrayLike([1, 2, 3]); - * // => true - * - * _.isArrayLike(document.body.children); - * // => true - * - * _.isArrayLike('abc'); - * // => true - * - * _.isArrayLike(_.noop); - * // => false - */ -function isArrayLike(value) { - return value != null && isLength(value.length) && !isFunction(value); -} - -/** - * This method is like `_.isArrayLike` except that it also checks if `value` - * is an object. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an array-like object, - * else `false`. - * @example - * - * _.isArrayLikeObject([1, 2, 3]); - * // => true - * - * _.isArrayLikeObject(document.body.children); - * // => true - * - * _.isArrayLikeObject('abc'); - * // => false - * - * _.isArrayLikeObject(_.noop); - * // => false - */ -function isArrayLikeObject(value) { - return isObjectLike(value) && isArrayLike(value); -} - -/** - * Checks if `value` is a buffer. - * - * @static - * @memberOf _ - * @since 4.3.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a buffer, else `false`. - * @example - * - * _.isBuffer(new Buffer(2)); - * // => true - * - * _.isBuffer(new Uint8Array(2)); - * // => false - */ -var isBuffer = nativeIsBuffer || stubFalse; - -/** - * Checks if `value` is classified as a `Function` object. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a function, else `false`. - * @example - * - * _.isFunction(_); - * // => true - * - * _.isFunction(/abc/); - * // => false - */ -function isFunction(value) { - // The use of `Object#toString` avoids issues with the `typeof` operator - // in Safari 8-9 which returns 'object' for typed array and other constructors. - var tag = isObject(value) ? objectToString.call(value) : ''; - return tag == funcTag || tag == genTag; -} - -/** - * Checks if `value` is a valid array-like length. - * - * **Note:** This method is loosely based on - * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. - * @example - * - * _.isLength(3); - * // => true - * - * _.isLength(Number.MIN_VALUE); - * // => false - * - * _.isLength(Infinity); - * // => false - * - * _.isLength('3'); - * // => false - */ -function isLength(value) { - return typeof value == 'number' && - value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; -} - -/** - * Checks if `value` is the - * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) - * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an object, else `false`. - * @example - * - * _.isObject({}); - * // => true - * - * _.isObject([1, 2, 3]); - * // => true - * - * _.isObject(_.noop); - * // => true - * - * _.isObject(null); - * // => false - */ -function isObject(value) { - var type = typeof value; - return !!value && (type == 'object' || type == 'function'); -} - -/** - * Checks if `value` is object-like. A value is object-like if it's not `null` - * and has a `typeof` result of "object". - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is object-like, else `false`. - * @example - * - * _.isObjectLike({}); - * // => true - * - * _.isObjectLike([1, 2, 3]); - * // => true - * - * _.isObjectLike(_.noop); - * // => false - * - * _.isObjectLike(null); - * // => false - */ -function isObjectLike(value) { - return !!value && typeof value == 'object'; -} - -/** - * Creates an array of the own enumerable property names of `object`. - * - * **Note:** Non-object values are coerced to objects. See the - * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) - * for more details. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Object - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names. - * @example - * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.keys(new Foo); - * // => ['a', 'b'] (iteration order is not guaranteed) - * - * _.keys('hi'); - * // => ['0', '1'] - */ -function keys(object) { - return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object); -} - -/** - * This method returns a new empty array. - * - * @static - * @memberOf _ - * @since 4.13.0 - * @category Util - * @returns {Array} Returns the new empty array. - * @example - * - * var arrays = _.times(2, _.stubArray); - * - * console.log(arrays); - * // => [[], []] - * - * console.log(arrays[0] === arrays[1]); - * // => false - */ -function stubArray() { - return []; -} - -/** - * This method returns `false`. - * - * @static - * @memberOf _ - * @since 4.13.0 - * @category Util - * @returns {boolean} Returns `false`. - * @example - * - * _.times(2, _.stubFalse); - * // => [false, false] - */ -function stubFalse() { - return false; -} - -module.exports = cloneDeep; - - -/***/ }), - -/***/ 282: -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__) -/* harmony export */ }); -/* harmony import */ var domify__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(137); -/* harmony import */ var domify__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(domify__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(555); - - - -// the hidden token that we will check against every time someone tries to add, remove, fire handler -var _ct = _utils__WEBPACK_IMPORTED_MODULE_1__/* .default.guid */ .Z.guid(); -var _f2t = _utils__WEBPACK_IMPORTED_MODULE_1__/* .default.guid */ .Z.guid(); - -var _handlerCollection = { - appManifestRequestFail: [], - appCreateRoot: [], - appRenderBefore: [], - appDestroyBefore: [], - appRenderAfter: [], - appDestroyAfter: [], - appRender: [], - appDestroy: [], - appScriptLoadFailed: [] -}; - -var _defaultMethods = { - appRender: function(appConfig, appHtml) - { - // if no app root is defined use the app's outer most node - if(!_utils__WEBPACK_IMPORTED_MODULE_1__/* .default.isNativeDOMNode */ .Z.isNativeDOMNode(appConfig.root)) - { - appConfig.root = domify__WEBPACK_IMPORTED_MODULE_0___default()(appHtml); - } - else - { - // append the app html to the root - appConfig.root.appendChild(domify__WEBPACK_IMPORTED_MODULE_0___default()(appHtml)); - } - - // append the root to the body by default. - document.body.appendChild(appConfig.root); - }, - appDestroy: function(appInstance) - { - // call the apps destroy method, if it has one - if(appInstance && appInstance.app && appInstance.app.destroy && typeof(appInstance.app.destroy) == 'function') - { - appInstance.app.destroy(); - } - // warn the Container and App Developer that even though they have a destroy method it hasn't been - else if(appInstance && appInstance.app && appInstance.app.destroy) - { - _utils__WEBPACK_IMPORTED_MODULE_1__/* .default.log */ .Z.log(appInstance.config.appId + ' has a destroy property, but destroy is not of type function and as such will not be executed.'); - } - - // remove the root - appInstance.config.root.parentNode.removeChild(appInstance.config.root); - } -}; - -var _createHandler = function(token, sNamespace, func_or_element, bDomNodeAppropriate) -{ - // will throw an exception and stop execution if the token is invalid - _validateToken(token); - - // create handler structure. Not all arguments properties will be populated/used. - var handler = { - func: (typeof(func_or_element)) ? func_or_element : null, - namespace: sNamespace, - domNode: (_utils__WEBPACK_IMPORTED_MODULE_1__/* .default.isNativeDOMNode */ .Z.isNativeDOMNode(func_or_element)) ? func_or_element : null - }; - - if(!handler.func && !handler.domNode) - { - throw ('Invalid or null argument passed. Handler will not be added to collection. A valid dom element or callback function is required.'); - } - - if(handler.domNode && !bDomNodeAppropriate) - { - throw ('Invalid argument passed. Handler will not be added to collection. A callback function is required for this event type.'); - } - - return handler; -}; - -var _validateToken = function(sToken) -{ - // check token against F2 and container - if(_ct != sToken && _f2t != sToken) { throw ('Invalid token passed. Please verify that you have correctly received and stored token from F2.AppHandlers.getToken().'); } -}; - -var _removeHandler = function(sToken, eventKey, sNamespace) -{ - // will throw an exception and stop execution if the token is invalid - _validateToken(sToken); - - if(!sNamespace && !eventKey) - { - return; - } - // remove by event key - else if(!sNamespace && eventKey) - { - _handlerCollection[eventKey] = []; - } - // remove by namespace only - else if(sNamespace && !eventKey) - { - sNamespace = sNamespace.toLowerCase(); - - for(var currentEventKey in _handlerCollection) - { - var eventCollection = _handlerCollection[currentEventKey]; - var newEvents = []; - - for(var i = 0, ec = eventCollection.length; i < ec; i++) - { - var currentEventHandler = eventCollection[i]; - if(currentEventHandler) - { - if(!currentEventHandler.namespace || currentEventHandler.namespace.toLowerCase() != sNamespace) - { - newEvents.push(currentEventHandler); - } - } - } - - eventCollection = newEvents; - } - } - else if(sNamespace && _handlerCollection[eventKey]) - { - sNamespace = sNamespace.toLowerCase(); - - var newHandlerCollection = []; - - for(var iCounter = 0, hc = _handlerCollection[eventKey].length; iCounter < hc; iCounter++) - { - var currentHandler = _handlerCollection[eventKey][iCounter]; - if(currentHandler) - { - if(!currentHandler.namespace || currentHandler.namespace.toLowerCase() != sNamespace) - { - newHandlerCollection.push(currentHandler); - } - } - } - - _handlerCollection[eventKey] = newHandlerCollection; - } -}; - -/** - * The `AppHandlers` functionality provides Container Developers a higher level of control over configuring app rendering and interaction. - * - * ### Order of Execution - * - * **App Rendering** - * - * 0. {{#crossLink "F2/registerApps"}}F2.registerApps(){{/crossLink}} method is called by the Container Developer and the following methods are run for *each* {{#crossLink "F2.AppConfig"}}{{/crossLink}} passed. - * 1. **'appCreateRoot'** (*{{#crossLink "F2.Constants.AppHandlers"}}{{/crossLink}}.APP\_CREATE\_ROOT*) handlers are fired in the order they were attached. - * 2. **'appRenderBefore'** (*{{#crossLink "F2.Constants.AppHandlers"}}{{/crossLink}}.APP\_RENDER\_BEFORE*) handlers are fired in the order they were attached. - * 3. Each app's `manifestUrl` is requested asynchronously; on success the following methods are fired. - * 3. **'appRender'** (*{{#crossLink "F2.Constants.AppHandlers"}}{{/crossLink}}.APP\_RENDER*) handlers are fired in the order they were attached. - * 4. **'appRenderAfter'** (*{{#crossLink "F2.Constants.AppHandlers"}}{{/crossLink}}.APP\_RENDER\_AFTER*) handlers are fired in the order they were attached. - * - * - * **App Removal** - - * 0. {{#crossLink "F2/removeApp"}}F2.removeApp(){{/crossLink}} with a specific {{#crossLink "F2.AppConfig/instanceId "}}{{/crossLink}} or {{#crossLink "F2/removeAllApps"}}F2.removeAllApps(){{/crossLink}} method is called by the Container Developer and the following methods are run. - * 1. **'appDestroyBefore'** (*{{#crossLink "F2.Constants.AppHandlers"}}{{/crossLink}}.APP\_DESTROY\_BEFORE*) handlers are fired in the order they were attached. - * 2. **'appDestroy'** (*{{#crossLink "F2.Constants.AppHandlers"}}{{/crossLink}}.APP\_DESTROY*) handlers are fired in the order they were attached. - * 3. **'appDestroyAfter'** (*{{#crossLink "F2.Constants.AppHandlers"}}{{/crossLink}}.APP\_DESTROY\_AFTER*) handlers are fired in the order they were attached. - * - * **Error Handling** - - * 0. **'appScriptLoadFailed'** (*{{#crossLink "F2.Constants.AppHandlers"}}{{/crossLink}}.APP\_SCRIPT\_LOAD\_FAILED*) handlers are fired in the order they were attached. - * - * @class F2.AppHandlers - */ -/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({ - /** - * Allows Container Developer to retrieve a unique token which must be passed to - * all `on` and `off` methods. This function will self destruct and can only be called - * one time. Container Developers must store the return value inside of a closure. - * @method getToken - **/ - getToken: function() - { - // delete this method for security that way only the container has access to the token 1 time. - // kind of Ethan Hunt-ish, this message will self destruct immediately. - delete this.getToken; - // return the token, which we validate against. - return _ct; - }, - /** - * Allows F2 to get a token internally. Token is required to call {{#crossLink "F2.AppHandlers/\_\_trigger:method"}}{{/crossLink}}. - * This function will self destruct to eliminate other sources from using the {{#crossLink "F2.AppHandlers/\_\_trigger:method"}}{{/crossLink}} - * and additional internal methods. - * @method __f2GetToken - * @private - **/ - __f2GetToken: function() - { - // delete this method for security that way only the F2 internally has access to the token 1 time. - // kind of Ethan Hunt-ish, this message will self destruct immediately. - delete this.__f2GetToken; - // return the token, which we validate against. - return _f2t; - }, - /** - * Allows F2 to trigger specific events internally. - * @method __trigger - * @private - * @chainable - * @param {String} token The token received from {{#crossLink "F2.AppHandlers/\_\_f2GetToken:method"}}{{/crossLink}}. - * @param {String} eventKey The event to fire. The complete list of event keys is available in {{#crossLink "F2.Constants.AppHandlers"}}{{/crossLink}}. - **/ - __trigger: function(token, eventKey) // additional arguments will likely be passed - { - // will throw an exception and stop execution if the token is invalid - if(token != _f2t) - { - throw ('Token passed is invalid. Only F2 is allowed to call F2.AppHandlers.__trigger().'); - } - - if(_handlerCollection && _handlerCollection[eventKey]) - { - // create a collection of arguments that are safe to pass to the callback. - var passableArgs = []; - - // populate that collection with all arguments except token and eventKey - for(var i = 2, j = arguments.length; i < j; i++) - { - passableArgs.push(arguments[i]); - } - - if(_handlerCollection[eventKey].length === 0 && _defaultMethods[eventKey]) - { - _defaultMethods[eventKey].apply(F2, passableArgs); - return this; - } - else if(_handlerCollection[eventKey].length === 0 && !_handlerCollection[eventKey]) - { - return this; - } - - // fire all event listeners in the order that they were added. - for(var iCounter = 0, hcl = _handlerCollection[eventKey].length; iCounter < hcl; iCounter++) - { - var handler = _handlerCollection[eventKey][iCounter]; - - // appRender where root is already defined - if (handler.domNode && arguments[2] && arguments[2].root && arguments[3]) - { - arguments[2].root.appendChild(domify__WEBPACK_IMPORTED_MODULE_0___default()(arguments[3])); - handler.domNode.appendChild(arguments[2].root); - } - else if (handler.domNode && arguments[2] && !arguments[2].root && arguments[3]) - { - // set the root to the actual HTML of the app - arguments[2].root = domify__WEBPACK_IMPORTED_MODULE_0___default()(arguments[3]); - // appends the root to the dom node specified - handler.domNode.appendChild(arguments[2].root); - } - else - { - handler.func.apply(F2, passableArgs); - } - } - } - else - { - throw ('Invalid EventKey passed. Check your inputs and try again.'); - } - - return this; - }, - /** - * Allows Container Developer to easily tell all apps to render in a specific location. Only valid for eventType `appRender`. - * @method on - * @chainable - * @param {String} token The token received from {{#crossLink "F2.AppHandlers/getToken:method"}}{{/crossLink}}. - * @param {String} eventKey{.namespace} The event key used to determine which event to attach the listener to. The namespace is useful for removal - * purposes. At this time it does not affect when an event is fired. Complete list of event keys available in - * {{#crossLink "F2.Constants.AppHandlers"}}{{/crossLink}}. - * @params {HTMLElement} element Specific DOM element to which app gets appended. - * @example - * var _token = F2.AppHandlers.getToken(); - * F2.AppHandlers.on( - * _token, - * 'appRender', - * document.getElementById('my_app') - * ); - * - * Or: - * @example - * F2.AppHandlers.on( - * _token, - * 'appRender.myNamespace', - * document.getElementById('my_app') - * ); - **/ - /** - * Allows Container Developer to add listener method that will be triggered when a specific event occurs. - * @method on - * @chainable - * @param {String} token The token received from {{#crossLink "F2.AppHandlers/getToken:method"}}{{/crossLink}}. - * @param {String} eventKey{.namespace} The event key used to determine which event to attach the listener to. The namespace is useful for removal - * purposes. At this time it does not affect when an event is fired. Complete list of event keys available in - * {{#crossLink "F2.Constants.AppHandlers"}}{{/crossLink}}. - * @params {Function} listener A function that will be triggered when a specific event occurs. For detailed argument definition refer to {{#crossLink "F2.Constants.AppHandlers"}}{{/crossLink}}. - * @example - * var _token = F2.AppHandlers.getToken(); - * F2.AppHandlers.on( - * _token, - * 'appRenderBefore' - * function() { F2.log('before app rendered!'); } - * ); - * - * Or: - * @example - * F2.AppHandlers.on( - * _token, - * 'appRenderBefore.myNamespace', - * function() { F2.log('before app rendered!'); } - * ); - **/ - on: function(token, eventKey, func_or_element) - { - var sNamespace = null; - - if(!eventKey) - { - throw ('eventKey must be of type string and not null. For available appHandlers check F2.Constants.AppHandlers.'); - } - - // we need to check the key for a namespace - if(eventKey.indexOf('.') > -1) - { - var arData = eventKey.split('.'); - eventKey = arData[0]; - sNamespace = arData[1]; - } - - if(_handlerCollection && _handlerCollection[eventKey]) - { - _handlerCollection[eventKey].push( - _createHandler( - token, - sNamespace, - func_or_element, - (eventKey == 'appRender') - ) - ); - } - else - { - throw ('Invalid EventKey passed. Check your inputs and try again.'); - } - - return this; - }, - /** - * Allows Container Developer to remove listener methods for specific events - * @method off - * @chainable - * @param {String} token The token received from {{#crossLink "F2.AppHandlers/getToken:method"}}{{/crossLink}}. - * @param {String} eventKey{.namespace} The event key used to determine which event to attach the listener to. If no namespace is provided all - * listeners for the specified event type will be removed. - * Complete list available in {{#crossLink "F2.Constants.AppHandlers"}}{{/crossLink}}. - * @example - * var _token = F2.AppHandlers.getToken(); - * F2.AppHandlers.off(_token,'appRenderBefore'); - * - **/ - off: function(token, eventKey) - { - var sNamespace = null; - - if(!eventKey) - { - throw ('eventKey must be of type string and not null. For available appHandlers check F2.Constants.AppHandlers.'); - } - - // we need to check the key for a namespace - if(eventKey.indexOf('.') > -1) - { - var arData = eventKey.split('.'); - eventKey = arData[0]; - sNamespace = arData[1]; - } - - if(_handlerCollection && _handlerCollection[eventKey]) - { - _removeHandler( - token, - eventKey, - sNamespace - ); - } - else - { - throw ('Invalid EventKey passed. Check your inputs and try again.'); - } - - return this; - } -}); - - -/***/ }), - -/***/ 24: -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__) -/* harmony export */ }); -/** - * The apps namespace is a place for app developers to put the javascript - * class that is used to initialize their app. The javascript classes should - * be namepaced with the {{#crossLink "F2.AppConfig"}}{{/crossLink}}.appId. - * It is recommended that the code be placed in a closure to help keep the - * global namespace clean. - * - * If the class has an 'init' function, that function will be called - * automatically by F2. - * @property Apps - * @type object - * @example - * F2.Apps["com_example_helloworld"] = (function() { - * var App_Class = function(appConfig, appContent, root) { - * this._app = appConfig; // the F2.AppConfig object - * this._appContent = appContent // the F2.AppManifest.AppContent object - * this.$root = root; // the root DOM Element that contains this app - * } - * - * App_Class.prototype.init = function() { - * // perform init actions - * } - * - * return App_Class; - * })(); - * @example - * F2.Apps["com_example_helloworld"] = function(appConfig, appContent, root) { - * return { - * init:function() { - * // perform init actions - * } - * }; - * }; - * @for F2 - */ -/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({}); - -/***/ }), - -/***/ 245: -/***/ ((module) => { - -/** -* The App Class is an optional class that can be namespaced onto the -* {{#crossLink "F2\Apps"}}{{/crossLink}} namespace. The -* [F2 Docs](../../app-development.html#app-class) -* has more information on the usage of the App Class. -* @class F2.App -* @constructor -* @param {F2.AppConfig} appConfig The F2.AppConfig object for the app -* @param {F2.AppManifest.AppContent} appContent The F2.AppManifest.AppContent -* object -* @param {Element} root The root DOM Element for the app -*/ -module.exports = function(appConfig, appContent, root) { - return { - /** - * An optional init function that will automatically be called when - *{{#crossLink "F2/registerApps"}}F2.registerApps(){{/crossLink}} is called. - * @method init - * @optional - */ - init:function() {}, - /** - * An optional destroy function that will automatically be called when - * {{#crossLink "F2/removeApp"}}F2.removeApp(){{/crossLink}} and subsequently - * the {{#crossLink "F2.Constants.AppHandlers/APP_DESTROY:property"}}F2.Constants.AppHandlers.APP_DESTROY{{/crossLink}} AppHandler. - * @method destroy - * @optional - */ - destroy:function() {} - }; -}; - - -/***/ }), - -/***/ 210: -/***/ ((module) => { - -/** - * The AppConfig object represents an app's meta data - * @class F2.AppConfig - */ -module.exports = { - /** - * The unique ID of the app. More information can be found - * [here](../../app-development.html#f2-appid) - * @property appId - * @type string - * @required - */ - appId: '', - /** - * An object that represents the context of an app - * @property context - * @type object - */ - context: {}, - /** - * True if the app should be requested in a single request with other apps. - * @property enableBatchRequests - * @type bool - * @default false - */ - enableBatchRequests: false, - /** - * The height of the app. The initial height will be pulled from - * the {{#crossLink "F2.AppConfig"}}{{/crossLink}} object - * @property height - * @type int - */ - height: 0, - /** - * The unique runtime ID of the app. - * - * **This property is populated during the - * F2.{{#crossLink "F2/registerApps"}}{{/crossLink}} process** - * @property instanceId - * @type string - */ - instanceId: '', - /** - * The language and region specification for this container - * represented as an IETF-defined standard language tag, - * e.g. `"en-us"` or `"de-de"`. This is passed during the - * F2.{{#crossLink "F2/registerApps"}}{{/crossLink}} process. - * - * @property containerLocale - * @type string - * @default null - * @since 1.4.0 - */ - containerLocale: null, - /** - * The languages and regions supported by this app represented - * as an array of IETF-defined standard language tags, - * e.g. `["en-us","de-de"]`. - * - * @property localeSupport - * @type array - * @default [] - * @since 1.4.0 - */ - localeSupport: [], - /** - * The url to retrieve the {{#crossLink "F2.AppManifest"}}{{/crossLink}} - * object. - * @property manifestUrl - * @type string - * @required - */ - manifestUrl: '', - /** - * The recommended maximum width in pixels that this app should be run. - * **It is up to the [container](../../container-development.html) to - * implement the logic to prevent an app from being run when the maxWidth - * requirements are not met.** - * @property maxWidth - * @type int - */ - maxWidth: 0, - /** - * The recommended minimum grid size that this app should be run. This - * value corresponds to the 12-grid system that is used by the - * [container](../../container-development.html). This property should be - * set by apps that require a certain number of columns in their layout. - * @property minGridSize - * @type int - * @default 4 - */ - minGridSize: 4, - /** - * The recommended minimum width in pixels that this app should be run. **It - * is up to the [container](../../container-development.html) to implement - * the logic to prevent an app from being run when the minWidth requirements - * are not met. - * @property minWidth - * @type int - * @default 300 - */ - minWidth: 300, - /** - * The name of the app - * @property name - * @type string - * @required - */ - name: '', - /** - * The root DOM element that contains the app - * - * **This property is populated during the - * F2.{{#crossLink "F2/registerApps"}}{{/crossLink}} process** - * @property root - * @type Element - */ - root: undefined -}; - -/***/ }), - -/***/ 595: -/***/ ((module) => { - -/** - * The AppContent object - * @class F2.AppManifest.AppContent - **/ -module.exports = { - /** - * Arbitrary data to be passed along with the app - * @property data - * @type object - * @optional - */ - data: {}, - /** - * The string of HTML representing the app - * @property html - * @type string - * @required - */ - html: '', - /** - * A status message - * @property status - * @type string - * @optional - */ - status: '' -}; - -/***/ }), - -/***/ 700: -/***/ ((module) => { - -/** - * The assets needed to render an app on the page - * @class F2.AppManifest - */ -module.exports = { - /** - * The array of {{#crossLink "F2.AppManifest.AppContent"}}{{/crossLink}} - * objects - * @property apps - * @type Array - * @required - */ - apps: [], - /** - * Any inline javascript tha should initially be run - * @property inlineScripts - * @type Array - * @optional - */ - inlineScripts: [], - /** - * Urls to javascript files required by the app - * @property scripts - * @type Array - * @optional - */ - scripts: [], - /** - * Urls to CSS files required by the app - * @property styles - * @type Array - * @optional - */ - styles: [] -}; - -/***/ }), - -/***/ 379: -/***/ ((module) => { - -/** - * An object containing configuration information for the - * [container](../../container-development.html) - * @class F2.ContainerConfig - */ -module.exports = { - /** - * True to enable debug mode in F2.js. Adds additional logging, resource cache busting, etc. - * @property debugMode - * @type bool - * @default false - */ - debugMode: false, - /** - * The default language and region specification for this container - * represented as an IETF-defined standard language tag, - * e.g. `"en-us"` or `"de-de"`. This value is passed to each app - * registered as `containerLocale`. - * - * @property locale - * @type string - * @default null - * @since 1.4.0 - */ - locale: null, - /** - * Milliseconds before F2 fires callback on script resource load errors. Due to issue with the way Internet Explorer attaches load events to script elements, the error event doesn't fire. - * @property scriptErrorTimeout - * @type milliseconds - * @default 7000 (7 seconds) - */ - scriptErrorTimeout: 7000, - /** - * Allows the container to fully override how the AppManifest request is - * made inside of F2. - * - * @method xhr - * @param {string} url The manifest url - * @param {Array} appConfigs An array of {{#crossLink "F2.AppConfig"}}{{/crossLink}} - * objects - * @param {function} success The function to be called if the request - * succeeds - * @param {function} error The function to be called if the request fails - * @param {function} complete The function to be called when the request - * finishes (after success and error callbacks have been executed) - * @return {XMLHttpRequest} The XMLHttpRequest object - * -  * @example -         *     F2.init({ -         *         xhr: function(url, appConfigs,successCallback, errorCallback, completeCallback) { -         *          var jsonpCallback = F2.Constants.JSONP_CALLBACK + appConfigs[0].appId, // Unique function name - * var fetchUrl = url + '?params=' + F2.stringify(appConfigs.apps, F2.appConfigReplacer); -         *          var fetchFunc = fetchJsonp(fetchUrl, { -         *                          timeout: 3000, -         *                          jsonpCallbackFunction: jsonpCallback -         *                          });                 -         *           fetchFunc.then(function(response) { -         *                          return response.json(); -         *                      }) -         *                      .then(function(data) { -         *                       successCallback(data); -         *                       completeCallback();                          -         *                  }) -         *                  .catch(function(error) { -         *                      F2.log('Failed to load app(s)', error.toString()); -         *                      errorCallback(); -         *                  }); -         *         } -         *     }); - * - * @for F2.ContainerConfig - */ - //xhr: function(url, appConfigs, success, error, complete) {}, - /** - * Allows the container to override individual parts of the AppManifest - * request. See properties and methods with the `xhr.` prefix. - * @property xhr - * @type Object - * - * @example - * F2.init({ - * xhr: { - * url: function(url, appConfigs) { - * return 'http://example.com/proxy.php?url=' + encocdeURIComponent(url); - * } - * } - * }); - */ - xhr: { - /** - * Allows the container to override the request data type (JSON or JSONP) - * that is used for the request - * @method xhr.dataType - * @param {string} url The manifest url - * @param {Array} appConfigs An array of {{#crossLink "F2.AppConfig"}}{{/crossLink}} - * objects - * @return {string} The request data type that should be used - * - * @example - * F2.init({ - * xhr: { - * dataType: function(url) { - * return F2.isLocalRequest(url) ? 'json' : 'jsonp'; - * }, - * type: function(url) { - * return F2.isLocalRequest(url) ? 'POST' : 'GET'; - * } - * } - * }); - */ - dataType: function(url, appConfigs) {}, - /** - * Allows the container to override the request method that is used. - * @method xhr.type - * @param {string} url The manifest url - * @param {Array} appConfigs An array of {{#crossLink "F2.AppConfig"}}{{/crossLink}} - * objects - * @return {string} The request method that should be used - * - * @example - * F2.init({ - * xhr: { - * dataType: function(url) { - * return F2.isLocalRequest(url) ? 'json' : 'jsonp'; - * }, - * type: function(url) { - * return F2.isLocalRequest(url) ? 'POST' : 'GET'; - * } - * } - * }); - */ - type: function(url, appConfigs) {}, - /** - * Allows the container to override the url that is used to request an - * app's F2.{{#crossLink "F2.AppManifest"}}{{/crossLink}} - * @method xhr.url - * @param {string} url The manifest url - * @param {Array} appConfigs An array of {{#crossLink "F2.AppConfig"}}{{/crossLink}} - * objects - * @return {string} The url that should be used for the request - * - * @example - * F2.init({ - * xhr: { - * url: function(url, appConfigs) { - * return 'http://example.com/proxy.php?url=' + encocdeURIComponent(url); - * } - * } - * }); - */ - url: function(url, appConfigs) {} - }, - /** - * Allows the container to override the script loader which requests - * dependencies defined in the {{#crossLink "F2.AppManifest"}}{{/crossLink}}. - * @property loadScripts - * @type function - * - * @example - * F2.init({ - * loadScripts: function(scripts,inlines,callback){ - * //load scripts using $.load() for each script or require(scripts) - * callback(); - * } - * }); - */ - loadScripts: function(scripts,inlines,callback){}, - /** - * Allows the container to override the stylesheet loader which requests - * dependencies defined in the {{#crossLink "F2.AppManifest"}}{{/crossLink}}. - * @property loadStyles - * @type function - * - * @example - * F2.init({ - * loadStyles: function(styles,callback){ - * //load styles using $.load() for each stylesheet or another method - * callback(); - * } - * }); - */ - loadStyles: function(styles,callback){} -}; - -/***/ }), - -/***/ 81: -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__) -/* harmony export */ }); -/* harmony import */ var _app__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(245); -/* harmony import */ var _app__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_app__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _appConfig__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(210); -/* harmony import */ var _appConfig__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_appConfig__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _appContent__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(595); -/* harmony import */ var _appContent__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_appContent__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var _appManifest__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(700); -/* harmony import */ var _appManifest__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_appManifest__WEBPACK_IMPORTED_MODULE_3__); -/* harmony import */ var _containerConfig__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(379); -/* harmony import */ var _containerConfig__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_containerConfig__WEBPACK_IMPORTED_MODULE_4__); - - - - - - -/** - * Class stubs for documentation purposes - * @main F2 - */ -/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({ - App: (_app__WEBPACK_IMPORTED_MODULE_0___default()), - AppConfig: (_appConfig__WEBPACK_IMPORTED_MODULE_1___default()), - AppContent: (_appContent__WEBPACK_IMPORTED_MODULE_2___default()), - AppManifest: (_appManifest__WEBPACK_IMPORTED_MODULE_3___default()), - ContainerConfig: (_containerConfig__WEBPACK_IMPORTED_MODULE_4___default()) -}); - - -/***/ }), - -/***/ 785: -/***/ ((module) => { - -/** - * Constants used throughout the Open Financial Framework - * @class F2.Constants.AppHandlers - * @static - */ -module.exports = { - /** - * When bound using {{#crossLink "F2.AppHandlers/on"}}F2.AppHandlers.on(){{/crossLink}} the listener function passed will receive the - * following argument(s): ( {{#crossLink "F2.AppConfig"}}appConfig{{/crossLink}} ) - * @property APP_MANIFEST_REQUEST_FAIL - * @type string - * @static - * @final - * @example - * var _token = F2.AppHandlers.getToken(); - * F2.AppHandlers.on( - * _token, - * F2.Constants.AppHandlers.APP_MANIFEST_REQUEST_FAIL, - * function(appConfig) - * { - * You can use information from the appConfig to surface a custom error message in the dom - * Or display some kind of default error placeholder element rather than having a blank spot in the dom - * } - * ); - */ - APP_MANIFEST_REQUEST_FAIL: 'appManifestRequestFail', - /** - * Equivalent to `appCreateRoot`. Identifies the create root method for use in AppHandlers.on/off. - * When bound using {{#crossLink "F2.AppHandlers/on"}}F2.AppHandlers.on(){{/crossLink}} the listener function passed will receive the - * following argument(s): ( {{#crossLink "F2.AppConfig"}}appConfig{{/crossLink}} ) - * @property APP_CREATE_ROOT - * @type string - * @static - * @final - * @example - * var _token = F2.AppHandlers.getToken(); - * F2.AppHandlers.on( - * _token, - * F2.Constants.AppHandlers.APP_CREATE_ROOT, - * function(appConfig) - * { - * // If you want to create a custom root. By default F2 uses the app's outermost HTML element. - * // the app's html is not available until after the manifest is retrieved so this logic occurs in F2.Constants.AppHandlers.APP_RENDER - * appConfig.root = document.createElement('section'); - * } - * ); - */ - APP_CREATE_ROOT: 'appCreateRoot', - /** - * Equivalent to `appRenderBefore`. Identifies the before app render method for use in AppHandlers.on/off. - * When bound using {{#crossLink "F2.AppHandlers/on"}}F2.AppHandlers.on(){{/crossLink}} the listener function passed will receive the - * following argument(s): ( {{#crossLink "F2.AppConfig"}}appConfig{{/crossLink}} ) - * @property APP_RENDER_BEFORE - * @type string - * @static - * @final - * @example - * var _token = F2.AppHandlers.getToken(); - * F2.AppHandlers.on( - * _token, - * F2.Constants.AppHandlers.APP_RENDER_BEFORE, - * function(appConfig) - * { - * F2.log(appConfig); - * } - * ); - */ - APP_RENDER_BEFORE: 'appRenderBefore', - /** - * Equivalent to `appRender`. Identifies the app render method for use in AppHandlers.on/off. - * When bound using {{#crossLink "F2.AppHandlers/on"}}F2.AppHandlers.on(){{/crossLink}} the listener function passed will receive the - * following argument(s): ( {{#crossLink "F2.AppConfig"}}appConfig{{/crossLink}}, [appHtml](../../app-development.html#app-design) ) - * @property APP_RENDER - * @type string - * @static - * @final - * @example - *   var _token = F2.AppHandlers.getToken(); -            *   F2.AppHandlers.on( -            *       _token, -            *       F2.Constants.AppHandlers.APP_RENDER, -            *       function(appConfig, appHtml) -            *       { -            *           // if no app root is defined use the app's outer most node -            *           if(!F2.isNativeDOMNode(appConfig.root)) -            *           { -            *               appConfig.root = domify(appHtml);                                -            *           } -            *           else -            *           {                        -            *               // append the app html to the root -            *               appConfig.root.appendChild(domify(appHtml)); -            *           }            -            *            -            *           // append the root to the body by default. -            *           document.body.appendChild(appConfig.root); -            *       } -            *   ); -            */ - APP_RENDER: 'appRender', - /** - * Equivalent to `appRenderAfter`. Identifies the after app render method for use in AppHandlers.on/off. - * When bound using {{#crossLink "F2.AppHandlers/on"}}F2.AppHandlers.on(){{/crossLink}} the listener function passed will receive the - * following argument(s): ( {{#crossLink "F2.AppConfig"}}appConfig{{/crossLink}} ) - * @property APP_RENDER_AFTER - * @type string - * @static - * @final - * @example - * var _token = F2.AppHandlers.getToken(); - * F2.AppHandlers.on( - * _token, - * F2.Constants.AppHandlers.APP_RENDER_AFTER, - * function(appConfig) - * { - * F2.log(appConfig); - * } - * ); - */ - APP_RENDER_AFTER: 'appRenderAfter', - /** - * Equivalent to `appDestroyBefore`. Identifies the before app destroy method for use in AppHandlers.on/off. - * When bound using {{#crossLink "F2.AppHandlers/on"}}F2.AppHandlers.on(){{/crossLink}} the listener function passed will receive the - * following argument(s): ( appInstance ) - * @property APP_DESTROY_BEFORE - * @type string - * @static - * @final - * @example - * var _token = F2.AppHandlers.getToken(); - * F2.AppHandlers.on( - * _token, - * F2.Constants.AppHandlers.APP_DESTROY_BEFORE, - * function(appInstance) - * { - * F2.log(appInstance); - * } - * ); - */ - APP_DESTROY_BEFORE: 'appDestroyBefore', - /** - * Equivalent to `appDestroy`. Identifies the app destroy method for use in AppHandlers.on/off. - * When bound using {{#crossLink "F2.AppHandlers/on"}}F2.AppHandlers.on(){{/crossLink}} the listener function passed will receive the - * following argument(s): ( appInstance ) - * @property APP_DESTROY - * @type string - * @static - * @final - * @example - *   var _token = F2.AppHandlers.getToken(); -            *   F2.AppHandlers.on( -            *       _token, -            *       F2.Constants.AppHandlers.APP_DESTROY, -            *       function(appInstance) -            *       { -            *           // call the apps destroy method, if it has one -            *           if(appInstance && appInstance.app && appInstance.app.destroy && typeof(appInstance.app.destroy) == 'function') -            *           { -            *               appInstance.app.destroy(); -            *           } -            *           else if(appInstance && appInstance.app && appInstance.app.destroy) -            *           { -            *               F2.log(appInstance.config.appId + ' has a destroy property, but destroy is not of type function and as such will not be executed.'); -            *           } -            *            -            *           // remove the root           -            *           appInstance.config.root.parentNode.removeChild(appInstance.config.root); -            *       } -            *   ); -            */ - APP_DESTROY: 'appDestroy', - /** - * Equivalent to `appDestroyAfter`. Identifies the after app destroy method for use in AppHandlers.on/off. - * When bound using {{#crossLink "F2.AppHandlers/on"}}F2.AppHandlers.on(){{/crossLink}} the listener function passed will receive the - * following argument(s): ( appInstance ) - * @property APP_DESTROY_AFTER - * @type string - * @static - * @final - * @example - *   var _token = F2.AppHandlers.getToken(); -            *   F2.AppHandlers.on( -            *       _token, -            *       F2.Constants.AppHandlers.APP_DESTROY_AFTER, -            *       function(appInstance) -            *       { -            *           F2.log(appInstance); -            *       } -            *   ); -            */ - APP_DESTROY_AFTER: 'appDestroyAfter', - /** - * Equivalent to `appScriptLoadFailed`. Identifies the app script load failed method for use in AppHandlers.on/off. - * When bound using {{#crossLink "F2.AppHandlers/on"}}F2.AppHandlers.on(){{/crossLink}} the listener function passed will receive the - * following argument(s): ( {{#crossLink "F2.AppConfig"}}appConfig{{/crossLink}}, scriptInfo ) - * @property APP_SCRIPT_LOAD_FAILED - * @type string - * @static - * @final - * @example - * var _token = F2.AppHandlers.getToken(); - * F2.AppHandlers.on( - * _token, - * F2.Constants.AppHandlers.APP_SCRIPT_LOAD_FAILED, - * function(appConfig, scriptInfo) - * { - * F2.log(appConfig.appId); - * } - * ); - */ - APP_SCRIPT_LOAD_FAILED: 'appScriptLoadFailed' -}; - -/***/ }), - -/***/ 10: -/***/ ((module) => { - -/** - * Constants used throughout the Open Financial Framework - * @class F2.Constants.Css - * @static - */ -module.exports = { - /** - * The APP class should be applied to the DOM Element that surrounds the - * entire app, including any extra html that surrounds the APP\_CONTAINER - * that is inserted by the container. See the - * {{#crossLink "F2.ContainerConfig"}}{{/crossLink}} object. - * @property APP - * @type string - * @static - * @final - */ - APP: 'f2-app', - /** - * The APP\_CONTAINER class should be applied to the outermost DOM Element - * of the app. - * @property APP_CONTAINER - * @type string - * @static - * @final - */ - APP_CONTAINER: 'f2-app-container' -}; - -/***/ }), - -/***/ 973: -/***/ ((module) => { - -/** - * Constants used throughout the Open Financial Framework - * @class F2.Constants.Events - * @static - */ -module.exports = { - /** - * The APP_SCRIPTS_LOADED event is fired when all the scripts defined in - * the AppManifest have been loaded. - * @property APP_SCRIPTS_LOADED - * @type string - * @static - * @final - */ - APP_SCRIPTS_LOADED: 'App.scriptsLoaded', - /** - * The APP\_SYMBOL\_CHANGE event is fired when the symbol is changed in an - * app. It is up to the app developer to fire this event. - * Returns an object with the symbol and company name: - * - * { symbol: 'MSFT', name: 'Microsoft Corp (NASDAQ)' } - * - * @property APP_SYMBOL_CHANGE - * @type string - * @static - * @final - */ - APP_SYMBOL_CHANGE: 'App.symbolChange', - /** - * The APP\_WIDTH\_CHANGE event will be fired by the container when the - * width of an app is changed. The app's instanceId should be concatenated - * to this constant. - * Returns an object with the gridSize and width in pixels: - * - * { gridSize:8, width:620 } - * - * @property APP_WIDTH_CHANGE - * @type string - * @static - * @final - */ - APP_WIDTH_CHANGE: 'App.widthChange.', - /** - * The CONTAINER\_SYMBOL\_CHANGE event is fired when the symbol is changed - * at the container level. This event should only be fired by the - * container or container provider. - * Returns an object with the symbol and company name: - * - * { symbol: 'MSFT', name: 'Microsoft Corp (NASDAQ)' } - * - * @property CONTAINER_SYMBOL_CHANGE - * @type string - * @static - * @final - */ - CONTAINER_SYMBOL_CHANGE: 'Container.symbolChange', - /** - * The CONTAINER\_WIDTH\_CHANGE event will be fired by the container when - * the width of the container has changed. - * @property CONTAINER_WIDTH_CHANGE - * @type string - * @static - * @final - */ - CONTAINER_WIDTH_CHANGE: 'Container.widthChange', - /** - * The CONTAINER\_LOCALE\_CHANGE event will be fired by the container when - * the locale of the container has changed. This event should only be fired by the - * container or container provider. - * Returns an object with the updated locale (IETF-defined standard language tag): - * - * { locale: 'en-us' } - * - * @property CONTAINER_LOCALE_CHANGE - * @type string - * @static - * @final - */ - CONTAINER_LOCALE_CHANGE: 'Container.localeChange', - /** - * The RESOURCE_FAILED_TO_LOAD event will be fired by the container when - * it fails to load a script or style. - * @property RESOURCE_FAILED_TO_LOAD - * @depreciated since 1.4 - * @type string - * @static - * @final - */ - RESOURCE_FAILED_TO_LOAD: 'Container.resourceFailedToLoad' -}; - - -/***/ }), - -/***/ 257: -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__) -/* harmony export */ }); -/* harmony import */ var _appHandlers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(785); -/* harmony import */ var _appHandlers__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_appHandlers__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _css__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(10); -/* harmony import */ var _css__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_css__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _events__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(973); -/* harmony import */ var _events__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_events__WEBPACK_IMPORTED_MODULE_2__); - - - - -/** - * Constants used throughout the Open Financial Framework - * @class F2.Constants - * @static - */ -/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({ - AppHandlers: (_appHandlers__WEBPACK_IMPORTED_MODULE_0___default()), - AppStatus: { - ERROR: 'ERROR', - SUCCESS: 'SUCCESS' - }, - Css: (_css__WEBPACK_IMPORTED_MODULE_1___default()), - Events: (_events__WEBPACK_IMPORTED_MODULE_2___default()), - JSONP_CALLBACK: 'F2_jsonpCallback_' -}); - - -/***/ }), - -/***/ 239: -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__) -/* harmony export */ }); -/* harmony import */ var _appHandlers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(282); -/* harmony import */ var _apps__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(24); -/* harmony import */ var _classes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(81); -/* harmony import */ var lodash_cloneDeep__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(525); -/* harmony import */ var lodash_cloneDeep__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(lodash_cloneDeep__WEBPACK_IMPORTED_MODULE_3__); -/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(257); -/* harmony import */ var domify__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(137); -/* harmony import */ var domify__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(domify__WEBPACK_IMPORTED_MODULE_5__); -/* harmony import */ var _events__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(478); -/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(555); -/* harmony import */ var fetch_jsonp__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(144); -/* harmony import */ var fetch_jsonp__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(fetch_jsonp__WEBPACK_IMPORTED_MODULE_8__); - - - - - - - - - - -var _apps = {}; -var _config = false; -var _sAppHandlerToken = _appHandlers__WEBPACK_IMPORTED_MODULE_0__/* .default.__f2GetToken */ .Z.__f2GetToken(); -var _loadingScripts = {}; - -/** - * Search for a value within an array. - * @method inArray - * @param {object} value The value to search for - * @param {Array} array The array to search - * @return {int} index of the value in the array, -1 if value not found - */ -var _inArray = function(value, array) { - if (Array.isArray(array)) { - return array.indexOf(value); - } - - for (var i = 0; i < array.length; i++) { - if (array[i] === value) { - return i; - } - } - - return -1; -}; - -/** - * Adds properties to the AppConfig object - * @method _createAppConfig - * @private - * @param {F2.AppConfig} appConfig The F2.AppConfig object - * @return {F2.AppConfig} The new F2.AppConfig object, prepopulated with - * necessary properties - */ -var _createAppConfig = function(appConfig) { - - // make a copy of the app config to ensure that the original is not modified - appConfig = lodash_cloneDeep__WEBPACK_IMPORTED_MODULE_3___default()(appConfig) || {}; - - // create the instanceId for the app - appConfig.instanceId = appConfig.instanceId || _utils__WEBPACK_IMPORTED_MODULE_7__/* .default.guid */ .Z.guid(); - - //pass container-defined locale to each app - if (_classes__WEBPACK_IMPORTED_MODULE_2__/* .default.ContainerConfig.locale */ .Z.ContainerConfig.locale){ - appConfig.containerLocale = _classes__WEBPACK_IMPORTED_MODULE_2__/* .default.ContainerConfig.locale */ .Z.ContainerConfig.locale; - } - - return appConfig; -}; - -/** - * Generate an AppConfig from the element's attributes - * @method _getAppConfigFromElement - * @private - * @param {Element} node The DOM node from which to generate the F2.AppConfig object - * @return {F2.AppConfig} The new F2.AppConfig object - */ -var _getAppConfigFromElement = function(node) { - var appConfig; - - if (node) { - var appId = node.getAttribute('data-f2-appid'); - var manifestUrl = node.getAttribute('data-f2-manifesturl'); - - if (appId && manifestUrl) { - appConfig = { - appId: appId, - enableBatchRequests: node.hasAttribute('data-f2-enablebatchrequests'), - manifestUrl: manifestUrl, - root: node - }; - - // See if the user passed in a block of serialized json - var contextJson = node.getAttribute('data-f2-context'); - - if (contextJson) { - try { - appConfig.context = _utils__WEBPACK_IMPORTED_MODULE_7__/* .default.parse */ .Z.parse(contextJson); - } - catch (e) { - console.warn('F2: "data-f2-context" of node is not valid JSON', '"' + e + '"'); - } - } - } - } - - return appConfig; -}; - -/** - * Returns true if the DOM node has children that are not text nodes - * @method _hasNonTextChildNodes - * @private - * @param {Element} node The DOM node - * @return {bool} True if there are non-text children - */ -var _hasNonTextChildNodes = function(node) { - var hasNodes = false; - - if (node.hasChildNodes()) { - for (var i = 0, len = node.childNodes.length; i < len; i++) { - if (node.childNodes[i].nodeType === 1) { - hasNodes = true; - break; - } - } - } - - return hasNodes; -}; - -/** - * Adds properties to the ContainerConfig object to take advantage of defaults - * @method _hydrateContainerConfig - * @private - * @param {F2.ContainerConfig} containerConfig The F2.ContainerConfig object - */ -var _hydrateContainerConfig = function(containerConfig) { - - if (!containerConfig.scriptErrorTimeout) { - containerConfig.scriptErrorTimeout = _classes__WEBPACK_IMPORTED_MODULE_2__/* .default.ContainerConfig.scriptErrorTimeout */ .Z.ContainerConfig.scriptErrorTimeout; - } - - if (containerConfig.debugMode !== true) { - containerConfig.debugMode = _classes__WEBPACK_IMPORTED_MODULE_2__/* .default.ContainerConfig.debugMode */ .Z.ContainerConfig.debugMode; - } - - if (containerConfig.locale && typeof containerConfig.locale == 'string'){ - _classes__WEBPACK_IMPORTED_MODULE_2__/* .default.ContainerConfig.locale */ .Z.ContainerConfig.locale = containerConfig.locale; - } -}; - -/** - * Attach container Events - * @method _initContainerEvents - * @private - */ -var _initContainerEvents = function() { - - var resizeTimeout; - var resizeHandler = function() { - _events__WEBPACK_IMPORTED_MODULE_6__/* .default.emit */ .Z.emit(_constants__WEBPACK_IMPORTED_MODULE_4__/* .default.Events.CONTAINER_WIDTH_CHANGE */ .Z.Events.CONTAINER_WIDTH_CHANGE); - }; - - // TODO: remove this on destroy() - window.addEventListener('resize', function() { - clearTimeout(resizeTimeout); - resizeTimeout = setTimeout(resizeHandler, 100); - }); - - //listen for container-broadcasted locale changes - _events__WEBPACK_IMPORTED_MODULE_6__/* .default.on */ .Z.on(_constants__WEBPACK_IMPORTED_MODULE_4__/* .default.Events.CONTAINER_LOCALE_CHANGE */ .Z.Events.CONTAINER_LOCALE_CHANGE,function(data){ - if (data.locale && typeof data.locale == 'string'){ - _classes__WEBPACK_IMPORTED_MODULE_2__/* .default.ContainerConfig.locale */ .Z.ContainerConfig.locale = data.locale; - } - }); -}; - -/** - * Checks if an element is a placeholder element - * @method _isPlaceholderElement - * @private - * @param {Element} node The DOM element to check - * @return {bool} True if the element is a placeholder - */ -var _isPlaceholderElement = function(node) { - return ( - _utils__WEBPACK_IMPORTED_MODULE_7__/* .default.isNativeDOMNode */ .Z.isNativeDOMNode(node) && - !_hasNonTextChildNodes(node) && - !!node.getAttribute('data-f2-appid') && - !!node.getAttribute('data-f2-manifesturl') - ); -}; - -/** - * Has the container been init? - * @method _isInit - * @private - * @return {bool} True if the container has been init - */ -var _isInit = function() { - return !!_config; -}; - -/** - * Instantiates each app from it's appConfig and stores that in a local private collection - * @method _createAppInstance - * @private - * @param {Array} appConfigs An array of {{#crossLink "F2.AppConfig"}}{{/crossLink}} objects - */ -var _createAppInstance = function(appConfig, appContent) { - // instantiate F2.App - if (_apps__WEBPACK_IMPORTED_MODULE_1__/* .default */ .Z[appConfig.appId] !== undefined) { - if (typeof _apps__WEBPACK_IMPORTED_MODULE_1__/* .default */ .Z[appConfig.appId] === 'function') { - - // IE - setTimeout(function() { - _apps[appConfig.instanceId].app = new _apps__WEBPACK_IMPORTED_MODULE_1__/* .default */ .Z[appConfig.appId](appConfig, appContent, appConfig.root); - if (_apps[appConfig.instanceId].app['init'] !== undefined) { - _apps[appConfig.instanceId].app.init(); - } - }, 0); - - } - else { - _utils__WEBPACK_IMPORTED_MODULE_7__/* .default.log */ .Z.log('app initialization class is defined but not a function. (' + appConfig.appId + ')'); - } - } -}; - -/** - * Loads the app's html/css/javascript - * @method loadApp - * @private - * @param {Array} appConfigs An array of - * {{#crossLink "F2.AppConfig"}}{{/crossLink}} objects - * @param {F2.AppManifest} [appManifest] The AppManifest object - */ -var _loadApps = function(appConfigs, appManifest) { - appConfigs = [].concat(appConfigs); - - // check that the number of apps in manifest matches the number requested - if (appConfigs.length != appManifest.apps.length) { - _utils__WEBPACK_IMPORTED_MODULE_7__/* .default.log */ .Z.log('The number of apps defined in the AppManifest do not match the number requested.', appManifest); - return; - } - - var _findExistingScripts = function() { - var scripts = document.querySelectorAll('script[src]') || []; - var src = []; - - for (var i = 0; i < scripts.length; i ++) { - src.push(scripts[i].src); - } - - return src; - }; - - var _findExistingStyles = function() { - var src = []; - var styles = document.querySelectorAll('link[href]') || []; - - for (var i = 0; i < styles.length; i ++) { - src.push(styles[i].src); - } - - return src; - }; - - // Fn for loading manifest Styles - var _loadStyles = function(styles, cb) { - // Reduce the list to styles that haven't been loaded - var existingStyles = _findExistingStyles(); - var filteredStyles = []; - - for (var i = 0; i < styles.length; i++) { - var url = styles[i]; - if (url && _inArray(url, existingStyles) === -1) { - filteredStyles.push(url); - } - } - - // Attempt to use the user provided method - if (_config.loadStyles) { - return _config.loadStyles(filteredStyles, cb); - } - - // load styles, see #101 - var stylesFragment = null, - useCreateStyleSheet = !!document.createStyleSheet; - - for (var j = 0; j < filteredStyles.length; j++) { - if (useCreateStyleSheet) { - document.createStyleSheet(filteredStyles[j]); - } - else { - stylesFragment = stylesFragment || []; - stylesFragment.push(''); - } - } - - if (stylesFragment) { - var node = domify__WEBPACK_IMPORTED_MODULE_5___default()(stylesFragment.join('')); - document.getElementsByTagName('head')[0].appendChild(node); - } - - cb(); - }; - - // For loading AppManifest.scripts - // Parts derived from curljs, headjs, requirejs, dojo - var _loadScripts = function(scripts, cb) { - // Reduce the list to scripts that haven't been loaded - var existingScripts = _findExistingScripts(); - var loadingScripts = Object.keys(_loadingScripts); - var filteredScripts = []; - - for (var i = 0; i < scripts.length; i++) { - var url = scripts[i]; - if (url && (_inArray(url, existingScripts) === -1 || _inArray(url, loadingScripts) !== -1)) { - filteredScripts.push(url); - } - } - - // Attempt to use the user provided method - if (_config.loadScripts) { - return _config.loadScripts(filteredScripts, cb); - } - - if (!filteredScripts.length) { - return cb(); - } - - var doc = window.document; - var scriptCount = filteredScripts.length; - var scriptsLoaded = 0; - //http://caniuse.com/#feat=script-async - // var supportsAsync = 'async' in doc.createElement('script') || 'MozAppearance' in doc.documentElement.style || window.opera; - var head = doc && (doc['head'] || doc.getElementsByTagName('head')[0]); - // to keep IE from crying, we need to put scripts before any - // elements, but after any . this should do it: - var insertBeforeEl = head && head.getElementsByTagName('base')[0] || null; - // Check for IE10+ so that we don't rely on onreadystatechange, readyStates for IE6-9 - var readyStates = 'addEventListener' in window ? {} : { 'loaded': true, 'complete': true }; - - // Log and emit event for the failed (400,500) scripts - var _error = function(e) { - setTimeout(function() { - var evtData = { - src: e.target.src, - appId: appConfigs[0].appId - }; - - // Send error to console - _utils__WEBPACK_IMPORTED_MODULE_7__/* .default.log */ .Z.log('Script defined in \'' + evtData.appId + '\' failed to load \'' + evtData.src + '\''); - - // @Brian ? TODO: deprecate, see #222 - _events__WEBPACK_IMPORTED_MODULE_6__/* .default.emit */ .Z.emit(_constants__WEBPACK_IMPORTED_MODULE_4__/* .default.Events.RESOURCE_FAILED_TO_LOAD */ .Z.Events.RESOURCE_FAILED_TO_LOAD, evtData); - - _appHandlers__WEBPACK_IMPORTED_MODULE_0__/* .default.__trigger */ .Z.__trigger( - _sAppHandlerToken, - _constants__WEBPACK_IMPORTED_MODULE_4__/* .default.AppHandlers.APP_SCRIPT_LOAD_FAILED */ .Z.AppHandlers.APP_SCRIPT_LOAD_FAILED, - appConfigs[0], - evtData.src - ); - }, _config.scriptErrorTimeout); // Defaults to 7000 - }; - - var _checkComplete = function() { - if (++scriptsLoaded === scriptCount) { - cb(); - } - }; - - var _emptyWaitlist = function(resourceKey, errorEvt) { - var waiting, - waitlist = _loadingScripts[resourceKey]; - - if (!waitlist) { - return; - } - - for (var i=0; i really is the best - head.insertBefore(script, insertBeforeEl); - }); - }; - - var _loadInlineScripts = function(inlines, cb) { - // Attempt to use the user provided method - if (_config.loadInlineScripts) { - _config.loadInlineScripts(inlines, cb); - } - else { - for (var i = 0, len = inlines.length; i < len; i++) { - try { - eval(inlines[i]); - } - catch (exception) { - _utils__WEBPACK_IMPORTED_MODULE_7__/* .default.log */ .Z.log('Error loading inline script: ' + exception + '\n\n' + inlines[i]); - - // Emit events - _events__WEBPACK_IMPORTED_MODULE_6__/* .default.emit */ .Z.emit('RESOURCE_FAILED_TO_LOAD', { appId:appConfigs[0].appId, src: inlines[i], err: exception }); - _appHandlers__WEBPACK_IMPORTED_MODULE_0__/* .default.__trigger */ .Z.__trigger( - _sAppHandlerToken, - _constants__WEBPACK_IMPORTED_MODULE_4__/* .default.AppHandlers.APP_SCRIPT_LOAD_FAILED */ .Z.AppHandlers.APP_SCRIPT_LOAD_FAILED, - appConfigs[0], - exception - ); - } - } - cb(); - } - }; - - // Determine whether an element has been added to the page - var elementInDocument = function(element) { - if (element) { - while (element.parentNode) { - element = element.parentNode; - - if (element === document) { - return true; - } - } - } - - return false; - }; - - // Fn for loading manifest app html - var _loadHtml = function(apps) { - apps.forEach(function(a, i) { - if (_isPlaceholderElement(appConfigs[i].root)) { - var node = domify__WEBPACK_IMPORTED_MODULE_5___default()(a.html); - node.classList.add(_constants__WEBPACK_IMPORTED_MODULE_4__/* .default.Css.APP_CONTAINER */ .Z.Css.APP_CONTAINER); - node.classList.add(appConfigs[i].appId); - appConfigs[i].root.classList.add(_constants__WEBPACK_IMPORTED_MODULE_4__/* .default.Css.APP */ .Z.Css.APP); - appConfigs[i].root.appendChild(node); - } - else { - var container = document.createElement('div'); - var childNode = domify__WEBPACK_IMPORTED_MODULE_5___default()(a.html); - childNode.classList.add(_constants__WEBPACK_IMPORTED_MODULE_4__/* .default.Css.APP_CONTAINER */ .Z.Css.APP_CONTAINER); - childNode.classList.add(appConfigs[i].appId); - container.appendChild(childNode); - - _appHandlers__WEBPACK_IMPORTED_MODULE_0__/* .default.__trigger */ .Z.__trigger( - _sAppHandlerToken, - _constants__WEBPACK_IMPORTED_MODULE_4__/* .default.AppHandlers.APP_RENDER */ .Z.AppHandlers.APP_RENDER, - appConfigs[i], // the app config - container.innerHTML - ); - - var appId = appConfigs[i].appId, - root = appConfigs[i].root; - - if (!root) { - throw ('Root for ' + appId + ' must be a native DOM element and cannot be null or undefined. Check your AppHandler callbacks to ensure you have set App root to a native DOM element.'); - } - - if (!elementInDocument(root)) { - throw ('App root for ' + appId + ' was not appended to the DOM. Check your AppHandler callbacks to ensure you have rendered the app root to the DOM.'); - } - - _appHandlers__WEBPACK_IMPORTED_MODULE_0__/* .default.__trigger */ .Z.__trigger( - _sAppHandlerToken, - _constants__WEBPACK_IMPORTED_MODULE_4__/* .default.AppHandlers.APP_RENDER_AFTER */ .Z.AppHandlers.APP_RENDER_AFTER, - appConfigs[i] // the app config - ); - - if (!_utils__WEBPACK_IMPORTED_MODULE_7__/* .default.isNativeDOMNode */ .Z.isNativeDOMNode(root)) { - throw ('App root for ' + appId + ' must be a native DOM element. Check your AppHandler callbacks to ensure you have set app root to a native DOM element.'); - } - } - - }); - }; - - // Pull out the manifest data - var scripts = appManifest.scripts || []; - var styles = appManifest.styles || []; - var inlines = appManifest.inlineScripts || []; - var apps = appManifest.apps || []; - - // Finally, load the styles, html, and scripts - _loadStyles(styles, function() { - // Put the html on the page - _loadHtml(apps); - // Add the script content to the page - _loadScripts(scripts, function() { - // emit event we're done with scripts - if (appConfigs[0]){ _events__WEBPACK_IMPORTED_MODULE_6__/* .default.emit */ .Z.emit('APP_SCRIPTS_LOADED', { appId:appConfigs[0].appId, scripts:scripts }); } - // Load any inline scripts - _loadInlineScripts(inlines, function() { - // Create the apps - appConfigs.forEach(function(a, i) { - _createAppInstance(a, appManifest.apps[i]); - }); - }); - }); - }); -}; - - -/** - * Checks if the app is valid - * @method _validateApp - * @private - * @param {F2.AppConfig} appConfig The F2.AppConfig object - * @returns {bool} True if the app is valid - */ -var _validateApp = function(appConfig) { - - // check for valid app configurations - if (!appConfig.appId) { - _utils__WEBPACK_IMPORTED_MODULE_7__/* .default.log */ .Z.log('"appId" missing from app object'); - return false; - } - else if (!appConfig.root && !appConfig.manifestUrl) { - _utils__WEBPACK_IMPORTED_MODULE_7__/* .default.log */ .Z.log('"manifestUrl" missing from app object'); - return false; - } - - return true; -}; - -/** - * Checks if the ContainerConfig is valid - * @method _validateContainerConfig - * @private - * @returns {bool} True if the config is valid - */ -var _validateContainerConfig = function() { - - if (_config) { - if (_config.xhr) { - if (!(typeof _config.xhr === 'function' || typeof _config.xhr === 'object')) { - throw ('ContainerConfig.xhr should be a function or an object'); - } - if (_config.xhr.dataType && typeof _config.xhr.dataType !== 'function') { - throw ('ContainerConfig.xhr.dataType should be a function'); - } - if (_config.xhr.type && typeof _config.xhr.type !== 'function') { - throw ('ContainerConfig.xhr.type should be a function'); - } - if (_config.xhr.url && typeof _config.xhr.url !== 'function') { - throw ('ContainerConfig.xhr.url should be a function'); - } - } - } - - return true; -}; - -/** - * Root namespace of the F2 SDK - * @module f2 - * @class F2 - */ -/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({ - /** - * Gets the current list of apps in the container - * @method getContainerState - * @returns {Array} An array of objects containing the appId - */ - getContainerState: function() { - if (!_isInit()) { - _utils__WEBPACK_IMPORTED_MODULE_7__/* .default.log */ .Z.log('F2.init() must be called before F2.getContainerState()'); - return; - } - - var apps = []; - - for (var i = 0; i < _apps.length; i++) { - apps.push({ - appId: _apps[i].config.appId - }); - } - - return apps; - }, - /** - * Gets the current locale defined by the container - * @method getContainerLocale - * @returns {String} IETF-defined standard language tag - */ - getContainerLocale: function() { - if (!_isInit()) { - _utils__WEBPACK_IMPORTED_MODULE_7__/* .default.log */ .Z.log('F2.init() must be called before F2.getContainerLocale()'); - return; - } - - return _classes__WEBPACK_IMPORTED_MODULE_2__/* .default.ContainerConfig.locale */ .Z.ContainerConfig.locale; - }, - /** - * Initializes the container. This method must be called before performing - * any other actions in the container. - * @method init - * @param {F2.ContainerConfig} config The configuration object - */ - init: function(config) { - _config = config || {}; - - _validateContainerConfig(); - - _hydrateContainerConfig(_config); - - // dictates whether we use the old logic or the new logic. - _initContainerEvents(); - }, - /** - * Has the container been init? - * @method isInit - * @return {bool} True if the container has been init - */ - isInit: _isInit, - /** - * Automatically load apps that are already defined in the DOM. Elements will - * be rendered into the location of the placeholder DOM element. Any AppHandlers - * that are defined will be bypassed. - * @method loadPlaceholders - * @param {Element} parentNode The element to search for placeholder apps - */ - loadPlaceholders: function(parentNode) { - - var self = this, - elements = [], - appConfigs = [], - add = function(e) { - if (!e) { return; } - elements.push(e); - }, - addAll = function(els) { - if (!els) { return; } - for (var i = 0, len = els.length; i < len; i++) { - add(els[i]); - } - }; - - if (!!parentNode && !_utils__WEBPACK_IMPORTED_MODULE_7__/* .default.isNativeDOMNode */ .Z.isNativeDOMNode(parentNode)) { - throw ('"parentNode" must be null or a DOM node'); - } - - // if the passed in element has a data-f2-appid attribute add - // it to the list of elements but to not search within that - // element for other placeholders - if (parentNode && parentNode.hasAttribute('data-f2-appid')) { - add(parentNode); - } else { - - // find placeholders within the parentNode only if - // querySelectorAll exists - parentNode = parentNode || document; - if (parentNode.querySelectorAll) { - addAll(parentNode.querySelectorAll('[data-f2-appid]')); - } - } - - for (var i = 0, len = elements.length; i < len; i++) { - var appConfig = _getAppConfigFromElement(elements[i]); - appConfigs.push(appConfig); - } - - if (appConfigs.length) { - self.registerApps(appConfigs); - } - }, - /** - * Begins the loading process for all apps and/or initialization process for pre-loaded apps. - * The app will be passed the {{#crossLink "F2.AppConfig"}}{{/crossLink}} object which will - * contain the app's unique instanceId within the container. If the - * {{#crossLink "F2.AppConfig"}}{{/crossLink}}.root property is populated the app is considered - * to be a pre-loaded app and will be handled accordingly. Optionally, the - * {{#crossLink "F2.AppManifest"}}{{/crossLink}} can be passed in and those - * assets will be used instead of making a request. - * @method registerApps - * @param {Array} appConfigs An array of {{#crossLink "F2.AppConfig"}}{{/crossLink}} - * objects - * @param {Array} [appManifests] An array of - * {{#crossLink "F2.AppManifest"}}{{/crossLink}} - * objects. This array must be the same length as the apps array that is - * objects. This array must be the same length as the apps array that is - * passed in. This can be useful if apps are loaded on the server-side and - * passed down to the client. - * @example - * Traditional App requests. - * - * // Traditional f2 app configs - * var arConfigs = [ - * { - * appId: 'com_externaldomain_example_app', - * context: {}, - * manifestUrl: 'http://www.externaldomain.com/F2/AppManifest' - * }, - * { - * appId: 'com_externaldomain_example_app', - * context: {}, - * manifestUrl: 'http://www.externaldomain.com/F2/AppManifest' - * }, - * { - * appId: 'com_externaldomain_example_app2', - * context: {}, - * manifestUrl: 'http://www.externaldomain.com/F2/AppManifest' - * } - * ]; - * - * F2.init(); - * F2.registerApps(arConfigs); - * - * @example - * Pre-loaded and tradition apps mixed. - * - * // Pre-loaded apps and traditional f2 app configs - * // you can preload the same app multiple times as long as you have a unique root for each - * var arConfigs = [ - * { - * appId: 'com_mydomain_example_app', - * context: {}, - * root: 'div#example-app-1', - * manifestUrl: '' - * }, - * { - * appId: 'com_mydomain_example_app', - * context: {}, - * root: 'div#example-app-2', - * manifestUrl: '' - * }, - * { - * appId: 'com_externaldomain_example_app', - * context: {}, - * manifestUrl: 'http://www.externaldomain.com/F2/AppManifest' - * } - * ]; - * - * F2.init(); - * F2.registerApps(arConfigs); - * - * @example - * Apps with predefined manifests. - * - * // Traditional f2 app configs - * var arConfigs = [ - * {appId: 'com_externaldomain_example_app', context: {}}, - * {appId: 'com_externaldomain_example_app', context: {}}, - * {appId: 'com_externaldomain_example_app2', context: {}} - * ]; - * - * // Pre requested manifest responses - * var arManifests = [ - * { - * apps: ['
Example App!
'], - * inlineScripts: [], - * scripts: ['http://www.domain.com/js/AppClass.js'], - * styles: ['http://www.domain.com/css/AppStyles.css'] - * }, - * { - * apps: ['
Example App!
'], - * inlineScripts: [], - * scripts: ['http://www.domain.com/js/AppClass.js'], - * styles: ['http://www.domain.com/css/AppStyles.css'] - * }, - * { - * apps: ['
Example App 2!
'], - * inlineScripts: [], - * scripts: ['http://www.domain.com/js/App2Class.js'], - * styles: ['http://www.domain.com/css/App2Styles.css'] - * } - * ]; - * - * F2.init(); - * F2.registerApps(arConfigs, arManifests); - */ - registerApps: function(appConfigs, appManifests) { - - if (!_isInit()) { - _utils__WEBPACK_IMPORTED_MODULE_7__/* .default.log */ .Z.log('F2.init() must be called before F2.registerApps()'); - return; - } - else if (!appConfigs) { - _utils__WEBPACK_IMPORTED_MODULE_7__/* .default.log */ .Z.log('At least one AppConfig must be passed when calling F2.registerApps()'); - return; - } - - var self = this; - var appStack = []; - var batches = {}; - var callbackStack = {}; - var haveManifests = false; - appConfigs = [].concat(appConfigs); - appManifests = [].concat(appManifests || []); - haveManifests = !! appManifests.length; - - // appConfigs must have a length - if (!appConfigs.length) { - _utils__WEBPACK_IMPORTED_MODULE_7__/* .default.log */ .Z.log('At least one AppConfig must be passed when calling F2.registerApps()'); - return; - // ensure that the array of apps and manifests are qual - } - else if (appConfigs.length && haveManifests && appConfigs.length != appManifests.length) { - _utils__WEBPACK_IMPORTED_MODULE_7__/* .default.log */ .Z.log('The length of "apps" does not equal the length of "appManifests"'); - return; - } - - // validate each app and assign it an instanceId - // then determine which apps can be batched together - appConfigs.forEach(function(a, i) { - // add properties and methods - a = _createAppConfig(a); - - // Will set to itself, for preloaded apps, or set to null for apps that aren't already - // on the page. - a.root = a.root || null; - - // we validate the app after setting the root property because pre-load apps do no require - // manifest url - if (!_validateApp(a)) { - return; // move to the next app - } - - // save app - _apps[a.instanceId] = { - config: a - }; - - // If the root property is defined then this app is considered to be preloaded and we will - // run it through that logic. - if (a.root && !_isPlaceholderElement(a.root)) { - if ((!a.root && typeof(a.root) != 'string') && !_utils__WEBPACK_IMPORTED_MODULE_7__/* .default.isNativeDOMNode */ .Z.isNativeDOMNode(a.root)) { - _utils__WEBPACK_IMPORTED_MODULE_7__/* .default.log */ .Z.log('AppConfig invalid for pre-load, not a valid string and not dom node'); - _utils__WEBPACK_IMPORTED_MODULE_7__/* .default.log */ .Z.log('AppConfig instance:', a); - throw ('Preloaded appConfig.root property must be a native dom node or a string representing a sizzle selector. Please check your inputs and try again.'); - } - - // instantiate F2.App - _createAppInstance(a, { - preloaded: true, - status: _constants__WEBPACK_IMPORTED_MODULE_4__/* .default.AppStatus.SUCCESS */ .Z.AppStatus.SUCCESS - }); - - - // Continue on in the .each loop, no need to continue because the app is on the page - // the js in initialized, and it is ready to role. - return; // equivalent to continue in .each - } - - if (!_isPlaceholderElement(a.root)) { - _appHandlers__WEBPACK_IMPORTED_MODULE_0__/* .default.__trigger */ .Z.__trigger( - _sAppHandlerToken, - _constants__WEBPACK_IMPORTED_MODULE_4__/* .default.AppHandlers.APP_CREATE_ROOT */ .Z.AppHandlers.APP_CREATE_ROOT, - a // the app config - ); - - _appHandlers__WEBPACK_IMPORTED_MODULE_0__/* .default.__trigger */ .Z.__trigger( - _sAppHandlerToken, - _constants__WEBPACK_IMPORTED_MODULE_4__/* .default.AppHandlers.APP_RENDER_BEFORE */ .Z.AppHandlers.APP_RENDER_BEFORE, - a // the app config - ); - } - - // if we have the manifest, go ahead and load the app - if (haveManifests) { - _loadApps(a, appManifests[i]); - } - else { - // check if this app can be batched - if (a.enableBatchRequests) { - batches[a.manifestUrl.toLowerCase()] = batches[a.manifestUrl.toLowerCase()] || []; - batches[a.manifestUrl.toLowerCase()].push(a); - } - else { - appStack.push({ - apps: [a], - url: a.manifestUrl - }); - } - } - }); - - // we don't have the manifests, go ahead and load them - if (!haveManifests) { - // add the batches to the appStack - for (var key in batches) { - appStack.push({ - url: key, - apps: batches[key] - }); - } - - // if an app is being loaded more than once on the page, there is the - // potential that the jsonp callback will be clobbered if the request - // for the AppManifest for the app comes back at the same time as - // another request for the same app. We'll create a callbackStack - // that will ensure that requests for the same app are loaded in order - // rather than at the same time - appStack.forEach(function(req, i) { - // define the callback function based on the first app's App ID - var jsonpCallback = _constants__WEBPACK_IMPORTED_MODULE_4__/* .default.JSONP_CALLBACK */ .Z.JSONP_CALLBACK + req.apps[0].appId; - - // push the request onto the callback stack - callbackStack[jsonpCallback] = callbackStack[jsonpCallback] || []; - callbackStack[jsonpCallback].push(req); - }); - - // loop through each item in the callback stack and make the request - // for the AppManifest. When the request is complete, pop the next - // request off the stack and make the request. - for (var i in callbackStack) { - /*jshint loopfunc: true */ - var requests = callbackStack[i]; - var manifestRequest = function(jsonpCallback, req) { - if (!req) { - return; - } - - // setup defaults and callbacks - var url = req.url, - type = 'GET', - dataType = 'jsonp', - completeFunc = function() { - manifestRequest(i, requests.pop()); - }, - errorFunc = function() { - req.apps.forEach(function(item, idx) { - item.name = item.name || item.appId; - _utils__WEBPACK_IMPORTED_MODULE_7__/* .default.log */ .Z.log('Removed failed ' + item.name + ' app', item); - _appHandlers__WEBPACK_IMPORTED_MODULE_0__/* .default.__trigger */ .Z.__trigger( - _sAppHandlerToken, - _constants__WEBPACK_IMPORTED_MODULE_4__/* .default.AppHandlers.APP_MANIFEST_REQUEST_FAIL */ .Z.AppHandlers.APP_MANIFEST_REQUEST_FAIL, - item // the app config - ); - self.removeApp(item.instanceId); - }); - }, - successFunc = function(appManifest) { - _loadApps(req.apps, appManifest); - }; - - // optionally fire xhr overrides - if (_config.xhr && _config.xhr.dataType) { - dataType = _config.xhr.dataType(req.url, req.apps); - if (typeof dataType !== 'string') { - throw ('ContainerConfig.xhr.dataType should return a string'); - } - } - if (_config.xhr && _config.xhr.type) { - type = _config.xhr.type(req.url, req.apps); - if (typeof type !== 'string') { - throw ('ContainerConfig.xhr.type should return a string'); - } - } - if (_config.xhr && _config.xhr.url) { - url = _config.xhr.url(req.url, req.apps); - if (typeof url !== 'string') { - throw ('ContainerConfig.xhr.url should return a string'); - } - } - - // setup the default request function if an override is not present - var requestFunc = _config.xhr; - if (typeof requestFunc !== 'function') { - requestFunc = function(url, appConfigs, successCallback, errorCallback, completeCallback) { - if (!window.fetch) { - throw ('Browser does not support the Fetch API.'); - } - - var fetchFunc, - fetchUrl = url + '?params=' + _utils__WEBPACK_IMPORTED_MODULE_7__/* .default.stringify */ .Z.stringify(req.apps, _utils__WEBPACK_IMPORTED_MODULE_7__/* .default.appConfigReplacer */ .Z.appConfigReplacer); - - // Fetch API does not support the JSONP calls so making JSON calls using Fetch API and - // JSONP call using fetch-jsonp package (https://www.npmjs.com/package/fetch-jsonp) - if (dataType === 'json') { - var fetchInputs = { - method: type, - mode: 'no-cors' - }; - - if (type === 'POST') { - fetchUrl = url; - fetchInputs.body = { - params: _utils__WEBPACK_IMPORTED_MODULE_7__/* .default.stringify */ .Z.stringify(req.apps, _utils__WEBPACK_IMPORTED_MODULE_7__/* .default.appConfigReplacer */ .Z.appConfigReplacer) - }; - } - - fetchFunc = fetch(fetchUrl, fetchInputs); - } else if (dataType === 'jsonp') { - fetchFunc = fetch_jsonp__WEBPACK_IMPORTED_MODULE_8___default()(fetchUrl, { - timeout: 3000, - jsonpCallbackFunction: jsonpCallback - }); - } - - fetchFunc.then(function(response) { - return response.json(); - }) - .then(function(data) { - successCallback(data); - completeCallback(); - }) - .catch(function(error) { - _utils__WEBPACK_IMPORTED_MODULE_7__/* .default.log */ .Z.log('Failed to load app(s)', error, req.apps); - errorCallback(); - }); - }; - } - - requestFunc(url, req.apps, successFunc, errorFunc, completeFunc); - }; - - manifestRequest(i, requests.pop()); - } - - } - }, - /** - * Removes all apps from the container - * @method removeAllApps - */ - removeAllApps: function() { - - var self = this; - - if (!_isInit()) { - _utils__WEBPACK_IMPORTED_MODULE_7__/* .default.log */ .Z.log('F2.init() must be called before F2.removeAllApps()'); - return; - } - - if(Object.keys(_apps).length > 0) { -  Object.keys(_apps).forEach(function(key) { -   self.removeApp(_apps[key].config.instanceId); - }); - } - }, - /** - * Removes an app from the container - * @method removeApp - * @param {string} instanceId The app's instanceId - */ - removeApp: function(instanceId) { - - if (!_isInit()) { - _utils__WEBPACK_IMPORTED_MODULE_7__/* .default.log */ .Z.log('F2.init() must be called before F2.removeApp()'); - return; - } - - if (_apps[instanceId]) { - _appHandlers__WEBPACK_IMPORTED_MODULE_0__/* .default.__trigger */ .Z.__trigger( - _sAppHandlerToken, - _constants__WEBPACK_IMPORTED_MODULE_4__/* .default.AppHandlers.APP_DESTROY_BEFORE */ .Z.AppHandlers.APP_DESTROY_BEFORE, - _apps[instanceId] // the app instance - ); - - _appHandlers__WEBPACK_IMPORTED_MODULE_0__/* .default.__trigger */ .Z.__trigger( - _sAppHandlerToken, - _constants__WEBPACK_IMPORTED_MODULE_4__/* .default.AppHandlers.APP_DESTROY */ .Z.AppHandlers.APP_DESTROY, - _apps[instanceId] // the app instance - ); - - _appHandlers__WEBPACK_IMPORTED_MODULE_0__/* .default.__trigger */ .Z.__trigger( - _sAppHandlerToken, - _constants__WEBPACK_IMPORTED_MODULE_4__/* .default.AppHandlers.APP_DESTROY_AFTER */ .Z.AppHandlers.APP_DESTROY_AFTER, - _apps[instanceId] // the app instance - ); - - delete _apps[instanceId]; - } - } -}); - - -/***/ }), - -/***/ 478: -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__) -/* harmony export */ }); -/* harmony import */ var eventemitter2__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(387); -/* harmony import */ var eventemitter2__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(eventemitter2__WEBPACK_IMPORTED_MODULE_0__); - - -/** - * Handles [Context](../../app-development.html#context) passing from - * containers to apps and apps to apps. - * @class F2.Events - */ -/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ((function() { - // init EventEmitter - var _events = new (eventemitter2__WEBPACK_IMPORTED_MODULE_0___default())({ - wildcard:true - }); - - // unlimited listeners, set to > 0 for debugging - _events.setMaxListeners(0); - - return { - /** - * Execute each of the listeners that may be listening for the specified - * event name in order with the list of arguments. - * @method emit - * @param {string} event The event name - * @param {object} [arg]* The arguments to be passed - */ - emit: function() { - return eventemitter2__WEBPACK_IMPORTED_MODULE_0___default().prototype.emit.apply(_events, [].slice.call(arguments)); - }, - /** - * Adds a listener that will execute n times for the event before being - * removed. The listener is invoked only the first time the event is - * fired, after which it is removed. - * @method many - * @param {string} event The event name - * @param {int} timesToListen The number of times to execute the event - * before being removed - * @param {function} listener The function to be fired when the event is - * emitted - */ - many: function(event, timesToListen, listener) { - return _events.many(event, timesToListen, listener); - }, - /** - * Remove a listener for the specified event. - * @method off - * @param {string} event The event name - * @param {function} listener The function that will be removed - */ - off: function(event, listener) { - return _events.off(event, listener); - }, - /** - * Adds a listener for the specified event - * @method on - * @param {string} event The event name - * @param {function} listener The function to be fired when the event is - * emitted - */ - on: function(event, listener){ - return _events.on(event, listener); - }, - /** - * Adds a one time listener for the event. The listener is invoked only - * the first time the event is fired, after which it is removed. - * @method once - * @param {string} event The event name - * @param {function} listener The function to be fired when the event is - * emitted - */ - once: function(event, listener) { - return _events.once(event, listener); - } - }; -})()); - - -/***/ }), - -/***/ 555: -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__) -/* harmony export */ }); -/** - * Abosolutizes a relative URL - * @method _absolutizeURI - * @private - * @param {e.g., location.href} base - * @param {URL to absolutize} href - * @return {string} URL - * Source: https://gist.github.com/Yaffle/1088850 - * Tests: http://skew.org/uri/uri_tests.html - */ - var _absolutizeURI = function(base, href) {// RFC 3986 - - function removeDotSegments(input) { - var output = []; - input.replace(/^(\.\.?(\/|$))+/, '') - .replace(/\/(\.(\/|$))+/g, '/') - .replace(/\/\.\.$/, '/../') - .replace(/\/?[^\/]*/g, function (p) { - if (p === '/..') { - output.pop(); - } else { - output.push(p); - } - }); - return output.join('').replace(/^\//, input.charAt(0) === '/' ? '/' : ''); - } - - href = _parseURI(href || ''); - base = _parseURI(base || ''); - - return !href || !base ? null : (href.protocol || base.protocol) + - (href.protocol || href.authority ? href.authority : base.authority) + - removeDotSegments(href.protocol || href.authority || href.pathname.charAt(0) === '/' ? href.pathname : (href.pathname ? ((base.authority && !base.pathname ? '/' : '') + base.pathname.slice(0, base.pathname.lastIndexOf('/') + 1) + href.pathname) : base.pathname)) + - (href.protocol || href.authority || href.pathname ? href.search : (href.search || base.search)) + - href.hash; -}; - -/** - * Parses URI - * @method _parseURI - * @private - * @param {The URL to parse} url - * @return {Parsed URL} string - * Source: https://gist.github.com/Yaffle/1088850 - * Tests: http://skew.org/uri/uri_tests.html - */ -var _parseURI = function(url) { - var m = String(url).replace(/^\s+|\s+$/g, '').match(/^([^:\/?#]+:)?(\/\/(?:[^:@]*(?::[^:@]*)?@)?(([^:\/?#]*)(?::(\d*))?))?([^?#]*)(\?[^#]*)?(#[\s\S]*)?/); - // authority = '//' + user + ':' + pass '@' + hostname + ':' port - return (m ? { - href : m[0] || '', - protocol : m[1] || '', - authority: m[2] || '', - host : m[3] || '', - hostname : m[4] || '', - port : m[5] || '', - pathname : m[6] || '', - search : m[7] || '', - hash : m[8] || '' - } : null); -}; - -/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({ - /** - * A function to pass into F2.stringify which will prevent circular - * reference errors when serializing objects - * @method appConfigReplacer - */ - appConfigReplacer: function(key, value) { - if (key == 'root' || key == 'ui' || key == 'height') { - return undefined; - } else { - return value; - } - }, - /** - * Creates a namespace on F2 and copies the contents of an object into - * that namespace optionally overwriting existing properties. - * @method extend - * @param {string} ns The namespace to create. Pass a falsy value to - * add properties to the F2 namespace directly. - * @param {object} obj The object to copy into the namespace. - * @param {bool} overwrite True if object properties should be overwritten - * @return {object} The created object - */ - extend: function (ns, obj, overwrite) { - var isFunc = typeof obj === 'function'; - var parts = ns ? ns.split('.') : []; - var parent = this; - obj = obj || {}; - - // ignore leading global - if (parts[0] === 'F2') { - parts = parts.slice(1); - } - - // create namespaces - for (var i = 0, len = parts.length; i < len; i++) { - if (!parent[parts[i]]) { - parent[parts[i]] = isFunc && i + 1 == len ? obj : {}; - } - parent = parent[parts[i]]; - } - - // copy object into namespace - if (!isFunc) { - for (var prop in obj) { - if (typeof parent[prop] === 'undefined' || overwrite) { - parent[prop] = obj[prop]; - } - } - } - - return parent; - }, - /** - * Generates a somewhat random id - * @method guid - * @return {string} A random id - * @for F2 - */ - guid: function() { - var S4 = function() { - return (((1+Math.random())*0x10000)|0).toString(16).substring(1); - }; - return (S4()+S4()+'-'+S4()+'-'+S4()+'-'+S4()+'-'+S4()+S4()+S4()); - }, - /** - * Tests a URL to see if it's on the same domain (local) or not - * @method isLocalRequest - * @param {URL to test} url - * @return {bool} Whether the URL is local or not - * Derived from: https://github.com/jquery/jquery/blob/master/src/ajax.js - */ - isLocalRequest: function(url){ - var rurl = /^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/, - urlLower = url.toLowerCase(), - parts = rurl.exec( urlLower ), - ajaxLocation, - ajaxLocParts; - - try { - ajaxLocation = location.href; - } catch( e ) { - // Use the href attribute of an A element - // since IE will modify it given document.location - ajaxLocation = document.createElement('a'); - ajaxLocation.href = ''; - ajaxLocation = ajaxLocation.href; - } - - ajaxLocation = ajaxLocation.toLowerCase(); - - // uh oh, the url must be relative - // make it fully qualified and re-regex url - if (!parts){ - urlLower = _absolutizeURI(ajaxLocation,urlLower).toLowerCase(); - parts = rurl.exec( urlLower ); - } - - // Segment location into parts - ajaxLocParts = rurl.exec( ajaxLocation ) || []; - - // do hostname and protocol and port of manifest URL match location.href? (a "local" request on the same domain) - var matched = !(parts && - (parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] || - (parts[ 3 ] || (parts[ 1 ] === 'http:' ? '80' : '443')) !== - (ajaxLocParts[ 3 ] || (ajaxLocParts[ 1 ] === 'http:' ? '80' : '443')))); - - return matched; - }, - /** - * Utility method to determine whether or not the argument passed in is or is not a native dom node. - * @method isNativeDOMNode - * @param {object} testObject The object you want to check as native dom node. - * @return {bool} Returns true if the object passed is a native dom node. - */ - isNativeDOMNode: function(testObject) { - var bIsNode = ( - typeof Node === 'object' ? testObject instanceof Node : - testObject && typeof testObject === 'object' && typeof testObject.nodeType === 'number' && typeof testObject.nodeName === 'string' - ); - - var bIsElement = ( - typeof HTMLElement === 'object' ? testObject instanceof HTMLElement : //DOM2 - testObject && typeof testObject === 'object' && testObject.nodeType === 1 && typeof testObject.nodeName === 'string' - ); - - return (bIsNode || bIsElement); - }, - /** - * A utility logging function to write messages or objects to the browser console. This is a proxy for the [`console` API](https://developers.google.com/chrome-developer-tools/docs/console). - * @method log - * @param {object|string} Object/Method An object to be logged _or_ a `console` API method name, such as `warn` or `error`. All of the console method names are [detailed in the Chrome docs](https://developers.google.com/chrome-developer-tools/docs/console-api). - * @param {object} [obj2]* An object to be logged - * @example - //Pass any object (string, int, array, object, bool) to .log() - F2.log('foo'); - F2.log(myArray); - //Use a console method name as the first argument. - F2.log('error', err); - F2.log('info', 'The session ID is ' + sessionId); - * Some code derived from [HTML5 Boilerplate console plugin](https://github.com/h5bp/html5-boilerplate/blob/master/js/plugins.js) - */ - log: function() { - var _log; - var _logMethod = 'log'; - var method; - var noop = function () { }; - var methods = [ - 'assert', 'clear', 'count', 'debug', 'dir', 'dirxml', 'error', - 'exception', 'group', 'groupCollapsed', 'groupEnd', 'info', 'log', - 'markTimeline', 'profile', 'profileEnd', 'table', 'time', 'timeEnd', - 'timeStamp', 'trace', 'warn' - ]; - var length = methods.length; - var console = (window.console = window.console || {}); - var args; - - while (length--) { - method = methods[length]; - - // Only stub undefined methods. - if (!console[method]) { - console[method] = noop; - } - - //if first arg is a console function, use it. - //defaults to console.log() - if (arguments && arguments.length > 1 && arguments[0] == method){ - _logMethod = method; - //remove console func from args - args = Array.prototype.slice.call(arguments, 1); - } - } - - if (Function.prototype.bind) { - _log = Function.prototype.bind.call(console[_logMethod], console); - } else { - _log = function() { - Function.prototype.apply.call(console[_logMethod], console, (args || arguments)); - }; - } - - _log.apply(this, (args || arguments)); - }, - /** - * Wrapper to convert a JSON string to an object - * @method parse - * @param {string} str The JSON string to convert - * @return {object} The parsed object - */ - parse: function(str) { - return JSON.parse(str); - }, - /** - * Wrapper to convert an object to JSON - * - * **Note: When using F2.stringify on an F2.AppConfig object, it is - * recommended to pass F2.appConfigReplacer as the replacer function in - * order to prevent circular serialization errors.** - * @method stringify - * @param {object} value The object to convert - * @param {function|Array} replacer An optional parameter that determines - * how object values are stringified for objects. It can be a function or an - * array of strings. - * @param {int|string} space An optional parameter that specifies the - * indentation of nested structures. If it is omitted, the text will be - * packed without extra whitespace. If it is a number, it will specify the - * number of spaces to indent at each level. If it is a string (such as '\t' - * or ' '), it contains the characters used to indent at each level. - * @return {string} The JSON string - */ - stringify: function(value, replacer, space) { - return JSON.stringify(value, replacer, space); - }, - /** - * Function to get the F2 version number - * @method version - * @return {string} F2 version number - */ - version: function() { - /* jshint undef: false */ - return "2.0.0-alpha"; - } -}); - - -/***/ }) - -/******/ }); -/************************************************************************/ -/******/ // The module cache -/******/ var __webpack_module_cache__ = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ // Check if module is in cache -/******/ var cachedModule = __webpack_module_cache__[moduleId]; -/******/ if (cachedModule !== undefined) { -/******/ return cachedModule.exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = __webpack_module_cache__[moduleId] = { -/******/ id: moduleId, -/******/ loaded: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.loaded = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/************************************************************************/ -/******/ /* webpack/runtime/compat get default export */ -/******/ (() => { -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = (module) => { -/******/ var getter = module && module.__esModule ? -/******/ () => (module['default']) : -/******/ () => (module); -/******/ __webpack_require__.d(getter, { a: getter }); -/******/ return getter; -/******/ }; -/******/ })(); -/******/ -/******/ /* webpack/runtime/define property getters */ -/******/ (() => { -/******/ // define getter functions for harmony exports -/******/ __webpack_require__.d = (exports, definition) => { -/******/ for(var key in definition) { -/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { -/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); -/******/ } -/******/ } -/******/ }; -/******/ })(); -/******/ -/******/ /* webpack/runtime/global */ -/******/ (() => { -/******/ __webpack_require__.g = (function() { -/******/ if (typeof globalThis === 'object') return globalThis; -/******/ try { -/******/ return this || new Function('return this')(); -/******/ } catch (e) { -/******/ if (typeof window === 'object') return window; -/******/ } -/******/ })(); -/******/ })(); -/******/ -/******/ /* webpack/runtime/hasOwnProperty shorthand */ -/******/ (() => { -/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) -/******/ })(); -/******/ -/******/ /* webpack/runtime/node module decorator */ -/******/ (() => { -/******/ __webpack_require__.nmd = (module) => { -/******/ module.paths = []; -/******/ if (!module.children) module.children = []; -/******/ return module; -/******/ }; -/******/ })(); -/******/ -/************************************************************************/ -var __webpack_exports__ = {}; -// This entry need to be wrapped in an IIFE because it need to be in strict mode. -(() => { -"use strict"; - -// EXPORTS -__webpack_require__.d(__webpack_exports__, { - "default": () => (/* binding */ src) -}); - -// EXTERNAL MODULE: ./src/appHandlers.js -var appHandlers = __webpack_require__(282); -// EXTERNAL MODULE: ./src/apps.js -var apps = __webpack_require__(24); -// EXTERNAL MODULE: ./src/container.js -var container = __webpack_require__(239); -;// CONCATENATED MODULE: ./src/autoload.js - - -/* harmony default export */ function autoload() { - - var callback = function() { - var autoloadEls = [], - add = function(e) { - if (!e) { return; } - autoloadEls.push(e); - }, - addAll = function(els) { - if (!els) { return; } - for (var i = 0, len = els.length; i < len; i++) { - add(els[i]); - } - }; - - // support id-based autoload - add(document.getElementById('f2-autoload')); - - // support class/attribute based autoload - if (document.querySelectorAll) { - addAll(document.querySelectorAll('[data-f2-autoload]')); - addAll(document.querySelectorAll('.f2-autoload')); - } - - // if elements were found, auto-init F2 and load any placeholders - if (autoloadEls.length) { - container/* default.init */.Z.init(); - for (var i = 0, len = autoloadEls.length; i < len; i++) { - container/* default.loadPlaceholders */.Z.loadPlaceholders(autoloadEls[i]); - } - } - }; - - if (document.readyState === 'complete' || (document.readyState !== 'loading' && !document.documentElement.doScroll)) { - callback(); - } else { - document.addEventListener('DOMContentLoaded', callback); - } -} -// EXTERNAL MODULE: ./src/classes/index.js -var classes = __webpack_require__(81); -// EXTERNAL MODULE: ./src/constants/index.js -var constants = __webpack_require__(257); -// EXTERNAL MODULE: ./src/events.js -var events = __webpack_require__(478); -// EXTERNAL MODULE: ./src/utils.js -var utils = __webpack_require__(555); -;// CONCATENATED MODULE: ./src/index.js - - - - - - - - - -autoload(); - -/** - * Open F2 - * @module f2 - * @main f2 - */ -const lib = { - ...utils/* default */.Z, - ...classes/* default */.Z, - ...container/* default */.Z, - AppHandlers: appHandlers/* default */.Z, - Apps: apps/* default */.Z, - Constants: constants/* default */.Z, - Events: events/* default */.Z -}; - -// always export F2 as a global -window.F2 = lib; - -/* harmony default export */ const src = (lib); -})(); - -__webpack_exports__ = __webpack_exports__.default; -/******/ return __webpack_exports__; -/******/ })() -; -}); -//# sourceMappingURL=f2.js.map \ No newline at end of file diff --git a/dist/f2.js.map b/dist/f2.js.map deleted file mode 100644 index 89d580e6..00000000 --- a/dist/f2.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["webpack://F2/webpack/universalModuleDefinition","webpack://F2/./node_modules/domify/index.js","webpack://F2/./node_modules/eventemitter2/lib/eventemitter2.js","webpack://F2/./node_modules/fetch-jsonp/build/fetch-jsonp.js","webpack://F2/./node_modules/lodash.cloneDeep/index.js","webpack://F2/./src/appHandlers.js","webpack://F2/./src/apps.js","webpack://F2/./src/classes/app.js","webpack://F2/./src/classes/appConfig.js","webpack://F2/./src/classes/appContent.js","webpack://F2/./src/classes/appManifest.js","webpack://F2/./src/classes/containerConfig.js","webpack://F2/./src/classes/index.js","webpack://F2/./src/constants/appHandlers.js","webpack://F2/./src/constants/css.js","webpack://F2/./src/constants/events.js","webpack://F2/./src/constants/index.js","webpack://F2/./src/container.js","webpack://F2/./src/events.js","webpack://F2/./src/utils.js","webpack://F2/webpack/bootstrap","webpack://F2/webpack/runtime/compat get default export","webpack://F2/webpack/runtime/define property getters","webpack://F2/webpack/runtime/global","webpack://F2/webpack/runtime/hasOwnProperty shorthand","webpack://F2/webpack/runtime/node module decorator","webpack://F2/./src/autoload.js","webpack://F2/./src/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;;;;;;;ACTA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,SAAS;AACpB,YAAY,QAAQ;AACpB;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA,wCAAwC;;AAExC;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;;;;;;AC/GA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,mBAAmB,SAAS;AAC5B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,OAAO;AACP;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA,0CAA0C;;AAE1C;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,mBAAmB,YAAY;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;;AAEP;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,OAAO;AACP;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,YAAY;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,SAAS;AAC5B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;;AAEX;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,OAAO;AACP;AACA,OAAO;AACP;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA,kDAAkD,qBAAqB;AACvE;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,OAAO;AACP;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA,OAAO;AACP;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,iBAAiB,aAAa;AAC9B;AACA;AACA;AACA;AACA;;;;AAIA;;AAEA,eAAe,SAAS;AACxB;;AAEA,2CAA2C;;AAE3C;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA,WAAW;AACX;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA,UAAU;AACV;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,OAAO;AACP;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW;AACX;AACA;AACA,WAAW;AACX;AACA;AACA,WAAW;AACX;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,4CAA4C;;AAE5C;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,OAAO;AACP;AACA;;AAEA;AACA;AACA;AACA;;AAEA,kBAAkB,OAAO;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,OAAO;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA,qCAAqC,OAAO;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB,QAAQ;AAC7B;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,mBAAmB,QAAQ;AAC3B;AACA,qCAAqC,OAAO;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,2BAA2B;AAC3B,OAAO;AACP;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA,wCAAwC,iCAAiC;AACzE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,OAAO;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA,uCAAuC,OAAO;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,QAAQ;AAC3B;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,mBAAmB,QAAQ;AAC3B;AACA,qCAAqC,OAAO;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,4CAA4C;AAC5C,OAAO;AACP;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,OAAO;AACP;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,kBAAkB,oBAAoB;AACtC;;AAEA,qBAAqB,oBAAoB;AACzC;AACA;AACA;;AAEA;;AAEA,iDAAiD,YAAY;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,gCAAgC,OAAO;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,kCAAkC,OAAO;AACzC;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,iBAAiB,kBAAkB;AACnC;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,iBAAiB;AACjB,KAAK;AACL,iBAAiB;AACjB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA,OAAO;;AAEP;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;;AAEL;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,OAAO;;AAEP;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;;AAEA;;AAEA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA,OAAO;AACP,mBAAmB;AACnB,GAAG;;AAEH,MAAM,IAA0C;AAChD;AACA,IAAI,mCAAO;AACX;AACA,KAAK;AAAA,kGAAC;AACN,GAAG,MAAM,gBAQN;AACH,CAAC;;;;;;;;ACxlDD;AACA,MAAM,IAA0C;AAChD,IAAI,iCAAO,CAAC,OAAS,EAAE,MAAQ,CAAC,oCAAE,OAAO;AAAA;AAAA;AAAA,kGAAC;AAC1C,GAAG,MAAM,YAQN;AACH,CAAC;AACD;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,0EAA0E;;AAE1E;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO;;AAEP;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA,CAAC,E;;;;;;;;AC1HD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,oCAAoC;;AAEpC;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,wBAAwB,qBAAM,gBAAgB,qBAAM,IAAI,qBAAM,sBAAsB,qBAAM;;AAE1F;AACA;;AAEA;AACA;;AAEA;AACA,kBAAkB,KAA0B;;AAE5C;AACA,gCAAgC,QAAa;;AAE7C;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,MAAM;AACjB,aAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,EAAE;AACb,aAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,SAAS;AACpB,aAAa,MAAM;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,MAAM;AACjB,aAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,SAAS;AACpB,WAAW,EAAE;AACb,WAAW,QAAQ;AACnB;AACA,aAAa,EAAE;AACf;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,SAAS;AACpB,aAAa,MAAM;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,aAAa,EAAE;AACf;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,EAAE;AACb,aAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,aAAa,MAAM;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,SAAS;AACpB,WAAW,SAAS;AACpB,aAAa,SAAS;AACtB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,aAAa,MAAM;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,aAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,aAAa,EAAE;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,aAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,EAAE;AACb,aAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,aAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,aAAa,EAAE;AACf;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,aAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,EAAE;AACb,aAAa,OAAO;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,aAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,aAAa,EAAE;AACf;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,aAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,EAAE;AACb,aAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,aAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,aAAa,EAAE;AACf;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,aAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,EAAE;AACb,aAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,EAAE;AACb,WAAW,QAAQ;AACnB,aAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,EAAE;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,EAAE;AACb,aAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,aAAa,OAAO;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,EAAE;AACb,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,SAAS;AACpB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,aAAa,EAAE;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0CAA0C;AAC1C;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,aAAa,OAAO;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,SAAS;AACpB,WAAW,SAAS;AACpB,aAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,EAAE;AACb,aAAa,OAAO;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,EAAE;AACb,aAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,aAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,QAAQ;AACnB,aAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,YAAY;AACvB,aAAa,YAAY;AACzB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,QAAQ;AACnB,aAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,SAAS;AACpB,WAAW,QAAQ;AACnB,aAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,aAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,SAAS;AACpB,WAAW,QAAQ;AACnB,aAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,aAAa,OAAO;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,QAAQ;AACnB,aAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,MAAM;AACjB,aAAa,MAAM;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,MAAM;AACjB,WAAW,OAAO,WAAW;AAC7B,WAAW,SAAS;AACpB,aAAa,OAAO;AACpB;AACA;AACA,wBAAwB;;AAExB;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO,WAAW;AAC7B,aAAa,OAAO;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,aAAa,MAAM;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,aAAa,EAAE;AACf;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,aAAa,EAAE;AACf;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,aAAa,MAAM;AACnB;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,EAAE;AACb,aAAa,OAAO;AACpB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,aAAa,MAAM;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,aAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,SAAS;AACpB,WAAW,QAAQ;AACnB,aAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,EAAE;AACb,WAAW,OAAO;AAClB,aAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,EAAE;AACb,aAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,SAAS;AACpB,aAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,EAAE;AACb,aAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,SAAS;AACpB,aAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,EAAE;AACb,aAAa,EAAE;AACf;AACA;AACA;AACA,mBAAmB,SAAS,GAAG,SAAS;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,EAAE;AACb,WAAW,EAAE;AACb,aAAa,QAAQ;AACrB;AACA;AACA,iBAAiB;AACjB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,EAAE;AACb,aAAa,QAAQ;AACrB;AACA;AACA;AACA,6BAA6B,kBAAkB,EAAE;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,EAAE;AACb,aAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,EAAE;AACb,aAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,EAAE;AACb,aAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,EAAE;AACb,aAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,EAAE;AACb,aAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,EAAE;AACb,aAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,EAAE;AACb,aAAa,QAAQ;AACrB;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,EAAE;AACb,aAAa,QAAQ;AACrB;AACA;AACA,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,aAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;;;;;;;;;;;;;ACntD4B;AACA;;AAE5B;AACA,UAAU,8DAAU;AACpB,WAAW,8DAAU;;AAErB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,MAAM,oFAAqB;AAC3B;AACA,oBAAoB,6CAAM;AAC1B;AACA;AACA;AACA;AACA,8BAA8B,6CAAM;AACpC;;AAEA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG,4DAAS;AACZ;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAY,oFAAqB;AACjC;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,sCAAsC,iIAAiI;AACvK;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,8CAA8C,QAAQ;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,iEAAiE,eAAe;AAChF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,8BAA8B,mBAAmB,YAAY,4FAA4F,6BAA6B,YAAY;AAC1M,8BAA8B,yCAAyC,YAAY;AACnF,gCAAgC,yCAAyC,YAAY;AACrF,2DAA2D;AAC3D,0BAA0B,yCAAyC,YAAY;AAC/E,+BAA+B,yCAAyC,YAAY;AACpF;AACA;AACA;;AAEA,QAAQ,2BAA2B,gBAAgB,YAAY,mBAAmB,yCAAyC,YAAY,MAAM,+BAA+B,oBAAoB,YAAY;AAC5M,iCAAiC,yCAAyC,YAAY;AACtF,2BAA2B,yCAAyC,YAAY;AAChF,gCAAgC,yCAAyC,YAAY;AACrF;AACA;;AAEA,oCAAoC,yCAAyC,YAAY;AACzF;AACA;AACA;AACA,iEAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA,oEAAoE,kDAAkD,YAAY;AAClI,gFAAgF,kDAAkD;AAClI;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO,iCAAiC,qDAAqD,YAAY;AACpH,WAAW,OAAO,+EAA+E,yCAAyC,YAAY;AACtJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,uCAAuC,OAAO;AAC9C;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,mEAAmE,gBAAgB;AACnF;AACA;;AAEA;AACA;AACA;AACA,mCAAmC,6CAAM;AACzC;AACA;AACA;AACA;AACA;AACA,yBAAyB,6CAAM;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA,WAAW,OAAO,iCAAiC,+CAA+C,YAAY;AAC9G,WAAW,OAAO,UAAU,WAAW;AACvC;AACA,KAAK,yCAAyC,YAAY;AAC1D,YAAY,YAAY;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO,iCAAiC,+CAA+C,YAAY;AAC9G,WAAW,OAAO,UAAU,WAAW;AACvC;AACA,KAAK,yCAAyC,YAAY;AAC1D,YAAY,SAAS,sHAAsH,yCAAyC,YAAY;AAChM;AACA;AACA;AACA;AACA;AACA,gBAAgB,gCAAgC;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,gCAAgC;AAChD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA,WAAW,OAAO,iCAAiC,+CAA+C,YAAY;AAC9G,WAAW,OAAO,UAAU,WAAW;AACvC;AACA,iCAAiC,yCAAyC,YAAY;AACtF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,CAAC,EAAC;;;;;;;;;;;;AClZF;AACA;AACA;AACA,2BAA2B,6BAA6B,YAAY;AACpE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC;AACrC;AACA,iCAAiC;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iEAAe,EAAE,E;;;;;;;ACnCjB;AACA;AACA,IAAI,wBAAwB,YAAY;AACxC;AACA;AACA;AACA;AACA,UAAU,aAAa;AACvB,UAAU,0BAA0B;AACpC;AACA,UAAU,QAAQ;AAClB;AACA;AACA;AACA;AACA;AACA,KAAK,8BAA8B,mBAAmB,YAAY;AAClE;AACA;AACA;AACA,oBAAoB;AACpB;AACA;AACA,MAAM,2BAA2B,gBAAgB,YAAY;AAC7D,UAAU,4DAA4D,sCAAsC,YAAY;AACxH;AACA;AACA;AACA;AACA;AACA;;;;;;;;AC9BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU,6BAA6B,YAAY;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,gCAAgC,YAAY;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,gCAAgC,YAAY;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B,+BAA+B;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,gCAAgC,YAAY;AACrD;AACA;AACA;AACA;AACA,E;;;;;;;ACtHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,E;;;;;;;AC1BA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,0CAA0C;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,E;;;;;;;AClCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,OAAO;AACnB,YAAY,MAAM,0BAA0B,6BAA6B;AACzE;AACA,YAAY,SAAS;AACrB;AACA,YAAY,SAAS;AACrB,YAAY,SAAS;AACrB;AACA,aAAa,eAAe;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC,E;AACrC;AACA;AACA,iCAAiC;AACjC;AACA;AACA,oD;AACA,6BAA6B;AAC7B;AACA;AACA;AACA,6BAA6B;AAC7B;AACA,gBAAgB;AAChB;AACA;AACA;AACA,8DAA8D;AAC9D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,OAAO;AACpB,aAAa,MAAM,0BAA0B,6BAA6B;AAC1E;AACA,cAAc,OAAO;AACrB;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA;AACA,UAAU;AACV;AACA,wCAAwC;AACxC;AACA;AACA;AACA,aAAa,OAAO;AACpB,aAAa,MAAM,0BAA0B,6BAA6B;AAC1E;AACA,cAAc,OAAO;AACrB;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA;AACA,UAAU;AACV;AACA,oCAAoC;AACpC;AACA;AACA,gBAAgB,+BAA+B;AAC/C;AACA,aAAa,OAAO;AACpB,aAAa,MAAM,0BAA0B,6BAA6B;AAC1E;AACA,cAAc,OAAO;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA,EAAE;AACF;AACA;AACA,kCAAkC,+BAA+B,YAAY;AAC7E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,kDAAkD;AAClD;AACA;AACA,kCAAkC,+BAA+B,YAAY;AAC7E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,E;;;;;;;;;;;;;;;;;;;;;ACtLwB;AACY;AACE;AACE;AACQ;;AAEhD;AACA;AACA;AACA;AACA,iEAAe;AACf,IAAI;AACJ,UAAU;AACV,WAAW;AACX,YAAY;AACZ,gBAAgB;AAChB,CAAC,EAAC;;;;;;;;AChBF;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,gCAAgC,qBAAqB,YAAY;AACvF,8BAA8B,2BAA2B,WAAW,YAAY;AAChF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,gCAAgC,qBAAqB,YAAY;AACvF,8BAA8B,2BAA2B,WAAW,YAAY;AAChF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,gCAAgC,qBAAqB,YAAY;AACxF,+BAA+B,2BAA2B,WAAW,YAAY;AACjF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,gCAAgC,qBAAqB,YAAY;AACvF,8BAA8B,2BAA2B,WAAW,YAAY;AAChF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6D;AACA;AACA;AACA,yB;AACA;AACA;AACA,yB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,gCAAgC,qBAAqB,YAAY;AACvF,8BAA8B,2BAA2B,WAAW,YAAY;AAChF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,gCAAgC,qBAAqB,YAAY;AACvF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,gCAAgC,qBAAqB,YAAY;AACvF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,gCAAgC,qBAAqB,YAAY;AACvF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,gCAAgC,qBAAqB,YAAY;AACvF,8BAA8B,2BAA2B,WAAW,YAAY;AAChF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,E;;;;;;;ACnNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,mCAAmC,YAAY;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,E;;;;;;;AC1BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;ACzFwC;AAChB;AACM;;AAE9B;AACA;AACA;AACA;AACA;AACA,iEAAe;AACf,cAAc,qDAAW;AACzB;AACA;AACA;AACA,EAAE;AACF,MAAM,6CAAG;AACT,SAAS,gDAAM;AACf;AACA,CAAC,EAAC;;;;;;;;;;;;;;;;;;;;;;;;AClBsC;AACR;AACA;AACS;AACL;AACR;AACE;AACF;AACS;;AAErC;AACA;AACA,wBAAwB,oFAAwB;AAChD;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,MAAM;AACjB,YAAY,IAAI;AAChB;AACA;AACA;AACA;AACA;;AAEA,gBAAgB,kBAAkB;AAClC;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,aAAa;AACxB,YAAY,aAAa;AACzB;AACA;AACA;;AAEA;AACA,aAAa,uDAAS;;AAEtB;AACA,gDAAgD,8DAAU;;AAE1D;AACA,KAAK,oGAA8B;AACnC,8BAA8B,oGAA8B;AAC5D;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB,YAAY,aAAa;AACzB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,yBAAyB,gEAAW;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB,YAAY,KAAK;AACjB;AACA;AACA;;AAEA;AACA,+CAA+C,SAAS;AACxD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,mBAAmB;AAC9B;AACA;;AAEA;AACA,uCAAuC,4HAA0C;AACjF;;AAEA;AACA,8BAA8B,0GAAiC;AAC/D;;AAEA;AACA,EAAE,oGAA8B;AAChC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,EAAE,+DAAW,CAAC,oHAAuC;AACrD;;AAEA;AACA;AACA;AACA;AACA,EAAE;;AAEF;AACA,CAAC,2DAAS,CAAC,sHAAwC;AACnD;AACA,GAAG,oGAA8B;AACjC;AACA,EAAE;AACF;;AAEA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB,YAAY,KAAK;AACjB;AACA;AACA;AACA,EAAE,oFAAqB;AACvB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAY,KAAK;AACjB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,MAAM,0BAA0B,6BAA6B,YAAY;AACpF;AACA;AACA;AACA,KAAK,mDAAU;AACf,aAAa,mDAAU;;AAEvB;AACA;AACA,0CAA0C,mDAAU;AACpD;AACA;AACA;AACA,IAAI;;AAEJ;AACA;AACA,GAAG,4DAAS;AACZ;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,KAAK,6BAA6B,YAAY;AAC9C,WAAW,eAAe;AAC1B;AACA;AACA;;AAEA;AACA;AACA,EAAE,4DAAS;AACX;AACA;;AAEA;AACA;AACA;;AAEA,iBAAiB,oBAAoB;AACrC;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA,iBAAiB,mBAAmB;AACpC;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,iBAAiB,mBAAmB;AACpC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,iBAAiB,2BAA2B;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc,6CAAM;AACpB;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,iBAAiB,oBAAoB;AACrC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qDAAqD,IAAI;;AAEzD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,IAAI,4DAAS;;AAEb;AACA,IAAI,+DAAW,CAAC,sHAAwC;;AAExD,IAAI,8EAAqB;AACzB;AACA,MAAM,8HAA4C;AAClD;AACA;AACA;AACA,IAAI,8BAA8B;AAClC;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,gBAAgB,mBAAmB;AACnC;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,0BAA0B;;AAE1B;AACA;AACA;AACA,yBAAyB,iBAAiB;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,wCAAwC,SAAS;AACjD;AACA;AACA;AACA;AACA,KAAK,4DAAS;;AAEd;AACA,KAAK,+DAAW,6BAA6B,6DAA6D;AAC1G,MAAM,8EAAqB;AAC3B;AACA,OAAO,8HAA4C;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,6CAAM;AACrB,uBAAuB,4FAA2B;AAClD;AACA,qCAAqC,wEAAiB;AACtD;AACA;AACA;AACA;AACA,oBAAoB,6CAAM;AAC1B,4BAA4B,4FAA2B;AACvD;AACA;;AAEA,IAAI,8EAAqB;AACzB;AACA,KAAK,sGAAgC;AACrC;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,IAAI,8EAAqB;AACzB;AACA,KAAK,kHAAsC;AAC3C;AACA;;AAEA,SAAS,oFAAqB;AAC9B;AACA;AACA;;AAEA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,CAAC,+DAAW,wBAAwB,6CAA6C,EAAE;AACzG;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,IAAI;AACJ,GAAG;AACH,EAAE;AACF;;;AAGA;AACA;AACA;AACA;AACA,WAAW,aAAa;AACxB,aAAa,KAAK;AAClB;AACA;;AAEA;AACA;AACA,EAAE,4DAAS;AACX;AACA;AACA;AACA,EAAE,4DAAS;AACX;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa,KAAK;AAClB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,iEAAe;AACf;AACA;AACA;AACA,cAAc,MAAM;AACpB;AACA;AACA;AACA,GAAG,4DAAS;AACZ;AACA;;AAEA;;AAEA,iBAAiB,kBAAkB;AACnC;AACA;AACA,IAAI;AACJ;;AAEA;AACA,EAAE;AACF;AACA;AACA;AACA,cAAc,OAAO;AACrB;AACA;AACA;AACA,GAAG,4DAAS;AACZ;AACA;;AAEA,SAAS,oGAA8B;AACvC,EAAE;AACF;AACA;AACA;AACA;AACA,YAAY,mBAAmB;AAC/B;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa,QAAQ;AACrB;AACA,IAAI;AACJ;AACA,eAAe,QAAQ;AACvB,qCAAqC,SAAS;AAC9C;AACA;AACA;;AAEA,uBAAuB,oFAAqB;AAC5C;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,wCAAwC,SAAS;AACjD;AACA;AACA;;AAEA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA,iCAAiC,6BAA6B,YAAY;AAC1E;AACA,MAAM,6BAA6B,YAAY;AAC/C;AACA,MAAM,+BAA+B,YAAY;AACjD;AACA;AACA,YAAY,MAAM,0BAA0B,6BAA6B;AACzE;AACA,YAAY,MAAM;AAClB,MAAM,+BAA+B;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA,MAAM;AACN;AACA;AACA,iBAAiB;AACjB;AACA,MAAM;AACN;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA,MAAM;AACN;AACA;AACA,iBAAiB;AACjB;AACA;AACA,MAAM;AACN;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,qDAAqD;AAC3D,MAAM,qDAAqD;AAC3D,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,GAAG,4DAAS;AACZ;AACA;AACA;AACA,GAAG,4DAAS;AACZ;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,GAAG,4DAAS;AACZ;AACA;AACA;AACA;AACA,GAAG,4DAAS;AACZ;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW;AACX;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,oDAAoD,oFAAqB;AACzE,KAAK,4DAAS;AACd,KAAK,4DAAS;AACd;AACA;;AAEA;AACA;AACA;AACA,aAAa,4FAA2B;AACxC,KAAK;;;AAGL;AACA;AACA,WAAW;AACX;;AAEA;AACA,KAAK,8EAAqB;AAC1B;AACA,MAAM,gHAAqC;AAC3C;AACA;;AAEA,KAAK,8EAAqB;AAC1B;AACA,MAAM,oHAAuC;AAC7C;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,sFAAwB;;AAEhD;AACA;AACA;AACA,IAAI;;AAEJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,QAAQ,4DAAS;AACjB,QAAQ,8EAAqB;AAC7B;AACA,SAAS,oIAA+C;AACxD;AACA;AACA;AACA,QAAQ;AACR,OAAO;AACP;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,sCAAsC,wEAAe,WAAW,wFAAuB;;AAEvF;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,kBAAkB,wEAAe,WAAW,wFAAuB;AACnE;AACA;;AAEA;AACA,QAAQ;AACR,oBAAoB,kDAAU;AAC9B;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA,QAAQ;AACR;AACA,QAAQ,4DAAS;AACjB;AACA,QAAQ;AACR;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,GAAG,4DAAS;AACZ;AACA;;AAEA;AACA;AACA;AACA,IAAI;AACJ;AACA,EAAE;AACF;AACA;AACA;AACA,YAAY,OAAO;AACnB;AACA;;AAEA;AACA,GAAG,4DAAS;AACZ;AACA;;AAEA;AACA,GAAG,8EAAqB;AACxB;AACA,IAAI,sHAAwC;AAC5C;AACA;;AAEA,GAAG,8EAAqB;AACxB;AACA,IAAI,wGAAiC;AACrC;AACA;;AAEA,GAAG,8EAAqB;AACxB;AACA,IAAI,oHAAuC;AAC3C;AACA;;AAEA;AACA;AACA;AACA,CAAC,EAAC;;;;;;;;;;;;;;ACtmCwC;;AAE1C;AACA;AACA;AACA;AACA;AACA,iEAAe;AACf;AACA,mBAAmB,sDAAa;AAChC;AACA,EAAE;;AAEF;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa,OAAO;AACpB,aAAa,OAAO;AACpB;AACA;AACA,UAAU,yEAAkC;AAC5C,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,aAAa,OAAO;AACpB,aAAa,IAAI;AACjB;AACA,aAAa,SAAS;AACtB;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,aAAa,OAAO;AACpB,aAAa,SAAS;AACtB;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,aAAa,OAAO;AACpB,aAAa,SAAS;AACtB;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,aAAa,OAAO;AACpB,aAAa,SAAS;AACtB;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,GAAG,EAAC;;;;;;;;;;;;ACxEL;AACA;AACA;AACA;AACA,YAAY,oBAAoB;AAChC,YAAY,kBAAkB;AAC9B,aAAa,OAAO;AACpB;AACA;AACA;AACA,4CAA4C;;AAE5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,IAAI;AACJ;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,iBAAiB;AAC5B,YAAY,WAAW;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA,iEAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA,YAAY,OAAO;AACnB;AACA,YAAY,OAAO;AACnB,YAAY,KAAK;AACjB,aAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,qCAAqC,SAAS;AAC9C;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,EAAE;AACF;AACA;AACA;AACA,aAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA,YAAY,YAAY;AACxB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,EAAE;AACF;AACA;AACA;AACA,YAAY,OAAO;AACnB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,EAAE;AACF;AACA;AACA;AACA,YAAY,cAAc;AAC1B,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sDAAsD;AACtD;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA,EAAE;AACF;AACA;AACA;AACA,YAAY,OAAO;AACnB,aAAa,OAAO;AACpB;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,OAAO;AACnB,YAAY,eAAe;AAC3B;AACA;AACA,YAAY,WAAW;AACvB;AACA;AACA;AACA,cAAc;AACd,aAAa,OAAO;AACpB;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA,aAAa,OAAO;AACpB;AACA;AACA;AACA,SAAS,aAAO;AAChB;AACA,CAAC,EAAC;;;;;;;UC7RF;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;;WCzBA;WACA;WACA;WACA;WACA;WACA,gCAAgC,YAAY;WAC5C;WACA,E;;;;;WCPA;WACA;WACA;WACA;WACA,wCAAwC,yCAAyC;WACjF;WACA;WACA,E;;;;;WCPA;WACA;WACA;WACA;WACA,EAAE;WACF;WACA;WACA,CAAC,I;;;;;WCPD,wF;;;;;WCAA;WACA;WACA;WACA;WACA,E;;;;;;;;;;;;;;;;;;;;;ACJoC;;AAEpC,6BAAe,oBAAW;;AAE1B;AACA;AACA;AACA,aAAa,QAAQ;AACrB;AACA,IAAI;AACJ;AACA,eAAe,QAAQ;AACvB,qCAAqC,SAAS;AAC9C;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,GAAG,kCAAc;AACjB,4CAA4C,SAAS;AACrD,IAAI,0DAA0B;AAC9B;AACA;AACA;;AAEA;AACA;AACA,EAAE;AACF;AACA;AACA,C;;;;;;;;;;ACxCwC;AACd;AACQ;AACF;AACI;AACA;AACN;AACF;;AAE5B,QAAQ;;AAER;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,oBAAK;AACT,IAAI,sBAAO;AACX,IAAI,wBAAS;AACb,YAAY;AACZ,KAAK;AACL,UAAU;AACV,OAAO;AACP;;AAEA;AACA;;AAEA,0CAAe,GAAG,E","file":"f2.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"F2\"] = factory();\n\telse\n\t\troot[\"F2\"] = factory();\n})(self, function() {\nreturn ","\n/**\n * Expose `parse`.\n */\n\nmodule.exports = parse;\n\n/**\n * Tests for browser support.\n */\n\nvar innerHTMLBug = false;\nvar bugTestDiv;\nif (typeof document !== 'undefined') {\n bugTestDiv = document.createElement('div');\n // Setup\n bugTestDiv.innerHTML = '
a';\n // Make sure that link elements get serialized correctly by innerHTML\n // This requires a wrapper element in IE\n innerHTMLBug = !bugTestDiv.getElementsByTagName('link').length;\n bugTestDiv = undefined;\n}\n\n/**\n * Wrap map from jquery.\n */\n\nvar map = {\n legend: [1, '
', '
'],\n tr: [2, '', '
'],\n col: [2, '', '
'],\n // for script/link/style tags to work in IE6-8, you have to wrap\n // in a div with a non-whitespace character in front, ha!\n _default: innerHTMLBug ? [1, 'X
', '
'] : [0, '', '']\n};\n\nmap.td =\nmap.th = [3, '', '
'];\n\nmap.option =\nmap.optgroup = [1, ''];\n\nmap.thead =\nmap.tbody =\nmap.colgroup =\nmap.caption =\nmap.tfoot = [1, '', '
'];\n\nmap.polyline =\nmap.ellipse =\nmap.polygon =\nmap.circle =\nmap.text =\nmap.line =\nmap.path =\nmap.rect =\nmap.g = [1, '',''];\n\n/**\n * Parse `html` and return a DOM Node instance, which could be a TextNode,\n * HTML DOM Node of some kind (
for example), or a DocumentFragment\n * instance, depending on the contents of the `html` string.\n *\n * @param {String} html - HTML string to \"domify\"\n * @param {Document} doc - The `document` instance to create the Node for\n * @return {DOMNode} the TextNode, DOM Node, or DocumentFragment instance\n * @api private\n */\n\nfunction parse(html, doc) {\n if ('string' != typeof html) throw new TypeError('String expected');\n\n // default to the global `document` object\n if (!doc) doc = document;\n\n // tag name\n var m = /<([\\w:]+)/.exec(html);\n if (!m) return doc.createTextNode(html);\n\n html = html.replace(/^\\s+|\\s+$/g, ''); // Remove leading/trailing whitespace\n\n var tag = m[1];\n\n // body support\n if (tag == 'body') {\n var el = doc.createElement('html');\n el.innerHTML = html;\n return el.removeChild(el.lastChild);\n }\n\n // wrap map\n var wrap = Object.prototype.hasOwnProperty.call(map, tag) ? map[tag] : map._default;\n var depth = wrap[0];\n var prefix = wrap[1];\n var suffix = wrap[2];\n var el = doc.createElement('div');\n el.innerHTML = prefix + html + suffix;\n while (depth--) el = el.lastChild;\n\n // one element\n if (el.firstChild == el.lastChild) {\n return el.removeChild(el.firstChild);\n }\n\n // several elements\n var fragment = doc.createDocumentFragment();\n while (el.firstChild) {\n fragment.appendChild(el.removeChild(el.firstChild));\n }\n\n return fragment;\n}\n","/*!\n * EventEmitter2\n * https://github.com/hij1nx/EventEmitter2\n *\n * Copyright (c) 2013 hij1nx\n * Licensed under the MIT license.\n */\n;!function(undefined) {\n var hasOwnProperty= Object.hasOwnProperty;\n var isArray = Array.isArray ? Array.isArray : function _isArray(obj) {\n return Object.prototype.toString.call(obj) === \"[object Array]\";\n };\n var defaultMaxListeners = 10;\n var nextTickSupported= typeof process=='object' && typeof process.nextTick=='function';\n var symbolsSupported= typeof Symbol==='function';\n var reflectSupported= typeof Reflect === 'object';\n var setImmediateSupported= typeof setImmediate === 'function';\n var _setImmediate= setImmediateSupported ? setImmediate : setTimeout;\n var ownKeys= symbolsSupported? (reflectSupported && typeof Reflect.ownKeys==='function'? Reflect.ownKeys : function(obj){\n var arr= Object.getOwnPropertyNames(obj);\n arr.push.apply(arr, Object.getOwnPropertySymbols(obj));\n return arr;\n }) : Object.keys;\n\n function init() {\n this._events = {};\n if (this._conf) {\n configure.call(this, this._conf);\n }\n }\n\n function configure(conf) {\n if (conf) {\n this._conf = conf;\n\n conf.delimiter && (this.delimiter = conf.delimiter);\n\n if(conf.maxListeners!==undefined){\n this._maxListeners= conf.maxListeners;\n }\n\n conf.wildcard && (this.wildcard = conf.wildcard);\n conf.newListener && (this._newListener = conf.newListener);\n conf.removeListener && (this._removeListener = conf.removeListener);\n conf.verboseMemoryLeak && (this.verboseMemoryLeak = conf.verboseMemoryLeak);\n conf.ignoreErrors && (this.ignoreErrors = conf.ignoreErrors);\n\n if (this.wildcard) {\n this.listenerTree = {};\n }\n }\n }\n\n function logPossibleMemoryLeak(count, eventName) {\n var errorMsg = '(node) warning: possible EventEmitter memory ' +\n 'leak detected. ' + count + ' listeners added. ' +\n 'Use emitter.setMaxListeners() to increase limit.';\n\n if(this.verboseMemoryLeak){\n errorMsg += ' Event name: ' + eventName + '.';\n }\n\n if(typeof process !== 'undefined' && process.emitWarning){\n var e = new Error(errorMsg);\n e.name = 'MaxListenersExceededWarning';\n e.emitter = this;\n e.count = count;\n process.emitWarning(e);\n } else {\n console.error(errorMsg);\n\n if (console.trace){\n console.trace();\n }\n }\n }\n\n var toArray = function (a, b, c) {\n var n = arguments.length;\n switch (n) {\n case 0:\n return [];\n case 1:\n return [a];\n case 2:\n return [a, b];\n case 3:\n return [a, b, c];\n default:\n var arr = new Array(n);\n while (n--) {\n arr[n] = arguments[n];\n }\n return arr;\n }\n };\n\n function toObject(keys, values) {\n var obj = {};\n var key;\n var len = keys.length;\n var valuesCount = values ? value.length : 0;\n for (var i = 0; i < len; i++) {\n key = keys[i];\n obj[key] = i < valuesCount ? values[i] : undefined;\n }\n return obj;\n }\n\n function TargetObserver(emitter, target, options) {\n this._emitter = emitter;\n this._target = target;\n this._listeners = {};\n this._listenersCount = 0;\n\n var on, off;\n\n if (options.on || options.off) {\n on = options.on;\n off = options.off;\n }\n\n if (target.addEventListener) {\n on = target.addEventListener;\n off = target.removeEventListener;\n } else if (target.addListener) {\n on = target.addListener;\n off = target.removeListener;\n } else if (target.on) {\n on = target.on;\n off = target.off;\n }\n\n if (!on && !off) {\n throw Error('target does not implement any known event API');\n }\n\n if (typeof on !== 'function') {\n throw TypeError('on method must be a function');\n }\n\n if (typeof off !== 'function') {\n throw TypeError('off method must be a function');\n }\n\n this._on = on;\n this._off = off;\n\n var _observers= emitter._observers;\n if(_observers){\n _observers.push(this);\n }else{\n emitter._observers= [this];\n }\n }\n\n Object.assign(TargetObserver.prototype, {\n subscribe: function(event, localEvent, reducer){\n var observer= this;\n var target= this._target;\n var emitter= this._emitter;\n var listeners= this._listeners;\n var handler= function(){\n var args= toArray.apply(null, arguments);\n var eventObj= {\n data: args,\n name: localEvent,\n original: event\n };\n if(reducer){\n var result= reducer.call(target, eventObj);\n if(result!==false){\n emitter.emit.apply(emitter, [eventObj.name].concat(args))\n }\n return;\n }\n emitter.emit.apply(emitter, [localEvent].concat(args));\n };\n\n\n if(listeners[event]){\n throw Error('Event \\'' + event + '\\' is already listening');\n }\n\n this._listenersCount++;\n\n if(emitter._newListener && emitter._removeListener && !observer._onNewListener){\n\n this._onNewListener = function (_event) {\n if (_event === localEvent && listeners[event] === null) {\n listeners[event] = handler;\n observer._on.call(target, event, handler);\n }\n };\n\n emitter.on('newListener', this._onNewListener);\n\n this._onRemoveListener= function(_event){\n if(_event === localEvent && !emitter.hasListeners(_event) && listeners[event]){\n listeners[event]= null;\n observer._off.call(target, event, handler);\n }\n };\n\n listeners[event]= null;\n\n emitter.on('removeListener', this._onRemoveListener);\n }else{\n listeners[event]= handler;\n observer._on.call(target, event, handler);\n }\n },\n\n unsubscribe: function(event){\n var observer= this;\n var listeners= this._listeners;\n var emitter= this._emitter;\n var handler;\n var events;\n var off= this._off;\n var target= this._target;\n var i;\n\n if(event && typeof event!=='string'){\n throw TypeError('event must be a string');\n }\n\n function clearRefs(){\n if(observer._onNewListener){\n emitter.off('newListener', observer._onNewListener);\n emitter.off('removeListener', observer._onRemoveListener);\n observer._onNewListener= null;\n observer._onRemoveListener= null;\n }\n var index= findTargetIndex.call(emitter, observer);\n emitter._observers.splice(index, 1);\n }\n\n if(event){\n handler= listeners[event];\n if(!handler) return;\n off.call(target, event, handler);\n delete listeners[event];\n if(!--this._listenersCount){\n clearRefs();\n }\n }else{\n events= ownKeys(listeners);\n i= events.length;\n while(i-->0){\n event= events[i];\n off.call(target, event, listeners[event]);\n }\n this._listeners= {};\n this._listenersCount= 0;\n clearRefs();\n }\n }\n });\n\n function resolveOptions(options, schema, reducers, allowUnknown) {\n var computedOptions = Object.assign({}, schema);\n\n if (!options) return computedOptions;\n\n if (typeof options !== 'object') {\n throw TypeError('options must be an object')\n }\n\n var keys = Object.keys(options);\n var length = keys.length;\n var option, value;\n var reducer;\n\n function reject(reason) {\n throw Error('Invalid \"' + option + '\" option value' + (reason ? '. Reason: ' + reason : ''))\n }\n\n for (var i = 0; i < length; i++) {\n option = keys[i];\n if (!allowUnknown && !hasOwnProperty.call(schema, option)) {\n throw Error('Unknown \"' + option + '\" option');\n }\n value = options[option];\n if (value !== undefined) {\n reducer = reducers[option];\n computedOptions[option] = reducer ? reducer(value, reject) : value;\n }\n }\n return computedOptions;\n }\n\n function constructorReducer(value, reject) {\n if (typeof value !== 'function' || !value.hasOwnProperty('prototype')) {\n reject('value must be a constructor');\n }\n return value;\n }\n\n function makeTypeReducer(types) {\n var message= 'value must be type of ' + types.join('|');\n var len= types.length;\n var firstType= types[0];\n var secondType= types[1];\n\n if (len === 1) {\n return function (v, reject) {\n if (typeof v === firstType) {\n return v;\n }\n reject(message);\n }\n }\n\n if (len === 2) {\n return function (v, reject) {\n var kind= typeof v;\n if (kind === firstType || kind === secondType) return v;\n reject(message);\n }\n }\n\n return function (v, reject) {\n var kind = typeof v;\n var i = len;\n while (i-- > 0) {\n if (kind === types[i]) return v;\n }\n reject(message);\n }\n }\n\n var functionReducer= makeTypeReducer(['function']);\n\n var objectFunctionReducer= makeTypeReducer(['object', 'function']);\n\n function makeCancelablePromise(Promise, executor, options) {\n var isCancelable;\n var callbacks;\n var timer= 0;\n var subscriptionClosed;\n\n var promise = new Promise(function (resolve, reject, onCancel) {\n options= resolveOptions(options, {\n timeout: 0,\n overload: false\n }, {\n timeout: function(value, reject){\n value*= 1;\n if (typeof value !== 'number' || value < 0 || !Number.isFinite(value)) {\n reject('timeout must be a positive number');\n }\n return value;\n }\n });\n\n isCancelable = !options.overload && typeof Promise.prototype.cancel === 'function' && typeof onCancel === 'function';\n\n function cleanup() {\n if (callbacks) {\n callbacks = null;\n }\n if (timer) {\n clearTimeout(timer);\n timer = 0;\n }\n }\n\n var _resolve= function(value){\n cleanup();\n resolve(value);\n };\n\n var _reject= function(err){\n cleanup();\n reject(err);\n };\n\n if (isCancelable) {\n executor(_resolve, _reject, onCancel);\n } else {\n callbacks = [function(reason){\n _reject(reason || Error('canceled'));\n }];\n executor(_resolve, _reject, function (cb) {\n if (subscriptionClosed) {\n throw Error('Unable to subscribe on cancel event asynchronously')\n }\n if (typeof cb !== 'function') {\n throw TypeError('onCancel callback must be a function');\n }\n callbacks.push(cb);\n });\n subscriptionClosed= true;\n }\n\n if (options.timeout > 0) {\n timer= setTimeout(function(){\n var reason= Error('timeout');\n reason.code = 'ETIMEDOUT'\n timer= 0;\n promise.cancel(reason);\n reject(reason);\n }, options.timeout);\n }\n });\n\n if (!isCancelable) {\n promise.cancel = function (reason) {\n if (!callbacks) {\n return;\n }\n var length = callbacks.length;\n for (var i = 1; i < length; i++) {\n callbacks[i](reason);\n }\n // internal callback to reject the promise\n callbacks[0](reason);\n callbacks = null;\n };\n }\n\n return promise;\n }\n\n function findTargetIndex(observer) {\n var observers = this._observers;\n if(!observers){\n return -1;\n }\n var len = observers.length;\n for (var i = 0; i < len; i++) {\n if (observers[i]._target === observer) return i;\n }\n return -1;\n }\n\n // Attention, function return type now is array, always !\n // It has zero elements if no any matches found and one or more\n // elements (leafs) if there are matches\n //\n function searchListenerTree(handlers, type, tree, i, typeLength) {\n if (!tree) {\n return null;\n }\n\n if (i === 0) {\n var kind = typeof type;\n if (kind === 'string') {\n var ns, n, l = 0, j = 0, delimiter = this.delimiter, dl = delimiter.length;\n if ((n = type.indexOf(delimiter)) !== -1) {\n ns = new Array(5);\n do {\n ns[l++] = type.slice(j, n);\n j = n + dl;\n } while ((n = type.indexOf(delimiter, j)) !== -1);\n\n ns[l++] = type.slice(j);\n type = ns;\n typeLength = l;\n } else {\n type = [type];\n typeLength = 1;\n }\n } else if (kind === 'object') {\n typeLength = type.length;\n } else {\n type = [type];\n typeLength = 1;\n }\n }\n\n var listeners= null, branch, xTree, xxTree, isolatedBranch, endReached, currentType = type[i],\n nextType = type[i + 1], branches, _listeners;\n\n if (i === typeLength && tree._listeners) {\n //\n // If at the end of the event(s) list and the tree has listeners\n // invoke those listeners.\n //\n if (typeof tree._listeners === 'function') {\n handlers && handlers.push(tree._listeners);\n return [tree];\n } else {\n handlers && handlers.push.apply(handlers, tree._listeners);\n return [tree];\n }\n }\n\n if (currentType === '*') {\n //\n // If the event emitted is '*' at this part\n // or there is a concrete match at this patch\n //\n branches= ownKeys(tree);\n n= branches.length;\n while(n-->0){\n branch= branches[n];\n if (branch !== '_listeners') {\n _listeners = searchListenerTree(handlers, type, tree[branch], i + 1, typeLength);\n if(_listeners){\n if(listeners){\n listeners.push.apply(listeners, _listeners);\n }else{\n listeners = _listeners;\n }\n }\n }\n }\n return listeners;\n } else if (currentType === '**') {\n endReached = (i + 1 === typeLength || (i + 2 === typeLength && nextType === '*'));\n if (endReached && tree._listeners) {\n // The next element has a _listeners, add it to the handlers.\n listeners = searchListenerTree(handlers, type, tree, typeLength, typeLength);\n }\n\n branches= ownKeys(tree);\n n= branches.length;\n while(n-->0){\n branch= branches[n];\n if (branch !== '_listeners') {\n if (branch === '*' || branch === '**') {\n if (tree[branch]._listeners && !endReached) {\n _listeners = searchListenerTree(handlers, type, tree[branch], typeLength, typeLength);\n if(_listeners){\n if(listeners){\n listeners.push.apply(listeners, _listeners);\n }else{\n listeners = _listeners;\n }\n }\n }\n _listeners = searchListenerTree(handlers, type, tree[branch], i, typeLength);\n } else if (branch === nextType) {\n _listeners = searchListenerTree(handlers, type, tree[branch], i + 2, typeLength);\n } else {\n // No match on this one, shift into the tree but not in the type array.\n _listeners = searchListenerTree(handlers, type, tree[branch], i, typeLength);\n }\n if(_listeners){\n if(listeners){\n listeners.push.apply(listeners, _listeners);\n }else{\n listeners = _listeners;\n }\n }\n }\n }\n return listeners;\n }else if (tree[currentType]) {\n listeners= searchListenerTree(handlers, type, tree[currentType], i + 1, typeLength);\n }\n\n xTree = tree['*'];\n if (xTree) {\n //\n // If the listener tree will allow any match for this part,\n // then recursively explore all branches of the tree\n //\n searchListenerTree(handlers, type, xTree, i + 1, typeLength);\n }\n\n xxTree = tree['**'];\n if (xxTree) {\n if (i < typeLength) {\n if (xxTree._listeners) {\n // If we have a listener on a '**', it will catch all, so add its handler.\n searchListenerTree(handlers, type, xxTree, typeLength, typeLength);\n }\n\n // Build arrays of matching next branches and others.\n branches= ownKeys(xxTree);\n n= branches.length;\n while(n-->0){\n branch= branches[n];\n if (branch !== '_listeners') {\n if (branch === nextType) {\n // We know the next element will match, so jump twice.\n searchListenerTree(handlers, type, xxTree[branch], i + 2, typeLength);\n } else if (branch === currentType) {\n // Current node matches, move into the tree.\n searchListenerTree(handlers, type, xxTree[branch], i + 1, typeLength);\n } else {\n isolatedBranch = {};\n isolatedBranch[branch] = xxTree[branch];\n searchListenerTree(handlers, type, {'**': isolatedBranch}, i + 1, typeLength);\n }\n }\n }\n } else if (xxTree._listeners) {\n // We have reached the end and still on a '**'\n searchListenerTree(handlers, type, xxTree, typeLength, typeLength);\n } else if (xxTree['*'] && xxTree['*']._listeners) {\n searchListenerTree(handlers, type, xxTree['*'], typeLength, typeLength);\n }\n }\n\n return listeners;\n }\n\n function growListenerTree(type, listener, prepend) {\n var len = 0, j = 0, i, delimiter = this.delimiter, dl= delimiter.length, ns;\n\n if(typeof type==='string') {\n if ((i = type.indexOf(delimiter)) !== -1) {\n ns = new Array(5);\n do {\n ns[len++] = type.slice(j, i);\n j = i + dl;\n } while ((i = type.indexOf(delimiter, j)) !== -1);\n\n ns[len++] = type.slice(j);\n }else{\n ns= [type];\n len= 1;\n }\n }else{\n ns= type;\n len= type.length;\n }\n\n //\n // Looks for two consecutive '**', if so, don't add the event at all.\n //\n if (len > 1) {\n for (i = 0; i + 1 < len; i++) {\n if (ns[i] === '**' && ns[i + 1] === '**') {\n return;\n }\n }\n }\n\n\n\n var tree = this.listenerTree, name;\n\n for (i = 0; i < len; i++) {\n name = ns[i];\n\n tree = tree[name] || (tree[name] = {});\n\n if (i === len - 1) {\n if (!tree._listeners) {\n tree._listeners = listener;\n } else {\n if (typeof tree._listeners === 'function') {\n tree._listeners = [tree._listeners];\n }\n\n if (prepend) {\n tree._listeners.unshift(listener);\n } else {\n tree._listeners.push(listener);\n }\n\n if (\n !tree._listeners.warned &&\n this._maxListeners > 0 &&\n tree._listeners.length > this._maxListeners\n ) {\n tree._listeners.warned = true;\n logPossibleMemoryLeak.call(this, tree._listeners.length, name);\n }\n }\n return true;\n }\n }\n\n return true;\n }\n\n function collectTreeEvents(tree, events, root, asArray){\n var branches= ownKeys(tree);\n var i= branches.length;\n var branch, branchName, path;\n var hasListeners= tree['_listeners'];\n var isArrayPath;\n\n while(i-->0){\n branchName= branches[i];\n\n branch= tree[branchName];\n\n if(branchName==='_listeners'){\n path= root;\n }else {\n path = root ? root.concat(branchName) : [branchName];\n }\n\n isArrayPath= asArray || typeof branchName==='symbol';\n\n hasListeners && events.push(isArrayPath? path : path.join(this.delimiter));\n\n if(typeof branch==='object'){\n collectTreeEvents.call(this, branch, events, path, isArrayPath);\n }\n }\n\n return events;\n }\n\n function recursivelyGarbageCollect(root) {\n var keys = ownKeys(root);\n var i= keys.length;\n var obj, key, flag;\n while(i-->0){\n key = keys[i];\n obj = root[key];\n\n if(obj){\n flag= true;\n if(key !== '_listeners' && !recursivelyGarbageCollect(obj)){\n delete root[key];\n }\n }\n }\n\n return flag;\n }\n\n function Listener(emitter, event, listener){\n this.emitter= emitter;\n this.event= event;\n this.listener= listener;\n }\n\n Listener.prototype.off= function(){\n this.emitter.off(this.event, this.listener);\n return this;\n };\n\n function setupListener(event, listener, options){\n if (options === true) {\n promisify = true;\n } else if (options === false) {\n async = true;\n } else {\n if (!options || typeof options !== 'object') {\n throw TypeError('options should be an object or true');\n }\n var async = options.async;\n var promisify = options.promisify;\n var nextTick = options.nextTick;\n var objectify = options.objectify;\n }\n\n if (async || nextTick || promisify) {\n var _listener = listener;\n var _origin = listener._origin || listener;\n\n if (nextTick && !nextTickSupported) {\n throw Error('process.nextTick is not supported');\n }\n\n if (promisify === undefined) {\n promisify = listener.constructor.name === 'AsyncFunction';\n }\n\n listener = function () {\n var args = arguments;\n var context = this;\n var event = this.event;\n\n return promisify ? (nextTick ? Promise.resolve() : new Promise(function (resolve) {\n _setImmediate(resolve);\n }).then(function () {\n context.event = event;\n return _listener.apply(context, args)\n })) : (nextTick ? process.nextTick : _setImmediate)(function () {\n context.event = event;\n _listener.apply(context, args)\n });\n };\n\n listener._async = true;\n listener._origin = _origin;\n }\n\n return [listener, objectify? new Listener(this, event, listener): this];\n }\n\n function EventEmitter(conf) {\n this._events = {};\n this._newListener = false;\n this._removeListener = false;\n this.verboseMemoryLeak = false;\n configure.call(this, conf);\n }\n\n EventEmitter.EventEmitter2 = EventEmitter; // backwards compatibility for exporting EventEmitter property\n\n EventEmitter.prototype.listenTo= function(target, events, options){\n if(typeof target!=='object'){\n throw TypeError('target musts be an object');\n }\n\n var emitter= this;\n\n options = resolveOptions(options, {\n on: undefined,\n off: undefined,\n reducers: undefined\n }, {\n on: functionReducer,\n off: functionReducer,\n reducers: objectFunctionReducer\n });\n\n function listen(events){\n if(typeof events!=='object'){\n throw TypeError('events must be an object');\n }\n\n var reducers= options.reducers;\n var index= findTargetIndex.call(emitter, target);\n var observer;\n\n if(index===-1){\n observer= new TargetObserver(emitter, target, options);\n }else{\n observer= emitter._observers[index];\n }\n\n var keys= ownKeys(events);\n var len= keys.length;\n var event;\n var isSingleReducer= typeof reducers==='function';\n\n for(var i=0; i 0) {\n observer = observers[i];\n if (!target || observer._target === target) {\n observer.unsubscribe(event);\n matched= true;\n }\n }\n\n return matched;\n };\n\n // By default EventEmitters will print a warning if more than\n // 10 listeners are added to it. This is a useful default which\n // helps finding memory leaks.\n //\n // Obviously not all Emitters should be limited to 10. This function allows\n // that to be increased. Set to zero for unlimited.\n\n EventEmitter.prototype.delimiter = '.';\n\n EventEmitter.prototype.setMaxListeners = function(n) {\n if (n !== undefined) {\n this._maxListeners = n;\n if (!this._conf) this._conf = {};\n this._conf.maxListeners = n;\n }\n };\n\n EventEmitter.prototype.getMaxListeners = function() {\n return this._maxListeners;\n };\n\n EventEmitter.prototype.event = '';\n\n EventEmitter.prototype.once = function(event, fn, options) {\n return this._once(event, fn, false, options);\n };\n\n EventEmitter.prototype.prependOnceListener = function(event, fn, options) {\n return this._once(event, fn, true, options);\n };\n\n EventEmitter.prototype._once = function(event, fn, prepend, options) {\n return this._many(event, 1, fn, prepend, options);\n };\n\n EventEmitter.prototype.many = function(event, ttl, fn, options) {\n return this._many(event, ttl, fn, false, options);\n };\n\n EventEmitter.prototype.prependMany = function(event, ttl, fn, options) {\n return this._many(event, ttl, fn, true, options);\n };\n\n EventEmitter.prototype._many = function(event, ttl, fn, prepend, options) {\n var self = this;\n\n if (typeof fn !== 'function') {\n throw new Error('many only accepts instances of Function');\n }\n\n function listener() {\n if (--ttl === 0) {\n self.off(event, listener);\n }\n return fn.apply(this, arguments);\n }\n\n listener._origin = fn;\n\n return this._on(event, listener, prepend, options);\n };\n\n EventEmitter.prototype.emit = function() {\n if (!this._events && !this._all) {\n return false;\n }\n\n this._events || init.call(this);\n\n var type = arguments[0], ns, wildcard= this.wildcard;\n var args,l,i,j, containsSymbol;\n\n if (type === 'newListener' && !this._newListener) {\n if (!this._events.newListener) {\n return false;\n }\n }\n\n if (wildcard) {\n ns= type;\n if(type!=='newListener' && type!=='removeListener'){\n if (typeof type === 'object') {\n l = type.length;\n if (symbolsSupported) {\n for (i = 0; i < l; i++) {\n if (typeof type[i] === 'symbol') {\n containsSymbol = true;\n break;\n }\n }\n }\n if (!containsSymbol) {\n type = type.join(this.delimiter);\n }\n }\n }\n }\n\n var al = arguments.length;\n var handler;\n\n if (this._all && this._all.length) {\n handler = this._all.slice();\n\n for (i = 0, l = handler.length; i < l; i++) {\n this.event = type;\n switch (al) {\n case 1:\n handler[i].call(this, type);\n break;\n case 2:\n handler[i].call(this, type, arguments[1]);\n break;\n case 3:\n handler[i].call(this, type, arguments[1], arguments[2]);\n break;\n default:\n handler[i].apply(this, arguments);\n }\n }\n }\n\n if (wildcard) {\n handler = [];\n searchListenerTree.call(this, handler, ns, this.listenerTree, 0, l);\n } else {\n handler = this._events[type];\n if (typeof handler === 'function') {\n this.event = type;\n switch (al) {\n case 1:\n handler.call(this);\n break;\n case 2:\n handler.call(this, arguments[1]);\n break;\n case 3:\n handler.call(this, arguments[1], arguments[2]);\n break;\n default:\n args = new Array(al - 1);\n for (j = 1; j < al; j++) args[j - 1] = arguments[j];\n handler.apply(this, args);\n }\n return true;\n } else if (handler) {\n // need to make copy of handlers because list can change in the middle\n // of emit call\n handler = handler.slice();\n }\n }\n\n if (handler && handler.length) {\n if (al > 3) {\n args = new Array(al - 1);\n for (j = 1; j < al; j++) args[j - 1] = arguments[j];\n }\n for (i = 0, l = handler.length; i < l; i++) {\n this.event = type;\n switch (al) {\n case 1:\n handler[i].call(this);\n break;\n case 2:\n handler[i].call(this, arguments[1]);\n break;\n case 3:\n handler[i].call(this, arguments[1], arguments[2]);\n break;\n default:\n handler[i].apply(this, args);\n }\n }\n return true;\n } else if (!this.ignoreErrors && !this._all && type === 'error') {\n if (arguments[1] instanceof Error) {\n throw arguments[1]; // Unhandled 'error' event\n } else {\n throw new Error(\"Uncaught, unspecified 'error' event.\");\n }\n }\n\n return !!this._all;\n };\n\n EventEmitter.prototype.emitAsync = function() {\n if (!this._events && !this._all) {\n return false;\n }\n\n this._events || init.call(this);\n\n var type = arguments[0], wildcard= this.wildcard, ns, containsSymbol;\n var args,l,i,j;\n\n if (type === 'newListener' && !this._newListener) {\n if (!this._events.newListener) { return Promise.resolve([false]); }\n }\n\n if (wildcard) {\n ns= type;\n if(type!=='newListener' && type!=='removeListener'){\n if (typeof type === 'object') {\n l = type.length;\n if (symbolsSupported) {\n for (i = 0; i < l; i++) {\n if (typeof type[i] === 'symbol') {\n containsSymbol = true;\n break;\n }\n }\n }\n if (!containsSymbol) {\n type = type.join(this.delimiter);\n }\n }\n }\n }\n\n var promises= [];\n\n var al = arguments.length;\n var handler;\n\n if (this._all) {\n for (i = 0, l = this._all.length; i < l; i++) {\n this.event = type;\n switch (al) {\n case 1:\n promises.push(this._all[i].call(this, type));\n break;\n case 2:\n promises.push(this._all[i].call(this, type, arguments[1]));\n break;\n case 3:\n promises.push(this._all[i].call(this, type, arguments[1], arguments[2]));\n break;\n default:\n promises.push(this._all[i].apply(this, arguments));\n }\n }\n }\n\n if (wildcard) {\n handler = [];\n searchListenerTree.call(this, handler, ns, this.listenerTree, 0);\n } else {\n handler = this._events[type];\n }\n\n if (typeof handler === 'function') {\n this.event = type;\n switch (al) {\n case 1:\n promises.push(handler.call(this));\n break;\n case 2:\n promises.push(handler.call(this, arguments[1]));\n break;\n case 3:\n promises.push(handler.call(this, arguments[1], arguments[2]));\n break;\n default:\n args = new Array(al - 1);\n for (j = 1; j < al; j++) args[j - 1] = arguments[j];\n promises.push(handler.apply(this, args));\n }\n } else if (handler && handler.length) {\n handler = handler.slice();\n if (al > 3) {\n args = new Array(al - 1);\n for (j = 1; j < al; j++) args[j - 1] = arguments[j];\n }\n for (i = 0, l = handler.length; i < l; i++) {\n this.event = type;\n switch (al) {\n case 1:\n promises.push(handler[i].call(this));\n break;\n case 2:\n promises.push(handler[i].call(this, arguments[1]));\n break;\n case 3:\n promises.push(handler[i].call(this, arguments[1], arguments[2]));\n break;\n default:\n promises.push(handler[i].apply(this, args));\n }\n }\n } else if (!this.ignoreErrors && !this._all && type === 'error') {\n if (arguments[1] instanceof Error) {\n return Promise.reject(arguments[1]); // Unhandled 'error' event\n } else {\n return Promise.reject(\"Uncaught, unspecified 'error' event.\");\n }\n }\n\n return Promise.all(promises);\n };\n\n EventEmitter.prototype.on = function(type, listener, options) {\n return this._on(type, listener, false, options);\n };\n\n EventEmitter.prototype.prependListener = function(type, listener, options) {\n return this._on(type, listener, true, options);\n };\n\n EventEmitter.prototype.onAny = function(fn) {\n return this._onAny(fn, false);\n };\n\n EventEmitter.prototype.prependAny = function(fn) {\n return this._onAny(fn, true);\n };\n\n EventEmitter.prototype.addListener = EventEmitter.prototype.on;\n\n EventEmitter.prototype._onAny = function(fn, prepend){\n if (typeof fn !== 'function') {\n throw new Error('onAny only accepts instances of Function');\n }\n\n if (!this._all) {\n this._all = [];\n }\n\n // Add the function to the event listener collection.\n if(prepend){\n this._all.unshift(fn);\n }else{\n this._all.push(fn);\n }\n\n return this;\n };\n\n EventEmitter.prototype._on = function(type, listener, prepend, options) {\n if (typeof type === 'function') {\n this._onAny(type, listener);\n return this;\n }\n\n if (typeof listener !== 'function') {\n throw new Error('on only accepts instances of Function');\n }\n this._events || init.call(this);\n\n var returnValue= this, temp;\n\n if (options !== undefined) {\n temp = setupListener.call(this, type, listener, options);\n listener = temp[0];\n returnValue = temp[1];\n }\n\n // To avoid recursion in the case that type == \"newListeners\"! Before\n // adding it to the listeners, first emit \"newListeners\".\n if (this._newListener) {\n this.emit('newListener', type, listener);\n }\n\n if (this.wildcard) {\n growListenerTree.call(this, type, listener, prepend);\n return returnValue;\n }\n\n if (!this._events[type]) {\n // Optimize the case of one listener. Don't need the extra array object.\n this._events[type] = listener;\n } else {\n if (typeof this._events[type] === 'function') {\n // Change to array.\n this._events[type] = [this._events[type]];\n }\n\n // If we've already got an array, just add\n if(prepend){\n this._events[type].unshift(listener);\n }else{\n this._events[type].push(listener);\n }\n\n // Check for listener leak\n if (\n !this._events[type].warned &&\n this._maxListeners > 0 &&\n this._events[type].length > this._maxListeners\n ) {\n this._events[type].warned = true;\n logPossibleMemoryLeak.call(this, this._events[type].length, type);\n }\n }\n\n return returnValue;\n };\n\n EventEmitter.prototype.off = function(type, listener) {\n if (typeof listener !== 'function') {\n throw new Error('removeListener only takes instances of Function');\n }\n\n var handlers,leafs=[];\n\n if(this.wildcard) {\n var ns = typeof type === 'string' ? type.split(this.delimiter) : type.slice();\n leafs = searchListenerTree.call(this, null, ns, this.listenerTree, 0);\n if(!leafs) return this;\n } else {\n // does not use listeners(), so no side effect of creating _events[type]\n if (!this._events[type]) return this;\n handlers = this._events[type];\n leafs.push({_listeners:handlers});\n }\n\n for (var iLeaf=0; iLeaf 0) {\n fns = this._all;\n for(i = 0, l = fns.length; i < l; i++) {\n if(fn === fns[i]) {\n fns.splice(i, 1);\n if (this._removeListener)\n this.emit(\"removeListenerAny\", fn);\n return this;\n }\n }\n } else {\n fns = this._all;\n if (this._removeListener) {\n for(i = 0, l = fns.length; i < l; i++)\n this.emit(\"removeListenerAny\", fns[i]);\n }\n this._all = [];\n }\n return this;\n };\n\n EventEmitter.prototype.removeListener = EventEmitter.prototype.off;\n\n EventEmitter.prototype.removeAllListeners = function (type) {\n if (type === undefined) {\n !this._events || init.call(this);\n return this;\n }\n\n if (this.wildcard) {\n var leafs = searchListenerTree.call(this, null, type, this.listenerTree, 0), leaf, i;\n if (!leafs) return this;\n for (i = 0; i < leafs.length; i++) {\n leaf = leafs[i];\n leaf._listeners = null;\n }\n this.listenerTree && recursivelyGarbageCollect(this.listenerTree);\n } else if (this._events) {\n this._events[type] = null;\n }\n return this;\n };\n\n EventEmitter.prototype.listeners = function (type) {\n var _events = this._events;\n var keys, listeners, allListeners;\n var i;\n var listenerTree;\n\n if (type === undefined) {\n if (this.wildcard) {\n throw Error('event name required for wildcard emitter');\n }\n\n if (!_events) {\n return [];\n }\n\n keys = ownKeys(_events);\n i = keys.length;\n allListeners = [];\n while (i-- > 0) {\n listeners = _events[keys[i]];\n if (typeof listeners === 'function') {\n allListeners.push(listeners);\n } else {\n allListeners.push.apply(allListeners, listeners);\n }\n }\n return allListeners;\n } else {\n if (this.wildcard) {\n listenerTree= this.listenerTree;\n if(!listenerTree) return [];\n var handlers = [];\n var ns = typeof type === 'string' ? type.split(this.delimiter) : type.slice();\n searchListenerTree.call(this, handlers, ns, listenerTree, 0);\n return handlers;\n }\n\n if (!_events) {\n return [];\n }\n\n listeners = _events[type];\n\n if (!listeners) {\n return [];\n }\n return typeof listeners === 'function' ? [listeners] : listeners;\n }\n };\n\n EventEmitter.prototype.eventNames = function(nsAsArray){\n var _events= this._events;\n return this.wildcard? collectTreeEvents.call(this, this.listenerTree, [], null, nsAsArray) : (_events? ownKeys(_events) : []);\n };\n\n EventEmitter.prototype.listenerCount = function(type) {\n return this.listeners(type).length;\n };\n\n EventEmitter.prototype.hasListeners = function (type) {\n if (this.wildcard) {\n var handlers = [];\n var ns = typeof type === 'string' ? type.split(this.delimiter) : type.slice();\n searchListenerTree.call(this, handlers, ns, this.listenerTree, 0);\n return handlers.length > 0;\n }\n\n var _events = this._events;\n var _all = this._all;\n\n return !!(_all && _all.length || _events && (type === undefined ? ownKeys(_events).length : _events[type]));\n };\n\n EventEmitter.prototype.listenersAny = function() {\n\n if(this._all) {\n return this._all;\n }\n else {\n return [];\n }\n\n };\n\n EventEmitter.prototype.waitFor = function (event, options) {\n var self = this;\n var type = typeof options;\n if (type === 'number') {\n options = {timeout: options};\n } else if (type === 'function') {\n options = {filter: options};\n }\n\n options= resolveOptions(options, {\n timeout: 0,\n filter: undefined,\n handleError: false,\n Promise: Promise,\n overload: false\n }, {\n filter: functionReducer,\n Promise: constructorReducer\n });\n\n return makeCancelablePromise(options.Promise, function (resolve, reject, onCancel) {\n function listener() {\n var filter= options.filter;\n if (filter && !filter.apply(self, arguments)) {\n return;\n }\n self.off(event, listener);\n if (options.handleError) {\n var err = arguments[0];\n err ? reject(err) : resolve(toArray.apply(null, arguments).slice(1));\n } else {\n resolve(toArray.apply(null, arguments));\n }\n }\n\n onCancel(function(){\n self.off(event, listener);\n });\n\n self._on(event, listener, false);\n }, {\n timeout: options.timeout,\n overload: options.overload\n })\n };\n\n function once(emitter, name, options) {\n options= resolveOptions(options, {\n Promise: Promise,\n timeout: 0,\n overload: false\n }, {\n Promise: constructorReducer\n });\n\n var _Promise= options.Promise;\n\n return makeCancelablePromise(_Promise, function(resolve, reject, onCancel){\n var handler;\n if (typeof emitter.addEventListener === 'function') {\n handler= function () {\n resolve(toArray.apply(null, arguments));\n };\n\n onCancel(function(){\n emitter.removeEventListener(name, handler);\n });\n\n emitter.addEventListener(\n name,\n handler,\n {once: true}\n );\n return;\n }\n\n var eventListener = function(){\n errorListener && emitter.removeListener('error', errorListener);\n resolve(toArray.apply(null, arguments));\n };\n\n var errorListener;\n\n if (name !== 'error') {\n errorListener = function (err){\n emitter.removeListener(name, eventListener);\n reject(err);\n };\n\n emitter.once('error', errorListener);\n }\n\n onCancel(function(){\n errorListener && emitter.removeListener('error', errorListener);\n emitter.removeListener(name, eventListener);\n });\n\n emitter.once(name, eventListener);\n }, {\n timeout: options.timeout,\n overload: options.overload\n });\n }\n\n var prototype= EventEmitter.prototype;\n\n Object.defineProperties(EventEmitter, {\n defaultMaxListeners: {\n get: function () {\n return prototype._maxListeners;\n },\n set: function (n) {\n if (typeof n !== 'number' || n < 0 || Number.isNaN(n)) {\n throw TypeError('n must be a non-negative number')\n }\n prototype._maxListeners = n;\n },\n enumerable: true\n },\n once: {\n value: once,\n writable: true,\n configurable: true\n }\n });\n\n Object.defineProperties(prototype, {\n _maxListeners: {\n value: defaultMaxListeners,\n writable: true,\n configurable: true\n },\n _observers: {value: null, writable: true, configurable: true}\n });\n\n if (typeof define === 'function' && define.amd) {\n // AMD. Register as an anonymous module.\n define(function() {\n return EventEmitter;\n });\n } else if (typeof exports === 'object') {\n // CommonJS\n module.exports = EventEmitter;\n }\n else {\n // global for any kind of environment.\n var _global= new Function('','return this')();\n _global.EventEmitter2 = EventEmitter;\n }\n}();\n","(function (global, factory) {\n if (typeof define === 'function' && define.amd) {\n define(['exports', 'module'], factory);\n } else if (typeof exports !== 'undefined' && typeof module !== 'undefined') {\n factory(exports, module);\n } else {\n var mod = {\n exports: {}\n };\n factory(mod.exports, mod);\n global.fetchJsonp = mod.exports;\n }\n})(this, function (exports, module) {\n 'use strict';\n\n var defaultOptions = {\n timeout: 5000,\n jsonpCallback: 'callback',\n jsonpCallbackFunction: null\n };\n\n function generateCallbackFunction() {\n return 'jsonp_' + Date.now() + '_' + Math.ceil(Math.random() * 100000);\n }\n\n function clearFunction(functionName) {\n // IE8 throws an exception when you try to delete a property on window\n // http://stackoverflow.com/a/1824228/751089\n try {\n delete window[functionName];\n } catch (e) {\n window[functionName] = undefined;\n }\n }\n\n function removeScript(scriptId) {\n var script = document.getElementById(scriptId);\n if (script) {\n document.getElementsByTagName('head')[0].removeChild(script);\n }\n }\n\n function fetchJsonp(_url) {\n var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];\n\n // to avoid param reassign\n var url = _url;\n var timeout = options.timeout || defaultOptions.timeout;\n var jsonpCallback = options.jsonpCallback || defaultOptions.jsonpCallback;\n\n var timeoutId = undefined;\n\n return new Promise(function (resolve, reject) {\n var callbackFunction = options.jsonpCallbackFunction || generateCallbackFunction();\n var scriptId = jsonpCallback + '_' + callbackFunction;\n\n window[callbackFunction] = function (response) {\n resolve({\n ok: true,\n // keep consistent with fetch API\n json: function json() {\n return Promise.resolve(response);\n }\n });\n\n if (timeoutId) clearTimeout(timeoutId);\n\n removeScript(scriptId);\n\n clearFunction(callbackFunction);\n };\n\n // Check if the user set their own params, and if not add a ? to start a list of params\n url += url.indexOf('?') === -1 ? '?' : '&';\n\n var jsonpScript = document.createElement('script');\n jsonpScript.setAttribute('src', '' + url + jsonpCallback + '=' + callbackFunction);\n if (options.charset) {\n jsonpScript.setAttribute('charset', options.charset);\n }\n jsonpScript.id = scriptId;\n document.getElementsByTagName('head')[0].appendChild(jsonpScript);\n\n timeoutId = setTimeout(function () {\n reject(new Error('JSONP request to ' + _url + ' timed out'));\n\n clearFunction(callbackFunction);\n removeScript(scriptId);\n window[callbackFunction] = function () {\n clearFunction(callbackFunction);\n };\n }, timeout);\n\n // Caught if got 404/500\n jsonpScript.onerror = function () {\n reject(new Error('JSONP request to ' + _url + ' failed'));\n\n clearFunction(callbackFunction);\n removeScript(scriptId);\n if (timeoutId) clearTimeout(timeoutId);\n };\n });\n }\n\n // export as global function\n /*\n let local;\n if (typeof global !== 'undefined') {\n local = global;\n } else if (typeof self !== 'undefined') {\n local = self;\n } else {\n try {\n local = Function('return this')();\n } catch (e) {\n throw new Error('polyfill failed because global object is unavailable in this environment');\n }\n }\n local.fetchJsonp = fetchJsonp;\n */\n\n module.exports = fetchJsonp;\n});","/**\n * lodash (Custom Build) \n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright jQuery Foundation and other contributors \n * Released under MIT license \n * Based on Underscore.js 1.8.3 \n * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n */\n\n/** Used as the size to enable large array optimizations. */\nvar LARGE_ARRAY_SIZE = 200;\n\n/** Used to stand-in for `undefined` hash values. */\nvar HASH_UNDEFINED = '__lodash_hash_undefined__';\n\n/** Used as references for various `Number` constants. */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]',\n arrayTag = '[object Array]',\n boolTag = '[object Boolean]',\n dateTag = '[object Date]',\n errorTag = '[object Error]',\n funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]',\n mapTag = '[object Map]',\n numberTag = '[object Number]',\n objectTag = '[object Object]',\n promiseTag = '[object Promise]',\n regexpTag = '[object RegExp]',\n setTag = '[object Set]',\n stringTag = '[object String]',\n symbolTag = '[object Symbol]',\n weakMapTag = '[object WeakMap]';\n\nvar arrayBufferTag = '[object ArrayBuffer]',\n dataViewTag = '[object DataView]',\n float32Tag = '[object Float32Array]',\n float64Tag = '[object Float64Array]',\n int8Tag = '[object Int8Array]',\n int16Tag = '[object Int16Array]',\n int32Tag = '[object Int32Array]',\n uint8Tag = '[object Uint8Array]',\n uint8ClampedTag = '[object Uint8ClampedArray]',\n uint16Tag = '[object Uint16Array]',\n uint32Tag = '[object Uint32Array]';\n\n/**\n * Used to match `RegExp`\n * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).\n */\nvar reRegExpChar = /[\\\\^$.*+?()[\\]{}|]/g;\n\n/** Used to match `RegExp` flags from their coerced string values. */\nvar reFlags = /\\w*$/;\n\n/** Used to detect host constructors (Safari). */\nvar reIsHostCtor = /^\\[object .+?Constructor\\]$/;\n\n/** Used to detect unsigned integer values. */\nvar reIsUint = /^(?:0|[1-9]\\d*)$/;\n\n/** Used to identify `toStringTag` values supported by `_.clone`. */\nvar cloneableTags = {};\ncloneableTags[argsTag] = cloneableTags[arrayTag] =\ncloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =\ncloneableTags[boolTag] = cloneableTags[dateTag] =\ncloneableTags[float32Tag] = cloneableTags[float64Tag] =\ncloneableTags[int8Tag] = cloneableTags[int16Tag] =\ncloneableTags[int32Tag] = cloneableTags[mapTag] =\ncloneableTags[numberTag] = cloneableTags[objectTag] =\ncloneableTags[regexpTag] = cloneableTags[setTag] =\ncloneableTags[stringTag] = cloneableTags[symbolTag] =\ncloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =\ncloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;\ncloneableTags[errorTag] = cloneableTags[funcTag] =\ncloneableTags[weakMapTag] = false;\n\n/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof global == 'object' && global && global.Object === Object && global;\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = freeGlobal || freeSelf || Function('return this')();\n\n/** Detect free variable `exports`. */\nvar freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;\n\n/** Detect free variable `module`. */\nvar freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;\n\n/** Detect the popular CommonJS extension `module.exports`. */\nvar moduleExports = freeModule && freeModule.exports === freeExports;\n\n/**\n * Adds the key-value `pair` to `map`.\n *\n * @private\n * @param {Object} map The map to modify.\n * @param {Array} pair The key-value pair to add.\n * @returns {Object} Returns `map`.\n */\nfunction addMapEntry(map, pair) {\n // Don't return `map.set` because it's not chainable in IE 11.\n map.set(pair[0], pair[1]);\n return map;\n}\n\n/**\n * Adds `value` to `set`.\n *\n * @private\n * @param {Object} set The set to modify.\n * @param {*} value The value to add.\n * @returns {Object} Returns `set`.\n */\nfunction addSetEntry(set, value) {\n // Don't return `set.add` because it's not chainable in IE 11.\n set.add(value);\n return set;\n}\n\n/**\n * A specialized version of `_.forEach` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns `array`.\n */\nfunction arrayEach(array, iteratee) {\n var index = -1,\n length = array ? array.length : 0;\n\n while (++index < length) {\n if (iteratee(array[index], index, array) === false) {\n break;\n }\n }\n return array;\n}\n\n/**\n * Appends the elements of `values` to `array`.\n *\n * @private\n * @param {Array} array The array to modify.\n * @param {Array} values The values to append.\n * @returns {Array} Returns `array`.\n */\nfunction arrayPush(array, values) {\n var index = -1,\n length = values.length,\n offset = array.length;\n\n while (++index < length) {\n array[offset + index] = values[index];\n }\n return array;\n}\n\n/**\n * A specialized version of `_.reduce` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @param {*} [accumulator] The initial value.\n * @param {boolean} [initAccum] Specify using the first element of `array` as\n * the initial value.\n * @returns {*} Returns the accumulated value.\n */\nfunction arrayReduce(array, iteratee, accumulator, initAccum) {\n var index = -1,\n length = array ? array.length : 0;\n\n if (initAccum && length) {\n accumulator = array[++index];\n }\n while (++index < length) {\n accumulator = iteratee(accumulator, array[index], index, array);\n }\n return accumulator;\n}\n\n/**\n * The base implementation of `_.times` without support for iteratee shorthands\n * or max array length checks.\n *\n * @private\n * @param {number} n The number of times to invoke `iteratee`.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the array of results.\n */\nfunction baseTimes(n, iteratee) {\n var index = -1,\n result = Array(n);\n\n while (++index < n) {\n result[index] = iteratee(index);\n }\n return result;\n}\n\n/**\n * Gets the value at `key` of `object`.\n *\n * @private\n * @param {Object} [object] The object to query.\n * @param {string} key The key of the property to get.\n * @returns {*} Returns the property value.\n */\nfunction getValue(object, key) {\n return object == null ? undefined : object[key];\n}\n\n/**\n * Checks if `value` is a host object in IE < 9.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a host object, else `false`.\n */\nfunction isHostObject(value) {\n // Many host objects are `Object` objects that can coerce to strings\n // despite having improperly defined `toString` methods.\n var result = false;\n if (value != null && typeof value.toString != 'function') {\n try {\n result = !!(value + '');\n } catch (e) {}\n }\n return result;\n}\n\n/**\n * Converts `map` to its key-value pairs.\n *\n * @private\n * @param {Object} map The map to convert.\n * @returns {Array} Returns the key-value pairs.\n */\nfunction mapToArray(map) {\n var index = -1,\n result = Array(map.size);\n\n map.forEach(function(value, key) {\n result[++index] = [key, value];\n });\n return result;\n}\n\n/**\n * Creates a unary function that invokes `func` with its argument transformed.\n *\n * @private\n * @param {Function} func The function to wrap.\n * @param {Function} transform The argument transform.\n * @returns {Function} Returns the new function.\n */\nfunction overArg(func, transform) {\n return function(arg) {\n return func(transform(arg));\n };\n}\n\n/**\n * Converts `set` to an array of its values.\n *\n * @private\n * @param {Object} set The set to convert.\n * @returns {Array} Returns the values.\n */\nfunction setToArray(set) {\n var index = -1,\n result = Array(set.size);\n\n set.forEach(function(value) {\n result[++index] = value;\n });\n return result;\n}\n\n/** Used for built-in method references. */\nvar arrayProto = Array.prototype,\n funcProto = Function.prototype,\n objectProto = Object.prototype;\n\n/** Used to detect overreaching core-js shims. */\nvar coreJsData = root['__core-js_shared__'];\n\n/** Used to detect methods masquerading as native. */\nvar maskSrcKey = (function() {\n var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');\n return uid ? ('Symbol(src)_1.' + uid) : '';\n}());\n\n/** Used to resolve the decompiled source of functions. */\nvar funcToString = funcProto.toString;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objectToString = objectProto.toString;\n\n/** Used to detect if a method is native. */\nvar reIsNative = RegExp('^' +\n funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\\\$&')\n .replace(/hasOwnProperty|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g, '$1.*?') + '$'\n);\n\n/** Built-in value references. */\nvar Buffer = moduleExports ? root.Buffer : undefined,\n Symbol = root.Symbol,\n Uint8Array = root.Uint8Array,\n getPrototype = overArg(Object.getPrototypeOf, Object),\n objectCreate = Object.create,\n propertyIsEnumerable = objectProto.propertyIsEnumerable,\n splice = arrayProto.splice;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeGetSymbols = Object.getOwnPropertySymbols,\n nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,\n nativeKeys = overArg(Object.keys, Object);\n\n/* Built-in method references that are verified to be native. */\nvar DataView = getNative(root, 'DataView'),\n Map = getNative(root, 'Map'),\n Promise = getNative(root, 'Promise'),\n Set = getNative(root, 'Set'),\n WeakMap = getNative(root, 'WeakMap'),\n nativeCreate = getNative(Object, 'create');\n\n/** Used to detect maps, sets, and weakmaps. */\nvar dataViewCtorString = toSource(DataView),\n mapCtorString = toSource(Map),\n promiseCtorString = toSource(Promise),\n setCtorString = toSource(Set),\n weakMapCtorString = toSource(WeakMap);\n\n/** Used to convert symbols to primitives and strings. */\nvar symbolProto = Symbol ? Symbol.prototype : undefined,\n symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;\n\n/**\n * Creates a hash object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction Hash(entries) {\n var index = -1,\n length = entries ? entries.length : 0;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n/**\n * Removes all key-value entries from the hash.\n *\n * @private\n * @name clear\n * @memberOf Hash\n */\nfunction hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n}\n\n/**\n * Removes `key` and its value from the hash.\n *\n * @private\n * @name delete\n * @memberOf Hash\n * @param {Object} hash The hash to modify.\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction hashDelete(key) {\n return this.has(key) && delete this.__data__[key];\n}\n\n/**\n * Gets the hash value for `key`.\n *\n * @private\n * @name get\n * @memberOf Hash\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction hashGet(key) {\n var data = this.__data__;\n if (nativeCreate) {\n var result = data[key];\n return result === HASH_UNDEFINED ? undefined : result;\n }\n return hasOwnProperty.call(data, key) ? data[key] : undefined;\n}\n\n/**\n * Checks if a hash value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf Hash\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction hashHas(key) {\n var data = this.__data__;\n return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key);\n}\n\n/**\n * Sets the hash `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf Hash\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the hash instance.\n */\nfunction hashSet(key, value) {\n var data = this.__data__;\n data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;\n return this;\n}\n\n// Add methods to `Hash`.\nHash.prototype.clear = hashClear;\nHash.prototype['delete'] = hashDelete;\nHash.prototype.get = hashGet;\nHash.prototype.has = hashHas;\nHash.prototype.set = hashSet;\n\n/**\n * Creates an list cache object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction ListCache(entries) {\n var index = -1,\n length = entries ? entries.length : 0;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n/**\n * Removes all key-value entries from the list cache.\n *\n * @private\n * @name clear\n * @memberOf ListCache\n */\nfunction listCacheClear() {\n this.__data__ = [];\n}\n\n/**\n * Removes `key` and its value from the list cache.\n *\n * @private\n * @name delete\n * @memberOf ListCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction listCacheDelete(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n if (index < 0) {\n return false;\n }\n var lastIndex = data.length - 1;\n if (index == lastIndex) {\n data.pop();\n } else {\n splice.call(data, index, 1);\n }\n return true;\n}\n\n/**\n * Gets the list cache value for `key`.\n *\n * @private\n * @name get\n * @memberOf ListCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction listCacheGet(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n return index < 0 ? undefined : data[index][1];\n}\n\n/**\n * Checks if a list cache value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf ListCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction listCacheHas(key) {\n return assocIndexOf(this.__data__, key) > -1;\n}\n\n/**\n * Sets the list cache `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf ListCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the list cache instance.\n */\nfunction listCacheSet(key, value) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n if (index < 0) {\n data.push([key, value]);\n } else {\n data[index][1] = value;\n }\n return this;\n}\n\n// Add methods to `ListCache`.\nListCache.prototype.clear = listCacheClear;\nListCache.prototype['delete'] = listCacheDelete;\nListCache.prototype.get = listCacheGet;\nListCache.prototype.has = listCacheHas;\nListCache.prototype.set = listCacheSet;\n\n/**\n * Creates a map cache object to store key-value pairs.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction MapCache(entries) {\n var index = -1,\n length = entries ? entries.length : 0;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n/**\n * Removes all key-value entries from the map.\n *\n * @private\n * @name clear\n * @memberOf MapCache\n */\nfunction mapCacheClear() {\n this.__data__ = {\n 'hash': new Hash,\n 'map': new (Map || ListCache),\n 'string': new Hash\n };\n}\n\n/**\n * Removes `key` and its value from the map.\n *\n * @private\n * @name delete\n * @memberOf MapCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction mapCacheDelete(key) {\n return getMapData(this, key)['delete'](key);\n}\n\n/**\n * Gets the map value for `key`.\n *\n * @private\n * @name get\n * @memberOf MapCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction mapCacheGet(key) {\n return getMapData(this, key).get(key);\n}\n\n/**\n * Checks if a map value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf MapCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction mapCacheHas(key) {\n return getMapData(this, key).has(key);\n}\n\n/**\n * Sets the map `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf MapCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the map cache instance.\n */\nfunction mapCacheSet(key, value) {\n getMapData(this, key).set(key, value);\n return this;\n}\n\n// Add methods to `MapCache`.\nMapCache.prototype.clear = mapCacheClear;\nMapCache.prototype['delete'] = mapCacheDelete;\nMapCache.prototype.get = mapCacheGet;\nMapCache.prototype.has = mapCacheHas;\nMapCache.prototype.set = mapCacheSet;\n\n/**\n * Creates a stack cache object to store key-value pairs.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction Stack(entries) {\n this.__data__ = new ListCache(entries);\n}\n\n/**\n * Removes all key-value entries from the stack.\n *\n * @private\n * @name clear\n * @memberOf Stack\n */\nfunction stackClear() {\n this.__data__ = new ListCache;\n}\n\n/**\n * Removes `key` and its value from the stack.\n *\n * @private\n * @name delete\n * @memberOf Stack\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction stackDelete(key) {\n return this.__data__['delete'](key);\n}\n\n/**\n * Gets the stack value for `key`.\n *\n * @private\n * @name get\n * @memberOf Stack\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction stackGet(key) {\n return this.__data__.get(key);\n}\n\n/**\n * Checks if a stack value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf Stack\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction stackHas(key) {\n return this.__data__.has(key);\n}\n\n/**\n * Sets the stack `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf Stack\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the stack cache instance.\n */\nfunction stackSet(key, value) {\n var cache = this.__data__;\n if (cache instanceof ListCache) {\n var pairs = cache.__data__;\n if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {\n pairs.push([key, value]);\n return this;\n }\n cache = this.__data__ = new MapCache(pairs);\n }\n cache.set(key, value);\n return this;\n}\n\n// Add methods to `Stack`.\nStack.prototype.clear = stackClear;\nStack.prototype['delete'] = stackDelete;\nStack.prototype.get = stackGet;\nStack.prototype.has = stackHas;\nStack.prototype.set = stackSet;\n\n/**\n * Creates an array of the enumerable property names of the array-like `value`.\n *\n * @private\n * @param {*} value The value to query.\n * @param {boolean} inherited Specify returning inherited property names.\n * @returns {Array} Returns the array of property names.\n */\nfunction arrayLikeKeys(value, inherited) {\n // Safari 8.1 makes `arguments.callee` enumerable in strict mode.\n // Safari 9 makes `arguments.length` enumerable in strict mode.\n var result = (isArray(value) || isArguments(value))\n ? baseTimes(value.length, String)\n : [];\n\n var length = result.length,\n skipIndexes = !!length;\n\n for (var key in value) {\n if ((inherited || hasOwnProperty.call(value, key)) &&\n !(skipIndexes && (key == 'length' || isIndex(key, length)))) {\n result.push(key);\n }\n }\n return result;\n}\n\n/**\n * Assigns `value` to `key` of `object` if the existing value is not equivalent\n * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * for equality comparisons.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {string} key The key of the property to assign.\n * @param {*} value The value to assign.\n */\nfunction assignValue(object, key, value) {\n var objValue = object[key];\n if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||\n (value === undefined && !(key in object))) {\n object[key] = value;\n }\n}\n\n/**\n * Gets the index at which the `key` is found in `array` of key-value pairs.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} key The key to search for.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\nfunction assocIndexOf(array, key) {\n var length = array.length;\n while (length--) {\n if (eq(array[length][0], key)) {\n return length;\n }\n }\n return -1;\n}\n\n/**\n * The base implementation of `_.assign` without support for multiple sources\n * or `customizer` functions.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @returns {Object} Returns `object`.\n */\nfunction baseAssign(object, source) {\n return object && copyObject(source, keys(source), object);\n}\n\n/**\n * The base implementation of `_.clone` and `_.cloneDeep` which tracks\n * traversed objects.\n *\n * @private\n * @param {*} value The value to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @param {boolean} [isFull] Specify a clone including symbols.\n * @param {Function} [customizer] The function to customize cloning.\n * @param {string} [key] The key of `value`.\n * @param {Object} [object] The parent object of `value`.\n * @param {Object} [stack] Tracks traversed objects and their clone counterparts.\n * @returns {*} Returns the cloned value.\n */\nfunction baseClone(value, isDeep, isFull, customizer, key, object, stack) {\n var result;\n if (customizer) {\n result = object ? customizer(value, key, object, stack) : customizer(value);\n }\n if (result !== undefined) {\n return result;\n }\n if (!isObject(value)) {\n return value;\n }\n var isArr = isArray(value);\n if (isArr) {\n result = initCloneArray(value);\n if (!isDeep) {\n return copyArray(value, result);\n }\n } else {\n var tag = getTag(value),\n isFunc = tag == funcTag || tag == genTag;\n\n if (isBuffer(value)) {\n return cloneBuffer(value, isDeep);\n }\n if (tag == objectTag || tag == argsTag || (isFunc && !object)) {\n if (isHostObject(value)) {\n return object ? value : {};\n }\n result = initCloneObject(isFunc ? {} : value);\n if (!isDeep) {\n return copySymbols(value, baseAssign(result, value));\n }\n } else {\n if (!cloneableTags[tag]) {\n return object ? value : {};\n }\n result = initCloneByTag(value, tag, baseClone, isDeep);\n }\n }\n // Check for circular references and return its corresponding clone.\n stack || (stack = new Stack);\n var stacked = stack.get(value);\n if (stacked) {\n return stacked;\n }\n stack.set(value, result);\n\n if (!isArr) {\n var props = isFull ? getAllKeys(value) : keys(value);\n }\n arrayEach(props || value, function(subValue, key) {\n if (props) {\n key = subValue;\n subValue = value[key];\n }\n // Recursively populate clone (susceptible to call stack limits).\n assignValue(result, key, baseClone(subValue, isDeep, isFull, customizer, key, value, stack));\n });\n return result;\n}\n\n/**\n * The base implementation of `_.create` without support for assigning\n * properties to the created object.\n *\n * @private\n * @param {Object} prototype The object to inherit from.\n * @returns {Object} Returns the new object.\n */\nfunction baseCreate(proto) {\n return isObject(proto) ? objectCreate(proto) : {};\n}\n\n/**\n * The base implementation of `getAllKeys` and `getAllKeysIn` which uses\n * `keysFunc` and `symbolsFunc` to get the enumerable property names and\n * symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Function} keysFunc The function to get the keys of `object`.\n * @param {Function} symbolsFunc The function to get the symbols of `object`.\n * @returns {Array} Returns the array of property names and symbols.\n */\nfunction baseGetAllKeys(object, keysFunc, symbolsFunc) {\n var result = keysFunc(object);\n return isArray(object) ? result : arrayPush(result, symbolsFunc(object));\n}\n\n/**\n * The base implementation of `getTag`.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nfunction baseGetTag(value) {\n return objectToString.call(value);\n}\n\n/**\n * The base implementation of `_.isNative` without bad shim checks.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a native function,\n * else `false`.\n */\nfunction baseIsNative(value) {\n if (!isObject(value) || isMasked(value)) {\n return false;\n }\n var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor;\n return pattern.test(toSource(value));\n}\n\n/**\n * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction baseKeys(object) {\n if (!isPrototype(object)) {\n return nativeKeys(object);\n }\n var result = [];\n for (var key in Object(object)) {\n if (hasOwnProperty.call(object, key) && key != 'constructor') {\n result.push(key);\n }\n }\n return result;\n}\n\n/**\n * Creates a clone of `buffer`.\n *\n * @private\n * @param {Buffer} buffer The buffer to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Buffer} Returns the cloned buffer.\n */\nfunction cloneBuffer(buffer, isDeep) {\n if (isDeep) {\n return buffer.slice();\n }\n var result = new buffer.constructor(buffer.length);\n buffer.copy(result);\n return result;\n}\n\n/**\n * Creates a clone of `arrayBuffer`.\n *\n * @private\n * @param {ArrayBuffer} arrayBuffer The array buffer to clone.\n * @returns {ArrayBuffer} Returns the cloned array buffer.\n */\nfunction cloneArrayBuffer(arrayBuffer) {\n var result = new arrayBuffer.constructor(arrayBuffer.byteLength);\n new Uint8Array(result).set(new Uint8Array(arrayBuffer));\n return result;\n}\n\n/**\n * Creates a clone of `dataView`.\n *\n * @private\n * @param {Object} dataView The data view to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Object} Returns the cloned data view.\n */\nfunction cloneDataView(dataView, isDeep) {\n var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;\n return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);\n}\n\n/**\n * Creates a clone of `map`.\n *\n * @private\n * @param {Object} map The map to clone.\n * @param {Function} cloneFunc The function to clone values.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Object} Returns the cloned map.\n */\nfunction cloneMap(map, isDeep, cloneFunc) {\n var array = isDeep ? cloneFunc(mapToArray(map), true) : mapToArray(map);\n return arrayReduce(array, addMapEntry, new map.constructor);\n}\n\n/**\n * Creates a clone of `regexp`.\n *\n * @private\n * @param {Object} regexp The regexp to clone.\n * @returns {Object} Returns the cloned regexp.\n */\nfunction cloneRegExp(regexp) {\n var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));\n result.lastIndex = regexp.lastIndex;\n return result;\n}\n\n/**\n * Creates a clone of `set`.\n *\n * @private\n * @param {Object} set The set to clone.\n * @param {Function} cloneFunc The function to clone values.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Object} Returns the cloned set.\n */\nfunction cloneSet(set, isDeep, cloneFunc) {\n var array = isDeep ? cloneFunc(setToArray(set), true) : setToArray(set);\n return arrayReduce(array, addSetEntry, new set.constructor);\n}\n\n/**\n * Creates a clone of the `symbol` object.\n *\n * @private\n * @param {Object} symbol The symbol object to clone.\n * @returns {Object} Returns the cloned symbol object.\n */\nfunction cloneSymbol(symbol) {\n return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};\n}\n\n/**\n * Creates a clone of `typedArray`.\n *\n * @private\n * @param {Object} typedArray The typed array to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Object} Returns the cloned typed array.\n */\nfunction cloneTypedArray(typedArray, isDeep) {\n var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;\n return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);\n}\n\n/**\n * Copies the values of `source` to `array`.\n *\n * @private\n * @param {Array} source The array to copy values from.\n * @param {Array} [array=[]] The array to copy values to.\n * @returns {Array} Returns `array`.\n */\nfunction copyArray(source, array) {\n var index = -1,\n length = source.length;\n\n array || (array = Array(length));\n while (++index < length) {\n array[index] = source[index];\n }\n return array;\n}\n\n/**\n * Copies properties of `source` to `object`.\n *\n * @private\n * @param {Object} source The object to copy properties from.\n * @param {Array} props The property identifiers to copy.\n * @param {Object} [object={}] The object to copy properties to.\n * @param {Function} [customizer] The function to customize copied values.\n * @returns {Object} Returns `object`.\n */\nfunction copyObject(source, props, object, customizer) {\n object || (object = {});\n\n var index = -1,\n length = props.length;\n\n while (++index < length) {\n var key = props[index];\n\n var newValue = customizer\n ? customizer(object[key], source[key], key, object, source)\n : undefined;\n\n assignValue(object, key, newValue === undefined ? source[key] : newValue);\n }\n return object;\n}\n\n/**\n * Copies own symbol properties of `source` to `object`.\n *\n * @private\n * @param {Object} source The object to copy symbols from.\n * @param {Object} [object={}] The object to copy symbols to.\n * @returns {Object} Returns `object`.\n */\nfunction copySymbols(source, object) {\n return copyObject(source, getSymbols(source), object);\n}\n\n/**\n * Creates an array of own enumerable property names and symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names and symbols.\n */\nfunction getAllKeys(object) {\n return baseGetAllKeys(object, keys, getSymbols);\n}\n\n/**\n * Gets the data for `map`.\n *\n * @private\n * @param {Object} map The map to query.\n * @param {string} key The reference key.\n * @returns {*} Returns the map data.\n */\nfunction getMapData(map, key) {\n var data = map.__data__;\n return isKeyable(key)\n ? data[typeof key == 'string' ? 'string' : 'hash']\n : data.map;\n}\n\n/**\n * Gets the native function at `key` of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {string} key The key of the method to get.\n * @returns {*} Returns the function if it's native, else `undefined`.\n */\nfunction getNative(object, key) {\n var value = getValue(object, key);\n return baseIsNative(value) ? value : undefined;\n}\n\n/**\n * Creates an array of the own enumerable symbol properties of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of symbols.\n */\nvar getSymbols = nativeGetSymbols ? overArg(nativeGetSymbols, Object) : stubArray;\n\n/**\n * Gets the `toStringTag` of `value`.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nvar getTag = baseGetTag;\n\n// Fallback for data views, maps, sets, and weak maps in IE 11,\n// for data views in Edge < 14, and promises in Node.js.\nif ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||\n (Map && getTag(new Map) != mapTag) ||\n (Promise && getTag(Promise.resolve()) != promiseTag) ||\n (Set && getTag(new Set) != setTag) ||\n (WeakMap && getTag(new WeakMap) != weakMapTag)) {\n getTag = function(value) {\n var result = objectToString.call(value),\n Ctor = result == objectTag ? value.constructor : undefined,\n ctorString = Ctor ? toSource(Ctor) : undefined;\n\n if (ctorString) {\n switch (ctorString) {\n case dataViewCtorString: return dataViewTag;\n case mapCtorString: return mapTag;\n case promiseCtorString: return promiseTag;\n case setCtorString: return setTag;\n case weakMapCtorString: return weakMapTag;\n }\n }\n return result;\n };\n}\n\n/**\n * Initializes an array clone.\n *\n * @private\n * @param {Array} array The array to clone.\n * @returns {Array} Returns the initialized clone.\n */\nfunction initCloneArray(array) {\n var length = array.length,\n result = array.constructor(length);\n\n // Add properties assigned by `RegExp#exec`.\n if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {\n result.index = array.index;\n result.input = array.input;\n }\n return result;\n}\n\n/**\n * Initializes an object clone.\n *\n * @private\n * @param {Object} object The object to clone.\n * @returns {Object} Returns the initialized clone.\n */\nfunction initCloneObject(object) {\n return (typeof object.constructor == 'function' && !isPrototype(object))\n ? baseCreate(getPrototype(object))\n : {};\n}\n\n/**\n * Initializes an object clone based on its `toStringTag`.\n *\n * **Note:** This function only supports cloning values with tags of\n * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.\n *\n * @private\n * @param {Object} object The object to clone.\n * @param {string} tag The `toStringTag` of the object to clone.\n * @param {Function} cloneFunc The function to clone values.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Object} Returns the initialized clone.\n */\nfunction initCloneByTag(object, tag, cloneFunc, isDeep) {\n var Ctor = object.constructor;\n switch (tag) {\n case arrayBufferTag:\n return cloneArrayBuffer(object);\n\n case boolTag:\n case dateTag:\n return new Ctor(+object);\n\n case dataViewTag:\n return cloneDataView(object, isDeep);\n\n case float32Tag: case float64Tag:\n case int8Tag: case int16Tag: case int32Tag:\n case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:\n return cloneTypedArray(object, isDeep);\n\n case mapTag:\n return cloneMap(object, isDeep, cloneFunc);\n\n case numberTag:\n case stringTag:\n return new Ctor(object);\n\n case regexpTag:\n return cloneRegExp(object);\n\n case setTag:\n return cloneSet(object, isDeep, cloneFunc);\n\n case symbolTag:\n return cloneSymbol(object);\n }\n}\n\n/**\n * Checks if `value` is a valid array-like index.\n *\n * @private\n * @param {*} value The value to check.\n * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.\n * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.\n */\nfunction isIndex(value, length) {\n length = length == null ? MAX_SAFE_INTEGER : length;\n return !!length &&\n (typeof value == 'number' || reIsUint.test(value)) &&\n (value > -1 && value % 1 == 0 && value < length);\n}\n\n/**\n * Checks if `value` is suitable for use as unique object key.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is suitable, else `false`.\n */\nfunction isKeyable(value) {\n var type = typeof value;\n return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')\n ? (value !== '__proto__')\n : (value === null);\n}\n\n/**\n * Checks if `func` has its source masked.\n *\n * @private\n * @param {Function} func The function to check.\n * @returns {boolean} Returns `true` if `func` is masked, else `false`.\n */\nfunction isMasked(func) {\n return !!maskSrcKey && (maskSrcKey in func);\n}\n\n/**\n * Checks if `value` is likely a prototype object.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.\n */\nfunction isPrototype(value) {\n var Ctor = value && value.constructor,\n proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;\n\n return value === proto;\n}\n\n/**\n * Converts `func` to its source code.\n *\n * @private\n * @param {Function} func The function to process.\n * @returns {string} Returns the source code.\n */\nfunction toSource(func) {\n if (func != null) {\n try {\n return funcToString.call(func);\n } catch (e) {}\n try {\n return (func + '');\n } catch (e) {}\n }\n return '';\n}\n\n/**\n * This method is like `_.clone` except that it recursively clones `value`.\n *\n * @static\n * @memberOf _\n * @since 1.0.0\n * @category Lang\n * @param {*} value The value to recursively clone.\n * @returns {*} Returns the deep cloned value.\n * @see _.clone\n * @example\n *\n * var objects = [{ 'a': 1 }, { 'b': 2 }];\n *\n * var deep = _.cloneDeep(objects);\n * console.log(deep[0] === objects[0]);\n * // => false\n */\nfunction cloneDeep(value) {\n return baseClone(value, true, true);\n}\n\n/**\n * Performs a\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * comparison between two values to determine if they are equivalent.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n * @example\n *\n * var object = { 'a': 1 };\n * var other = { 'a': 1 };\n *\n * _.eq(object, object);\n * // => true\n *\n * _.eq(object, other);\n * // => false\n *\n * _.eq('a', 'a');\n * // => true\n *\n * _.eq('a', Object('a'));\n * // => false\n *\n * _.eq(NaN, NaN);\n * // => true\n */\nfunction eq(value, other) {\n return value === other || (value !== value && other !== other);\n}\n\n/**\n * Checks if `value` is likely an `arguments` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n * else `false`.\n * @example\n *\n * _.isArguments(function() { return arguments; }());\n * // => true\n *\n * _.isArguments([1, 2, 3]);\n * // => false\n */\nfunction isArguments(value) {\n // Safari 8.1 makes `arguments.callee` enumerable in strict mode.\n return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&\n (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);\n}\n\n/**\n * Checks if `value` is classified as an `Array` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array, else `false`.\n * @example\n *\n * _.isArray([1, 2, 3]);\n * // => true\n *\n * _.isArray(document.body.children);\n * // => false\n *\n * _.isArray('abc');\n * // => false\n *\n * _.isArray(_.noop);\n * // => false\n */\nvar isArray = Array.isArray;\n\n/**\n * Checks if `value` is array-like. A value is considered array-like if it's\n * not a function and has a `value.length` that's an integer greater than or\n * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is array-like, else `false`.\n * @example\n *\n * _.isArrayLike([1, 2, 3]);\n * // => true\n *\n * _.isArrayLike(document.body.children);\n * // => true\n *\n * _.isArrayLike('abc');\n * // => true\n *\n * _.isArrayLike(_.noop);\n * // => false\n */\nfunction isArrayLike(value) {\n return value != null && isLength(value.length) && !isFunction(value);\n}\n\n/**\n * This method is like `_.isArrayLike` except that it also checks if `value`\n * is an object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array-like object,\n * else `false`.\n * @example\n *\n * _.isArrayLikeObject([1, 2, 3]);\n * // => true\n *\n * _.isArrayLikeObject(document.body.children);\n * // => true\n *\n * _.isArrayLikeObject('abc');\n * // => false\n *\n * _.isArrayLikeObject(_.noop);\n * // => false\n */\nfunction isArrayLikeObject(value) {\n return isObjectLike(value) && isArrayLike(value);\n}\n\n/**\n * Checks if `value` is a buffer.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.\n * @example\n *\n * _.isBuffer(new Buffer(2));\n * // => true\n *\n * _.isBuffer(new Uint8Array(2));\n * // => false\n */\nvar isBuffer = nativeIsBuffer || stubFalse;\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a function, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\nfunction isFunction(value) {\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in Safari 8-9 which returns 'object' for typed array and other constructors.\n var tag = isObject(value) ? objectToString.call(value) : '';\n return tag == funcTag || tag == genTag;\n}\n\n/**\n * Checks if `value` is a valid array-like length.\n *\n * **Note:** This method is loosely based on\n * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.\n * @example\n *\n * _.isLength(3);\n * // => true\n *\n * _.isLength(Number.MIN_VALUE);\n * // => false\n *\n * _.isLength(Infinity);\n * // => false\n *\n * _.isLength('3');\n * // => false\n */\nfunction isLength(value) {\n return typeof value == 'number' &&\n value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\n}\n\n/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return !!value && (type == 'object' || type == 'function');\n}\n\n/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return !!value && typeof value == 'object';\n}\n\n/**\n * Creates an array of the own enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects. See the\n * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)\n * for more details.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keys(new Foo);\n * // => ['a', 'b'] (iteration order is not guaranteed)\n *\n * _.keys('hi');\n * // => ['0', '1']\n */\nfunction keys(object) {\n return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);\n}\n\n/**\n * This method returns a new empty array.\n *\n * @static\n * @memberOf _\n * @since 4.13.0\n * @category Util\n * @returns {Array} Returns the new empty array.\n * @example\n *\n * var arrays = _.times(2, _.stubArray);\n *\n * console.log(arrays);\n * // => [[], []]\n *\n * console.log(arrays[0] === arrays[1]);\n * // => false\n */\nfunction stubArray() {\n return [];\n}\n\n/**\n * This method returns `false`.\n *\n * @static\n * @memberOf _\n * @since 4.13.0\n * @category Util\n * @returns {boolean} Returns `false`.\n * @example\n *\n * _.times(2, _.stubFalse);\n * // => [false, false]\n */\nfunction stubFalse() {\n return false;\n}\n\nmodule.exports = cloneDeep;\n","import domify from 'domify';\r\nimport utils from './utils';\r\n\r\n// the hidden token that we will check against every time someone tries to add, remove, fire handler\r\nvar _ct = utils.guid();\r\nvar _f2t = utils.guid();\r\n\r\nvar _handlerCollection = {\r\n\tappManifestRequestFail: [],\r\n\tappCreateRoot: [],\r\n\tappRenderBefore: [],\r\n\tappDestroyBefore: [],\r\n\tappRenderAfter: [],\r\n\tappDestroyAfter: [],\r\n\tappRender: [],\r\n\tappDestroy: [],\r\n\tappScriptLoadFailed: []\r\n};\r\n\r\nvar _defaultMethods = {\r\n\tappRender: function(appConfig, appHtml)\r\n\t{\r\n\t\t// if no app root is defined use the app's outer most node\r\n\t\tif(!utils.isNativeDOMNode(appConfig.root))\r\n\t\t{\r\n\t\t\tappConfig.root = domify(appHtml);\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t// append the app html to the root\r\n\t\t\tappConfig.root.appendChild(domify(appHtml));\r\n\t\t}\r\n\r\n\t\t// append the root to the body by default.\r\n\t\tdocument.body.appendChild(appConfig.root);\r\n\t},\r\n\tappDestroy: function(appInstance)\r\n\t{\r\n\t\t// call the apps destroy method, if it has one\r\n\t\tif(appInstance && appInstance.app && appInstance.app.destroy && typeof(appInstance.app.destroy) == 'function')\r\n\t\t{\r\n\t\t\tappInstance.app.destroy();\r\n\t\t}\r\n\t\t// warn the Container and App Developer that even though they have a destroy method it hasn't been\r\n\t\telse if(appInstance && appInstance.app && appInstance.app.destroy)\r\n\t\t{\r\n\t\t\tutils.log(appInstance.config.appId + ' has a destroy property, but destroy is not of type function and as such will not be executed.');\r\n\t\t}\r\n\r\n\t\t// remove the root\r\n\t\tappInstance.config.root.parentNode.removeChild(appInstance.config.root);\r\n\t}\r\n};\r\n\r\nvar _createHandler = function(token, sNamespace, func_or_element, bDomNodeAppropriate)\r\n{\r\n\t// will throw an exception and stop execution if the token is invalid\r\n\t_validateToken(token);\r\n\r\n\t// create handler structure. Not all arguments properties will be populated/used.\r\n\tvar handler = {\r\n\t\tfunc: (typeof(func_or_element)) ? func_or_element : null,\r\n\t\tnamespace: sNamespace,\r\n\t\tdomNode: (utils.isNativeDOMNode(func_or_element)) ? func_or_element : null\r\n\t};\r\n\r\n\tif(!handler.func && !handler.domNode)\r\n\t{\r\n\t\tthrow ('Invalid or null argument passed. Handler will not be added to collection. A valid dom element or callback function is required.');\r\n\t}\r\n\r\n\tif(handler.domNode && !bDomNodeAppropriate)\r\n\t{\r\n\t\tthrow ('Invalid argument passed. Handler will not be added to collection. A callback function is required for this event type.');\r\n\t}\r\n\r\n\treturn handler;\r\n};\r\n\r\nvar _validateToken = function(sToken)\r\n{\r\n\t// check token against F2 and container\r\n\tif(_ct != sToken && _f2t != sToken) { throw ('Invalid token passed. Please verify that you have correctly received and stored token from F2.AppHandlers.getToken().'); }\r\n};\r\n\r\nvar _removeHandler = function(sToken, eventKey, sNamespace)\r\n{\r\n\t// will throw an exception and stop execution if the token is invalid\r\n\t_validateToken(sToken);\r\n\r\n\tif(!sNamespace && !eventKey)\r\n\t{\r\n\t\treturn;\r\n\t}\r\n\t// remove by event key\r\n\telse if(!sNamespace && eventKey)\r\n\t{\r\n\t\t_handlerCollection[eventKey] = [];\r\n\t}\r\n\t// remove by namespace only\r\n\telse if(sNamespace && !eventKey)\r\n\t{\r\n\t\tsNamespace = sNamespace.toLowerCase();\r\n\r\n\t\tfor(var currentEventKey in _handlerCollection)\r\n\t\t{\r\n\t\t\tvar eventCollection = _handlerCollection[currentEventKey];\r\n\t\t\tvar newEvents = [];\r\n\r\n\t\t\tfor(var i = 0, ec = eventCollection.length; i < ec; i++)\r\n\t\t\t{\r\n\t\t\t\tvar currentEventHandler = eventCollection[i];\r\n\t\t\t\tif(currentEventHandler)\r\n\t\t\t\t{\r\n\t\t\t\t\tif(!currentEventHandler.namespace || currentEventHandler.namespace.toLowerCase() != sNamespace)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tnewEvents.push(currentEventHandler);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\teventCollection = newEvents;\r\n\t\t}\r\n\t}\r\n\telse if(sNamespace && _handlerCollection[eventKey])\r\n\t{\r\n\t\tsNamespace = sNamespace.toLowerCase();\r\n\r\n\t\tvar newHandlerCollection = [];\r\n\r\n\t\tfor(var iCounter = 0, hc = _handlerCollection[eventKey].length; iCounter < hc; iCounter++)\r\n\t\t{\r\n\t\t\tvar currentHandler = _handlerCollection[eventKey][iCounter];\r\n\t\t\tif(currentHandler)\r\n\t\t\t{\r\n\t\t\t\tif(!currentHandler.namespace || currentHandler.namespace.toLowerCase() != sNamespace)\r\n\t\t\t\t{\r\n\t\t\t\t\tnewHandlerCollection.push(currentHandler);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t_handlerCollection[eventKey] = newHandlerCollection;\r\n\t}\r\n};\r\n\r\n/**\r\n * The `AppHandlers` functionality provides Container Developers a higher level of control over configuring app rendering and interaction.\r\n *\r\n * ### Order of Execution\r\n *\r\n * **App Rendering**\r\n *\r\n * 0. {{#crossLink \"F2/registerApps\"}}F2.registerApps(){{/crossLink}} method is called by the Container Developer and the following methods are run for *each* {{#crossLink \"F2.AppConfig\"}}{{/crossLink}} passed.\r\n * 1. **'appCreateRoot'** (*{{#crossLink \"F2.Constants.AppHandlers\"}}{{/crossLink}}.APP\\_CREATE\\_ROOT*) handlers are fired in the order they were attached.\r\n * 2. **'appRenderBefore'** (*{{#crossLink \"F2.Constants.AppHandlers\"}}{{/crossLink}}.APP\\_RENDER\\_BEFORE*) handlers are fired in the order they were attached.\r\n * 3. Each app's `manifestUrl` is requested asynchronously; on success the following methods are fired.\r\n * 3. **'appRender'** (*{{#crossLink \"F2.Constants.AppHandlers\"}}{{/crossLink}}.APP\\_RENDER*) handlers are fired in the order they were attached.\r\n * 4. **'appRenderAfter'** (*{{#crossLink \"F2.Constants.AppHandlers\"}}{{/crossLink}}.APP\\_RENDER\\_AFTER*) handlers are fired in the order they were attached.\r\n *\r\n *\r\n * **App Removal**\r\n\r\n * 0. {{#crossLink \"F2/removeApp\"}}F2.removeApp(){{/crossLink}} with a specific {{#crossLink \"F2.AppConfig/instanceId \"}}{{/crossLink}} or {{#crossLink \"F2/removeAllApps\"}}F2.removeAllApps(){{/crossLink}} method is called by the Container Developer and the following methods are run.\r\n * 1. **'appDestroyBefore'** (*{{#crossLink \"F2.Constants.AppHandlers\"}}{{/crossLink}}.APP\\_DESTROY\\_BEFORE*) handlers are fired in the order they were attached.\r\n * 2. **'appDestroy'** (*{{#crossLink \"F2.Constants.AppHandlers\"}}{{/crossLink}}.APP\\_DESTROY*) handlers are fired in the order they were attached.\r\n * 3. **'appDestroyAfter'** (*{{#crossLink \"F2.Constants.AppHandlers\"}}{{/crossLink}}.APP\\_DESTROY\\_AFTER*) handlers are fired in the order they were attached.\r\n *\r\n * **Error Handling**\r\n\r\n * 0. **'appScriptLoadFailed'** (*{{#crossLink \"F2.Constants.AppHandlers\"}}{{/crossLink}}.APP\\_SCRIPT\\_LOAD\\_FAILED*) handlers are fired in the order they were attached.\r\n *\r\n * @class F2.AppHandlers\r\n */\r\nexport default {\r\n\t/**\r\n\t* Allows Container Developer to retrieve a unique token which must be passed to\r\n\t* all `on` and `off` methods. This function will self destruct and can only be called\r\n\t* one time. Container Developers must store the return value inside of a closure.\r\n\t* @method getToken\r\n\t**/\r\n\tgetToken: function()\r\n\t{\r\n\t\t// delete this method for security that way only the container has access to the token 1 time.\r\n\t\t// kind of Ethan Hunt-ish, this message will self destruct immediately.\r\n\t\tdelete this.getToken;\r\n\t\t// return the token, which we validate against.\r\n\t\treturn _ct;\r\n\t},\r\n\t/**\r\n\t* Allows F2 to get a token internally. Token is required to call {{#crossLink \"F2.AppHandlers/\\_\\_trigger:method\"}}{{/crossLink}}.\r\n\t* This function will self destruct to eliminate other sources from using the {{#crossLink \"F2.AppHandlers/\\_\\_trigger:method\"}}{{/crossLink}}\r\n\t* and additional internal methods.\r\n\t* @method __f2GetToken\r\n\t* @private\r\n\t**/\r\n\t__f2GetToken: function()\r\n\t{\r\n\t\t// delete this method for security that way only the F2 internally has access to the token 1 time.\r\n\t\t// kind of Ethan Hunt-ish, this message will self destruct immediately.\r\n\t\tdelete this.__f2GetToken;\r\n\t\t// return the token, which we validate against.\r\n\t\treturn _f2t;\r\n\t},\r\n\t/**\r\n\t* Allows F2 to trigger specific events internally.\r\n\t* @method __trigger\r\n\t* @private\r\n\t* @chainable\r\n\t* @param {String} token The token received from {{#crossLink \"F2.AppHandlers/\\_\\_f2GetToken:method\"}}{{/crossLink}}.\r\n\t* @param {String} eventKey The event to fire. The complete list of event keys is available in {{#crossLink \"F2.Constants.AppHandlers\"}}{{/crossLink}}.\r\n\t**/\r\n\t__trigger: function(token, eventKey) // additional arguments will likely be passed\r\n\t{\r\n\t\t// will throw an exception and stop execution if the token is invalid\r\n\t\tif(token != _f2t)\r\n\t\t{\r\n\t\t\tthrow ('Token passed is invalid. Only F2 is allowed to call F2.AppHandlers.__trigger().');\r\n\t\t}\r\n\r\n\t\tif(_handlerCollection && _handlerCollection[eventKey])\r\n\t\t{\r\n\t\t\t// create a collection of arguments that are safe to pass to the callback.\r\n\t\t\tvar passableArgs = [];\r\n\r\n\t\t\t// populate that collection with all arguments except token and eventKey\r\n\t\t\tfor(var i = 2, j = arguments.length; i < j; i++)\r\n\t\t\t{\r\n\t\t\t\tpassableArgs.push(arguments[i]);\r\n\t\t\t}\r\n\r\n\t\t\tif(_handlerCollection[eventKey].length === 0 && _defaultMethods[eventKey])\r\n\t\t\t{\r\n\t\t\t\t_defaultMethods[eventKey].apply(F2, passableArgs);\r\n\t\t\t\treturn this;\r\n\t\t\t}\r\n\t\t\telse if(_handlerCollection[eventKey].length === 0 && !_handlerCollection[eventKey])\r\n\t\t\t{\r\n\t\t\t\treturn this;\r\n\t\t\t}\r\n\r\n\t\t\t// fire all event listeners in the order that they were added.\r\n\t\t\tfor(var iCounter = 0, hcl = _handlerCollection[eventKey].length; iCounter < hcl; iCounter++)\r\n\t\t\t{\r\n\t\t\t\tvar handler = _handlerCollection[eventKey][iCounter];\r\n\r\n\t\t\t\t// appRender where root is already defined\r\n\t\t\t\tif (handler.domNode && arguments[2] && arguments[2].root && arguments[3])\r\n\t\t\t\t{\r\n\t\t\t\t\targuments[2].root.appendChild(domify(arguments[3]));\r\n\t\t\t\t\thandler.domNode.appendChild(arguments[2].root);\r\n\t\t\t\t}\r\n\t\t\t\telse if (handler.domNode && arguments[2] && !arguments[2].root && arguments[3])\r\n\t\t\t\t{\r\n\t\t\t\t\t// set the root to the actual HTML of the app\r\n\t\t\t\t\targuments[2].root = domify(arguments[3]);\r\n\t\t\t\t\t// appends the root to the dom node specified\r\n\t\t\t\t\thandler.domNode.appendChild(arguments[2].root);\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\thandler.func.apply(F2, passableArgs);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tthrow ('Invalid EventKey passed. Check your inputs and try again.');\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\t},\r\n\t/**\r\n\t* Allows Container Developer to easily tell all apps to render in a specific location. Only valid for eventType `appRender`.\r\n\t* @method on\r\n\t* @chainable\r\n\t* @param {String} token The token received from {{#crossLink \"F2.AppHandlers/getToken:method\"}}{{/crossLink}}.\r\n\t* @param {String} eventKey{.namespace} The event key used to determine which event to attach the listener to. The namespace is useful for removal\r\n\t* purposes. At this time it does not affect when an event is fired. Complete list of event keys available in\r\n\t* {{#crossLink \"F2.Constants.AppHandlers\"}}{{/crossLink}}.\r\n\t* @params {HTMLElement} element Specific DOM element to which app gets appended.\r\n\t* @example\r\n\t*\tvar _token = F2.AppHandlers.getToken();\r\n\t*\tF2.AppHandlers.on(\r\n\t*\t\t_token,\r\n\t*\t\t'appRender',\r\n\t*\t\tdocument.getElementById('my_app')\r\n\t*\t);\r\n\t*\r\n\t* Or:\r\n\t* @example\r\n\t*\tF2.AppHandlers.on(\r\n\t*\t\t_token,\r\n\t*\t\t'appRender.myNamespace',\r\n\t*\t\tdocument.getElementById('my_app')\r\n\t*\t);\r\n\t**/\r\n\t/**\r\n\t* Allows Container Developer to add listener method that will be triggered when a specific event occurs.\r\n\t* @method on\r\n\t* @chainable\r\n\t* @param {String} token The token received from {{#crossLink \"F2.AppHandlers/getToken:method\"}}{{/crossLink}}.\r\n\t* @param {String} eventKey{.namespace} The event key used to determine which event to attach the listener to. The namespace is useful for removal\r\n\t* purposes. At this time it does not affect when an event is fired. Complete list of event keys available in\r\n\t* {{#crossLink \"F2.Constants.AppHandlers\"}}{{/crossLink}}.\r\n\t* @params {Function} listener A function that will be triggered when a specific event occurs. For detailed argument definition refer to {{#crossLink \"F2.Constants.AppHandlers\"}}{{/crossLink}}.\r\n\t* @example\r\n\t*\tvar _token = F2.AppHandlers.getToken();\r\n\t*\tF2.AppHandlers.on(\r\n\t*\t\t_token,\r\n\t*\t\t'appRenderBefore'\r\n\t*\t\tfunction() { F2.log('before app rendered!'); }\r\n\t*\t);\r\n\t*\r\n\t* Or:\r\n\t* @example\r\n\t*\tF2.AppHandlers.on(\r\n\t*\t\t_token,\r\n\t*\t\t'appRenderBefore.myNamespace',\r\n\t*\t\tfunction() { F2.log('before app rendered!'); }\r\n\t*\t);\r\n\t**/\r\n\ton: function(token, eventKey, func_or_element)\r\n\t{\r\n\t\tvar sNamespace = null;\r\n\r\n\t\tif(!eventKey)\r\n\t\t{\r\n\t\t\tthrow ('eventKey must be of type string and not null. For available appHandlers check F2.Constants.AppHandlers.');\r\n\t\t}\r\n\r\n\t\t// we need to check the key for a namespace\r\n\t\tif(eventKey.indexOf('.') > -1)\r\n\t\t{\r\n\t\t\tvar arData = eventKey.split('.');\r\n\t\t\teventKey = arData[0];\r\n\t\t\tsNamespace = arData[1];\r\n\t\t}\r\n\r\n\t\tif(_handlerCollection && _handlerCollection[eventKey])\r\n\t\t{\r\n\t\t\t_handlerCollection[eventKey].push(\r\n\t\t\t\t_createHandler(\r\n\t\t\t\t\ttoken,\r\n\t\t\t\t\tsNamespace,\r\n\t\t\t\t\tfunc_or_element,\r\n\t\t\t\t\t(eventKey == 'appRender')\r\n\t\t\t\t)\r\n\t\t\t);\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tthrow ('Invalid EventKey passed. Check your inputs and try again.');\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\t},\r\n\t/**\r\n\t* Allows Container Developer to remove listener methods for specific events\r\n\t* @method off\r\n\t* @chainable\r\n\t* @param {String} token The token received from {{#crossLink \"F2.AppHandlers/getToken:method\"}}{{/crossLink}}.\r\n\t* @param {String} eventKey{.namespace} The event key used to determine which event to attach the listener to. If no namespace is provided all\r\n\t* listeners for the specified event type will be removed.\r\n\t* Complete list available in {{#crossLink \"F2.Constants.AppHandlers\"}}{{/crossLink}}.\r\n\t* @example\r\n\t*\tvar _token = F2.AppHandlers.getToken();\r\n\t*\tF2.AppHandlers.off(_token,'appRenderBefore');\r\n\t*\r\n\t**/\r\n\toff: function(token, eventKey)\r\n\t{\r\n\t\tvar sNamespace = null;\r\n\r\n\t\tif(!eventKey)\r\n\t\t{\r\n\t\t\tthrow ('eventKey must be of type string and not null. For available appHandlers check F2.Constants.AppHandlers.');\r\n\t\t}\r\n\r\n\t\t// we need to check the key for a namespace\r\n\t\tif(eventKey.indexOf('.') > -1)\r\n\t\t{\r\n\t\t\tvar arData = eventKey.split('.');\r\n\t\t\teventKey = arData[0];\r\n\t\t\tsNamespace = arData[1];\r\n\t\t}\r\n\r\n\t\tif(_handlerCollection && _handlerCollection[eventKey])\r\n\t\t{\r\n\t\t\t_removeHandler(\r\n\t\t\t\ttoken,\r\n\t\t\t\teventKey,\r\n\t\t\t\tsNamespace\r\n\t\t\t);\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tthrow ('Invalid EventKey passed. Check your inputs and try again.');\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\t}\r\n};\r\n","/**\r\n * The apps namespace is a place for app developers to put the javascript\r\n * class that is used to initialize their app. The javascript classes should\r\n * be namepaced with the {{#crossLink \"F2.AppConfig\"}}{{/crossLink}}.appId.\r\n * It is recommended that the code be placed in a closure to help keep the\r\n * global namespace clean.\r\n *\r\n * If the class has an 'init' function, that function will be called\r\n * automatically by F2.\r\n * @property Apps\r\n * @type object\r\n * @example\r\n * F2.Apps[\"com_example_helloworld\"] = (function() {\r\n * var App_Class = function(appConfig, appContent, root) {\r\n * this._app = appConfig; // the F2.AppConfig object\r\n * this._appContent = appContent // the F2.AppManifest.AppContent object\r\n * this.$root = root; // the root DOM Element that contains this app\r\n * }\r\n *\r\n * App_Class.prototype.init = function() {\r\n * // perform init actions\r\n * }\r\n *\r\n * return App_Class;\r\n * })();\r\n * @example\r\n * F2.Apps[\"com_example_helloworld\"] = function(appConfig, appContent, root) {\r\n * return {\r\n * init:function() {\r\n * // perform init actions\r\n * }\r\n * };\r\n * };\r\n * @for F2\r\n */\r\nexport default {};","/**\r\n* The App Class is an optional class that can be namespaced onto the\r\n* {{#crossLink \"F2\\Apps\"}}{{/crossLink}} namespace. The\r\n* [F2 Docs](../../app-development.html#app-class)\r\n* has more information on the usage of the App Class.\r\n* @class F2.App\r\n* @constructor\r\n* @param {F2.AppConfig} appConfig The F2.AppConfig object for the app\r\n* @param {F2.AppManifest.AppContent} appContent The F2.AppManifest.AppContent\r\n* object\r\n* @param {Element} root The root DOM Element for the app\r\n*/\r\nmodule.exports = function(appConfig, appContent, root) {\r\n return {\r\n\t /**\r\n\t\t* An optional init function that will automatically be called when\r\n\t\t*{{#crossLink \"F2/registerApps\"}}F2.registerApps(){{/crossLink}} is called.\r\n\t\t* @method init\r\n\t\t* @optional\r\n\t\t*/\r\n\t init:function() {},\r\n\t /**\r\n\t\t* An optional destroy function that will automatically be called when\r\n\t\t* {{#crossLink \"F2/removeApp\"}}F2.removeApp(){{/crossLink}} and subsequently\r\n\t\t* the {{#crossLink \"F2.Constants.AppHandlers/APP_DESTROY:property\"}}F2.Constants.AppHandlers.APP_DESTROY{{/crossLink}} AppHandler.\r\n\t\t* @method destroy\r\n\t\t* @optional\r\n\t\t*/\r\n\t destroy:function() {}\r\n };\r\n};\r\n","/**\r\n * The AppConfig object represents an app's meta data\r\n * @class F2.AppConfig\r\n */\r\nmodule.exports = {\r\n\t/**\r\n\t * The unique ID of the app. More information can be found\r\n\t * [here](../../app-development.html#f2-appid)\r\n\t * @property appId\r\n\t * @type string\r\n\t * @required\r\n\t */\r\n\tappId: '',\r\n\t/**\r\n\t * An object that represents the context of an app\r\n\t * @property context\r\n\t * @type object\r\n\t */\r\n\tcontext: {},\r\n\t/**\r\n\t * True if the app should be requested in a single request with other apps.\r\n\t * @property enableBatchRequests\r\n\t * @type bool\r\n\t * @default false\r\n\t */\r\n\tenableBatchRequests: false,\r\n\t/**\r\n\t * The height of the app. The initial height will be pulled from\r\n\t * the {{#crossLink \"F2.AppConfig\"}}{{/crossLink}} object\r\n\t * @property height\r\n\t * @type int\r\n\t */\r\n\theight: 0,\r\n\t/**\r\n\t * The unique runtime ID of the app.\r\n\t *\r\n\t * **This property is populated during the\r\n\t * F2.{{#crossLink \"F2/registerApps\"}}{{/crossLink}} process**\r\n\t * @property instanceId\r\n\t * @type string\r\n\t */\r\n\tinstanceId: '',\r\n\t/**\r\n\t * The language and region specification for this container\r\n\t * represented as an IETF-defined standard language tag,\r\n\t * e.g. `\"en-us\"` or `\"de-de\"`. This is passed during the\r\n\t * F2.{{#crossLink \"F2/registerApps\"}}{{/crossLink}} process.\r\n\t *\r\n\t * @property containerLocale\r\n\t * @type string\r\n\t * @default null\r\n\t * @since 1.4.0\r\n\t */\r\n\tcontainerLocale: null,\r\n\t/**\r\n\t * The languages and regions supported by this app represented\r\n\t * as an array of IETF-defined standard language tags,\r\n\t * e.g. `[\"en-us\",\"de-de\"]`.\r\n\t *\r\n\t * @property localeSupport\r\n\t * @type array\r\n\t * @default []\r\n\t * @since 1.4.0\r\n\t */\r\n\tlocaleSupport: [],\r\n\t/**\r\n\t * The url to retrieve the {{#crossLink \"F2.AppManifest\"}}{{/crossLink}}\r\n\t * object.\r\n\t * @property manifestUrl\r\n\t * @type string\r\n\t * @required\r\n\t */\r\n\tmanifestUrl: '',\r\n\t/**\r\n\t * The recommended maximum width in pixels that this app should be run.\r\n\t * **It is up to the [container](../../container-development.html) to\r\n\t * implement the logic to prevent an app from being run when the maxWidth\r\n\t * requirements are not met.**\r\n\t * @property maxWidth\r\n\t * @type int\r\n\t */\r\n\tmaxWidth: 0,\r\n\t/**\r\n\t * The recommended minimum grid size that this app should be run. This\r\n\t * value corresponds to the 12-grid system that is used by the\r\n\t * [container](../../container-development.html). This property should be\r\n\t * set by apps that require a certain number of columns in their layout.\r\n\t * @property minGridSize\r\n\t * @type int\r\n\t * @default 4\r\n\t */\r\n\tminGridSize: 4,\r\n\t/**\r\n\t * The recommended minimum width in pixels that this app should be run. **It\r\n\t * is up to the [container](../../container-development.html) to implement\r\n\t * the logic to prevent an app from being run when the minWidth requirements\r\n\t * are not met.\r\n\t * @property minWidth\r\n\t * @type int\r\n\t * @default 300\r\n\t */\r\n\tminWidth: 300,\r\n\t/**\r\n\t * The name of the app\r\n\t * @property name\r\n\t * @type string\r\n\t * @required\r\n\t */\r\n\tname: '',\r\n\t/**\r\n\t * The root DOM element that contains the app\r\n\t *\r\n\t * **This property is populated during the\r\n\t * F2.{{#crossLink \"F2/registerApps\"}}{{/crossLink}} process**\r\n\t * @property root\r\n\t * @type Element\r\n\t */\r\n\troot: undefined\r\n};","/**\r\n * The AppContent object\r\n * @class F2.AppManifest.AppContent\r\n **/\r\nmodule.exports = {\r\n\t/**\r\n\t * Arbitrary data to be passed along with the app\r\n\t * @property data\r\n\t * @type object\r\n\t * @optional\r\n\t */\r\n\tdata: {},\r\n\t/**\r\n\t * The string of HTML representing the app\r\n\t * @property html\r\n\t * @type string\r\n\t * @required\r\n\t */\r\n\thtml: '',\r\n\t/**\r\n\t * A status message\r\n\t * @property status\r\n\t * @type string\r\n\t * @optional\r\n\t */\r\n\tstatus: ''\r\n};","/**\r\n * The assets needed to render an app on the page\r\n * @class F2.AppManifest\r\n */\r\nmodule.exports = {\r\n\t/**\r\n\t * The array of {{#crossLink \"F2.AppManifest.AppContent\"}}{{/crossLink}}\r\n\t * objects\r\n\t * @property apps\r\n\t * @type Array\r\n\t * @required\r\n\t */\r\n\tapps: [],\r\n\t/**\r\n\t * Any inline javascript tha should initially be run\r\n\t * @property inlineScripts\r\n\t * @type Array\r\n\t * @optional\r\n\t */\r\n\tinlineScripts: [],\r\n\t/**\r\n\t * Urls to javascript files required by the app\r\n\t * @property scripts\r\n\t * @type Array\r\n\t * @optional\r\n\t */\r\n\tscripts: [],\r\n\t/**\r\n\t * Urls to CSS files required by the app\r\n\t * @property styles\r\n\t * @type Array\r\n\t * @optional\r\n\t */\r\n\tstyles: []\r\n};","/**\r\n * An object containing configuration information for the\r\n * [container](../../container-development.html)\r\n * @class F2.ContainerConfig\r\n */\r\nmodule.exports = {\r\n\t/**\r\n\t * True to enable debug mode in F2.js. Adds additional logging, resource cache busting, etc.\r\n\t * @property debugMode\r\n\t * @type bool\r\n\t * @default false\r\n\t */\r\n\tdebugMode: false,\r\n\t/**\r\n\t * The default language and region specification for this container\r\n\t * represented as an IETF-defined standard language tag,\r\n\t * e.g. `\"en-us\"` or `\"de-de\"`. This value is passed to each app\r\n\t * registered as `containerLocale`.\r\n\t *\r\n\t * @property locale\r\n\t * @type string\r\n\t * @default null\r\n\t * @since 1.4.0\r\n\t */\r\n\tlocale: null,\r\n\t/**\r\n\t * Milliseconds before F2 fires callback on script resource load errors. Due to issue with the way Internet Explorer attaches load events to script elements, the error event doesn't fire.\r\n\t * @property scriptErrorTimeout\r\n\t * @type milliseconds\r\n\t * @default 7000 (7 seconds)\r\n\t */\r\n\tscriptErrorTimeout: 7000,\r\n\t/**\r\n\t * Allows the container to fully override how the AppManifest request is\r\n\t * made inside of F2.\r\n\t *\r\n\t * @method xhr\r\n\t * @param {string} url The manifest url\r\n\t * @param {Array} appConfigs An array of {{#crossLink \"F2.AppConfig\"}}{{/crossLink}}\r\n\t * objects\r\n\t * @param {function} success The function to be called if the request\r\n\t * succeeds\r\n\t * @param {function} error The function to be called if the request fails\r\n\t * @param {function} complete The function to be called when the request\r\n\t * finishes (after success and error callbacks have been executed)\r\n\t * @return {XMLHttpRequest} The XMLHttpRequest object\r\n\t *\r\n\t * @example\r\n         *     F2.init({\r\n         *         xhr: function(url, appConfigs,successCallback, errorCallback, completeCallback) {\r\n         *          var jsonpCallback = F2.Constants.JSONP_CALLBACK + appConfigs[0].appId, // Unique function name\r\n\t\t\t * var fetchUrl = url + '?params=' + F2.stringify(appConfigs.apps, F2.appConfigReplacer);\r\n         *          var fetchFunc = fetchJsonp(fetchUrl, {\r\n         *                          timeout: 3000,\r\n         *                          jsonpCallbackFunction: jsonpCallback\r\n         *                          });                \r\n         *           fetchFunc.then(function(response) {\r\n         *                          return response.json();\r\n         *                      })\r\n         *                      .then(function(data) {\r\n         *                      \tsuccessCallback(data);\r\n         *                      \tcompleteCallback();                         \r\n         *                  })\r\n         *                  .catch(function(error) {\r\n         *                      F2.log('Failed to load app(s)', error.toString());\r\n         *                      errorCallback();\r\n         *                  });\r\n         *         }\r\n         *     });\r\n\t *\r\n\t * @for F2.ContainerConfig\r\n\t */\r\n\t//xhr: function(url, appConfigs, success, error, complete) {},\r\n\t/**\r\n\t * Allows the container to override individual parts of the AppManifest\r\n\t * request. See properties and methods with the `xhr.` prefix.\r\n\t * @property xhr\r\n\t * @type Object\r\n\t *\r\n\t * @example\r\n\t * F2.init({\r\n\t * xhr: {\r\n\t * url: function(url, appConfigs) {\r\n\t * return 'http://example.com/proxy.php?url=' + encocdeURIComponent(url);\r\n\t * }\r\n\t * }\r\n\t * });\r\n\t */\r\n\txhr: {\r\n\t\t/**\r\n\t\t * Allows the container to override the request data type (JSON or JSONP)\r\n\t\t * that is used for the request\r\n\t\t * @method xhr.dataType\r\n\t\t * @param {string} url The manifest url\r\n\t\t * @param {Array} appConfigs An array of {{#crossLink \"F2.AppConfig\"}}{{/crossLink}}\r\n\t\t * objects\r\n\t\t * @return {string} The request data type that should be used\r\n\t\t *\r\n\t\t * @example\r\n\t\t * F2.init({\r\n\t\t * xhr: {\r\n\t\t * dataType: function(url) {\r\n\t\t * return F2.isLocalRequest(url) ? 'json' : 'jsonp';\r\n\t\t * },\r\n\t\t * type: function(url) {\r\n\t\t * return F2.isLocalRequest(url) ? 'POST' : 'GET';\r\n\t\t * }\r\n\t\t * }\r\n\t\t * });\r\n\t\t */\r\n\t\tdataType: function(url, appConfigs) {},\r\n\t\t/**\r\n\t\t * Allows the container to override the request method that is used.\r\n\t\t * @method xhr.type\r\n\t\t * @param {string} url The manifest url\r\n\t\t * @param {Array} appConfigs An array of {{#crossLink \"F2.AppConfig\"}}{{/crossLink}}\r\n\t\t * objects\r\n\t\t * @return {string} The request method that should be used\r\n\t\t *\r\n\t\t * @example\r\n\t\t * F2.init({\r\n\t\t * xhr: {\r\n\t\t * dataType: function(url) {\r\n\t\t * return F2.isLocalRequest(url) ? 'json' : 'jsonp';\r\n\t\t * },\r\n\t\t * type: function(url) {\r\n\t\t * return F2.isLocalRequest(url) ? 'POST' : 'GET';\r\n\t\t * }\r\n\t\t * }\r\n\t\t * });\r\n\t\t */\r\n\t\ttype: function(url, appConfigs) {},\r\n\t\t/**\r\n\t\t * Allows the container to override the url that is used to request an\r\n\t\t * app's F2.{{#crossLink \"F2.AppManifest\"}}{{/crossLink}}\r\n\t\t * @method xhr.url\r\n\t\t * @param {string} url The manifest url\r\n\t\t * @param {Array} appConfigs An array of {{#crossLink \"F2.AppConfig\"}}{{/crossLink}}\r\n\t\t * objects\r\n\t\t * @return {string} The url that should be used for the request\r\n\t\t *\r\n\t\t * @example\r\n\t\t * F2.init({\r\n\t\t * xhr: {\r\n\t\t * url: function(url, appConfigs) {\r\n\t\t * return 'http://example.com/proxy.php?url=' + encocdeURIComponent(url);\r\n\t\t * }\r\n\t\t * }\r\n\t\t * });\r\n\t\t */\r\n\t\turl: function(url, appConfigs) {}\r\n\t},\r\n\t/**\r\n\t * Allows the container to override the script loader which requests\r\n\t * dependencies defined in the {{#crossLink \"F2.AppManifest\"}}{{/crossLink}}.\r\n\t * @property loadScripts\r\n\t * @type function\r\n\t *\r\n\t * @example\r\n\t * F2.init({\r\n\t *\t\t\tloadScripts: function(scripts,inlines,callback){\r\n\t *\t\t\t\t//load scripts using $.load() for each script or require(scripts)\r\n\t *\t\t\t\tcallback();\r\n\t *\t\t\t}\r\n\t * });\r\n\t */\r\n\tloadScripts: function(scripts,inlines,callback){},\r\n\t/**\r\n\t * Allows the container to override the stylesheet loader which requests\r\n\t * dependencies defined in the {{#crossLink \"F2.AppManifest\"}}{{/crossLink}}.\r\n\t * @property loadStyles\r\n\t * @type function\r\n\t *\r\n\t * @example\r\n\t * F2.init({\r\n\t *\t\t\tloadStyles: function(styles,callback){\r\n\t *\t\t\t\t//load styles using $.load() for each stylesheet or another method\r\n\t *\t\t\t\tcallback();\r\n\t *\t\t\t}\r\n\t * });\r\n\t */\r\n\tloadStyles: function(styles,callback){}\r\n};","import App from './app';\r\nimport AppConfig from './appConfig';\r\nimport AppContent from './appContent';\r\nimport AppManifest from './appManifest';\r\nimport ContainerConfig from './containerConfig';\r\n\r\n/**\r\n * Class stubs for documentation purposes\r\n * @main F2\r\n */\r\nexport default {\r\n\tApp,\r\n\tAppConfig,\r\n\tAppContent,\r\n\tAppManifest,\r\n\tContainerConfig\r\n};\r\n","/**\r\n * Constants used throughout the Open Financial Framework\r\n * @class F2.Constants.AppHandlers\r\n * @static\r\n */\r\nmodule.exports = {\r\n\t/**\r\n\t* When bound using {{#crossLink \"F2.AppHandlers/on\"}}F2.AppHandlers.on(){{/crossLink}} the listener function passed will receive the\r\n\t* following argument(s): ( {{#crossLink \"F2.AppConfig\"}}appConfig{{/crossLink}} )\r\n\t* @property APP_MANIFEST_REQUEST_FAIL\r\n\t* @type string\r\n\t* @static\r\n\t* @final\r\n\t* @example\r\n\t*\tvar _token = F2.AppHandlers.getToken();\r\n\t*\tF2.AppHandlers.on(\r\n\t*\t\t_token,\r\n\t*\t\tF2.Constants.AppHandlers.APP_MANIFEST_REQUEST_FAIL,\r\n\t*\t\tfunction(appConfig)\r\n\t*\t\t{\r\n\t*\t\t\tYou can use information from the appConfig to surface a custom error message in the dom\r\n\t*\t\t\tOr display some kind of default error placeholder element rather than having a blank spot in the dom\r\n\t*\t\t}\r\n\t*\t);\r\n\t*/\r\n\tAPP_MANIFEST_REQUEST_FAIL: 'appManifestRequestFail',\r\n\t/**\r\n\t* Equivalent to `appCreateRoot`. Identifies the create root method for use in AppHandlers.on/off.\r\n\t* When bound using {{#crossLink \"F2.AppHandlers/on\"}}F2.AppHandlers.on(){{/crossLink}} the listener function passed will receive the\r\n\t* following argument(s): ( {{#crossLink \"F2.AppConfig\"}}appConfig{{/crossLink}} )\r\n\t* @property APP_CREATE_ROOT\r\n\t* @type string\r\n\t* @static\r\n\t* @final\r\n\t* @example\r\n\t*\tvar _token = F2.AppHandlers.getToken();\r\n\t*\tF2.AppHandlers.on(\r\n\t*\t\t_token,\r\n\t*\t\tF2.Constants.AppHandlers.APP_CREATE_ROOT,\r\n\t*\t\tfunction(appConfig)\r\n\t*\t\t{\r\n\t*\t\t\t// If you want to create a custom root. By default F2 uses the app's outermost HTML element.\r\n\t*\t\t\t// the app's html is not available until after the manifest is retrieved so this logic occurs in F2.Constants.AppHandlers.APP_RENDER\r\n\t*\t\t\tappConfig.root = document.createElement('section');\r\n\t*\t\t}\r\n\t*\t);\r\n\t*/\r\n\tAPP_CREATE_ROOT: 'appCreateRoot',\r\n\t/**\r\n\t * Equivalent to `appRenderBefore`. Identifies the before app render method for use in AppHandlers.on/off.\r\n\t * When bound using {{#crossLink \"F2.AppHandlers/on\"}}F2.AppHandlers.on(){{/crossLink}} the listener function passed will receive the\r\n\t * following argument(s): ( {{#crossLink \"F2.AppConfig\"}}appConfig{{/crossLink}} )\r\n\t * @property APP_RENDER_BEFORE\r\n\t * @type string\r\n\t * @static\r\n\t * @final\r\n\t * @example\r\n\t *\tvar _token = F2.AppHandlers.getToken();\r\n\t *\tF2.AppHandlers.on(\r\n\t *\t\t_token,\r\n\t *\t\tF2.Constants.AppHandlers.APP_RENDER_BEFORE,\r\n\t *\t\tfunction(appConfig)\r\n\t *\t\t{\r\n\t *\t\t\tF2.log(appConfig);\r\n\t *\t\t}\r\n\t *\t);\r\n\t */\r\n\tAPP_RENDER_BEFORE: 'appRenderBefore',\r\n\t/**\r\n\t* Equivalent to `appRender`. Identifies the app render method for use in AppHandlers.on/off.\r\n\t* When bound using {{#crossLink \"F2.AppHandlers/on\"}}F2.AppHandlers.on(){{/crossLink}} the listener function passed will receive the\r\n\t* following argument(s): ( {{#crossLink \"F2.AppConfig\"}}appConfig{{/crossLink}}, [appHtml](../../app-development.html#app-design) )\r\n\t* @property APP_RENDER\r\n\t* @type string\r\n\t* @static\r\n\t* @final\r\n\t* @example\r\n\t*   var _token = F2.AppHandlers.getToken();\r\n            *   F2.AppHandlers.on(\r\n            *       _token,\r\n            *       F2.Constants.AppHandlers.APP_RENDER,\r\n            *       function(appConfig, appHtml)\r\n            *       {\r\n            *           // if no app root is defined use the app's outer most node\r\n            *           if(!F2.isNativeDOMNode(appConfig.root))\r\n            *           {\r\n            *               appConfig.root = domify(appHtml);                               \r\n            *           }\r\n            *           else\r\n            *           {                       \r\n            *               // append the app html to the root\r\n            *               appConfig.root.appendChild(domify(appHtml));\r\n            *           }           \r\n            *           \r\n            *           // append the root to the body by default.\r\n            *           document.body.appendChild(appConfig.root);\r\n            *       }\r\n            *   );\r\n            */\r\n\tAPP_RENDER: 'appRender',\r\n\t/**\r\n\t* Equivalent to `appRenderAfter`. Identifies the after app render method for use in AppHandlers.on/off.\r\n\t* When bound using {{#crossLink \"F2.AppHandlers/on\"}}F2.AppHandlers.on(){{/crossLink}} the listener function passed will receive the\r\n\t* following argument(s): ( {{#crossLink \"F2.AppConfig\"}}appConfig{{/crossLink}} )\r\n\t* @property APP_RENDER_AFTER\r\n\t* @type string\r\n\t* @static\r\n\t* @final\r\n\t* @example\r\n\t*\tvar _token = F2.AppHandlers.getToken();\r\n\t*\tF2.AppHandlers.on(\r\n\t*\t\t_token,\r\n\t*\t\tF2.Constants.AppHandlers.APP_RENDER_AFTER,\r\n\t*\t\tfunction(appConfig)\r\n\t*\t\t{\r\n\t*\t\t\tF2.log(appConfig);\r\n\t*\t\t}\r\n\t*\t);\r\n\t*/\r\n\tAPP_RENDER_AFTER: 'appRenderAfter',\r\n\t/**\r\n\t* Equivalent to `appDestroyBefore`. Identifies the before app destroy method for use in AppHandlers.on/off.\r\n\t* When bound using {{#crossLink \"F2.AppHandlers/on\"}}F2.AppHandlers.on(){{/crossLink}} the listener function passed will receive the\r\n\t* following argument(s): ( appInstance )\r\n\t* @property APP_DESTROY_BEFORE\r\n\t* @type string\r\n\t* @static\r\n\t* @final\r\n\t* @example\r\n\t*\tvar _token = F2.AppHandlers.getToken();\r\n\t*\tF2.AppHandlers.on(\r\n\t*\t\t_token,\r\n\t*\t\tF2.Constants.AppHandlers.APP_DESTROY_BEFORE,\r\n\t*\t\tfunction(appInstance)\r\n\t*\t\t{\r\n\t*\t\t\tF2.log(appInstance);\r\n\t*\t\t}\r\n\t*\t);\r\n\t*/\r\n\tAPP_DESTROY_BEFORE: 'appDestroyBefore',\r\n\t/**\r\n\t* Equivalent to `appDestroy`. Identifies the app destroy method for use in AppHandlers.on/off.\r\n\t* When bound using {{#crossLink \"F2.AppHandlers/on\"}}F2.AppHandlers.on(){{/crossLink}} the listener function passed will receive the\r\n\t* following argument(s): ( appInstance )\r\n\t* @property APP_DESTROY\r\n\t* @type string\r\n\t* @static\r\n\t* @final\r\n\t* @example\r\n\t*   var _token = F2.AppHandlers.getToken();\r\n            *   F2.AppHandlers.on(\r\n            *       _token,\r\n            *       F2.Constants.AppHandlers.APP_DESTROY,\r\n            *       function(appInstance)\r\n            *       {\r\n            *           // call the apps destroy method, if it has one\r\n            *           if(appInstance && appInstance.app && appInstance.app.destroy && typeof(appInstance.app.destroy) == 'function')\r\n            *           {\r\n            *               appInstance.app.destroy();\r\n            *           }\r\n            *           else if(appInstance && appInstance.app && appInstance.app.destroy)\r\n            *           {\r\n            *               F2.log(appInstance.config.appId + ' has a destroy property, but destroy is not of type function and as such will not be executed.');\r\n            *           }\r\n            *           \r\n            *           // remove the root          \r\n            *           appInstance.config.root.parentNode.removeChild(appInstance.config.root);\r\n            *       }\r\n            *   );\r\n            */\r\n\tAPP_DESTROY: 'appDestroy',\r\n\t/**\r\n\t* Equivalent to `appDestroyAfter`. Identifies the after app destroy method for use in AppHandlers.on/off.\r\n\t* When bound using {{#crossLink \"F2.AppHandlers/on\"}}F2.AppHandlers.on(){{/crossLink}} the listener function passed will receive the\r\n\t* following argument(s): ( appInstance )\r\n\t* @property APP_DESTROY_AFTER\r\n\t* @type string\r\n\t* @static\r\n\t* @final\r\n\t* @example\r\n\t*   var _token = F2.AppHandlers.getToken();\r\n            *   F2.AppHandlers.on(\r\n            *       _token,\r\n            *       F2.Constants.AppHandlers.APP_DESTROY_AFTER,\r\n            *       function(appInstance)\r\n            *       {\r\n            *           F2.log(appInstance);\r\n            *       }\r\n            *   );\r\n            */\r\n\tAPP_DESTROY_AFTER: 'appDestroyAfter',\r\n\t/**\r\n\t* Equivalent to `appScriptLoadFailed`. Identifies the app script load failed method for use in AppHandlers.on/off.\r\n\t* When bound using {{#crossLink \"F2.AppHandlers/on\"}}F2.AppHandlers.on(){{/crossLink}} the listener function passed will receive the\r\n\t* following argument(s): ( {{#crossLink \"F2.AppConfig\"}}appConfig{{/crossLink}}, scriptInfo )\r\n\t* @property APP_SCRIPT_LOAD_FAILED\r\n\t* @type string\r\n\t* @static\r\n\t* @final\r\n\t* @example\r\n\t*\tvar _token = F2.AppHandlers.getToken();\r\n\t*\tF2.AppHandlers.on(\r\n\t*\t\t_token,\r\n\t*\t\tF2.Constants.AppHandlers.APP_SCRIPT_LOAD_FAILED,\r\n\t*\t\tfunction(appConfig, scriptInfo)\r\n\t*\t\t{\r\n\t*\t\t\tF2.log(appConfig.appId);\r\n\t*\t\t}\r\n\t*\t);\r\n\t*/\r\n\tAPP_SCRIPT_LOAD_FAILED: 'appScriptLoadFailed'\r\n};","/**\r\n * Constants used throughout the Open Financial Framework\r\n * @class F2.Constants.Css\r\n * @static\r\n */\r\nmodule.exports = {\r\n\t/**\r\n\t * The APP class should be applied to the DOM Element that surrounds the\r\n\t * entire app, including any extra html that surrounds the APP\\_CONTAINER\r\n\t * that is inserted by the container. See the\r\n\t * {{#crossLink \"F2.ContainerConfig\"}}{{/crossLink}} object.\r\n\t * @property APP\r\n\t * @type string\r\n\t * @static\r\n\t * @final\r\n\t */\r\n\tAPP: 'f2-app',\r\n\t/**\r\n\t * The APP\\_CONTAINER class should be applied to the outermost DOM Element\r\n\t * of the app.\r\n\t * @property APP_CONTAINER\r\n\t * @type string\r\n\t * @static\r\n\t * @final\r\n\t */\r\n\tAPP_CONTAINER: 'f2-app-container'\r\n};","/**\r\n * Constants used throughout the Open Financial Framework\r\n * @class F2.Constants.Events\r\n * @static\r\n */\r\nmodule.exports = {\r\n\t/**\r\n\t * The APP_SCRIPTS_LOADED event is fired when all the scripts defined in\r\n\t * the AppManifest have been loaded.\r\n\t * @property APP_SCRIPTS_LOADED\r\n\t * @type string\r\n\t * @static\r\n\t * @final\r\n\t */\r\n\tAPP_SCRIPTS_LOADED: 'App.scriptsLoaded',\r\n\t/**\r\n\t * The APP\\_SYMBOL\\_CHANGE event is fired when the symbol is changed in an\r\n\t * app. It is up to the app developer to fire this event.\r\n\t * Returns an object with the symbol and company name:\r\n\t *\r\n\t * { symbol: 'MSFT', name: 'Microsoft Corp (NASDAQ)' }\r\n\t *\r\n\t * @property APP_SYMBOL_CHANGE\r\n\t * @type string\r\n\t * @static\r\n\t * @final\r\n\t */\r\n\tAPP_SYMBOL_CHANGE: 'App.symbolChange',\r\n\t/**\r\n\t * The APP\\_WIDTH\\_CHANGE event will be fired by the container when the\r\n\t * width of an app is changed. The app's instanceId should be concatenated\r\n\t * to this constant.\r\n\t * Returns an object with the gridSize and width in pixels:\r\n\t *\r\n\t * { gridSize:8, width:620 }\r\n\t *\r\n\t * @property APP_WIDTH_CHANGE\r\n\t * @type string\r\n\t * @static\r\n\t * @final\r\n\t */\r\n\tAPP_WIDTH_CHANGE: 'App.widthChange.',\r\n\t/**\r\n\t * The CONTAINER\\_SYMBOL\\_CHANGE event is fired when the symbol is changed\r\n\t * at the container level. This event should only be fired by the\r\n\t * container or container provider.\r\n\t * Returns an object with the symbol and company name:\r\n\t *\r\n\t * { symbol: 'MSFT', name: 'Microsoft Corp (NASDAQ)' }\r\n\t *\r\n\t * @property CONTAINER_SYMBOL_CHANGE\r\n\t * @type string\r\n\t * @static\r\n\t * @final\r\n\t */\r\n\tCONTAINER_SYMBOL_CHANGE: 'Container.symbolChange',\r\n\t/**\r\n\t * The CONTAINER\\_WIDTH\\_CHANGE event will be fired by the container when\r\n\t * the width of the container has changed.\r\n\t * @property CONTAINER_WIDTH_CHANGE\r\n\t * @type string\r\n\t * @static\r\n\t * @final\r\n\t */\r\n\tCONTAINER_WIDTH_CHANGE: 'Container.widthChange',\r\n\t/**\r\n\t * The CONTAINER\\_LOCALE\\_CHANGE event will be fired by the container when\r\n\t * the locale of the container has changed. This event should only be fired by the\r\n\t * container or container provider.\r\n\t * Returns an object with the updated locale (IETF-defined standard language tag):\r\n\t *\r\n\t * { locale: 'en-us' }\r\n\t *\r\n\t * @property CONTAINER_LOCALE_CHANGE\r\n\t * @type string\r\n\t * @static\r\n\t * @final\r\n\t */\r\n\tCONTAINER_LOCALE_CHANGE: 'Container.localeChange',\r\n\t/**\r\n\t * The RESOURCE_FAILED_TO_LOAD event will be fired by the container when\r\n\t * it fails to load a script or style.\r\n\t * @property RESOURCE_FAILED_TO_LOAD\r\n\t * @depreciated since 1.4\r\n\t * @type string\r\n\t * @static\r\n\t * @final\r\n\t */\r\n\tRESOURCE_FAILED_TO_LOAD: 'Container.resourceFailedToLoad'\r\n};\r\n","import appHandlers from './appHandlers';\r\nimport css from './css';\r\nimport events from './events';\r\n\r\n/**\r\n * Constants used throughout the Open Financial Framework\r\n * @class F2.Constants\r\n * @static\r\n */\r\nexport default {\r\n\tAppHandlers: appHandlers,\r\n\tAppStatus: {\r\n\t\tERROR: 'ERROR',\r\n\t\tSUCCESS: 'SUCCESS'\r\n\t},\r\n\tCss: css,\r\n\tEvents: events,\r\n\tJSONP_CALLBACK: 'F2_jsonpCallback_'\r\n};\r\n","import appHandlers from './appHandlers';\r\nimport appClasses from './apps';\r\nimport classes from './classes';\r\nimport cloneDeep from 'lodash.cloneDeep';\r\nimport constants from './constants';\r\nimport domify from 'domify';\r\nimport events from './events';\r\nimport utils from './utils';\r\nimport fetchJsonp from 'fetch-jsonp';\r\n\r\nvar _apps = {};\r\nvar _config = false;\r\nvar _sAppHandlerToken = appHandlers.__f2GetToken();\r\nvar _loadingScripts = {};\r\n\r\n/**\r\n * Search for a value within an array.\r\n * @method inArray\r\n * @param {object} value The value to search for\r\n * @param {Array} array The array to search\r\n * @return {int} index of the value in the array, -1 if value not found\r\n */\r\nvar _inArray = function(value, array) {\r\n\tif (Array.isArray(array)) {\r\n\t\treturn array.indexOf(value);\r\n\t}\r\n\r\n\tfor (var i = 0; i < array.length; i++) {\r\n\t\tif (array[i] === value) {\r\n\t\t\treturn i;\r\n\t\t}\r\n\t}\r\n\r\n\treturn -1;\r\n};\r\n\r\n/**\r\n * Adds properties to the AppConfig object\r\n * @method _createAppConfig\r\n * @private\r\n * @param {F2.AppConfig} appConfig The F2.AppConfig object\r\n * @return {F2.AppConfig} The new F2.AppConfig object, prepopulated with\r\n * necessary properties\r\n */\r\nvar _createAppConfig = function(appConfig) {\r\n\r\n\t// make a copy of the app config to ensure that the original is not modified\r\n\tappConfig = cloneDeep(appConfig) || {};\r\n\r\n\t// create the instanceId for the app\r\n\tappConfig.instanceId = appConfig.instanceId || utils.guid();\r\n\r\n\t//pass container-defined locale to each app\r\n\tif (classes.ContainerConfig.locale){\r\n\t\tappConfig.containerLocale = classes.ContainerConfig.locale;\r\n\t}\r\n\r\n\treturn appConfig;\r\n};\r\n\r\n/**\r\n * Generate an AppConfig from the element's attributes\r\n * @method _getAppConfigFromElement\r\n * @private\r\n * @param {Element} node The DOM node from which to generate the F2.AppConfig object\r\n * @return {F2.AppConfig} The new F2.AppConfig object\r\n */\r\nvar _getAppConfigFromElement = function(node) {\r\n\tvar appConfig;\r\n\r\n\tif (node) {\r\n\t\tvar appId = node.getAttribute('data-f2-appid');\r\n\t\tvar manifestUrl = node.getAttribute('data-f2-manifesturl');\r\n\r\n\t\tif (appId && manifestUrl) {\r\n\t\t\tappConfig = {\r\n\t\t\t\tappId: appId,\r\n\t\t\t\tenableBatchRequests: node.hasAttribute('data-f2-enablebatchrequests'),\r\n\t\t\t\tmanifestUrl: manifestUrl,\r\n\t\t\t\troot: node\r\n\t\t\t};\r\n\r\n\t\t\t// See if the user passed in a block of serialized json\r\n\t\t\tvar contextJson = node.getAttribute('data-f2-context');\r\n\r\n\t\t\tif (contextJson) {\r\n\t\t\t\ttry {\r\n\t\t\t\t\tappConfig.context = utils.parse(contextJson);\r\n\t\t\t\t}\r\n\t\t\t\tcatch (e) {\r\n\t\t\t\t\tconsole.warn('F2: \"data-f2-context\" of node is not valid JSON', '\"' + e + '\"');\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\treturn appConfig;\r\n};\r\n\r\n/**\r\n * Returns true if the DOM node has children that are not text nodes\r\n * @method _hasNonTextChildNodes\r\n * @private\r\n * @param {Element} node The DOM node\r\n * @return {bool} True if there are non-text children\r\n */\r\nvar _hasNonTextChildNodes = function(node) {\r\n\tvar hasNodes = false;\r\n\r\n\tif (node.hasChildNodes()) {\r\n\t\tfor (var i = 0, len = node.childNodes.length; i < len; i++) {\r\n\t\t\tif (node.childNodes[i].nodeType === 1) {\r\n\t\t\t\thasNodes = true;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\treturn hasNodes;\r\n};\r\n\r\n/**\r\n * Adds properties to the ContainerConfig object to take advantage of defaults\r\n * @method _hydrateContainerConfig\r\n * @private\r\n * @param {F2.ContainerConfig} containerConfig The F2.ContainerConfig object\r\n */\r\nvar _hydrateContainerConfig = function(containerConfig) {\r\n\r\n\tif (!containerConfig.scriptErrorTimeout) {\r\n\t\tcontainerConfig.scriptErrorTimeout = classes.ContainerConfig.scriptErrorTimeout;\r\n\t}\r\n\r\n\tif (containerConfig.debugMode !== true) {\r\n\t\tcontainerConfig.debugMode = classes.ContainerConfig.debugMode;\r\n\t}\r\n\r\n\tif (containerConfig.locale && typeof containerConfig.locale == 'string'){\r\n\t\tclasses.ContainerConfig.locale = containerConfig.locale;\r\n\t}\r\n};\r\n\r\n/**\r\n * Attach container Events\r\n * @method _initContainerEvents\r\n * @private\r\n */\r\nvar _initContainerEvents = function() {\r\n\r\n\tvar resizeTimeout;\r\n\tvar resizeHandler = function() {\r\n\t\tevents.emit(constants.Events.CONTAINER_WIDTH_CHANGE);\r\n\t};\r\n\r\n\t// TODO: remove this on destroy()\r\n\twindow.addEventListener('resize', function() {\r\n\t\tclearTimeout(resizeTimeout);\r\n\t\tresizeTimeout = setTimeout(resizeHandler, 100);\r\n\t});\r\n\r\n\t//listen for container-broadcasted locale changes\r\n\tevents.on(constants.Events.CONTAINER_LOCALE_CHANGE,function(data){\r\n\t\tif (data.locale && typeof data.locale == 'string'){\r\n\t\t\tclasses.ContainerConfig.locale = data.locale;\r\n\t\t}\r\n\t});\r\n};\r\n\r\n/**\r\n * Checks if an element is a placeholder element\r\n * @method _isPlaceholderElement\r\n * @private\r\n * @param {Element} node The DOM element to check\r\n * @return {bool} True if the element is a placeholder\r\n */\r\nvar _isPlaceholderElement = function(node) {\r\n\treturn (\r\n\t\tutils.isNativeDOMNode(node) &&\r\n\t\t!_hasNonTextChildNodes(node) &&\r\n\t\t!!node.getAttribute('data-f2-appid') &&\r\n\t\t!!node.getAttribute('data-f2-manifesturl')\r\n\t);\r\n};\r\n\r\n/**\r\n * Has the container been init?\r\n * @method _isInit\r\n * @private\r\n * @return {bool} True if the container has been init\r\n */\r\nvar _isInit = function() {\r\n\treturn !!_config;\r\n};\r\n\r\n/**\r\n * Instantiates each app from it's appConfig and stores that in a local private collection\r\n * @method _createAppInstance\r\n * @private\r\n * @param {Array} appConfigs An array of {{#crossLink \"F2.AppConfig\"}}{{/crossLink}} objects\r\n */\r\nvar _createAppInstance = function(appConfig, appContent) {\r\n\t// instantiate F2.App\r\n\tif (appClasses[appConfig.appId] !== undefined) {\r\n\t\tif (typeof appClasses[appConfig.appId] === 'function') {\r\n\r\n\t\t\t// IE\r\n\t\t\tsetTimeout(function() {\r\n\t\t\t\t_apps[appConfig.instanceId].app = new appClasses[appConfig.appId](appConfig, appContent, appConfig.root);\r\n\t\t\t\tif (_apps[appConfig.instanceId].app['init'] !== undefined) {\r\n\t\t\t\t\t_apps[appConfig.instanceId].app.init();\r\n\t\t\t\t}\r\n\t\t\t}, 0);\r\n\r\n\t\t}\r\n\t\telse {\r\n\t\t\tutils.log('app initialization class is defined but not a function. (' + appConfig.appId + ')');\r\n\t\t}\r\n\t}\r\n};\r\n\r\n/**\r\n * Loads the app's html/css/javascript\r\n * @method loadApp\r\n * @private\r\n * @param {Array} appConfigs An array of\r\n * {{#crossLink \"F2.AppConfig\"}}{{/crossLink}} objects\r\n * @param {F2.AppManifest} [appManifest] The AppManifest object\r\n */\r\nvar _loadApps = function(appConfigs, appManifest) {\r\n\tappConfigs = [].concat(appConfigs);\r\n\r\n\t// check that the number of apps in manifest matches the number requested\r\n\tif (appConfigs.length != appManifest.apps.length) {\r\n\t\tutils.log('The number of apps defined in the AppManifest do not match the number requested.', appManifest);\r\n\t\treturn;\r\n\t}\r\n\r\n\tvar _findExistingScripts = function() {\r\n\t\tvar scripts = document.querySelectorAll('script[src]') || [];\r\n\t\tvar src = [];\r\n\r\n\t\tfor (var i = 0; i < scripts.length; i ++) {\r\n\t\t\tsrc.push(scripts[i].src);\r\n\t\t}\r\n\r\n\t\treturn src;\r\n\t};\r\n\r\n\tvar _findExistingStyles = function() {\r\n\t\tvar src = [];\r\n\t\tvar styles = document.querySelectorAll('link[href]') || [];\r\n\r\n\t\tfor (var i = 0; i < styles.length; i ++) {\r\n\t\t\tsrc.push(styles[i].src);\r\n\t\t}\r\n\r\n\t\treturn src;\r\n\t};\r\n\r\n\t// Fn for loading manifest Styles\r\n\tvar _loadStyles = function(styles, cb) {\r\n\t\t// Reduce the list to styles that haven't been loaded\r\n\t\tvar existingStyles = _findExistingStyles();\r\n\t\tvar filteredStyles = [];\r\n\r\n\t\tfor (var i = 0; i < styles.length; i++) {\r\n\t\t\tvar url = styles[i];\r\n\t\t\tif (url && _inArray(url, existingStyles) === -1) {\r\n\t\t\t\tfilteredStyles.push(url);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Attempt to use the user provided method\r\n\t\tif (_config.loadStyles) {\r\n\t\t\treturn _config.loadStyles(filteredStyles, cb);\r\n\t\t}\r\n\r\n\t\t// load styles, see #101\r\n\t\tvar stylesFragment = null,\r\n\t\t\tuseCreateStyleSheet = !!document.createStyleSheet;\r\n\r\n\t\tfor (var j = 0; j < filteredStyles.length; j++) {\r\n\t\t\tif (useCreateStyleSheet) {\r\n\t\t\t\tdocument.createStyleSheet(filteredStyles[j]);\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tstylesFragment = stylesFragment || [];\r\n\t\t\t\tstylesFragment.push('');\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif (stylesFragment) {\r\n\t\t\tvar node = domify(stylesFragment.join(''));\r\n\t\t\tdocument.getElementsByTagName('head')[0].appendChild(node);\r\n\t\t}\r\n\r\n\t\tcb();\r\n\t};\r\n\r\n\t// For loading AppManifest.scripts\r\n\t// Parts derived from curljs, headjs, requirejs, dojo\r\n\tvar _loadScripts = function(scripts, cb) {\r\n\t\t// Reduce the list to scripts that haven't been loaded\r\n\t\tvar existingScripts = _findExistingScripts();\r\n\t\tvar loadingScripts = Object.keys(_loadingScripts);\r\n\t\tvar filteredScripts = [];\r\n\r\n\t\tfor (var i = 0; i < scripts.length; i++) {\r\n\t\t\tvar url = scripts[i];\r\n\t\t\tif (url && (_inArray(url, existingScripts) === -1 || _inArray(url, loadingScripts) !== -1)) {\r\n\t\t\t\tfilteredScripts.push(url);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Attempt to use the user provided method\r\n\t\tif (_config.loadScripts) {\r\n\t\t\treturn _config.loadScripts(filteredScripts, cb);\r\n\t\t}\r\n\r\n\t\tif (!filteredScripts.length) {\r\n\t\t\treturn cb();\r\n\t\t}\r\n\r\n\t\tvar doc = window.document;\r\n\t\tvar scriptCount = filteredScripts.length;\r\n\t\tvar scriptsLoaded = 0;\r\n\t\t//http://caniuse.com/#feat=script-async\r\n\t\t// var supportsAsync = 'async' in doc.createElement('script') || 'MozAppearance' in doc.documentElement.style || window.opera;\r\n\t\tvar head = doc && (doc['head'] || doc.getElementsByTagName('head')[0]);\r\n\t\t// to keep IE from crying, we need to put scripts before any\r\n\t\t// elements, but after any . this should do it:\r\n\t\tvar insertBeforeEl = head && head.getElementsByTagName('base')[0] || null;\r\n\t\t// Check for IE10+ so that we don't rely on onreadystatechange, readyStates for IE6-9\r\n\t\tvar readyStates = 'addEventListener' in window ? {} : { 'loaded': true, 'complete': true };\r\n\r\n\t\t// Log and emit event for the failed (400,500) scripts\r\n\t\tvar _error = function(e) {\r\n\t\t\tsetTimeout(function() {\r\n\t\t\t\tvar evtData = {\r\n\t\t\t\t\tsrc: e.target.src,\r\n\t\t\t\t\tappId: appConfigs[0].appId\r\n\t\t\t\t};\r\n\r\n\t\t\t\t// Send error to console\r\n\t\t\t\tutils.log('Script defined in \\'' + evtData.appId + '\\' failed to load \\'' + evtData.src + '\\'');\r\n\r\n\t\t\t\t// @Brian ? TODO: deprecate, see #222\r\n\t\t\t\tevents.emit(constants.Events.RESOURCE_FAILED_TO_LOAD, evtData);\r\n\r\n\t\t\t\tappHandlers.__trigger(\r\n\t\t\t\t\t\t_sAppHandlerToken,\r\n\t\t\t\t\t\tconstants.AppHandlers.APP_SCRIPT_LOAD_FAILED,\r\n\t\t\t\t\t\tappConfigs[0],\r\n\t\t\t\t\t\tevtData.src\r\n\t\t\t\t\t);\r\n\t\t\t}, _config.scriptErrorTimeout); // Defaults to 7000\r\n\t\t};\r\n\r\n\t\tvar _checkComplete = function() {\r\n\t\t\tif (++scriptsLoaded === scriptCount) {\r\n\t\t\t\tcb();\r\n\t\t\t}\r\n\t\t};\r\n\r\n\t\tvar _emptyWaitlist = function(resourceKey, errorEvt) {\r\n\t\t\tvar waiting,\r\n\t\t\t\twaitlist = _loadingScripts[resourceKey];\r\n\r\n\t\t\tif (!waitlist) {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\tfor (var i=0; i really is the best\r\n\t\t\thead.insertBefore(script, insertBeforeEl);\r\n\t\t});\r\n\t};\r\n\r\n\tvar _loadInlineScripts = function(inlines, cb) {\r\n\t\t// Attempt to use the user provided method\r\n\t\tif (_config.loadInlineScripts) {\r\n\t\t\t_config.loadInlineScripts(inlines, cb);\r\n\t\t}\r\n\t\telse {\r\n\t\t\tfor (var i = 0, len = inlines.length; i < len; i++) {\r\n\t\t\t\ttry {\r\n\t\t\t\t\teval(inlines[i]);\r\n\t\t\t\t}\r\n\t\t\t\tcatch (exception) {\r\n\t\t\t\t\tutils.log('Error loading inline script: ' + exception + '\\n\\n' + inlines[i]);\r\n\r\n\t\t\t\t\t// Emit events\r\n\t\t\t\t\tevents.emit('RESOURCE_FAILED_TO_LOAD', { appId:appConfigs[0].appId, src: inlines[i], err: exception });\r\n\t\t\t\t\t\tappHandlers.__trigger(\r\n\t\t\t\t\t\t\t_sAppHandlerToken,\r\n\t\t\t\t\t\t\tconstants.AppHandlers.APP_SCRIPT_LOAD_FAILED,\r\n\t\t\t\t\t\t\tappConfigs[0],\r\n\t\t\t\t\t\t\texception\r\n\t\t\t\t\t\t);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tcb();\r\n\t\t}\r\n\t};\r\n\r\n\t// Determine whether an element has been added to the page\r\n\tvar elementInDocument = function(element) {\r\n\t\tif (element) {\r\n\t\t\twhile (element.parentNode) {\r\n\t\t\t\telement = element.parentNode;\r\n\r\n\t\t\t\tif (element === document) {\r\n\t\t\t\t\treturn true;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn false;\r\n\t};\r\n\r\n\t// Fn for loading manifest app html\r\n\tvar _loadHtml = function(apps) {\r\n\t\tapps.forEach(function(a, i) {\r\n\t\t\tif (_isPlaceholderElement(appConfigs[i].root)) {\r\n\t\t\t\tvar node = domify(a.html);\r\n\t\t\t\tnode.classList.add(constants.Css.APP_CONTAINER);\r\n\t\t\t\tnode.classList.add(appConfigs[i].appId);\r\n\t\t\t\tappConfigs[i].root.classList.add(constants.Css.APP);\r\n\t\t\t\tappConfigs[i].root.appendChild(node);\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tvar container = document.createElement('div');\r\n\t\t\t\tvar childNode = domify(a.html);\r\n\t\t\t\tchildNode.classList.add(constants.Css.APP_CONTAINER);\r\n\t\t\t\tchildNode.classList.add(appConfigs[i].appId);\r\n\t\t\t\tcontainer.appendChild(childNode);\r\n\r\n\t\t\t\tappHandlers.__trigger(\r\n\t\t\t\t\t_sAppHandlerToken,\r\n\t\t\t\t\tconstants.AppHandlers.APP_RENDER,\r\n\t\t\t\t\tappConfigs[i], // the app config\r\n\t\t\t\t\tcontainer.innerHTML\r\n\t\t\t\t);\r\n\r\n\t\t\t\tvar appId = appConfigs[i].appId,\r\n\t\t\t\t\troot = appConfigs[i].root;\r\n\r\n\t\t\t\tif (!root) {\r\n\t\t\t\t\tthrow ('Root for ' + appId + ' must be a native DOM element and cannot be null or undefined. Check your AppHandler callbacks to ensure you have set App root to a native DOM element.');\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (!elementInDocument(root)) {\r\n\t\t\t\t\tthrow ('App root for ' + appId + ' was not appended to the DOM. Check your AppHandler callbacks to ensure you have rendered the app root to the DOM.');\r\n\t\t\t\t}\r\n\r\n\t\t\t\tappHandlers.__trigger(\r\n\t\t\t\t\t_sAppHandlerToken,\r\n\t\t\t\t\tconstants.AppHandlers.APP_RENDER_AFTER,\r\n\t\t\t\t\tappConfigs[i] // the app config\r\n\t\t\t\t);\r\n\r\n\t\t\t\tif (!utils.isNativeDOMNode(root)) {\r\n\t\t\t\t\tthrow ('App root for ' + appId + ' must be a native DOM element. Check your AppHandler callbacks to ensure you have set app root to a native DOM element.');\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t});\r\n\t};\r\n\r\n\t// Pull out the manifest data\r\n\tvar scripts = appManifest.scripts || [];\r\n\tvar styles = appManifest.styles || [];\r\n\tvar inlines = appManifest.inlineScripts || [];\r\n\tvar apps = appManifest.apps || [];\r\n\r\n\t// Finally, load the styles, html, and scripts\r\n\t_loadStyles(styles, function() {\r\n\t\t// Put the html on the page\r\n\t\t_loadHtml(apps);\r\n\t\t// Add the script content to the page\r\n\t\t_loadScripts(scripts, function() {\r\n\t\t\t// emit event we're done with scripts\r\n\t\t\tif (appConfigs[0]){ events.emit('APP_SCRIPTS_LOADED', { appId:appConfigs[0].appId, scripts:scripts }); }\r\n\t\t\t// Load any inline scripts\r\n\t\t\t_loadInlineScripts(inlines, function() {\r\n\t\t\t\t// Create the apps\r\n\t\t\t\tappConfigs.forEach(function(a, i) {\r\n\t\t\t\t\t_createAppInstance(a, appManifest.apps[i]);\r\n\t\t\t\t});\r\n\t\t\t});\r\n\t\t});\r\n\t});\r\n};\r\n\r\n\r\n/**\r\n * Checks if the app is valid\r\n * @method _validateApp\r\n * @private\r\n * @param {F2.AppConfig} appConfig The F2.AppConfig object\r\n * @returns {bool} True if the app is valid\r\n */\r\nvar _validateApp = function(appConfig) {\r\n\r\n\t// check for valid app configurations\r\n\tif (!appConfig.appId) {\r\n\t\tutils.log('\"appId\" missing from app object');\r\n\t\treturn false;\r\n\t}\r\n\telse if (!appConfig.root && !appConfig.manifestUrl) {\r\n\t\tutils.log('\"manifestUrl\" missing from app object');\r\n\t\treturn false;\r\n\t}\r\n\r\n\treturn true;\r\n};\r\n\r\n/**\r\n * Checks if the ContainerConfig is valid\r\n * @method _validateContainerConfig\r\n * @private\r\n * @returns {bool} True if the config is valid\r\n */\r\nvar _validateContainerConfig = function() {\r\n\r\n\tif (_config) {\r\n\t\tif (_config.xhr) {\r\n\t\t\tif (!(typeof _config.xhr === 'function' || typeof _config.xhr === 'object')) {\r\n\t\t\t\tthrow ('ContainerConfig.xhr should be a function or an object');\r\n\t\t\t}\r\n\t\t\tif (_config.xhr.dataType && typeof _config.xhr.dataType !== 'function') {\r\n\t\t\t\tthrow ('ContainerConfig.xhr.dataType should be a function');\r\n\t\t\t}\r\n\t\t\tif (_config.xhr.type && typeof _config.xhr.type !== 'function') {\r\n\t\t\t\tthrow ('ContainerConfig.xhr.type should be a function');\r\n\t\t\t}\r\n\t\t\tif (_config.xhr.url && typeof _config.xhr.url !== 'function') {\r\n\t\t\t\tthrow ('ContainerConfig.xhr.url should be a function');\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\treturn true;\r\n};\r\n\r\n/**\r\n * Root namespace of the F2 SDK\r\n * @module f2\r\n * @class F2\r\n */\r\nexport default {\r\n\t/**\r\n\t * Gets the current list of apps in the container\r\n\t * @method getContainerState\r\n\t * @returns {Array} An array of objects containing the appId\r\n\t */\r\n\tgetContainerState: function() {\r\n\t\tif (!_isInit()) {\r\n\t\t\tutils.log('F2.init() must be called before F2.getContainerState()');\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tvar apps = [];\r\n\r\n\t\tfor (var i = 0; i < _apps.length; i++) {\r\n\t\t\tapps.push({\r\n\t\t\t\tappId: _apps[i].config.appId\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\treturn apps;\r\n\t},\r\n\t/**\r\n\t * Gets the current locale defined by the container\r\n\t * @method getContainerLocale\r\n\t * @returns {String} IETF-defined standard language tag\r\n\t */\r\n\tgetContainerLocale: function() {\r\n\t\tif (!_isInit()) {\r\n\t\t\tutils.log('F2.init() must be called before F2.getContainerLocale()');\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\treturn classes.ContainerConfig.locale;\r\n\t},\r\n\t/**\r\n\t * Initializes the container. This method must be called before performing\r\n\t * any other actions in the container.\r\n\t * @method init\r\n\t * @param {F2.ContainerConfig} config The configuration object\r\n\t */\r\n\tinit: function(config) {\r\n\t\t_config = config || {};\r\n\r\n\t\t_validateContainerConfig();\r\n\r\n\t\t_hydrateContainerConfig(_config);\r\n\r\n\t\t// dictates whether we use the old logic or the new logic.\r\n\t\t_initContainerEvents();\r\n\t},\r\n\t/**\r\n\t * Has the container been init?\r\n\t * @method isInit\r\n\t * @return {bool} True if the container has been init\r\n\t */\r\n\tisInit: _isInit,\r\n\t/**\r\n\t * Automatically load apps that are already defined in the DOM. Elements will\r\n\t * be rendered into the location of the placeholder DOM element. Any AppHandlers\r\n\t * that are defined will be bypassed.\r\n\t * @method loadPlaceholders\r\n\t * @param {Element} parentNode The element to search for placeholder apps\r\n\t */\r\n\tloadPlaceholders: function(parentNode) {\r\n\r\n\t\tvar self = this,\r\n\t\t\telements = [],\r\n\t\t\tappConfigs = [],\r\n\t\t\tadd = function(e) {\r\n\t\t\t\tif (!e) { return; }\r\n\t\t\t\telements.push(e);\r\n\t\t\t},\r\n\t\t\taddAll = function(els) {\r\n\t\t\t\tif (!els) { return; }\r\n\t\t\t\tfor (var i = 0, len = els.length; i < len; i++) {\r\n\t\t\t\t\tadd(els[i]);\r\n\t\t\t\t}\r\n\t\t\t};\r\n\r\n\t\tif (!!parentNode && !utils.isNativeDOMNode(parentNode)) {\r\n\t\t\tthrow ('\"parentNode\" must be null or a DOM node');\r\n\t\t}\r\n\r\n\t\t// if the passed in element has a data-f2-appid attribute add\r\n\t\t// it to the list of elements but to not search within that\r\n\t\t// element for other placeholders\r\n\t\tif (parentNode && parentNode.hasAttribute('data-f2-appid')) {\r\n\t\t\tadd(parentNode);\r\n\t\t} else {\r\n\r\n\t\t\t// find placeholders within the parentNode only if\r\n\t\t\t// querySelectorAll exists\r\n\t\t\tparentNode = parentNode || document;\r\n\t\t\tif (parentNode.querySelectorAll) {\r\n\t\t\t\taddAll(parentNode.querySelectorAll('[data-f2-appid]'));\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tfor (var i = 0, len = elements.length; i < len; i++) {\r\n\t\t\tvar appConfig = _getAppConfigFromElement(elements[i]);\r\n\t\t\tappConfigs.push(appConfig);\r\n\t\t}\r\n\r\n\t\tif (appConfigs.length) {\r\n\t\t\tself.registerApps(appConfigs);\r\n\t\t}\r\n\t},\r\n\t/**\r\n\t * Begins the loading process for all apps and/or initialization process for pre-loaded apps.\r\n\t * The app will be passed the {{#crossLink \"F2.AppConfig\"}}{{/crossLink}} object which will\r\n\t * contain the app's unique instanceId within the container. If the\r\n\t * {{#crossLink \"F2.AppConfig\"}}{{/crossLink}}.root property is populated the app is considered\r\n\t * to be a pre-loaded app and will be handled accordingly. Optionally, the\r\n\t * {{#crossLink \"F2.AppManifest\"}}{{/crossLink}} can be passed in and those\r\n\t * assets will be used instead of making a request.\r\n\t * @method registerApps\r\n\t * @param {Array} appConfigs An array of {{#crossLink \"F2.AppConfig\"}}{{/crossLink}}\r\n\t * objects\r\n\t * @param {Array} [appManifests] An array of\r\n\t * {{#crossLink \"F2.AppManifest\"}}{{/crossLink}}\r\n\t * objects. This array must be the same length as the apps array that is\r\n\t * objects. This array must be the same length as the apps array that is\r\n\t * passed in. This can be useful if apps are loaded on the server-side and\r\n\t * passed down to the client.\r\n\t * @example\r\n\t * Traditional App requests.\r\n\t *\r\n\t *\t// Traditional f2 app configs\r\n\t\t*\tvar arConfigs = [\r\n\t\t*\t\t{\r\n\t\t*\t\t\tappId: 'com_externaldomain_example_app',\r\n\t\t*\t\t\tcontext: {},\r\n\t\t*\t\t\tmanifestUrl: 'http://www.externaldomain.com/F2/AppManifest'\r\n\t\t*\t\t},\r\n\t\t*\t\t{\r\n\t\t*\t\t\tappId: 'com_externaldomain_example_app',\r\n\t\t*\t\t\tcontext: {},\r\n\t\t*\t\t\tmanifestUrl: 'http://www.externaldomain.com/F2/AppManifest'\r\n\t\t*\t\t},\r\n\t\t*\t\t{\r\n\t\t*\t\t\tappId: 'com_externaldomain_example_app2',\r\n\t\t*\t\t\tcontext: {},\r\n\t\t*\t\t\tmanifestUrl: 'http://www.externaldomain.com/F2/AppManifest'\r\n\t\t*\t\t}\r\n\t\t*\t];\r\n\t\t*\r\n\t\t*\tF2.init();\r\n\t\t*\tF2.registerApps(arConfigs);\r\n\t\t*\r\n\t\t* @example\r\n\t\t* Pre-loaded and tradition apps mixed.\r\n\t\t*\r\n\t\t*\t// Pre-loaded apps and traditional f2 app configs\r\n\t\t*\t// you can preload the same app multiple times as long as you have a unique root for each\r\n\t\t*\tvar arConfigs = [\r\n\t\t*\t\t{\r\n\t\t*\t\t\tappId: 'com_mydomain_example_app',\r\n\t\t*\t\t\tcontext: {},\r\n\t\t*\t\t\troot: 'div#example-app-1',\r\n\t\t*\t\t\tmanifestUrl: ''\r\n\t\t*\t\t},\r\n\t\t*\t\t{\r\n\t\t*\t\t\tappId: 'com_mydomain_example_app',\r\n\t\t*\t\t\tcontext: {},\r\n\t\t*\t\t\troot: 'div#example-app-2',\r\n\t\t*\t\t\tmanifestUrl: ''\r\n\t\t*\t\t},\r\n\t\t*\t\t{\r\n\t\t*\t\t\tappId: 'com_externaldomain_example_app',\r\n\t\t*\t\t\tcontext: {},\r\n\t\t*\t\t\tmanifestUrl: 'http://www.externaldomain.com/F2/AppManifest'\r\n\t\t*\t\t}\r\n\t\t*\t];\r\n\t\t*\r\n\t\t*\tF2.init();\r\n\t\t*\tF2.registerApps(arConfigs);\r\n\t\t*\r\n\t\t* @example\r\n\t\t* Apps with predefined manifests.\r\n\t\t*\r\n\t\t*\t// Traditional f2 app configs\r\n\t\t*\tvar arConfigs = [\r\n\t\t*\t\t{appId: 'com_externaldomain_example_app', context: {}},\r\n\t\t*\t\t{appId: 'com_externaldomain_example_app', context: {}},\r\n\t\t*\t\t{appId: 'com_externaldomain_example_app2', context: {}}\r\n\t\t*\t];\r\n\t\t*\r\n\t\t*\t// Pre requested manifest responses\r\n\t\t*\tvar arManifests = [\r\n\t\t*\t\t{\r\n\t\t*\t\t\tapps: ['
Example App!
'],\r\n\t\t*\t\t\tinlineScripts: [],\r\n\t\t*\t\t\tscripts: ['http://www.domain.com/js/AppClass.js'],\r\n\t\t*\t\t\tstyles: ['http://www.domain.com/css/AppStyles.css']\r\n\t\t*\t\t},\r\n\t\t*\t\t{\r\n\t\t*\t\t\tapps: ['
Example App!
'],\r\n\t\t*\t\t\tinlineScripts: [],\r\n\t\t*\t\t\tscripts: ['http://www.domain.com/js/AppClass.js'],\r\n\t\t*\t\t\tstyles: ['http://www.domain.com/css/AppStyles.css']\r\n\t\t*\t\t},\r\n\t\t*\t\t{\r\n\t\t*\t\t\tapps: ['
Example App 2!
'],\r\n\t\t*\t\t\tinlineScripts: [],\r\n\t\t*\t\t\tscripts: ['http://www.domain.com/js/App2Class.js'],\r\n\t\t*\t\t\tstyles: ['http://www.domain.com/css/App2Styles.css']\r\n\t\t*\t\t}\r\n\t\t*\t];\r\n\t\t*\r\n\t\t*\tF2.init();\r\n\t\t*\tF2.registerApps(arConfigs, arManifests);\r\n\t\t*/\r\n\tregisterApps: function(appConfigs, appManifests) {\r\n\r\n\t\tif (!_isInit()) {\r\n\t\t\tutils.log('F2.init() must be called before F2.registerApps()');\r\n\t\t\treturn;\r\n\t\t}\r\n\t\telse if (!appConfigs) {\r\n\t\t\tutils.log('At least one AppConfig must be passed when calling F2.registerApps()');\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tvar self = this;\r\n\t\tvar appStack = [];\r\n\t\tvar batches = {};\r\n\t\tvar callbackStack = {};\r\n\t\tvar haveManifests = false;\r\n\t\tappConfigs = [].concat(appConfigs);\r\n\t\tappManifests = [].concat(appManifests || []);\r\n\t\thaveManifests = !! appManifests.length;\r\n\r\n\t\t// appConfigs must have a length\r\n\t\tif (!appConfigs.length) {\r\n\t\t\tutils.log('At least one AppConfig must be passed when calling F2.registerApps()');\r\n\t\t\treturn;\r\n\t\t\t// ensure that the array of apps and manifests are qual\r\n\t\t}\r\n\t\telse if (appConfigs.length && haveManifests && appConfigs.length != appManifests.length) {\r\n\t\t\tutils.log('The length of \"apps\" does not equal the length of \"appManifests\"');\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\t// validate each app and assign it an instanceId\r\n\t\t// then determine which apps can be batched together\r\n\t\tappConfigs.forEach(function(a, i) {\r\n\t\t\t// add properties and methods\r\n\t\t\ta = _createAppConfig(a);\r\n\r\n\t\t\t// Will set to itself, for preloaded apps, or set to null for apps that aren't already\r\n\t\t\t// on the page.\r\n\t\t\ta.root = a.root || null;\r\n\r\n\t\t\t// we validate the app after setting the root property because pre-load apps do no require\r\n\t\t\t// manifest url\r\n\t\t\tif (!_validateApp(a)) {\r\n\t\t\t\treturn; // move to the next app\r\n\t\t\t}\r\n\r\n\t\t\t// save app\r\n\t\t\t_apps[a.instanceId] = {\r\n\t\t\t\tconfig: a\r\n\t\t\t};\r\n\r\n\t\t\t// If the root property is defined then this app is considered to be preloaded and we will\r\n\t\t\t// run it through that logic.\r\n\t\t\tif (a.root && !_isPlaceholderElement(a.root)) {\r\n\t\t\t\tif ((!a.root && typeof(a.root) != 'string') && !utils.isNativeDOMNode(a.root)) {\r\n\t\t\t\t\tutils.log('AppConfig invalid for pre-load, not a valid string and not dom node');\r\n\t\t\t\t\tutils.log('AppConfig instance:', a);\r\n\t\t\t\t\tthrow ('Preloaded appConfig.root property must be a native dom node or a string representing a sizzle selector. Please check your inputs and try again.');\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// instantiate F2.App\r\n\t\t\t\t_createAppInstance(a, {\r\n\t\t\t\t\tpreloaded: true,\r\n\t\t\t\t\tstatus: constants.AppStatus.SUCCESS\r\n\t\t\t\t});\r\n\r\n\r\n\t\t\t\t// Continue on in the .each loop, no need to continue because the app is on the page\r\n\t\t\t\t// the js in initialized, and it is ready to role.\r\n\t\t\t\treturn; // equivalent to continue in .each\r\n\t\t\t}\r\n\r\n\t\t\tif (!_isPlaceholderElement(a.root)) {\r\n\t\t\t\t\tappHandlers.__trigger(\r\n\t\t\t\t\t\t_sAppHandlerToken,\r\n\t\t\t\t\t\tconstants.AppHandlers.APP_CREATE_ROOT,\r\n\t\t\t\t\t\ta // the app config\r\n\t\t\t\t\t);\r\n\r\n\t\t\t\t\tappHandlers.__trigger(\r\n\t\t\t\t\t\t_sAppHandlerToken,\r\n\t\t\t\t\t\tconstants.AppHandlers.APP_RENDER_BEFORE,\r\n\t\t\t\t\t\ta // the app config\r\n\t\t\t\t\t);\r\n\t\t\t}\r\n\r\n\t\t\t// if we have the manifest, go ahead and load the app\r\n\t\t\tif (haveManifests) {\r\n\t\t\t\t_loadApps(a, appManifests[i]);\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\t// check if this app can be batched\r\n\t\t\t\tif (a.enableBatchRequests) {\r\n\t\t\t\t\tbatches[a.manifestUrl.toLowerCase()] = batches[a.manifestUrl.toLowerCase()] || [];\r\n\t\t\t\t\tbatches[a.manifestUrl.toLowerCase()].push(a);\r\n\t\t\t\t}\r\n\t\t\t\telse {\r\n\t\t\t\t\tappStack.push({\r\n\t\t\t\t\t\tapps: [a],\r\n\t\t\t\t\t\turl: a.manifestUrl\r\n\t\t\t\t\t});\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\t// we don't have the manifests, go ahead and load them\r\n\t\tif (!haveManifests) {\r\n\t\t\t// add the batches to the appStack\r\n\t\t\tfor (var key in batches) {\r\n\t\t\t\tappStack.push({\r\n\t\t\t\t\turl: key,\r\n\t\t\t\t\tapps: batches[key]\r\n\t\t\t\t});\r\n\t\t\t}\r\n\r\n\t\t\t// if an app is being loaded more than once on the page, there is the\r\n\t\t\t// potential that the jsonp callback will be clobbered if the request\r\n\t\t\t// for the AppManifest for the app comes back at the same time as\r\n\t\t\t// another request for the same app. We'll create a callbackStack\r\n\t\t\t// that will ensure that requests for the same app are loaded in order\r\n\t\t\t// rather than at the same time\r\n\t\t\tappStack.forEach(function(req, i) {\r\n\t\t\t\t// define the callback function based on the first app's App ID\r\n\t\t\t\tvar jsonpCallback = constants.JSONP_CALLBACK + req.apps[0].appId;\r\n\r\n\t\t\t\t// push the request onto the callback stack\r\n\t\t\t\tcallbackStack[jsonpCallback] = callbackStack[jsonpCallback] || [];\r\n\t\t\t\tcallbackStack[jsonpCallback].push(req);\r\n\t\t\t});\r\n\r\n\t\t\t// loop through each item in the callback stack and make the request\r\n\t\t\t// for the AppManifest. When the request is complete, pop the next\r\n\t\t\t// request off the stack and make the request.\r\n\t\t\tfor (var i in callbackStack) {\r\n\t\t\t\t/*jshint loopfunc: true */\r\n\t\t\t\tvar requests = callbackStack[i];\r\n\t\t\t\tvar manifestRequest = function(jsonpCallback, req) {\r\n\t\t\t\t\tif (!req) {\r\n\t\t\t\t\t\treturn;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t// setup defaults and callbacks\r\n\t\t\t\t\tvar url = req.url,\r\n\t\t\t\t\t\ttype = 'GET',\r\n\t\t\t\t\t\tdataType = 'jsonp',\r\n\t\t\t\t\t\tcompleteFunc = function() {\r\n\t\t\t\t\t\t\tmanifestRequest(i, requests.pop());\r\n\t\t\t\t\t\t},\r\n\t\t\t\t\t\terrorFunc = function() {\r\n\t\t\t\t\t\t\treq.apps.forEach(function(item, idx) {\r\n\t\t\t\t\t\t\t\titem.name = item.name || item.appId;\r\n\t\t\t\t\t\t\t\tutils.log('Removed failed ' + item.name + ' app', item);\r\n\t\t\t\t\t\t\t\tappHandlers.__trigger(\r\n\t\t\t\t\t\t\t\t\t_sAppHandlerToken,\r\n\t\t\t\t\t\t\t\t\tconstants.AppHandlers.APP_MANIFEST_REQUEST_FAIL,\r\n\t\t\t\t\t\t\t\t\titem // the app config\r\n\t\t\t\t\t\t\t\t);\r\n\t\t\t\t\t\t\t\tself.removeApp(item.instanceId);\r\n\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t},\r\n\t\t\t\t\t\tsuccessFunc = function(appManifest) {\r\n\t\t\t\t\t\t\t_loadApps(req.apps, appManifest);\r\n\t\t\t\t\t\t};\r\n\r\n\t\t\t\t\t// optionally fire xhr overrides\r\n\t\t\t\t\tif (_config.xhr && _config.xhr.dataType) {\r\n\t\t\t\t\t\tdataType = _config.xhr.dataType(req.url, req.apps);\r\n\t\t\t\t\t\tif (typeof dataType !== 'string') {\r\n\t\t\t\t\t\t\tthrow ('ContainerConfig.xhr.dataType should return a string');\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (_config.xhr && _config.xhr.type) {\r\n\t\t\t\t\t\ttype = _config.xhr.type(req.url, req.apps);\r\n\t\t\t\t\t\tif (typeof type !== 'string') {\r\n\t\t\t\t\t\t\tthrow ('ContainerConfig.xhr.type should return a string');\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (_config.xhr && _config.xhr.url) {\r\n\t\t\t\t\t\turl = _config.xhr.url(req.url, req.apps);\r\n\t\t\t\t\t\tif (typeof url !== 'string') {\r\n\t\t\t\t\t\t\tthrow ('ContainerConfig.xhr.url should return a string');\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t// setup the default request function if an override is not present\r\n\t\t\t\t\tvar requestFunc = _config.xhr;\r\n\t\t\t\t\tif (typeof requestFunc !== 'function') {\r\n\t\t\t\t\t\trequestFunc = function(url, appConfigs, successCallback, errorCallback, completeCallback) {\r\n\t\t\t\t\t\t\tif (!window.fetch) {\r\n\t\t\t\t\t\t\t\tthrow ('Browser does not support the Fetch API.');\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\tvar fetchFunc,\r\n\t\t\t\t\t\t\t\tfetchUrl = url + '?params=' + utils.stringify(req.apps, utils.appConfigReplacer);\r\n\r\n\t\t\t\t\t\t\t// Fetch API does not support the JSONP calls so making JSON calls using Fetch API and\r\n\t\t\t\t\t\t\t// JSONP call using fetch-jsonp package (https://www.npmjs.com/package/fetch-jsonp)\r\n\t\t\t\t\t\t\tif (dataType === 'json') {\r\n\t\t\t\t\t\t\t\tvar fetchInputs = {\r\n\t\t\t\t\t\t\t\t\tmethod: type,\r\n\t\t\t\t\t\t\t\t\tmode: 'no-cors'\r\n\t\t\t\t\t\t\t\t};\r\n\r\n\t\t\t\t\t\t\t\tif (type === 'POST') {\r\n\t\t\t\t\t\t\t\t\tfetchUrl = url;\r\n\t\t\t\t\t\t\t\t\tfetchInputs.body = {\r\n\t\t\t\t\t\t\t\t\t\tparams: utils.stringify(req.apps, utils.appConfigReplacer)\r\n\t\t\t\t\t\t\t\t\t};\r\n\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\tfetchFunc = fetch(fetchUrl, fetchInputs);\r\n\t\t\t\t\t\t\t} else if (dataType === 'jsonp') {\r\n\t\t\t\t\t\t\t\tfetchFunc = fetchJsonp(fetchUrl, {\r\n\t\t\t\t\t\t\t\t\ttimeout: 3000,\r\n\t\t\t\t\t\t\t\t\tjsonpCallbackFunction: jsonpCallback\r\n\t\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\tfetchFunc.then(function(response) {\r\n\t\t\t\t\t\t\t\treturn response.json();\r\n\t\t\t\t\t\t\t})\r\n\t\t\t\t\t\t\t.then(function(data) {\r\n\t\t\t\t\t\t\t\tsuccessCallback(data);\r\n\t\t\t\t\t\t\t\tcompleteCallback();\r\n\t\t\t\t\t\t\t})\r\n\t\t\t\t\t\t\t.catch(function(error) {\r\n\t\t\t\t\t\t\t\tutils.log('Failed to load app(s)', error, req.apps);\r\n\t\t\t\t\t\t\t\terrorCallback();\r\n\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t};\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\trequestFunc(url, req.apps, successFunc, errorFunc, completeFunc);\r\n\t\t\t\t};\r\n\r\n\t\t\t\tmanifestRequest(i, requests.pop());\r\n\t\t\t}\r\n\r\n\t\t}\r\n\t},\r\n\t/**\r\n\t * Removes all apps from the container\r\n\t * @method removeAllApps\r\n\t */\r\n\tremoveAllApps: function() {\r\n\r\n\t\tvar self = this;\r\n\r\n\t\tif (!_isInit()) {\r\n\t\t\tutils.log('F2.init() must be called before F2.removeAllApps()');\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tif(Object.keys(_apps).length > 0) {\r\n\t\t\t Object.keys(_apps).forEach(function(key) {\r\n\t\t\t \tself.removeApp(_apps[key].config.instanceId);\r\n\t\t\t});\r\n\t\t}\r\n\t},\r\n\t/**\r\n\t * Removes an app from the container\r\n\t * @method removeApp\r\n\t * @param {string} instanceId The app's instanceId\r\n\t */\r\n\tremoveApp: function(instanceId) {\r\n\r\n\t\tif (!_isInit()) {\r\n\t\t\tutils.log('F2.init() must be called before F2.removeApp()');\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tif (_apps[instanceId]) {\r\n\t\t\tappHandlers.__trigger(\r\n\t\t\t\t_sAppHandlerToken,\r\n\t\t\t\tconstants.AppHandlers.APP_DESTROY_BEFORE,\r\n\t\t\t\t_apps[instanceId] // the app instance\r\n\t\t\t);\r\n\r\n\t\t\tappHandlers.__trigger(\r\n\t\t\t\t_sAppHandlerToken,\r\n\t\t\t\tconstants.AppHandlers.APP_DESTROY,\r\n\t\t\t\t_apps[instanceId] // the app instance\r\n\t\t\t);\r\n\r\n\t\t\tappHandlers.__trigger(\r\n\t\t\t\t_sAppHandlerToken,\r\n\t\t\t\tconstants.AppHandlers.APP_DESTROY_AFTER,\r\n\t\t\t\t_apps[instanceId] // the app instance\r\n\t\t\t);\r\n\r\n\t\t\tdelete _apps[instanceId];\r\n\t\t}\r\n\t}\r\n};\r\n","import EventEmitter2 from 'eventemitter2';\r\n\r\n/**\r\n * Handles [Context](../../app-development.html#context) passing from\r\n * containers to apps and apps to apps.\r\n * @class F2.Events\r\n */\r\nexport default (function() {\r\n\t// init EventEmitter\r\n\tvar _events = new EventEmitter2({\r\n\t\twildcard:true\r\n\t});\r\n\r\n\t// unlimited listeners, set to > 0 for debugging\r\n\t_events.setMaxListeners(0);\r\n\r\n\treturn {\r\n\t\t/**\r\n\t\t * Execute each of the listeners that may be listening for the specified\r\n\t\t * event name in order with the list of arguments.\r\n\t\t * @method emit\r\n\t\t * @param {string} event The event name\r\n\t\t * @param {object} [arg]* The arguments to be passed\r\n\t\t */\r\n\t\temit: function() {\r\n\t\t\treturn EventEmitter2.prototype.emit.apply(_events, [].slice.call(arguments));\r\n\t\t},\r\n\t\t/**\r\n\t\t * Adds a listener that will execute n times for the event before being\r\n\t\t * removed. The listener is invoked only the first time the event is\r\n\t\t * fired, after which it is removed.\r\n\t\t * @method many\r\n\t\t * @param {string} event The event name\r\n\t\t * @param {int} timesToListen The number of times to execute the event\r\n\t\t * before being removed\r\n\t\t * @param {function} listener The function to be fired when the event is\r\n\t\t * emitted\r\n\t\t */\r\n\t\tmany: function(event, timesToListen, listener) {\r\n\t\t\treturn _events.many(event, timesToListen, listener);\r\n\t\t},\r\n\t\t/**\r\n\t\t * Remove a listener for the specified event.\r\n\t\t * @method off\r\n\t\t * @param {string} event The event name\r\n\t\t * @param {function} listener The function that will be removed\r\n\t\t */\r\n\t\toff: function(event, listener) {\r\n\t\t\treturn _events.off(event, listener);\r\n\t\t},\r\n\t\t/**\r\n\t\t * Adds a listener for the specified event\r\n\t\t * @method on\r\n\t\t * @param {string} event The event name\r\n\t\t * @param {function} listener The function to be fired when the event is\r\n\t\t * emitted\r\n\t\t */\r\n\t\ton: function(event, listener){\r\n\t\t\treturn _events.on(event, listener);\r\n\t\t},\r\n\t\t/**\r\n\t\t * Adds a one time listener for the event. The listener is invoked only\r\n\t\t * the first time the event is fired, after which it is removed.\r\n\t\t * @method once\r\n\t\t * @param {string} event The event name\r\n\t\t * @param {function} listener The function to be fired when the event is\r\n\t\t * emitted\r\n\t\t */\r\n\t\tonce: function(event, listener) {\r\n\t\t\treturn _events.once(event, listener);\r\n\t\t}\r\n\t};\r\n})();\r\n","/**\r\n\t * Abosolutizes a relative URL\r\n\t * @method _absolutizeURI\r\n\t * @private\r\n\t * @param {e.g., location.href} base\r\n\t * @param {URL to absolutize} href\r\n\t * @return {string} URL\r\n\t * Source: https://gist.github.com/Yaffle/1088850\r\n\t * Tests: http://skew.org/uri/uri_tests.html\r\n\t */\r\n var _absolutizeURI = function(base, href) {// RFC 3986\r\n\r\n\tfunction removeDotSegments(input) {\r\n\t\tvar output = [];\r\n\t\tinput.replace(/^(\\.\\.?(\\/|$))+/, '')\r\n\t\t\t.replace(/\\/(\\.(\\/|$))+/g, '/')\r\n\t\t\t.replace(/\\/\\.\\.$/, '/../')\r\n\t\t\t.replace(/\\/?[^\\/]*/g, function (p) {\r\n\t\t\t\tif (p === '/..') {\r\n\t\t\t\t\toutput.pop();\r\n\t\t\t\t} else {\r\n\t\t\t\t\toutput.push(p);\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\treturn output.join('').replace(/^\\//, input.charAt(0) === '/' ? '/' : '');\r\n\t}\r\n\r\n\thref = _parseURI(href || '');\r\n\tbase = _parseURI(base || '');\r\n\r\n\treturn !href || !base ? null : (href.protocol || base.protocol) +\r\n\t\t(href.protocol || href.authority ? href.authority : base.authority) +\r\n\t\tremoveDotSegments(href.protocol || href.authority || href.pathname.charAt(0) === '/' ? href.pathname : (href.pathname ? ((base.authority && !base.pathname ? '/' : '') + base.pathname.slice(0, base.pathname.lastIndexOf('/') + 1) + href.pathname) : base.pathname)) +\r\n\t\t(href.protocol || href.authority || href.pathname ? href.search : (href.search || base.search)) +\r\n\t\thref.hash;\r\n};\r\n\r\n/**\r\n * Parses URI\r\n * @method _parseURI\r\n * @private\r\n * @param {The URL to parse} url\r\n * @return {Parsed URL} string\r\n * Source: https://gist.github.com/Yaffle/1088850\r\n * Tests: http://skew.org/uri/uri_tests.html\r\n */\r\nvar _parseURI = function(url) {\r\n\tvar m = String(url).replace(/^\\s+|\\s+$/g, '').match(/^([^:\\/?#]+:)?(\\/\\/(?:[^:@]*(?::[^:@]*)?@)?(([^:\\/?#]*)(?::(\\d*))?))?([^?#]*)(\\?[^#]*)?(#[\\s\\S]*)?/);\r\n\t// authority = '//' + user + ':' + pass '@' + hostname + ':' port\r\n\treturn (m ? {\r\n\t\t\thref : m[0] || '',\r\n\t\t\tprotocol : m[1] || '',\r\n\t\t\tauthority: m[2] || '',\r\n\t\t\thost : m[3] || '',\r\n\t\t\thostname : m[4] || '',\r\n\t\t\tport : m[5] || '',\r\n\t\t\tpathname : m[6] || '',\r\n\t\t\tsearch : m[7] || '',\r\n\t\t\thash : m[8] || ''\r\n\t\t} : null);\r\n};\r\n\r\nexport default {\r\n\t/**\r\n\t * A function to pass into F2.stringify which will prevent circular\r\n\t * reference errors when serializing objects\r\n\t * @method appConfigReplacer\r\n\t */\r\n\tappConfigReplacer: function(key, value) {\r\n\t\tif (key == 'root' || key == 'ui' || key == 'height') {\r\n\t\t\treturn undefined;\r\n\t\t} else {\r\n\t\t\treturn value;\r\n\t\t}\r\n\t},\r\n\t/**\r\n\t * Creates a namespace on F2 and copies the contents of an object into\r\n\t * that namespace optionally overwriting existing properties.\r\n\t * @method extend\r\n\t * @param {string} ns The namespace to create. Pass a falsy value to\r\n\t * add properties to the F2 namespace directly.\r\n\t * @param {object} obj The object to copy into the namespace.\r\n\t * @param {bool} overwrite True if object properties should be overwritten\r\n\t * @return {object} The created object\r\n\t */\r\n\textend: function (ns, obj, overwrite) {\r\n\t\tvar isFunc = typeof obj === 'function';\r\n\t\tvar parts = ns ? ns.split('.') : [];\r\n\t\tvar parent = this;\r\n\t\tobj = obj || {};\r\n\r\n\t\t// ignore leading global\r\n\t\tif (parts[0] === 'F2') {\r\n\t\t\tparts = parts.slice(1);\r\n\t\t}\r\n\r\n\t\t// create namespaces\r\n\t\tfor (var i = 0, len = parts.length; i < len; i++) {\r\n\t\t\tif (!parent[parts[i]]) {\r\n\t\t\t\tparent[parts[i]] = isFunc && i + 1 == len ? obj : {};\r\n\t\t\t}\r\n\t\t\tparent = parent[parts[i]];\r\n\t\t}\r\n\r\n\t\t// copy object into namespace\r\n\t\tif (!isFunc) {\r\n\t\t\tfor (var prop in obj) {\r\n\t\t\t\tif (typeof parent[prop] === 'undefined' || overwrite) {\r\n\t\t\t\t\tparent[prop] = obj[prop];\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn parent;\r\n\t},\r\n\t/**\r\n\t * Generates a somewhat random id\r\n\t * @method guid\r\n\t * @return {string} A random id\r\n\t * @for F2\r\n\t */\r\n\tguid: function() {\r\n\t\tvar S4 = function() {\r\n\t\t\treturn (((1+Math.random())*0x10000)|0).toString(16).substring(1);\r\n\t\t};\r\n\t\treturn (S4()+S4()+'-'+S4()+'-'+S4()+'-'+S4()+'-'+S4()+S4()+S4());\r\n\t},\r\n\t/**\r\n\t * Tests a URL to see if it's on the same domain (local) or not\r\n\t * @method isLocalRequest\r\n\t * @param {URL to test} url\r\n\t * @return {bool} Whether the URL is local or not\r\n\t * Derived from: https://github.com/jquery/jquery/blob/master/src/ajax.js\r\n\t */\r\n\tisLocalRequest: function(url){\r\n\t\tvar rurl = /^([\\w.+-]+:)(?:\\/\\/([^\\/?#:]*)(?::(\\d+)|)|)/,\r\n\t\t\turlLower = url.toLowerCase(),\r\n\t\t\tparts = rurl.exec( urlLower ),\r\n\t\t\tajaxLocation,\r\n\t\t\tajaxLocParts;\r\n\r\n\t\ttry {\r\n\t\t\tajaxLocation = location.href;\r\n\t\t} catch( e ) {\r\n\t\t\t// Use the href attribute of an A element\r\n\t\t\t// since IE will modify it given document.location\r\n\t\t\tajaxLocation = document.createElement('a');\r\n\t\t\tajaxLocation.href = '';\r\n\t\t\tajaxLocation = ajaxLocation.href;\r\n\t\t}\r\n\r\n\t\tajaxLocation = ajaxLocation.toLowerCase();\r\n\r\n\t\t// uh oh, the url must be relative\r\n\t\t// make it fully qualified and re-regex url\r\n\t\tif (!parts){\r\n\t\t\turlLower = _absolutizeURI(ajaxLocation,urlLower).toLowerCase();\r\n\t\t\tparts = rurl.exec( urlLower );\r\n\t\t}\r\n\r\n\t\t// Segment location into parts\r\n\t\tajaxLocParts = rurl.exec( ajaxLocation ) || [];\r\n\r\n\t\t// do hostname and protocol and port of manifest URL match location.href? (a \"local\" request on the same domain)\r\n\t\tvar matched = !(parts &&\r\n\t\t\t\t(parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] ||\r\n\t\t\t\t\t(parts[ 3 ] || (parts[ 1 ] === 'http:' ? '80' : '443')) !==\r\n\t\t\t\t\t\t(ajaxLocParts[ 3 ] || (ajaxLocParts[ 1 ] === 'http:' ? '80' : '443'))));\r\n\r\n\t\treturn matched;\r\n\t},\r\n\t/**\r\n\t * Utility method to determine whether or not the argument passed in is or is not a native dom node.\r\n\t * @method isNativeDOMNode\r\n\t * @param {object} testObject The object you want to check as native dom node.\r\n\t * @return {bool} Returns true if the object passed is a native dom node.\r\n\t */\r\n\tisNativeDOMNode: function(testObject) {\r\n\t\tvar bIsNode = (\r\n\t\t\ttypeof Node === 'object' ? testObject instanceof Node :\r\n\t\t\ttestObject && typeof testObject === 'object' && typeof testObject.nodeType === 'number' && typeof testObject.nodeName === 'string'\r\n\t\t);\r\n\r\n\t\tvar bIsElement = (\r\n\t\t\ttypeof HTMLElement === 'object' ? testObject instanceof HTMLElement : //DOM2\r\n\t\t\ttestObject && typeof testObject === 'object' && testObject.nodeType === 1 && typeof testObject.nodeName === 'string'\r\n\t\t);\r\n\r\n\t\treturn (bIsNode || bIsElement);\r\n\t},\r\n\t/**\r\n\t * A utility logging function to write messages or objects to the browser console. This is a proxy for the [`console` API](https://developers.google.com/chrome-developer-tools/docs/console).\r\n\t * @method log\r\n\t * @param {object|string} Object/Method An object to be logged _or_ a `console` API method name, such as `warn` or `error`. All of the console method names are [detailed in the Chrome docs](https://developers.google.com/chrome-developer-tools/docs/console-api).\r\n\t * @param {object} [obj2]* An object to be logged\r\n\t * @example\r\n\t\t//Pass any object (string, int, array, object, bool) to .log()\r\n\t\tF2.log('foo');\r\n\t\tF2.log(myArray);\r\n\t\t//Use a console method name as the first argument.\r\n\t\tF2.log('error', err);\r\n\t\tF2.log('info', 'The session ID is ' + sessionId);\r\n\t\t* Some code derived from [HTML5 Boilerplate console plugin](https://github.com/h5bp/html5-boilerplate/blob/master/js/plugins.js)\r\n\t\t*/\r\n\tlog: function() {\r\n\t\tvar _log;\r\n\t\tvar _logMethod = 'log';\r\n\t\tvar method;\r\n\t\tvar noop = function () { };\r\n\t\tvar methods = [\r\n\t\t\t'assert', 'clear', 'count', 'debug', 'dir', 'dirxml', 'error',\r\n\t\t\t'exception', 'group', 'groupCollapsed', 'groupEnd', 'info', 'log',\r\n\t\t\t'markTimeline', 'profile', 'profileEnd', 'table', 'time', 'timeEnd',\r\n\t\t\t'timeStamp', 'trace', 'warn'\r\n\t\t];\r\n\t\tvar length = methods.length;\r\n\t\tvar console = (window.console = window.console || {});\r\n\t\tvar args;\r\n\r\n\t\twhile (length--) {\r\n\t\t\tmethod = methods[length];\r\n\r\n\t\t\t// Only stub undefined methods.\r\n\t\t\tif (!console[method]) {\r\n\t\t\t\tconsole[method] = noop;\r\n\t\t\t}\r\n\r\n\t\t\t//if first arg is a console function, use it.\r\n\t\t\t//defaults to console.log()\r\n\t\t\tif (arguments && arguments.length > 1 && arguments[0] == method){\r\n\t\t\t\t_logMethod = method;\r\n\t\t\t\t//remove console func from args\r\n\t\t\t\targs = Array.prototype.slice.call(arguments, 1);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif (Function.prototype.bind) {\r\n\t\t\t_log = Function.prototype.bind.call(console[_logMethod], console);\r\n\t\t} else {\r\n\t\t\t_log = function() {\r\n\t\t\t\tFunction.prototype.apply.call(console[_logMethod], console, (args || arguments));\r\n\t\t\t};\r\n\t\t}\r\n\r\n\t\t_log.apply(this, (args || arguments));\r\n\t},\r\n\t/**\r\n\t * Wrapper to convert a JSON string to an object\r\n\t * @method parse\r\n\t * @param {string} str The JSON string to convert\r\n\t * @return {object} The parsed object\r\n\t */\r\n\tparse: function(str) {\r\n\t\treturn JSON.parse(str);\r\n\t},\r\n\t/**\r\n\t * Wrapper to convert an object to JSON\r\n\t *\r\n\t * **Note: When using F2.stringify on an F2.AppConfig object, it is\r\n\t * recommended to pass F2.appConfigReplacer as the replacer function in\r\n\t * order to prevent circular serialization errors.**\r\n\t * @method stringify\r\n\t * @param {object} value The object to convert\r\n\t * @param {function|Array} replacer An optional parameter that determines\r\n\t * how object values are stringified for objects. It can be a function or an\r\n\t * array of strings.\r\n\t * @param {int|string} space An optional parameter that specifies the\r\n\t * indentation of nested structures. If it is omitted, the text will be\r\n\t * packed without extra whitespace. If it is a number, it will specify the\r\n\t * number of spaces to indent at each level. If it is a string (such as '\\t'\r\n\t * or ' '), it contains the characters used to indent at each level.\r\n\t * @return {string} The JSON string\r\n\t */\r\n\tstringify: function(value, replacer, space) {\r\n\t\treturn JSON.stringify(value, replacer, space);\r\n\t},\r\n\t/**\r\n\t * Function to get the F2 version number\r\n\t * @method version\r\n\t * @return {string} F2 version number\r\n\t */\r\n\tversion: function() {\r\n\t\t/* jshint undef: false */\r\n\t\treturn VERSION;\r\n\t}\r\n};\r\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\tid: moduleId,\n\t\tloaded: false,\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Flag the module as loaded\n\tmodule.loaded = true;\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.g = (function() {\n\tif (typeof globalThis === 'object') return globalThis;\n\ttry {\n\t\treturn this || new Function('return this')();\n\t} catch (e) {\n\t\tif (typeof window === 'object') return window;\n\t}\n})();","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","__webpack_require__.nmd = (module) => {\n\tmodule.paths = [];\n\tif (!module.children) module.children = [];\n\treturn module;\n};","import container from './container';\r\n\r\nexport default function() {\r\n\r\n\tvar callback = function() {\r\n\t\tvar autoloadEls = [],\r\n\t\t\tadd = function(e) {\r\n\t\t\t\tif (!e) { return; }\r\n\t\t\t\tautoloadEls.push(e);\r\n\t\t\t},\r\n\t\t\taddAll = function(els) {\r\n\t\t\t\tif (!els) { return; }\r\n\t\t\t\tfor (var i = 0, len = els.length; i < len; i++) {\r\n\t\t\t\t\tadd(els[i]);\r\n\t\t\t\t}\r\n\t\t\t};\r\n\r\n\t\t// support id-based autoload\r\n\t\tadd(document.getElementById('f2-autoload'));\r\n\r\n\t\t// support class/attribute based autoload\r\n\t\tif (document.querySelectorAll) {\r\n\t\t\taddAll(document.querySelectorAll('[data-f2-autoload]'));\r\n\t\t\taddAll(document.querySelectorAll('.f2-autoload'));\r\n\t\t}\r\n\r\n\t\t// if elements were found, auto-init F2 and load any placeholders\r\n\t\tif (autoloadEls.length) {\r\n\t\t\tcontainer.init();\r\n\t\t\tfor (var i = 0, len = autoloadEls.length; i < len; i++) {\r\n\t\t\t\tcontainer.loadPlaceholders(autoloadEls[i]);\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\r\n\tif (document.readyState === 'complete' || (document.readyState !== 'loading' && !document.documentElement.doScroll)) {\r\n\t\tcallback();\r\n\t} else {\r\n\t\tdocument.addEventListener('DOMContentLoaded', callback);\r\n\t}\r\n}","import AppHandlers from './appHandlers';\r\nimport Apps from './apps';\r\nimport autoload from './autoload';\r\nimport Classes from './classes';\r\nimport Constants from './constants';\r\nimport container from './container';\r\nimport Events from './events';\r\nimport utils from './utils';\r\n\r\nautoload();\r\n\r\n/**\r\n * Open F2\r\n * @module f2\r\n * @main f2\r\n */\r\nconst lib = {\r\n\t...utils,\r\n\t...Classes,\r\n\t...container,\r\n\tAppHandlers,\r\n\tApps,\r\n\tConstants,\r\n\tEvents\r\n};\r\n\r\n// always export F2 as a global\r\nwindow.F2 = lib;\r\n\r\nexport default lib;"],"sourceRoot":""} \ No newline at end of file diff --git a/docs/src/container-development.md b/docs/src/container-development.md index e9659d78..6e6be97c 100644 --- a/docs/src/container-development.md +++ b/docs/src/container-development.md @@ -402,13 +402,17 @@ F2.init({ ### Handling Script Errors -In the event any scripts defined in an `AppManifest` fail to load—such as HTTP 404 or simply timeout after the [configurable](./sdk/classes/F2.ContainerConfig.html#properties-scriptErrorTimeout) 7 seconds—F2 Events are triggered. The two events are: `RESOURCE_FAILED_TO_LOAD` and the `APP_SCRIPT_LOAD_FAILED` [AppHandler](./sdk/classes/F2.Constants.AppHandlers.html#properties-APP_SCRIPT_LOAD_FAILED). Both events are passed the `appId` and `src` of the failed script. +In the event any scripts defined in an `AppManifest` fail to load—such as HTTP 404 or simply timeout after the [configurable](./sdk/classes/F2.ContainerConfig.html#properties-scriptErrorTimeout) 7 seconds—the `APP_SCRIPT_LOAD_FAILED` [AppHandler](./sdk/classes/F2.Constants.AppHandlers.html#properties-APP_SCRIPT_LOAD_FAILED) will be fired. The event is passed the `appId` and `src` of the failed script. ```javascript -F2.Events.on('RESOURCE_FAILED_TO_LOAD', function(data){ - F2.log('Script failed to load: ' data.src); - //Ouputs 'Script failed to load: http://cdn.com/script.js' -}); +var _token = F2.AppHandlers.getToken(); +F2.AppHandlers.on( + _token, + F2.Constants.AppHandlers.APP_SCRIPT_LOAD_FAILED, + function(appConfig, scriptInfo) { + F2.log(appConfig.appId); + } +); ``` ### When Are Scripts Loaded? diff --git a/examples/container-locale/js/container.js b/examples/container-locale/js/container.js index f87f2432..62a6fb6a 100644 --- a/examples/container-locale/js/container.js +++ b/examples/container-locale/js/container.js @@ -20,11 +20,11 @@ for (var i in logFns) { } $(function() { - + //locale switcher $('#locale-switcher').on('click','a',function(e){ var locale = $(this).data('locale'); - + //emit standard event with new locale F2.Events.emit(F2.Constants.Events.CONTAINER_LOCALE_CHANGE,{ locale: locale @@ -50,13 +50,13 @@ $(function() { '', '
', '' - ].join('')).get(0); + ].join('')).get(0); }; var appRenderFunc = function(appConfig, app) { var gridWidth = appConfig.minGridSize || 3; - + // find a row that can fit this app var row; $('#mainContent div.row').each(function(i, el) { @@ -85,7 +85,7 @@ $(function() { var appDestroyFunc = function(appInstance) { if(!appInstance) { return; } - + // call the apps destroy method, if it has one if(appInstance.app && appInstance.app.destroy && typeof(appInstance.app.destroy) == 'function'){ appInstance.app.destroy(); @@ -94,14 +94,14 @@ $(function() { else if(appInstance.app && appInstance.app.destroy){ F2.log(appInstance.appId + ' has a Destroy property, but Destroy is not of type function and as such will not be executed.'); } - + // fade out and remove the root jQuery(appInstance.config.root).fadeOut(250, function() { jQuery(this).remove(); }); }; /** - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /** @@ -111,25 +111,25 @@ $(function() { debugMode: true, locale: "en-gb" }); - + // Define these prior to calling F2.registerApps F2.AppHandlers .on(containerAppHandlerToken, F2.Constants.AppHandlers.APP_CREATE_ROOT, appCreateRootFunc) .on(containerAppHandlerToken, F2.Constants.AppHandlers.APP_RENDER, appRenderFunc) .on(containerAppHandlerToken, F2.Constants.AppHandlers.APP_DESTROY, appDestroyFunc) ; - + //listen for app symbol change events and re-broadcast F2.Events.on(F2.Constants.Events.APP_SYMBOL_CHANGE,function(data) { F2.Events.emit(F2.Constants.Events.CONTAINER_SYMBOL_CHANGE, { symbol: data.symbol, name: data.name || '' }); }); //listen for any failed resources and display alert (demo purposes only) - F2.Events.on('RESOURCE_FAILED_TO_LOAD', function(data){ + F2.AppHandlers.on(F2.Constants.AppHandlers.APP_SCRIPT_LOAD_FAILED, function(appConfig, data){ var error = ['
', '
', '
', - 'A script resource defined in "'+data.appId+'" failed to load.', + 'A script resource defined in "'+appConfig.appId+'" failed to load.', '
', '
', '
']; @@ -142,7 +142,7 @@ $(function() { } /** - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /** diff --git a/examples/container/js/container.js b/examples/container/js/container.js index e1971e5b..f4b56bbb 100644 --- a/examples/container/js/container.js +++ b/examples/container/js/container.js @@ -20,7 +20,7 @@ for (var i in logFns) { } $(function() { - + var containerAppHandlerToken = F2.AppHandlers.getToken(); var appCreateRootFunc = function(appConfig) { @@ -33,13 +33,13 @@ $(function() { '', '
', '' - ].join('')).get(0); + ].join('')).get(0); }; var appRenderFunc = function(appConfig, app) { var gridWidth = appConfig.minGridSize || 3; - + // find a row that can fit this app var row; $('#mainContent div.row').each(function(i, el) { @@ -68,7 +68,7 @@ $(function() { var appDestroyFunc = function(appInstance) { if(!appInstance) { return; } - + // call the apps destroy method, if it has one if(appInstance.app && appInstance.app.destroy && typeof(appInstance.app.destroy) == 'function'){ appInstance.app.destroy(); @@ -77,14 +77,14 @@ $(function() { else if(appInstance.app && appInstance.app.destroy){ F2.log(appInstance.appId + ' has a Destroy property, but Destroy is not of type function and as such will not be executed.'); } - + // fade out and remove the root jQuery(appInstance.config.root).fadeOut(250, function() { jQuery(this).remove(); }); }; /** - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /** @@ -93,25 +93,25 @@ $(function() { F2.init({ debugMode: true // this should go on a separate domain from index.html }); - + // Define these prior to calling F2.registerApps F2.AppHandlers .on(containerAppHandlerToken, F2.Constants.AppHandlers.APP_CREATE_ROOT, appCreateRootFunc) .on(containerAppHandlerToken, F2.Constants.AppHandlers.APP_RENDER, appRenderFunc) .on(containerAppHandlerToken, F2.Constants.AppHandlers.APP_DESTROY, appDestroyFunc) ; - + //listen for app symbol change events and re-broadcast F2.Events.on(F2.Constants.Events.APP_SYMBOL_CHANGE,function(data) { F2.Events.emit(F2.Constants.Events.CONTAINER_SYMBOL_CHANGE, { symbol: data.symbol, name: data.name || '' }); }); //listen for any failed resources and display alert (demo purposes only) - F2.Events.on('RESOURCE_FAILED_TO_LOAD', function(data){ + F2.AppHandlers.on(F2.Constants.AppHandlers.APP_SCRIPT_LOAD_FAILED, function(appConfig, data){ var error = ['
', '
', '
', - 'A script resource defined in "'+data.appId+'" failed to load.', + 'A script resource defined in "'+appConfig.appId+'" failed to load.', '
', '
', '
']; @@ -119,7 +119,7 @@ $(function() { }); /** - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /** diff --git a/package.json b/package.json index df6d84b2..9c721bf1 100644 --- a/package.json +++ b/package.json @@ -18,13 +18,14 @@ }, "license": "Apache-2.0", "scripts": { - "build": "webpack --config webpack.config.js", - "ci": "npm run test", + "build": "webpack --config webpack.prod.js", + "build-dev": "webpack --config webpack.dev.js", "docs": "rm -rf ./docs/dist && webpack --config ./docs/src/webpack.config.js && node docs/bin/gen-docs && node docs/bin/yuidocs && rm docs/dist/css/site.js && cp -r docs/src/img docs/src/fonts docs/src/apps docs/src/js docs/dist && cp dist/* docs/dist/js", "docs-live": "http-server ./docs/dist", "gh-pages": "cp -r docs/dist/* ../gh-pages && cp dist/* ../gh-pages && npm run zip", "lint": "jshint --verbose src/", "test": "npm run lint && concurrently -s first -k -r \"cross-env PORT=8080 node tests/server\" \"cross-env PORT=8081 node tests/server\" \"karma start --single-run --browsers ChromeHeadless --reporters nested\"", + "test-debug": "npm run lint && concurrently -s first -k -r \"cross-env PORT=8080 node tests/server\" \"cross-env PORT=8081 node tests/server\" \"karma start --log-level debug --single-run --browsers ChromeHeadless --reporters nested\"", "test-live": "npm run lint && concurrently -s first -k -r \"cross-env PORT=8080 node tests/server\" \"cross-env PORT=8081 node tests/server\" \"karma start\"", "zip": "bestzip F2-examples.zip examples/* dist/* && cp -f F2-examples.zip ../gh-pages " }, @@ -59,6 +60,7 @@ "webpack": "^5.42.0", "webpack-bundle-analyzer": "^4.4.2", "webpack-cli": "^4.7.2", + "webpack-merge": "^5.8.0", "yuidocjs": "^0.10.2" }, "files": [ diff --git a/src/appHandlers.js b/src/appHandlers.js index 5c0c22f0..b017b58a 100644 --- a/src/appHandlers.js +++ b/src/appHandlers.js @@ -48,7 +48,9 @@ var _defaultMethods = { } // remove the root - appInstance.config.root.parentNode.removeChild(appInstance.config.root); + if (appInstance.config.root && appInstance.config.root.parentNode) { + appInstance.config.root.parentNode.removeChild(appInstance.config.root); + } } }; diff --git a/src/constants/appHandlers.js b/src/constants/appHandlers.js index cbd4c882..0c7d8d2a 100644 --- a/src/constants/appHandlers.js +++ b/src/constants/appHandlers.js @@ -25,7 +25,7 @@ module.exports = { */ APP_MANIFEST_REQUEST_FAIL: 'appManifestRequestFail', /** - * Equivalent to `appCreateRoot`. Identifies the create root method for use in AppHandlers.on/off. + * Identifies the create root method for use in AppHandlers.on/off. * When bound using {{#crossLink "F2.AppHandlers/on"}}F2.AppHandlers.on(){{/crossLink}} the listener function passed will receive the * following argument(s): ( {{#crossLink "F2.AppConfig"}}appConfig{{/crossLink}} ) * @property APP_CREATE_ROOT @@ -47,7 +47,7 @@ module.exports = { */ APP_CREATE_ROOT: 'appCreateRoot', /** - * Equivalent to `appRenderBefore`. Identifies the before app render method for use in AppHandlers.on/off. + * Identifies the before app render method for use in AppHandlers.on/off. * When bound using {{#crossLink "F2.AppHandlers/on"}}F2.AppHandlers.on(){{/crossLink}} the listener function passed will receive the * following argument(s): ( {{#crossLink "F2.AppConfig"}}appConfig{{/crossLink}} ) * @property APP_RENDER_BEFORE @@ -67,7 +67,7 @@ module.exports = { */ APP_RENDER_BEFORE: 'appRenderBefore', /** - * Equivalent to `appRender`. Identifies the app render method for use in AppHandlers.on/off. + * Identifies the app render method for use in AppHandlers.on/off. * When bound using {{#crossLink "F2.AppHandlers/on"}}F2.AppHandlers.on(){{/crossLink}} the listener function passed will receive the * following argument(s): ( {{#crossLink "F2.AppConfig"}}appConfig{{/crossLink}}, [appHtml](../../app-development.html#app-design) ) * @property APP_RENDER @@ -99,7 +99,7 @@ module.exports = {             */ APP_RENDER: 'appRender', /** - * Equivalent to `appRenderAfter`. Identifies the after app render method for use in AppHandlers.on/off. + * Identifies the after app render method for use in AppHandlers.on/off. * When bound using {{#crossLink "F2.AppHandlers/on"}}F2.AppHandlers.on(){{/crossLink}} the listener function passed will receive the * following argument(s): ( {{#crossLink "F2.AppConfig"}}appConfig{{/crossLink}} ) * @property APP_RENDER_AFTER @@ -119,7 +119,7 @@ module.exports = { */ APP_RENDER_AFTER: 'appRenderAfter', /** - * Equivalent to `appDestroyBefore`. Identifies the before app destroy method for use in AppHandlers.on/off. + * Identifies the before app destroy method for use in AppHandlers.on/off. * When bound using {{#crossLink "F2.AppHandlers/on"}}F2.AppHandlers.on(){{/crossLink}} the listener function passed will receive the * following argument(s): ( appInstance ) * @property APP_DESTROY_BEFORE @@ -139,7 +139,7 @@ module.exports = { */ APP_DESTROY_BEFORE: 'appDestroyBefore', /** - * Equivalent to `appDestroy`. Identifies the app destroy method for use in AppHandlers.on/off. + * Identifies the app destroy method for use in AppHandlers.on/off. * When bound using {{#crossLink "F2.AppHandlers/on"}}F2.AppHandlers.on(){{/crossLink}} the listener function passed will receive the * following argument(s): ( appInstance ) * @property APP_DESTROY @@ -170,7 +170,7 @@ module.exports = {             */ APP_DESTROY: 'appDestroy', /** - * Equivalent to `appDestroyAfter`. Identifies the after app destroy method for use in AppHandlers.on/off. + * Identifies the after app destroy method for use in AppHandlers.on/off. * When bound using {{#crossLink "F2.AppHandlers/on"}}F2.AppHandlers.on(){{/crossLink}} the listener function passed will receive the * following argument(s): ( appInstance ) * @property APP_DESTROY_AFTER @@ -190,7 +190,7 @@ module.exports = {             */ APP_DESTROY_AFTER: 'appDestroyAfter', /** - * Equivalent to `appScriptLoadFailed`. Identifies the app script load failed method for use in AppHandlers.on/off. + * Identifies the app script load failed method for use in AppHandlers.on/off. * When bound using {{#crossLink "F2.AppHandlers/on"}}F2.AppHandlers.on(){{/crossLink}} the listener function passed will receive the * following argument(s): ( {{#crossLink "F2.AppConfig"}}appConfig{{/crossLink}}, scriptInfo ) * @property APP_SCRIPT_LOAD_FAILED @@ -198,15 +198,14 @@ module.exports = { * @static * @final * @example - * var _token = F2.AppHandlers.getToken(); - * F2.AppHandlers.on( - * _token, - * F2.Constants.AppHandlers.APP_SCRIPT_LOAD_FAILED, - * function(appConfig, scriptInfo) - * { - * F2.log(appConfig.appId); - * } - * ); + * var _token = F2.AppHandlers.getToken(); + * F2.AppHandlers.on( + * _token, + * F2.Constants.AppHandlers.APP_SCRIPT_LOAD_FAILED, + * function(appConfig, scriptInfo) { + * F2.log(appConfig.appId); + * } + * ); */ APP_SCRIPT_LOAD_FAILED: 'appScriptLoadFailed' }; \ No newline at end of file diff --git a/src/constants/events.js b/src/constants/events.js index 63f810cc..e40be4c9 100644 --- a/src/constants/events.js +++ b/src/constants/events.js @@ -76,15 +76,5 @@ module.exports = { * @static * @final */ - CONTAINER_LOCALE_CHANGE: 'Container.localeChange', - /** - * The RESOURCE_FAILED_TO_LOAD event will be fired by the container when - * it fails to load a script or style. - * @property RESOURCE_FAILED_TO_LOAD - * @depreciated since 1.4 - * @type string - * @static - * @final - */ - RESOURCE_FAILED_TO_LOAD: 'Container.resourceFailedToLoad' + CONTAINER_LOCALE_CHANGE: 'Container.localeChange' }; diff --git a/src/container.js b/src/container.js index 9aec9648..a573a69b 100644 --- a/src/container.js +++ b/src/container.js @@ -1,7 +1,7 @@ import appHandlers from './appHandlers'; import appClasses from './apps'; import classes from './classes'; -import cloneDeep from 'lodash.cloneDeep'; +import cloneDeep from 'lodash.clonedeep'; import constants from './constants'; import domify from 'domify'; import events from './events'; @@ -205,6 +205,11 @@ var _createAppInstance = function(appConfig, appContent) { // IE setTimeout(function() { + // #265 + if (!_apps[appConfig.instanceId]) { + utils.log('Unable to create app (' + appConfig.instanceId + ') as it does not exist.'); + return; + } _apps[appConfig.instanceId].app = new appClasses[appConfig.appId](appConfig, appContent, appConfig.root); if (_apps[appConfig.instanceId].app['init'] !== undefined) { _apps[appConfig.instanceId].app.init(); @@ -344,15 +349,12 @@ var _loadApps = function(appConfigs, appManifest) { // Send error to console utils.log('Script defined in \'' + evtData.appId + '\' failed to load \'' + evtData.src + '\''); - // @Brian ? TODO: deprecate, see #222 - events.emit(constants.Events.RESOURCE_FAILED_TO_LOAD, evtData); - appHandlers.__trigger( - _sAppHandlerToken, - constants.AppHandlers.APP_SCRIPT_LOAD_FAILED, - appConfigs[0], - evtData.src - ); + _sAppHandlerToken, + constants.AppHandlers.APP_SCRIPT_LOAD_FAILED, + appConfigs[0], + evtData.src + ); }, _config.scriptErrorTimeout); // Defaults to 7000 }; @@ -459,13 +461,12 @@ var _loadApps = function(appConfigs, appManifest) { utils.log('Error loading inline script: ' + exception + '\n\n' + inlines[i]); // Emit events - events.emit('RESOURCE_FAILED_TO_LOAD', { appId:appConfigs[0].appId, src: inlines[i], err: exception }); - appHandlers.__trigger( - _sAppHandlerToken, - constants.AppHandlers.APP_SCRIPT_LOAD_FAILED, - appConfigs[0], - exception - ); + appHandlers.__trigger( + _sAppHandlerToken, + constants.AppHandlers.APP_SCRIPT_LOAD_FAILED, + appConfigs[0], + exception + ); } } cb(); diff --git a/tests/spec/autoload-spec.js b/tests/spec/autoload-spec.js index a7e1f72b..fd32f6d1 100644 --- a/tests/spec/autoload-spec.js +++ b/tests/spec/autoload-spec.js @@ -7,8 +7,10 @@ describe('F2.loadPlaceholders - auto', function() { function() { var element = document.querySelectorAll(selector); if (!element) { - clearInterval(periodicCheck); - throw new Error('unable to locate selector: ' + selector); + return; + // clearInterval(periodicCheck); + // console.log('unable to locate selector: ' + selector); + // throw new Error('unable to locate selector: ' + selector); } // sum the number of children found in each of the elements that were found children = Array.from(element).reduce((total, current) => total + current.children.length, 0); diff --git a/tests/spec/spec-helpers.js b/tests/spec/spec-helpers.js index 929dc932..da929b8c 100644 --- a/tests/spec/spec-helpers.js +++ b/tests/spec/spec-helpers.js @@ -15,19 +15,23 @@ var TEST_MANIFEST_URL = 'http://localhost:8080/F2/apps/test/hello-world', */ var beforeEachReloadF2 = function(callback) { beforeEach(function(done) { + console.info('beforeEachReloadF2: start') window.F2 = null; var head = (document.head || document.getElementsByTagName('head')[0]); var script = document.createElement('script'); head.appendChild(script); script.async = false; script.onerror = function(e) { + console.error('F2 FAILED TO LOAD: ' + e.message); throw new Error('F2 FAILED TO LOAD: ' + e.message); } script.onload = script.onreadystatechange = function(e) { script = null; if (!window.F2) { + console.error('F2 WAS NOT PROPERLY LOADED') throw new Error('F2 WAS NOT PROPERLY LOADED'); } + console.info('beforeEachReloadF2: end') callback && callback(); done(); } diff --git a/webpack.config.js b/webpack.base.js similarity index 90% rename from webpack.config.js rename to webpack.base.js index 61f51948..9fee9896 100644 --- a/webpack.config.js +++ b/webpack.base.js @@ -1,15 +1,9 @@ -const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin; const path = require('path'); const pkg = require('./package.json'); const webpack = require('webpack'); module.exports = { - devtool: 'source-map', entry: './src/index.js', - mode: 'production', - optimization: { - minimize: false - }, output: { path: path.resolve(__dirname, 'dist'), filename: 'f2.js', @@ -50,7 +44,6 @@ nor result in you having acquiring any rights whatsoever, other than as stipulat in the terms and conditions related to the specific Third Party Material, if any.`; } }), - new BundleAnalyzerPlugin(), new webpack.DefinePlugin({ VERSION: JSON.stringify(pkg.version) }), diff --git a/webpack.dev.js b/webpack.dev.js new file mode 100644 index 00000000..70ec49b9 --- /dev/null +++ b/webpack.dev.js @@ -0,0 +1,14 @@ +//const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin; +const { merge } = require('webpack-merge'); +const webpackBase = require('./webpack.base.js'); + +module.exports = merge(webpackBase, { + devtool: 'eval', + mode: 'development', + optimization: { + minimize: false + }, + plugins: [ + //new BundleAnalyzerPlugin() + ] +}); diff --git a/webpack.prod.js b/webpack.prod.js new file mode 100644 index 00000000..83368585 --- /dev/null +++ b/webpack.prod.js @@ -0,0 +1,10 @@ +const { merge } = require('webpack-merge'); +const webpackBase = require('./webpack.base.js'); + +module.exports = merge(webpackBase, { + devtool: 'source-map', + mode: 'production', + optimization: { + minimize: true + } +});