UNPKG

weex-flymeui

Version:

A Flyme Style UI library based on Weex for Creator.

1,474 lines (1,303 loc) 1.24 MB
console.log('START WEEX VUE RENDER: 0.12.21, Build 2017-10-12 15:49.'); (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : (global.WeexVueRender = factory()); }(this, (function () { 'use strict'; function __$styleInject(css, returnValue) { if (typeof document === 'undefined') { return returnValue; } css = css || ''; var head = document.head || document.getElementsByTagName('head')[0]; var style = document.createElement('style'); style.type = 'text/css'; if (style.styleSheet){ style.styleSheet.cssText = css; } else { style.appendChild(document.createTextNode(css)); } head.appendChild(style); return returnValue; } __$styleInject("/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n \n.weex-root,\n.weex-root * {\n color: initial;\n cursor: initial;\n direction: initial;\n font: initial;\n font-family: initial;\n font-size: initial;\n font-style: initial;\n font-variant: initial;\n font-weight: initial;\n line-height: initial;\n text-align: initial;\n text-indent: initial;\n visibility: initial;\n white-space: initial;\n word-spacing: initial;\n font-family: BlinkMacSystemFont, 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif;\n}\n\n.weex-root,\n.weex-root *,\n.weex-root *::before,\n.weex-root *::after {\n box-sizing: border-box;\n -webkit-text-size-adjust: none;\n -moz-text-size-adjust: none;\n -ms-text-size-adjust: none;\n text-size-adjust: none;\n}\n\n.weex-root a,\n.weex-root button,\n.weex-root [role=\"button\"],\n.weex-root input,\n.weex-root label,\n.weex-root select,\n.weex-root textarea {\n -ms-touch-action: manipulation;\n touch-action: manipulation;\n}\n\n.weex-root p,\n.weex-root ol,\n.weex-root ul,\n.weex-root dl {\n margin: 0;\n padding: 0;\n}\n\n.weex-root li {\n list-style: none;\n}\n\n.weex-root figure {\n margin: 0;\n}\n\n.weex-root textarea {\n resize: none;\n}\n\n/* show no scroll bar. */\n::-webkit-scrollbar {\n display: none;\n}\n",undefined); __$styleInject("/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n \n.weex-root * {\n border-width: 0;\n border-color: inherit;\n border-style: solid;\n}\n\n.weex-flex-ct {\n display: -webkit-box;\n display: -webkit-flex;\n display: -moz-box;\n display: -ms-flexbox;\n display: flex;\n}\n\n.weex-ct {\n box-sizing: border-box;\n display: -webkit-box;\n display: -webkit-flex;\n display: -moz-box;\n display: -ms-flexbox;\n display: flex;\n position: relative;\n -webkit-box-orient: vertical;\n -webkit-flex-direction: column;\n -moz-box-orient: vertical;\n -moz-box-direction: normal;\n -ms-flex-direction: column;\n flex-direction: column;\n -webkit-flex-shrink: 0;\n -ms-flex-negative: 0;\n flex-shrink: 0;\n -webkit-flex-grow: 0;\n -moz-box-flex: 0;\n -ms-flex-grow: 0;\n flex-grow: 0;\n -webkit-flex-basis: auto;\n -ms-flex-preferred-size: auto;\n flex-basis: auto;\n -webkit-box-align: stretch;\n -webkit-align-items: stretch;\n -moz-box-align: stretch;\n -ms-flex-align: stretch;\n align-items: stretch;\n -webkit-align-content: flex-start;\n -ms-flex-line-pack: start;\n align-content: flex-start;\n border: 0 solid black;\n margin: 0;\n padding: 0;\n min-width: 0;\n}\n\n.weex-ct.horizontal {\n -webkit-box-orient: horizontal;\n -webkit-flex-direction: row;\n -moz-box-orient: horizontal;\n -moz-box-direction: normal;\n -ms-flex-direction: row;\n flex-direction: row;\n}\n\n.weex-el {\n display: block;\n box-sizing: border-box;\n position: relative;\n -webkit-flex-shrink: 0;\n -ms-flex-negative: 0;\n flex-shrink: 0;\n -webkit-flex-grow: 0;\n -moz-box-flex: 0;\n -ms-flex-grow: 0;\n flex-grow: 0;\n -webkit-flex-basis: auto;\n -ms-flex-preferred-size: auto;\n flex-basis: auto;\n border: 0 solid black;\n margin: 0;\n padding: 0;\n min-width: 0;\n}\n\n.weex-ios-sticky {\n position: -webkit-sticky !important;\n position: sticky !important;\n z-index: 9999;\n top: 0;\n}\n\n.weex-fixed {\n position: fixed;\n z-index: 1;\n}\n\n.weex-sticky {\n position: fixed;\n top: 0;\n z-index: 9999;\n}\n",undefined); /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you 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. */ /* eslint-disable */ var isInitialized = false; // major events supported: // panstart // panmove // panend // swipe // longpress // extra events supported: // dualtouchstart // dualtouch // dualtouchend // tap // doubletap // pressend var doc = window.document; var docEl = doc.documentElement; var slice = Array.prototype.slice; var gestures = {}; var lastTap = null; /** * find the closest common ancestor * if there's no one, return null * * @param {Element} el1 first element * @param {Element} el2 second element * @return {Element} common ancestor */ function getCommonAncestor(el1, el2) { var el = el1; while (el) { if (el.contains(el2) || el == el2) { return el } el = el.parentNode; } return null } /** * fire a HTMLEvent * * @param {Element} element which element to fire a event on * @param {string} type type of event * @param {object} extra extra data for the event object */ function fireEvent(element, type, extra) { var event = doc.createEvent('HTMLEvents'); event.initEvent(type, true, true); if (typeof extra === 'object') { for (var p in extra) { event[p] = extra[p]; } } /** * A flag to distinguish with other events with the same name generated * by another library in the same page. */ event._for = 'weex'; element.dispatchEvent(event); } /** * calc the transform * assume 4 points ABCD on the coordinate system * > rotate:angle rotating from AB to CD * > scale:scale ratio from AB to CD * > translate:translate shift from A to C * * @param {number} x1 abscissa of A * @param {number} y1 ordinate of A * @param {number} x2 abscissa of B * @param {number} y2 ordinate of B * @param {number} x3 abscissa of C * @param {number} y3 ordinate of C * @param {number} x4 abscissa of D * @param {number} y4 ordinate of D * @return {object} transform object like * {rotate, scale, translate[2], matrix[3][3]} */ function calc(x1, y1, x2, y2, x3, y3, x4, y4) { var rotate = Math.atan2(y4 - y3, x4 - x3) - Math.atan2(y2 - y1, x2 - x1); var scale = Math.sqrt((Math.pow(y4 - y3, 2) + Math.pow(x4 - x3, 2)) / (Math.pow(y2 - y1, 2) + Math.pow(x2 - x1, 2))); var translate = [ x3 - scale * x1 * Math.cos(rotate) + scale * y1 * Math.sin(rotate), y3 - scale * y1 * Math.cos(rotate) - scale * x1 * Math.sin(rotate)]; return { rotate: rotate, scale: scale, translate: translate, matrix: [ [scale * Math.cos(rotate), -scale * Math.sin(rotate), translate[0]], [scale * Math.sin(rotate), scale * Math.cos(rotate), translate[1]], [0, 0, 1] ] } } /** * take over the touchstart events. Add new touches to the gestures. * If there is no previous records, then bind touchmove, tochend * and touchcancel events. * new touches initialized with state 'tapping', and within 500 milliseconds * if the state is still tapping, then trigger gesture 'press'. * If there are two touche points, then the 'dualtouchstart' is triggerd. The * node of the touch gesture is their cloest common ancestor. * * @event * @param {event} event */ function touchstartHandler(event) { if (Object.keys(gestures).length === 0) { docEl.addEventListener('touchmove', touchmoveHandler, false); docEl.addEventListener('touchend', touchendHandler, false); docEl.addEventListener('touchcancel', touchcancelHandler, false); } // record every touch for (var i = 0; i < event.changedTouches.length; i++) { var touch = event.changedTouches[i]; var touchRecord = {}; for (var p in touch) { touchRecord[p] = touch[p]; } var gesture = { startTouch: touchRecord, startTime: Date.now(), status: 'tapping', element: event.srcElement || event.target, pressingHandler: setTimeout(function (element, touch) { return function () { if (gesture.status === 'tapping') { gesture.status = 'pressing'; fireEvent(element, 'longpress', { // add touch data for weex touch: touch, touches: event.touches, changedTouches: event.changedTouches, touchEvent: event }); } clearTimeout(gesture.pressingHandler); gesture.pressingHandler = null; } }(event.srcElement || event.target, event.changedTouches[i]), 500) }; gestures[touch.identifier] = gesture; } if (Object.keys(gestures).length == 2) { var elements = []; for (var p in gestures) { elements.push(gestures[p].element); } fireEvent(getCommonAncestor(elements[0], elements[1]), 'dualtouchstart', { touches: slice.call(event.touches), touchEvent: event }); } } /** * take over touchmove events, and handle pan and dual related gestures. * * 1. traverse every touch point: * > if 'tapping' and the shift is over 10 pixles, then it's a 'panning'. * 2. if there are two touch points, then calc the tranform and trigger * 'dualtouch'. * * @event * @param {event} event */ function touchmoveHandler(event) { for (var i = 0; i < event.changedTouches.length; i++) { var touch = event.changedTouches[i]; var gesture = gestures[touch.identifier]; if (!gesture) { return } if (!gesture.lastTouch) { gesture.lastTouch = gesture.startTouch; } if (!gesture.lastTime) { gesture.lastTime = gesture.startTime; } if (!gesture.velocityX) { gesture.velocityX = 0; } if (!gesture.velocityY) { gesture.velocityY = 0; } if (!gesture.duration) { gesture.duration = 0; } var time = Date.now() - gesture.lastTime; var vx = (touch.clientX - gesture.lastTouch.clientX) / time; var vy = (touch.clientY - gesture.lastTouch.clientY) / time; var RECORD_DURATION = 70; if (time > RECORD_DURATION) { time = RECORD_DURATION; } if (gesture.duration + time > RECORD_DURATION) { gesture.duration = RECORD_DURATION - time; } gesture.velocityX = (gesture.velocityX * gesture.duration + vx * time) / (gesture.duration + time); gesture.velocityY = (gesture.velocityY * gesture.duration + vy * time) / (gesture.duration + time); gesture.duration += time; gesture.lastTouch = {}; for (var p in touch) { gesture.lastTouch[p] = touch[p]; } gesture.lastTime = Date.now(); var displacementX = touch.clientX - gesture.startTouch.clientX; var displacementY = touch.clientY - gesture.startTouch.clientY; var distance = Math.sqrt(Math.pow(displacementX, 2) + Math.pow(displacementY, 2)); var isVertical = !(Math.abs(displacementX) > Math.abs(displacementY)); var direction = isVertical ? displacementY >= 0 ? 'down' : 'up' : displacementX >= 0 ? 'right' : 'left'; // magic number 10: moving 10px means pan, not tap if ((gesture.status === 'tapping' || gesture.status === 'pressing') && distance > 10) { gesture.status = 'panning'; gesture.isVertical = isVertical; gesture.direction = direction; fireEvent(gesture.element, 'panstart', { touch: touch, touches: event.touches, changedTouches: event.changedTouches, touchEvent: event, isVertical: gesture.isVertical, direction: direction }); } if (gesture.status === 'panning') { gesture.panTime = Date.now(); fireEvent(gesture.element, 'panmove', { displacementX: displacementX, displacementY: displacementY, touch: touch, touches: event.touches, changedTouches: event.changedTouches, touchEvent: event, isVertical: gesture.isVertical, direction: direction }); } } if (Object.keys(gestures).length == 2) { var position = []; var current = []; var elements = []; var transform; for (var i = 0; i < event.touches.length; i++) { var touch = event.touches[i]; var gesture = gestures[touch.identifier]; position.push([gesture.startTouch.clientX, gesture.startTouch.clientY]); current.push([touch.clientX, touch.clientY]); } for (var p in gestures) { elements.push(gestures[p].element); } transform = calc( position[0][0], position[0][1], position[1][0], position[1][1], current[0][0], current[0][1], current[1][0], current[1][1] ); fireEvent(getCommonAncestor(elements[0], elements[1]), 'dualtouch', { transform: transform, touches: event.touches, touchEvent: event }); } } /** * handle touchend event * * 1. if there are tow touch points, then trigger 'dualtouchend'如 * * 2. traverse every touch piont: * > if tapping, then trigger 'tap'. * If there is a tap 300 milliseconds before, then it's a 'doubletap'. * > if padding, then decide to trigger 'panend' or 'swipe' * > if pressing, then trigger 'pressend'. * * 3. remove listeners. * * @event * @param {event} event */ function touchendHandler(event) { if (Object.keys(gestures).length == 2) { var elements = []; for (var p in gestures) { elements.push(gestures[p].element); } fireEvent(getCommonAncestor(elements[0], elements[1]), 'dualtouchend', { touches: slice.call(event.touches), touchEvent: event }); } for (var i = 0; i < event.changedTouches.length; i++) { var touch = event.changedTouches[i]; var id = touch.identifier; var gesture = gestures[id]; if (!gesture) { continue } if (gesture.pressingHandler) { clearTimeout(gesture.pressingHandler); gesture.pressingHandler = null; } if (gesture.status === 'tapping') { gesture.timestamp = Date.now(); // fire click, not tap. fireEvent(gesture.element, 'tap', { touch: touch, touchEvent: event }); if (lastTap && gesture.timestamp - lastTap.timestamp < 300) { fireEvent(gesture.element, 'doubletap', { touch: touch, touchEvent: event }); } lastTap = gesture; } if (gesture.status === 'panning') { var now = Date.now(); var duration = now - gesture.startTime; var displacementX = touch.clientX - gesture.startTouch.clientX; var displacementY = touch.clientY - gesture.startTouch.clientY; var velocity = Math.sqrt(gesture.velocityY * gesture.velocityY + gesture.velocityX * gesture.velocityX); var isSwipe = velocity > 0.5 && (now - gesture.lastTime) < 100; var extra = { duration: duration, isSwipe: isSwipe, velocityX: gesture.velocityX, velocityY: gesture.velocityY, displacementX: displacementX, displacementY: displacementY, touch: touch, touches: event.touches, changedTouches: event.changedTouches, touchEvent: event, isVertical: gesture.isVertical, direction: gesture.direction }; fireEvent(gesture.element, 'panend', extra); if (isSwipe) { fireEvent(gesture.element, 'swipe', extra); } } if (gesture.status === 'pressing') { fireEvent(gesture.element, 'pressend', { touch: touch, touchEvent: event }); } delete gestures[id]; } if (Object.keys(gestures).length === 0) { docEl.removeEventListener('touchmove', touchmoveHandler, false); docEl.removeEventListener('touchend', touchendHandler, false); docEl.removeEventListener('touchcancel', touchcancelHandler, false); } } /** * handle touchcancel * * 1. if there are two touch points, then trigger 'dualtouchend' * * 2. traverse everty touch point: * > if pannnig, then trigger 'panend' * > if pressing, then trigger 'pressend' * * 3. remove listeners * * @event * @param {event} event */ function touchcancelHandler(event) { if (Object.keys(gestures).length == 2) { var elements = []; for (var p in gestures) { elements.push(gestures[p].element); } fireEvent(getCommonAncestor(elements[0], elements[1]), 'dualtouchend', { touches: slice.call(event.touches), touchEvent: event }); } for (var i = 0; i < event.changedTouches.length; i++) { var touch = event.changedTouches[i]; var id = touch.identifier; var gesture = gestures[id]; if (!gesture) { continue } if (gesture.pressingHandler) { clearTimeout(gesture.pressingHandler); gesture.pressingHandler = null; } if (gesture.status === 'panning') { fireEvent(gesture.element, 'panend', { touch: touch, touches: event.touches, changedTouches: event.changedTouches, touchEvent: event }); } if (gesture.status === 'pressing') { fireEvent(gesture.element, 'pressend', { touch: touch, touchEvent: event }); } delete gestures[id]; } if (Object.keys(gestures).length === 0) { docEl.removeEventListener('touchmove', touchmoveHandler, false); docEl.removeEventListener('touchend', touchendHandler, false); docEl.removeEventListener('touchcancel', touchcancelHandler, false); } } if (!isInitialized) { docEl.addEventListener('touchstart', touchstartHandler, false); isInitialized = true; } /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you 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. */ /* eslint-disable */ // Production steps of ECMA-262, Edition 6, 22.1.2.1 // Reference: https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.from /* istanbul ignore if */ if (!Array.from) { Array.from = (function() { var toStr = Object.prototype.toString; var isCallable = function(fn) { return typeof fn === 'function' || toStr.call(fn) === '[object Function]'; }; var toInteger = function(value) { var number = Number(value); if (isNaN(number)) { return 0; } if (number === 0 || !isFinite(number)) { return number; } return (number > 0 ? 1 : -1) * Math.floor(Math.abs(number)); }; var maxSafeInteger = Math.pow(2, 53) - 1; var toLength = function(value) { var len = toInteger(value); return Math.min(Math.max(len, 0), maxSafeInteger); }; // The length property of the from method is 1. return function from(arrayLike/*, mapFn, thisArg */) { // 1. Let C be the this value. var C = this; // 2. Let items be ToObject(arrayLike). var items = Object(arrayLike); // 3. ReturnIfAbrupt(items). if (arrayLike == null) { throw new TypeError('Array.from requires an array-like object - not null or undefined'); } // 4. If mapfn is undefined, then let mapping be false. var mapFn = arguments.length > 1 ? arguments[1] : void undefined; var T; if (typeof mapFn !== 'undefined') { // 5. else // 5. a If IsCallable(mapfn) is false, throw a TypeError exception. if (!isCallable(mapFn)) { throw new TypeError('Array.from: when provided, the second argument must be a function'); } // 5. b. If thisArg was supplied, let T be thisArg; else let T be undefined. if (arguments.length > 2) { T = arguments[2]; } } // 10. Let lenValue be Get(items, "length"). // 11. Let len be ToLength(lenValue). var len = toLength(items.length); // 13. If IsConstructor(C) is true, then // 13. a. Let A be the result of calling the [[Construct]] internal method of C with an argument list containing the single item len. // 14. a. Else, Let A be ArrayCreate(len). var A = isCallable(C) ? Object(new C(len)) : new Array(len); // 16. Let k be 0. var k = 0; // 17. Repeat, while k < len… (also steps a - h) var kValue; while (k < len) { kValue = items[k]; if (mapFn) { A[k] = typeof T === 'undefined' ? mapFn(kValue, k) : mapFn.call(T, kValue, k); } else { A[k] = kValue; } k += 1; } // 18. Let putStatus be Put(A, "length", len, true). A.length = len; // 20. Return A. return A; }; }()); } function unwrapExports (x) { return x && x.__esModule ? x['default'] : x; } function createCommonjsModule(fn, module) { return module = { exports: {} }, fn(module, module.exports), module.exports; } var _global = createCommonjsModule(function (module) { // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 var global = module.exports = typeof window != 'undefined' && window.Math == Math ? window : typeof self != 'undefined' && self.Math == Math ? self : Function('return this')(); if(typeof __g == 'number'){ __g = global; } // eslint-disable-line no-undef }); var _core = createCommonjsModule(function (module) { var core = module.exports = {version: '2.4.0'}; if(typeof __e == 'number'){ __e = core; } // eslint-disable-line no-undef }); var _isObject = function(it){ return typeof it === 'object' ? it !== null : typeof it === 'function'; }; var isObject = _isObject; var _anObject = function(it){ if(!isObject(it)){ throw TypeError(it + ' is not an object!'); } return it; }; var _fails = function(exec){ try { return !!exec(); } catch(e){ return true; } }; // Thank's IE8 for his funny defineProperty var _descriptors = !_fails(function(){ return Object.defineProperty({}, 'a', {get: function(){ return 7; }}).a != 7; }); var isObject$1 = _isObject; var document$1 = _global.document; var is = isObject$1(document$1) && isObject$1(document$1.createElement); var _domCreate = function(it){ return is ? document$1.createElement(it) : {}; }; var _ie8DomDefine = !_descriptors && !_fails(function(){ return Object.defineProperty(_domCreate('div'), 'a', {get: function(){ return 7; }}).a != 7; }); // 7.1.1 ToPrimitive(input [, PreferredType]) var isObject$2 = _isObject; // instead of the ES6 spec version, we didn't implement @@toPrimitive case // and the second argument - flag - preferred type is a string var _toPrimitive = function(it, S){ if(!isObject$2(it)){ return it; } var fn, val; if(S && typeof (fn = it.toString) == 'function' && !isObject$2(val = fn.call(it))){ return val; } if(typeof (fn = it.valueOf) == 'function' && !isObject$2(val = fn.call(it))){ return val; } if(!S && typeof (fn = it.toString) == 'function' && !isObject$2(val = fn.call(it))){ return val; } throw TypeError("Can't convert object to primitive value"); }; var anObject = _anObject; var IE8_DOM_DEFINE = _ie8DomDefine; var toPrimitive = _toPrimitive; var dP$1 = Object.defineProperty; var f = _descriptors ? Object.defineProperty : function defineProperty(O, P, Attributes){ anObject(O); P = toPrimitive(P, true); anObject(Attributes); if(IE8_DOM_DEFINE){ try { return dP$1(O, P, Attributes); } catch(e){ /* empty */ } } if('get' in Attributes || 'set' in Attributes){ throw TypeError('Accessors not supported!'); } if('value' in Attributes){ O[P] = Attributes.value; } return O; }; var _objectDp = { f: f }; var _propertyDesc = function(bitmap, value){ return { enumerable : !(bitmap & 1), configurable: !(bitmap & 2), writable : !(bitmap & 4), value : value }; }; var dP = _objectDp; var createDesc = _propertyDesc; var _hide = _descriptors ? function(object, key, value){ return dP.f(object, key, createDesc(1, value)); } : function(object, key, value){ object[key] = value; return object; }; var hasOwnProperty = {}.hasOwnProperty; var _has = function(it, key){ return hasOwnProperty.call(it, key); }; var id = 0; var px = Math.random(); var _uid = function(key){ return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36)); }; var _redefine = createCommonjsModule(function (module) { var global = _global , hide = _hide , has = _has , SRC = _uid('src') , TO_STRING = 'toString' , $toString = Function[TO_STRING] , TPL = ('' + $toString).split(TO_STRING); _core.inspectSource = function(it){ return $toString.call(it); }; (module.exports = function(O, key, val, safe){ var isFunction = typeof val == 'function'; if(isFunction){ has(val, 'name') || hide(val, 'name', key); } if(O[key] === val){ return; } if(isFunction){ has(val, SRC) || hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key))); } if(O === global){ O[key] = val; } else { if(!safe){ delete O[key]; hide(O, key, val); } else { if(O[key]){ O[key] = val; } else { hide(O, key, val); } } } // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative })(Function.prototype, TO_STRING, function toString(){ return typeof this == 'function' && this[SRC] || $toString.call(this); }); }); var _aFunction = function(it){ if(typeof it != 'function'){ throw TypeError(it + ' is not a function!'); } return it; }; // optional / simple context binding var aFunction = _aFunction; var _ctx = function(fn, that, length){ aFunction(fn); if(that === undefined){ return fn; } switch(length){ case 1: return function(a){ return fn.call(that, a); }; case 2: return function(a, b){ return fn.call(that, a, b); }; case 3: return function(a, b, c){ return fn.call(that, a, b, c); }; } return function(/* ...args */){ return fn.apply(that, arguments); }; }; var global$1 = _global; var core = _core; var hide = _hide; var redefine = _redefine; var ctx = _ctx; var PROTOTYPE = 'prototype'; var $export$1 = function(type, name, source){ var IS_FORCED = type & $export$1.F , IS_GLOBAL = type & $export$1.G , IS_STATIC = type & $export$1.S , IS_PROTO = type & $export$1.P , IS_BIND = type & $export$1.B , target = IS_GLOBAL ? global$1 : IS_STATIC ? global$1[name] || (global$1[name] = {}) : (global$1[name] || {})[PROTOTYPE] , exports = IS_GLOBAL ? core : core[name] || (core[name] = {}) , expProto = exports[PROTOTYPE] || (exports[PROTOTYPE] = {}) , key, own, out, exp; if(IS_GLOBAL){ source = name; } for(key in source){ // contains in native own = !IS_FORCED && target && target[key] !== undefined; // export native or passed out = (own ? target : source)[key]; // bind timers to global for call from export context exp = IS_BIND && own ? ctx(out, global$1) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out; // extend global if(target){ redefine(target, key, out, type & $export$1.U); } // export if(exports[key] != out){ hide(exports, key, exp); } if(IS_PROTO && expProto[key] != out){ expProto[key] = out; } } }; global$1.core = core; // type bitmap $export$1.F = 1; // forced $export$1.G = 2; // global $export$1.S = 4; // static $export$1.P = 8; // proto $export$1.B = 16; // bind $export$1.W = 32; // wrap $export$1.U = 64; // safe $export$1.R = 128; // real proto method for `library` var _export = $export$1; var toString$1 = {}.toString; var _cof = function(it){ return toString$1.call(it).slice(8, -1); }; // fallback for non-array-like ES3 and non-enumerable old V8 strings var cof = _cof; var _iobject = Object('z').propertyIsEnumerable(0) ? Object : function(it){ return cof(it) == 'String' ? it.split('') : Object(it); }; // 7.2.1 RequireObjectCoercible(argument) var _defined = function(it){ if(it == undefined){ throw TypeError("Can't call method on " + it); } return it; }; // to indexed object, toObject with fallback for non-array-like ES3 strings var IObject$1 = _iobject; var defined = _defined; var _toIobject = function(it){ return IObject$1(defined(it)); }; // 7.1.4 ToInteger var ceil = Math.ceil; var floor = Math.floor; var _toInteger = function(it){ return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it); }; // 7.1.15 ToLength var toInteger = _toInteger; var min = Math.min; var _toLength = function(it){ return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991 }; var toInteger$1 = _toInteger; var max = Math.max; var min$1 = Math.min; var _toIndex = function(index, length){ index = toInteger$1(index); return index < 0 ? max(index + length, 0) : min$1(index, length); }; // false -> Array#indexOf // true -> Array#includes var toIObject$1 = _toIobject; var toLength = _toLength; var toIndex = _toIndex; var _arrayIncludes = function(IS_INCLUDES){ return function($this, el, fromIndex){ var O = toIObject$1($this) , length = toLength(O.length) , index = toIndex(fromIndex, length) , value; // Array#includes uses SameValueZero equality algorithm if(IS_INCLUDES && el != el){ while(length > index){ value = O[index++]; if(value != value){ return true; } // Array#toIndex ignores holes, Array#includes - not } } else { for(;length > index; index++){ if(IS_INCLUDES || index in O){ if(O[index] === el){ return IS_INCLUDES || index || 0; } } } } return !IS_INCLUDES && -1; }; }; var global$2 = _global; var SHARED = '__core-js_shared__'; var store = global$2[SHARED] || (global$2[SHARED] = {}); var _shared = function(key){ return store[key] || (store[key] = {}); }; var shared = _shared('keys'); var uid = _uid; var _sharedKey = function(key){ return shared[key] || (shared[key] = uid(key)); }; var has = _has; var toIObject = _toIobject; var arrayIndexOf = _arrayIncludes(false); var IE_PROTO = _sharedKey('IE_PROTO'); var _objectKeysInternal = function(object, names){ var O = toIObject(object) , i = 0 , result = [] , key; for(key in O){ if(key != IE_PROTO){ has(O, key) && result.push(key); } } // Don't enum bug & hidden keys while(names.length > i){ if(has(O, key = names[i++])){ ~arrayIndexOf(result, key) || result.push(key); } } return result; }; // IE 8- don't enum bug keys var _enumBugKeys = ( 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf' ).split(','); // 19.1.2.14 / 15.2.3.14 Object.keys(O) var $keys = _objectKeysInternal; var enumBugKeys = _enumBugKeys; var _objectKeys = Object.keys || function keys(O){ return $keys(O, enumBugKeys); }; var f$1 = Object.getOwnPropertySymbols; var _objectGops = { f: f$1 }; var f$2 = {}.propertyIsEnumerable; var _objectPie = { f: f$2 }; // 7.1.13 ToObject(argument) var defined$1 = _defined; var _toObject = function(it){ return Object(defined$1(it)); }; // 19.1.2.1 Object.assign(target, source, ...) var getKeys = _objectKeys; var gOPS = _objectGops; var pIE = _objectPie; var toObject = _toObject; var IObject = _iobject; var $assign = Object.assign; // should work with symbols and should have deterministic property order (V8 bug) var _objectAssign = !$assign || _fails(function(){ var A = {} , B = {} , S = Symbol() , K = 'abcdefghijklmnopqrst'; A[S] = 7; K.split('').forEach(function(k){ B[k] = k; }); return $assign({}, A)[S] != 7 || Object.keys($assign({}, B)).join('') != K; }) ? function assign(target, source){ var arguments$1 = arguments; // eslint-disable-line no-unused-vars var T = toObject(target) , aLen = arguments.length , index = 1 , getSymbols = gOPS.f , isEnum = pIE.f; while(aLen > index){ var S = IObject(arguments$1[index++]) , keys = getSymbols ? getKeys(S).concat(getSymbols(S)) : getKeys(S) , length = keys.length , j = 0 , key; while(length > j){ if(isEnum.call(S, key = keys[j++])){ T[key] = S[key]; } } } return T; } : $assign; // 19.1.3.1 Object.assign(target, source) var $export = _export; $export($export.S + $export.F, 'Object', {assign: _objectAssign}); /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you 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. */ /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you 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. */ /* eslint-disable */ // https://gist.github.com/WebReflection/5593554 /* istanbul ignore if */ if (!Object.setPrototypeOf) { Object.setPrototypeOf = (function(Object, magic) { var set; function setPrototypeOf(O, proto) { set.call(O, proto); return O; } try { // this works already in Firefox and Safari set = Object.getOwnPropertyDescriptor(Object.prototype, magic).set; set.call({}, null); } catch (e) { if ( // IE < 11 cannot be shimmed Object.prototype !== {}[magic] || // neither can any browser that actually // implemented __proto__ correctly // (all but old V8 will return here) {__proto__: null}.__proto__ === void 0 // this case means null objects cannot be passed // through setPrototypeOf in a reliable way // which means here a **Sham** is needed instead ) { return; } // nodejs 0.8 and 0.10 are (buggy and..) fine here // probably Chrome or some old Mobile stock browser set = function(proto) { this[magic] = proto; }; // please note that this will **not** work // in those browsers that do not inherit // __proto__ by mistake from Object.prototype // in these cases we should probably throw an error // or at least be informed about the issue setPrototypeOf.polyfill = setPrototypeOf( setPrototypeOf({}, null), Object.prototype ) instanceof Object; // setPrototypeOf.polyfill === true means it works as meant // setPrototypeOf.polyfill === false means it's not 100% reliable // setPrototypeOf.polyfill === undefined // or // setPrototypeOf.polyfill == null means it's not a polyfill // which means it works as expected // we can even delete Object.prototype.__proto__; } return setPrototypeOf; }(Object, '__proto__')); } var _wks = createCommonjsModule(function (module) { var store = _shared('wks') , uid = _uid , Symbol = _global.Symbol , USE_SYMBOL = typeof Symbol == 'function'; var $exports = module.exports = function(name){ return store[name] || (store[name] = USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : uid)('Symbol.' + name)); }; $exports.store = store; }); // getting tag from 19.1.3.6 Object.prototype.toString() var cof$1 = _cof; var TAG = _wks('toStringTag'); var ARG = cof$1(function(){ return arguments; }()) == 'Arguments'; // fallback for IE11 Script Access Denied error var tryGet = function(it, key){ try { return it[key]; } catch(e){ /* empty */ } }; var _classof = function(it){ var O, T, B; return it === undefined ? 'Undefined' : it === null ? 'Null' // @@toStringTag case : typeof (T = tryGet(O = Object(it), TAG)) == 'string' ? T // builtinTag case : ARG ? cof$1(O) // ES3 arguments fallback : (B = cof$1(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B; }; // 19.1.3.6 Object.prototype.toString() var classof = _classof; var test = {}; test[_wks('toStringTag')] = 'z'; if(test + '' != '[object z]'){ _redefine(Object.prototype, 'toString', function toString(){ return '[object ' + classof(this) + ']'; }, true); } var toInteger$2 = _toInteger; var defined$2 = _defined; // true -> String#at // false -> String#codePointAt var _stringAt = function(TO_STRING){ return function(that, pos){ var s = String(defined$2(that)) , i = toInteger$2(pos) , l = s.length , a, b; if(i < 0 || i >= l){ return TO_STRING ? '' : undefined; } a = s.charCodeAt(i); return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff ? TO_STRING ? s.charAt(i) : a : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000; }; }; var _library = false; var _iterators = {}; var dP$2 = _objectDp; var anObject$2 = _anObject; var getKeys$1 = _objectKeys; var _objectDps = _descriptors ? Object.defineProperties : function defineProperties(O, Properties){ anObject$2(O); var keys = getKeys$1(Properties) , length = keys.length , i = 0 , P; while(length > i){ dP$2.f(O, P = keys[i++], Properties[P]); } return O; }; var _html = _global.document && document.documentElement; // 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties]) var anObject$1 = _anObject; var dPs = _objectDps; var enumBugKeys$1 = _enumBugKeys; var IE_PROTO$1 = _sharedKey('IE_PROTO'); var Empty = function(){ /* empty */ }; var PROTOTYPE$1 = 'prototype'; // Create object with fake `null` prototype: use iframe Object with cleared prototype var createDict = function(){ // Thrash, waste and sodomy: IE GC bug var iframe = _domCreate('iframe') , i = enumBugKeys$1.length , lt = '<' , gt = '>' , iframeDocument; iframe.style.display = 'none'; _html.appendChild(iframe); iframe.src = 'javascript:'; // eslint-disable-line no-script-url // createDict = iframe.contentWindow.Object; // html.removeChild(iframe); iframeDocument = iframe.contentWindow.document; iframeDocument.open(); iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt); iframeDocument.close(); createDict = iframeDocument.F; while(i--){ delete createDict[PROTOTYPE$1][enumBugKeys$1[i]]; } return createDict(); }; var _objectCreate = Object.create || function create(O, Properties){ var result; if(O !== null){ Empty[PROTOTYPE$1] = anObject$1(O); result = new Empty; Empty[PROTOTYPE$1] = null; // add "__proto__" for Object.getPrototypeOf polyfill result[IE_PROTO$1] = O; } else { result = createDict(); } return Properties === undefined ? result : dPs(result, Properties); }; var def = _objectDp.f; var has$2 = _has; var TAG$1 = _wks('toStringTag'); var _setToStringTag = function(it, tag, stat){ if(it && !has$2(it = stat ? it : it.prototype, TAG$1)){ def(it, TAG$1, {configurable: true, value: tag}); } }; var create$1 = _objectCreate; var descriptor = _propertyDesc; var setToStringTag$1 = _setToStringTag; var IteratorPrototype = {}; // 25.1.2.1.1 %IteratorPrototype%[@@iterator]() _hide(IteratorPrototype, _wks('iterator'), function(){ return this; }); var _iterCreate = function(Constructor, NAME, next){ Constructor.prototype = create$1(IteratorPrototype, {next: descriptor(1, next)}); setToStringTag$1(Constructor, NAME + ' Iterator'); }; // 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O) var has$3 = _has; var toObject$1 = _toObject; var IE_PROTO$2 = _sharedKey('IE_PROTO'); var ObjectProto = Object.prototype; var _objectGpo = Object.getPrototypeOf || function(O){ O = toObject$1(O); if(has$3(O, IE_PROTO$2)){ return O[IE_PROTO$2]; } if(typeof O.constructor == 'function' && O instanceof O.constructor){ return O.constructor.prototype; } return O instanceof Object ? ObjectProto : null; }; var LIBRARY = _library; var $export$2 = _export; var redefine$1 = _redefine; var hide$1 = _hide; var has$1 = _has; var Iterators = _iterators; var $iterCreate = _iterCreate; var setToStringTag = _setToStringTag; var getPrototypeOf = _objectGpo; var ITERATOR = _wks('iterator'); var BUGGY = !([].keys && 'next' in [].keys()); var FF_ITERATOR = '@@iterator'; var KEYS = 'keys'; var VALUES = 'values'; var returnThis = function(){ return this; }; var _iterDefine = function(Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED){ $iterCreate(Constructor, NAME, next); var getMethod = function(kind){ if(!BUGGY && kind in proto){ return proto[kind]; } switch(kind){ case KEYS: return function keys(){ return new Constructor(this, kind); }; case VALUES: return function values(){ return new Constructor(this, kind); }; } return function entries(){ return new Constructor(this, kind); }; }; var TAG = NAME + ' Iterator' , DEF_VALUES = DEFAULT == VALUES , VALUES_BUG = false , proto = Base.prototype , $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT] , $default = $native || getMethod(DEFAULT) , $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined , $anyNative = NAME == 'Array' ? proto.entries || $native : $native , methods, key, IteratorPrototype; // Fix native if($anyNative){ IteratorPrototype = getPrototypeOf($anyNative.call(new Base)); if(IteratorPrototype !== Object.prototype){ // Set @@toStringTag to native iterators setToStringTag(IteratorPrototype, TAG, true); // fix for some old engines if(!LIBRARY && !has$1(IteratorPrototype, ITERATOR)){ hide$1(IteratorPrototype, ITERATOR, returnThis); } } } // fix Array#{values, @@iterator}.name in V8 / FF if(DEF_VALUES && $native && $native.name !== VALUES){ VALUES_BUG = true; $default = function values(){ return $native.call(this); }; } // Define iterator if((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])){ hide$1(proto, ITERATOR, $default); } // Plug for library Iterators[NAME] = $default; Iterators[TAG] = returnThis; if(DEFAULT){ methods = { values: DEF_VALUES ? $default : getMethod(VALUES), keys: IS_SET ? $default : getMethod(KEYS), entries: $entries }; if(FORCED){ for(key in methods){ if(!(key in proto)){ redefine$1(proto, key, methods[key]); } } } else { $export$2($export$2.P + $export$2.F * (BUGGY || VALUES_BUG), NAME, methods); } } return methods; }; var $at = _stringAt(true); // 21.1.3.27 String.prototype[@@iterator]() _iterDefine(String, 'String', function(iterated){ this._t = String(iterated); // target this._i = 0; // next index // 21.1.5.2.1 %StringIteratorPrototype%.next() }, function(){ var O = this._t , index = this._i , point; if(index >= O.length){ return {value: undefined, done: true}; } point = $at(O, index); this._i += point.length; return {value: point, done: false}; }); // 22.1.3.31 Array.prototype[@@unscopables] var UNSCOPABLES = _wks('unscopables'); var ArrayProto = Array.prototype; if(ArrayProto[UNSCOPABLES] == undefined){ _hide(ArrayProto, UNSCOPABLES, {}); } var _addToUnscopables = function(key){ ArrayProto[UNSCOPABLES][key] = true; }; var _iterStep = function(done, value){ return {value: value, done: !!done}; }; var addToUnscopables = _addToUnscopables; var step = _iterStep; var Iterators$2 = _iterators; var toIObject$2 = _toIobject; // 22.1.3.4 Array.prototype.entries() // 22.1.3.13 Array.prototype.keys() // 22.1.3.29 Array.prototype.values() // 22.1.3.30 Array.prototype[@@iterator]() var es6_array_iterator = _iterDefine(Array, 'Array', function(iterated, kind){ this._t = toIObject$2(iterated); // target this._i = 0; // next index this._k = kind; // kind // 22.1.5.2.1 %ArrayIteratorPrototype%.next() }, function(){ var O = this._t , kind = this._k , index = this._i++; if(!O || index >= O.length){ this._t = undefined; return step(1); } if(kind == 'keys' ){ return step(0, index); } if(kind == 'values'){ return step(0, O[index]); } return step(0, [index, O[index]]); }, 'values'); // argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7) Iterators$2.Arguments = Iterators$2.Array; addToUnscopables('keys'); addToUnscopables('values'); addToUnscopables('entries'); var $iterators = es6_array_iterator; var redefine$2 = _redefine; var global$3 = _global; var hide$2 = _hide; var Iterators$1 = _iterators; var wks = _wks; var ITERATOR$1 = wks('iterator'); var TO_STRING_TAG = wks('toStringTag'); var ArrayValues = Iterators$1.Array; for(var collections = ['NodeList', 'DOMTokenList', 'MediaList', 'StyleSheetList', 'CSSRuleList'], i = 0; i < 5; i++){ var NAME = collections[i] , Collection = global$3[NAME] , proto = Collection && Collection.prototype , key; if(proto){ if(!proto[ITERATOR$1]){ hide$2(proto, ITERATOR$1, ArrayValues); } if(!proto[TO_STRING_TAG]){ hide$2(proto, TO_STRING_TAG, NAME); } Iterators$1[NAME] = ArrayValues; for(key in $iterators){ if(!proto[key]){ redefine$2(proto, key, $iterators[key], true); } } } } var _anInstance = function(it, Constructor, name, forbiddenField){ if(!(it instanceof Constructor) || (forbiddenField !== undefined && forbiddenField in it)){ throw TypeError(name + ': incorrect invocation!'); } return it; }; // call something on iterator step with safe closing on error var anObject$3 = _anObject; var _iterCall = function(iterator, fn, value, entries){ try { return entries ? fn(anObject$3(value)[0], value[1]) : fn(value); // 7.4.6 IteratorClose(iterator, completion) } catch(e){ var ret = iterator['return']; if(ret !== undefined){ anObject$3(ret.call(iterator)); } throw e;